mirror of
https://github.com/GreenComfyTea/MHR-Overlay.git
synced 2026-01-25 12:58:06 -08:00
Implement Error Handler
This commit is contained in:
@@ -9,6 +9,7 @@ local time;
|
||||
local small_monster;
|
||||
local large_monster;
|
||||
local drawing;
|
||||
local error_handler;
|
||||
|
||||
local sdk = sdk;
|
||||
local tostring = tostring;
|
||||
@@ -52,7 +53,6 @@ function this.draw(monster, ailment_buildup_UI, cached_config, ailment_buildups_
|
||||
return;
|
||||
end
|
||||
|
||||
|
||||
for id, ailment in pairs(monster.ailments) do
|
||||
if id == ailments.stun_id then
|
||||
if not cached_config.filter.stun then
|
||||
@@ -239,6 +239,7 @@ function this.init_dependencies()
|
||||
small_monster = require("MHR_Overlay.Monsters.small_monster");
|
||||
large_monster = require("MHR_Overlay.Monsters.large_monster");
|
||||
drawing = require("MHR_Overlay.UI.drawing");
|
||||
error_handler = require("MHR_Overlay.Misc.error_handler");
|
||||
end
|
||||
|
||||
function this.init_module()
|
||||
|
||||
@@ -4,6 +4,7 @@ local small_monster;
|
||||
local large_monster;
|
||||
local config;
|
||||
local ailments;
|
||||
local error_handler;
|
||||
|
||||
local sdk = sdk;
|
||||
local tostring = tostring;
|
||||
@@ -62,16 +63,19 @@ local blast_adjust_rate_method = blast_param_type:get_method("get_BlastDamageAdj
|
||||
|
||||
function this.poison_proc(poison_param)
|
||||
if poison_param == nil then
|
||||
error_handler.report("ailment_hook.poison_proc", "Missing Parameter: poison_param");
|
||||
return;
|
||||
end
|
||||
|
||||
local enemy = get_enemy_method:call(poison_param);
|
||||
if enemy == nil then
|
||||
error_handler.report("ailment_hook.poison_proc", "Failed to Access Data: enemy");
|
||||
return;
|
||||
end
|
||||
|
||||
local is_large = is_boss_enemy_method:call(enemy);
|
||||
if is_large == nil then
|
||||
error_handler.report("ailment_hook.poison_proc", "Failed to Access Data: is_large");
|
||||
return;
|
||||
end
|
||||
|
||||
@@ -90,16 +94,19 @@ end
|
||||
|
||||
function this.blast_proc(blast_param)
|
||||
if blast_param == nil then
|
||||
error_handler.report("ailment_hook.blast_proc", "Missing Parameter: blast_param");
|
||||
return;
|
||||
end
|
||||
|
||||
local enemy = get_enemy_method:call(blast_param);
|
||||
if enemy == nil then
|
||||
error_handler.report("ailment_hook.blast_proc", "Failed to Access Data: enemy");
|
||||
return;
|
||||
end
|
||||
|
||||
local is_large = is_boss_enemy_method:call(enemy);
|
||||
if is_large == nil then
|
||||
error_handler.report("ailment_hook.blast_proc", "Failed to Access Data: is_large");
|
||||
return;
|
||||
end
|
||||
|
||||
@@ -122,10 +129,15 @@ function this.stock_damage()
|
||||
for enemy, monster in pairs(large_monster.list) do
|
||||
local damage_param = get_damage_param_method:call(enemy);
|
||||
if damage_param == nil then
|
||||
goto continue
|
||||
error_handler.report("ailment_hook.stock_damage", "Failed to Access Data: large_monster -> damage_param");
|
||||
goto continue;
|
||||
end
|
||||
|
||||
local poison_param = poison_param_field:get_data(damage_param);
|
||||
if poison_param == nil then
|
||||
error_handler.report("ailment_hook.stock_damage", "Failed to Access Data: large_monster -> poison_param");
|
||||
goto continue;
|
||||
end
|
||||
|
||||
ailments.update_poison(monster, poison_param);
|
||||
::continue::
|
||||
@@ -134,10 +146,15 @@ function this.stock_damage()
|
||||
for enemy, monster in pairs(small_monster.list) do
|
||||
local damage_param = get_damage_param_method:call(enemy);
|
||||
if damage_param == nil then
|
||||
error_handler.report("ailment_hook.stock_damage", "Failed to Access Data: small_monster -> damage_param");
|
||||
goto continue
|
||||
end
|
||||
|
||||
local poison_param = poison_param_field:get_data(damage_param);
|
||||
if poison_param == nil then
|
||||
error_handler.report("ailment_hook.stock_damage", "Failed to Access Data: small_monster -> poison_param");
|
||||
goto continue;
|
||||
end
|
||||
|
||||
ailments.update_poison(monster, poison_param);
|
||||
::continue::
|
||||
@@ -149,6 +166,7 @@ function this.init_dependencies()
|
||||
large_monster = require("MHR_Overlay.Monsters.large_monster");
|
||||
config = require("MHR_Overlay.Misc.config");
|
||||
ailments = require("MHR_Overlay.Monsters.ailments");
|
||||
error_handler = require("MHR_Overlay.Misc.error_handler");
|
||||
end
|
||||
|
||||
function this.init_module()
|
||||
|
||||
@@ -9,6 +9,7 @@ local time;
|
||||
local small_monster;
|
||||
local large_monster;
|
||||
local non_players;
|
||||
local error_handler;
|
||||
|
||||
local sdk = sdk;
|
||||
local tostring = tostring;
|
||||
@@ -247,8 +248,6 @@ end
|
||||
local enemy_character_base_type_def = sdk.find_type_definition("snow.enemy.EnemyCharacterBase");
|
||||
local get_damage_param_method = enemy_character_base_type_def:get_method("get_DamageParam");
|
||||
|
||||
|
||||
|
||||
local damage_param_type_def = get_damage_param_method:get_return_type();
|
||||
local get_condition_param_method = damage_param_type_def:get_method("get_ConditionParam");
|
||||
|
||||
@@ -277,10 +276,13 @@ local get_value_method = system_array_type_def:get_method("GetValue(System.Int32
|
||||
|
||||
function this.update_ailments(enemy, monster)
|
||||
if enemy == nil then
|
||||
error_handler.report("ailments.update_ailments", "Missing Parameter: enemy");
|
||||
return;
|
||||
end
|
||||
|
||||
local damage_param = get_damage_param_method:call(enemy);
|
||||
if damage_param == nil then
|
||||
error_handler.report("ailments.update_ailments", "Failed to Access Data: damage_param");
|
||||
return;
|
||||
end
|
||||
|
||||
@@ -297,13 +299,14 @@ function this.update_ailments(enemy, monster)
|
||||
end
|
||||
|
||||
local condition_param_array = get_condition_param_method:call(damage_param);
|
||||
|
||||
if condition_param_array == nil then
|
||||
error_handler.report("ailments.update_ailments", "Failed to Access Data: condition_param_array");
|
||||
return;
|
||||
end
|
||||
|
||||
local condition_param_array_length = 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;
|
||||
end
|
||||
|
||||
@@ -314,6 +317,7 @@ function this.update_ailments(enemy, monster)
|
||||
|
||||
local ailment_param = get_value_method:call(condition_param_array, id);
|
||||
if ailment_param == nil then
|
||||
error_handler.report("ailments.update_ailments", "Failed to Access Data: ailment_param No. " .. tostring(id));
|
||||
goto continue
|
||||
end
|
||||
|
||||
@@ -326,16 +330,22 @@ function this.update_stun_poison_blast_ailments(monster, damage_param)
|
||||
local stun_param = stun_param_field:get_data(damage_param);
|
||||
if stun_param ~= nil then
|
||||
this.update_ailment(monster, stun_param, this.stun_id);
|
||||
else
|
||||
error_handler.report("ailments.update_stun_poison_blast_ailments", "Failed to Access Data: stun_param");
|
||||
end
|
||||
|
||||
local poison_param = poison_param_field:get_data(damage_param);
|
||||
if poison_param ~= nil then
|
||||
this.update_ailment(monster, poison_param, this.poison_id);
|
||||
else
|
||||
error_handler.report("ailments.update_stun_poison_blast_ailments", "Failed to Access Data: poison_param");
|
||||
end
|
||||
|
||||
local blast_param = blast_param_field:get_data(damage_param);
|
||||
if blast_param ~= nil then
|
||||
this.update_ailment(monster, blast_param, this.blast_id);
|
||||
else
|
||||
error_handler.report("ailments.update_stun_poison_blast_ailments", "Failed to Access Data: blast_param");
|
||||
end
|
||||
end
|
||||
|
||||
@@ -348,9 +358,9 @@ function this.update_ailment(monster, ailment_param, id)
|
||||
local duration = get_active_time_method:call(ailment_param);
|
||||
local is_active = get_is_active_method:call(ailment_param);
|
||||
|
||||
local activate_count = -999;
|
||||
local buildup = -999;
|
||||
local buildup_limit = 9999;
|
||||
local activate_count = nil;
|
||||
local buildup = nil;
|
||||
local buildup_limit = nil;
|
||||
|
||||
if activate_count_array ~= nil then
|
||||
local activate_count_array_length = length_method:call(activate_count_array);
|
||||
@@ -361,14 +371,16 @@ function this.update_ailment(monster, ailment_param, id)
|
||||
local activate_count_valuetype = get_value_method:call(activate_count_array, 0);
|
||||
|
||||
if activate_count_valuetype ~= nil then
|
||||
local _activate_count = activate_count_valuetype:get_field("mValue");
|
||||
|
||||
if _activate_count ~= nil then
|
||||
activate_count = _activate_count;
|
||||
end
|
||||
activate_count = activate_count_valuetype:get_field("mValue");
|
||||
else
|
||||
error_handler.report("ailments.update_ailment", "Failed to Access Data: activate_count_valuetype");
|
||||
end
|
||||
end
|
||||
else
|
||||
error_handler.report("ailments.update_ailment", "Failed to Access Data: activate_count_array_length");
|
||||
end
|
||||
else
|
||||
error_handler.report("ailments.update_ailment", "Failed to Access Data: activate_count_array");
|
||||
end
|
||||
|
||||
if buildup_array ~= nil then
|
||||
@@ -380,14 +392,16 @@ function this.update_ailment(monster, ailment_param, id)
|
||||
local buildup_valuetype = get_value_method:call(buildup_array, 0);
|
||||
|
||||
if buildup_valuetype ~= nil then
|
||||
local _buildup = buildup_valuetype:get_field("mValue");
|
||||
|
||||
if _buildup ~= nil then
|
||||
buildup = _buildup;
|
||||
end
|
||||
buildup = buildup_valuetype:get_field("mValue");
|
||||
else
|
||||
error_handler.report("ailments.update_ailment", "Failed to Access Data: buildup_valuetype");
|
||||
end
|
||||
end
|
||||
else
|
||||
error_handler.report("ailments.update_ailment", "Failed to Access Data: buildup_array_length");
|
||||
end
|
||||
else
|
||||
error_handler.report("ailments.update_ailment", "Failed to Access Data: buildup_array");
|
||||
end
|
||||
|
||||
if buildup_limit_array ~= nil then
|
||||
@@ -399,14 +413,16 @@ function this.update_ailment(monster, ailment_param, id)
|
||||
local buildup_limit_valuetype = get_value_method:call(buildup_limit_array, 0);
|
||||
|
||||
if buildup_limit_valuetype ~= nil then
|
||||
local _buildup_limit = buildup_limit_valuetype:get_field("mValue");
|
||||
|
||||
if _buildup_limit ~= nil then
|
||||
buildup_limit = _buildup_limit;
|
||||
end
|
||||
buildup_limit = buildup_limit_valuetype:get_field("mValue");
|
||||
else
|
||||
error_handler.report("ailments.update_ailment", "Failed to Access Data: buildup_limit_valuetype");
|
||||
end
|
||||
end
|
||||
else
|
||||
error_handler.report("ailments.update_ailment", "Failed to Access Data: buildup_limit_array_length");
|
||||
end
|
||||
else
|
||||
error_handler.report("ailments.update_ailment", "Failed to Access Data: buildup_limit_array");
|
||||
end
|
||||
|
||||
if is_enable == nil then
|
||||
@@ -429,6 +445,8 @@ function this.update_ailment(monster, ailment_param, id)
|
||||
end
|
||||
|
||||
monster.ailments[id].activate_count = activate_count;
|
||||
else
|
||||
error_handler.report("ailments.update_ailment", "Failed to Access Data: activate_count");
|
||||
end
|
||||
|
||||
if buildup ~= nil then
|
||||
@@ -437,6 +455,8 @@ function this.update_ailment(monster, ailment_param, id)
|
||||
end
|
||||
|
||||
monster.ailments[id].total_buildup = buildup;
|
||||
else
|
||||
error_handler.report("ailments.update_ailment", "Failed to Access Data: buildup");
|
||||
end
|
||||
|
||||
if buildup_limit ~= nil then
|
||||
@@ -445,6 +465,8 @@ function this.update_ailment(monster, ailment_param, id)
|
||||
end
|
||||
|
||||
monster.ailments[id].buildup_limit = buildup_limit;
|
||||
else
|
||||
error_handler.report("ailments.update_ailment", "Failed to Access Data: buildup_limit");
|
||||
end
|
||||
|
||||
if buildup ~= nil and buildup_limit ~= nil and buildup_limit ~= 0 then
|
||||
@@ -503,18 +525,29 @@ end
|
||||
-- Code by coavins
|
||||
function this.update_poison(monster, poison_param)
|
||||
if monster == nil then
|
||||
error_handler.report("ailments.update_poison", "Missing Parameter: monster");
|
||||
return;
|
||||
end
|
||||
|
||||
if poison_param ~= nil then
|
||||
--if poison tick, apply damage
|
||||
local is_damage = poison_get_is_damage_method:call(poison_param);
|
||||
if is_damage then
|
||||
local poison_damage = poison_damage_field:get_data(poison_param);
|
||||
|
||||
this.apply_ailment_damage(monster, this.poison_id, poison_damage);
|
||||
end
|
||||
if poison_param == nil then
|
||||
error_handler.report("ailments.update_poison", "Missing Parameter: poison_param");
|
||||
return;
|
||||
end
|
||||
|
||||
--if poison tick, apply damage
|
||||
local is_damage = poison_get_is_damage_method:call(poison_param);
|
||||
if is_damage == nil then
|
||||
error_handler.report("ailments.update_poison", "Failed to Access Data: is_damage");
|
||||
return;
|
||||
end
|
||||
|
||||
local poison_damage = poison_damage_field:get_data(poison_param);
|
||||
if poison_damage == nil then
|
||||
error_handler.report("ailments.update_poison", "Failed to Access Data: poison_damage");
|
||||
return;
|
||||
end
|
||||
|
||||
this.apply_ailment_damage(monster, this.poison_id, poison_damage);
|
||||
end
|
||||
|
||||
function this.draw(monster, ailment_UI, cached_config, ailments_position_on_screen, opacity_scale)
|
||||
@@ -608,14 +641,17 @@ function this.draw(monster, ailment_UI, cached_config, ailments_position_on_scre
|
||||
goto continue
|
||||
end
|
||||
|
||||
if cached_config.settings.hide_ailments_with_zero_buildup and ailment.total_buildup == 0 and
|
||||
ailment.buildup_limit ~= 0
|
||||
and ailment.activate_count == 0 and not ailment.is_active then
|
||||
if cached_config.settings.hide_ailments_with_zero_buildup
|
||||
and ailment.total_buildup == 0
|
||||
and ailment.buildup_limit ~= 0
|
||||
and ailment.activate_count == 0
|
||||
and not ailment.is_active then
|
||||
goto continue
|
||||
end
|
||||
|
||||
if cached_config.settings.hide_inactive_ailments_with_no_buildup_support and ailment.buildup_limit == 0 and
|
||||
not ailment.is_active then
|
||||
if cached_config.settings.hide_inactive_ailments_with_no_buildup_support
|
||||
and ailment.buildup_limit == 0
|
||||
and not ailment.is_active then
|
||||
goto continue
|
||||
end
|
||||
|
||||
@@ -631,9 +667,9 @@ function this.draw(monster, ailment_UI, cached_config, ailments_position_on_scre
|
||||
goto continue
|
||||
end
|
||||
|
||||
if cached_config.settings.time_limit ~= 0 and
|
||||
time.total_elapsed_script_seconds - ailment.last_change_time > cached_config.settings.time_limit and
|
||||
not ailment.is_active then
|
||||
if cached_config.settings.time_limit ~= 0
|
||||
and time.total_elapsed_script_seconds - ailment.last_change_time > cached_config.settings.time_limit
|
||||
and not ailment.is_active then
|
||||
goto continue
|
||||
end
|
||||
|
||||
@@ -682,14 +718,21 @@ function this.draw(monster, ailment_UI, cached_config, ailments_position_on_scre
|
||||
|
||||
ailment_UI_entity.draw(ailment, ailment_UI, cached_config, ailment_position_on_screen, opacity_scale);
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
function this.apply_ailment_buildup(monster, player, otomo, ailment_type, ailment_buildup)
|
||||
if monster == nil or
|
||||
(ailment_type ~= this.poison_id and ailment_type ~= this.blast_id and ailment_type ~= this.stun_id)
|
||||
or (ailment_buildup == 0 or ailment_buildup == nil) then
|
||||
if monster == nil then
|
||||
error_handler.report("ailments.apply_ailment_buildup", "Missing Parameter: monster");
|
||||
return;
|
||||
end
|
||||
|
||||
if ailment_buildup == nil then
|
||||
error_handler.report("ailments.apply_ailment_buildup", "Missing Parameter: ailment_buildup");
|
||||
return;
|
||||
end
|
||||
|
||||
if (ailment_type ~= this.poison_id and ailment_type ~= this.blast_id and ailment_type ~= this.stun_id)
|
||||
or ailment_buildup == 0 then
|
||||
return;
|
||||
end
|
||||
|
||||
@@ -709,7 +752,6 @@ function this.apply_ailment_buildup(monster, player, otomo, ailment_type, ailmen
|
||||
monster.ailments[ailment_type].otomo_buildup[otomo] = (monster.ailments[ailment_type].otomo_buildup[otomo] or 0) + ailment_buildup;
|
||||
end
|
||||
|
||||
|
||||
this.calculate_ailment_contribution(monster, ailment_type);
|
||||
end
|
||||
|
||||
@@ -751,7 +793,17 @@ end
|
||||
-- Code by coavins
|
||||
function this.apply_ailment_damage(monster, ailment_type, ailment_damage)
|
||||
-- we only track poison and blast for now
|
||||
if ailment_type == nil or ailment_damage == nil then
|
||||
if monster == nil then
|
||||
error_handler.report("ailments.apply_ailment_damage", "Missing Parameter: monster");
|
||||
end
|
||||
|
||||
if ailment_type == nil then
|
||||
error_handler.report("ailments.apply_ailment_damage", "Missing Parameter: ailment_type");
|
||||
return;
|
||||
end
|
||||
|
||||
if ailment_damage == nil then
|
||||
error_handler.report("ailments.apply_ailment_damage", "Missing Parameter: ailment_damage");
|
||||
return;
|
||||
end
|
||||
|
||||
@@ -824,6 +876,7 @@ function this.init_dependencies()
|
||||
time = require("MHR_Overlay.Game_Handler.time");
|
||||
small_monster = require("MHR_Overlay.Monsters.small_monster");
|
||||
large_monster = require("MHR_Overlay.Monsters.large_monster");
|
||||
error_handler = require("MHR_Overlay.Misc.error_handler");
|
||||
end
|
||||
|
||||
function this.init_module()
|
||||
|
||||
@@ -12,6 +12,7 @@ local drawing;
|
||||
local part_names;
|
||||
local time;
|
||||
local utils;
|
||||
local error_handler;
|
||||
|
||||
local sdk = sdk;
|
||||
local tostring = tostring;
|
||||
@@ -50,7 +51,6 @@ this.list = {};
|
||||
function this.new(id, name)
|
||||
local part = {};
|
||||
|
||||
|
||||
part.id = id;
|
||||
part.name = name;
|
||||
|
||||
@@ -475,6 +475,7 @@ function this.init_dependencies()
|
||||
part_names = require("MHR_Overlay.Misc.part_names");
|
||||
time = require("MHR_Overlay.Game_Handler.time");
|
||||
utils = require("MHR_Overlay.Misc.utils");
|
||||
error_handler = require("MHR_Overlay.Misc.error_handler");
|
||||
end
|
||||
|
||||
function this.init_module()
|
||||
|
||||
@@ -19,6 +19,7 @@ local players;
|
||||
local time;
|
||||
local body_part;
|
||||
local part_names;
|
||||
local error_handler;
|
||||
|
||||
local sdk = sdk;
|
||||
local tostring = tostring;
|
||||
@@ -56,6 +57,7 @@ this.list = {};
|
||||
|
||||
function this.new(enemy)
|
||||
local monster = {};
|
||||
|
||||
monster.enemy = enemy;
|
||||
monster.is_large = true;
|
||||
|
||||
@@ -259,7 +261,7 @@ local on_break_method = enemy_mystery_core_parts_type_def:get_method("onBreak");
|
||||
function this.init(monster, enemy)
|
||||
local enemy_type = enemy_type_field:get_data(enemy);
|
||||
if enemy_type == nil then
|
||||
customization_menu.status = "No enemy type";
|
||||
error_handler.report("large_monster.init", "Failed to Access Data: enemy_type");
|
||||
return;
|
||||
end
|
||||
|
||||
@@ -272,6 +274,8 @@ function this.init(monster, enemy)
|
||||
local enemy_name = get_enemy_name_message_method:call(singletons.message_manager, enemy_type);
|
||||
if enemy_name ~= nil then
|
||||
monster.name = enemy_name;
|
||||
else
|
||||
error_handler.report("large_monster.init", "Failed to Access Data: enemy_name");
|
||||
end
|
||||
|
||||
local set_info = get_set_info_method:call(enemy);
|
||||
@@ -279,7 +283,11 @@ function this.init(monster, enemy)
|
||||
local unique_id = get_unique_id_method:call(set_info);
|
||||
if unique_id ~= nil then
|
||||
monster.unique_id = unique_id;
|
||||
else
|
||||
error_handler.report("large_monster.init", "Failed to Access Data: unique_id");
|
||||
end
|
||||
else
|
||||
error_handler.report("large_monster.init", "Failed to Access Data: set_info");
|
||||
end
|
||||
|
||||
local size_info = find_enemy_size_info_method:call(singletons.enemy_manager, enemy_type);
|
||||
@@ -292,18 +300,26 @@ function this.init(monster, enemy)
|
||||
|
||||
if small_border ~= nil then
|
||||
monster.small_border = small_border;
|
||||
else
|
||||
error_handler.report("large_monster.init", "Failed to Access Data: small_border");
|
||||
end
|
||||
|
||||
if big_border ~= nil then
|
||||
monster.big_border = big_border;
|
||||
else
|
||||
error_handler.report("large_monster.init", "Failed to Access Data: big_border");
|
||||
end
|
||||
|
||||
if king_border ~= nil then
|
||||
monster.king_border = king_border;
|
||||
else
|
||||
error_handler.report("large_monster.init", "Failed to Access Data: king_border");
|
||||
end
|
||||
|
||||
if size ~= nil then
|
||||
monster.size = size;
|
||||
else
|
||||
error_handler.report("large_monster.init", "Failed to Access Data: size");
|
||||
end
|
||||
|
||||
if monster.size <= monster.small_border then
|
||||
@@ -313,6 +329,8 @@ function this.init(monster, enemy)
|
||||
elseif monster.size >= monster.big_border then
|
||||
monster.crown = language.current_language.UI.silver;
|
||||
end
|
||||
else
|
||||
error_handler.report("large_monster.init", "Failed to Access Data: size_info");
|
||||
end
|
||||
|
||||
local is_capture_enable = true;
|
||||
@@ -325,12 +343,19 @@ function this.init(monster, enemy)
|
||||
local is_capture_enable_ = capture_param:call("get_IsEnable");
|
||||
if is_capture_enable_ ~= nil then
|
||||
is_capture_enable = is_capture_enable_;
|
||||
else
|
||||
error_handler.report("large_monster.init", "Failed to Access Data: is_capture_enable_");
|
||||
end
|
||||
else
|
||||
error_handler.report("large_monster.init", "Failed to Access Data: capture_param");
|
||||
end
|
||||
else
|
||||
error_handler.report("large_monster.init", "Failed to Access Data: damage_param");
|
||||
end
|
||||
|
||||
--local curia_param = enemy:get_field("<CuriaParam>k__BackingField");
|
||||
local mystery_param = get_mystery_param_method:call(enemy);
|
||||
|
||||
local is_anomaly = mystery_param ~= nil;
|
||||
|
||||
monster.is_anomaly = is_anomaly;
|
||||
@@ -426,15 +451,17 @@ function this.init_UI(monster, monster_UI, cached_config)
|
||||
end
|
||||
|
||||
function this.update_position(enemy, monster)
|
||||
if not config.current_config.large_monster_UI.dynamic.enabled and
|
||||
config.current_config.large_monster_UI.static.sorting.type ~= "Distance" then
|
||||
if not config.current_config.large_monster_UI.dynamic.enabled
|
||||
and config.current_config.large_monster_UI.static.sorting.type ~= "Distance" then
|
||||
return;
|
||||
end
|
||||
|
||||
local position = get_pos_field:call(enemy);
|
||||
if position ~= nil then
|
||||
monster.position = position;
|
||||
if position == nil then
|
||||
error_handler.report("large_monster.update_position", "Failed to Access Data: position");
|
||||
end
|
||||
|
||||
monster.position = position;
|
||||
end
|
||||
|
||||
-- Code by coavins
|
||||
@@ -442,26 +469,31 @@ function this.update_all_riders()
|
||||
for enemy, monster in pairs(this.list) do
|
||||
-- get marionette rider
|
||||
local mario_param = get_mario_param_method:call(enemy);
|
||||
if mario_param ~= nil then
|
||||
local is_marionette = get_is_marionette_method:call(mario_param);
|
||||
if mario_param == nil then
|
||||
error_handler.report("large_monster.update_all_riders", "Failed to Access Data: mario_param");
|
||||
goto continue;
|
||||
end
|
||||
|
||||
if is_marionette == nil then
|
||||
local is_marionette = get_is_marionette_method:call(mario_param);
|
||||
if is_marionette == nil then
|
||||
error_handler.report("large_monster.update_all_riders", "Failed to Access Data: is_marionette");
|
||||
goto continue;
|
||||
end
|
||||
|
||||
if is_marionette then
|
||||
local player_id = get_mario_player_index_method:call(mario_param);
|
||||
if player_id == nil then
|
||||
error_handler.report("large_monster.update_all_riders", "Failed to Access Data: player_id");
|
||||
goto continue;
|
||||
end
|
||||
|
||||
if is_marionette then
|
||||
local player_id = get_mario_player_index_method:call(mario_param);
|
||||
if player_id ~= nil then
|
||||
monster.rider_id = player_id;
|
||||
end
|
||||
else
|
||||
monster.rider_id = -1;
|
||||
end
|
||||
|
||||
monster.rider_id = player_id;
|
||||
else
|
||||
monster.rider_id = -1;
|
||||
end
|
||||
|
||||
::continue::
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function this.update(enemy, monster)
|
||||
@@ -476,11 +508,15 @@ function this.update(enemy, monster)
|
||||
local dead_or_captured = check_die_method:call(enemy);
|
||||
if dead_or_captured ~= nil then
|
||||
monster.dead_or_captured = dead_or_captured;
|
||||
else
|
||||
error_handler.report("large_monster.update", "Failed to Access Data: dead_or_captured");
|
||||
end
|
||||
|
||||
local is_disp_icon_mini_map = is_disp_icon_mini_map_method:call(enemy);
|
||||
if is_disp_icon_mini_map ~= nil then
|
||||
monster.is_disp_icon_mini_map = is_disp_icon_mini_map;
|
||||
else
|
||||
error_handler.report("large_monster.update", "Failed to Access Data: is_disp_icon_mini_map");
|
||||
end
|
||||
|
||||
if monster.id == 549 or monster.id == 25 or monster.id == 2073 then
|
||||
@@ -491,23 +527,29 @@ function this.update(enemy, monster)
|
||||
-- Lucent Nargacuga
|
||||
if monster.id == 549 then
|
||||
local is_stealth = is_stealth_method:call(enemy);
|
||||
if is_stealth ~= nil then
|
||||
if is_stealth == nil then
|
||||
monster.is_stealth = is_stealth;
|
||||
else
|
||||
error_handler.report("large_monster.update", "Failed to Access Data: is_stealth");
|
||||
end
|
||||
|
||||
-- Chameleos and Risen Chameleos
|
||||
elseif monster.id == 25 or monster.id == 2073 then
|
||||
local stealth_controller = get_stealth_ctrl_method:call(enemy);
|
||||
if stealth_controller ~= nil then
|
||||
local status = get_current_status_method:call(stealth_controller);
|
||||
|
||||
if status >= 2 then
|
||||
if status == nil then
|
||||
error_handler.report("large_monster.update", "Failed to Access Data: status");
|
||||
elseif status >= 2 then
|
||||
monster.is_stealth = true;
|
||||
else
|
||||
monster.is_stealth = false;
|
||||
end
|
||||
else
|
||||
error_handler.report("large_monster.update", "Failed to Access Data: stealth_controller");
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
pcall(ailments.update_ailments, enemy, monster);
|
||||
@@ -530,24 +572,41 @@ function this.update_health(enemy, monster)
|
||||
|
||||
local physical_param = get_physical_param_method:call(enemy);
|
||||
if physical_param == nil then
|
||||
customization_menu.status = "No physical param";
|
||||
error_handler.report("large_monster.update_health", "Failed to Access Data: physical_param");
|
||||
return nil;
|
||||
end
|
||||
|
||||
local vital_param = get_vital_method:call(physical_param, 0, 0);
|
||||
if vital_param == nil then
|
||||
customization_menu.status = "No vital param";
|
||||
error_handler.report("large_monster.update_health", "Failed to Access Data: vital_param");
|
||||
return nil;
|
||||
end
|
||||
|
||||
monster.health = get_current_method:call(vital_param) or monster.health;
|
||||
monster.max_health = get_max_method:call(vital_param) or monster.max_health;
|
||||
monster.capture_health = get_capture_hp_vital_method:call(physical_param) or monster.capture_health;
|
||||
local health = get_current_method:call(vital_param);
|
||||
if health ~= nil then
|
||||
monster.health = health;
|
||||
else
|
||||
error_handler.report("large_monster.update_health", "Failed to Access Data: health");
|
||||
end
|
||||
|
||||
monster.missing_health = monster.max_health - monster.health;
|
||||
local max_health = get_max_method:call(vital_param);
|
||||
if max_health ~= nil then
|
||||
monster.max_health = max_health;
|
||||
else
|
||||
error_handler.report("large_monster.update_health", "Failed to Access Data: max_health");
|
||||
end
|
||||
|
||||
local capture_health = get_capture_hp_vital_method:call(physical_param);
|
||||
if capture_health ~= nil then
|
||||
monster.capture_health = capture_health;
|
||||
else
|
||||
error_handler.report("large_monster.update_health", "Failed to Access Data: capture_health");
|
||||
end
|
||||
|
||||
monster.missing_health = max_health - health;
|
||||
if monster.max_health ~= 0 then
|
||||
monster.health_percentage = monster.health / monster.max_health;
|
||||
monster.capture_percentage = monster.capture_health / monster.max_health;
|
||||
monster.health_percentage = health / max_health;
|
||||
monster.capture_percentage = capture_health / max_health;
|
||||
end
|
||||
|
||||
return physical_param;
|
||||
@@ -569,9 +628,9 @@ function this.update_stamina(enemy, monster, stamina_param)
|
||||
end
|
||||
|
||||
if stamina_param == nil then
|
||||
stamina_param =get_stamina_param_method:call(enemy);
|
||||
stamina_param = get_stamina_param_method:call(enemy);
|
||||
if stamina_param == nil then
|
||||
customization_menu.status = "No stamina param";
|
||||
error_handler.report("large_monster.update_stamina", "Failed to Access Data: stamina_param");
|
||||
return;
|
||||
end
|
||||
end
|
||||
@@ -579,14 +638,34 @@ function this.update_stamina(enemy, monster, stamina_param)
|
||||
local is_tired = is_tired_method:call(stamina_param, false);
|
||||
if is_tired ~= nil then
|
||||
monster.is_tired = is_tired;
|
||||
else
|
||||
error_handler.report("large_monster.update_stamina", "Failed to Access Data: is_tired");
|
||||
return;
|
||||
end
|
||||
|
||||
monster.stamina = get_stamina_method:call(stamina_param) or monster.stamina;
|
||||
monster.max_stamina = get_max_stamina_method:call(stamina_param) or monster.max_stamina;
|
||||
if is_tired then
|
||||
return;
|
||||
end
|
||||
|
||||
monster.missing_stamina = monster.max_stamina - monster.stamina;
|
||||
if monster.max_stamina ~= 0 then
|
||||
monster.stamina_percentage = monster.stamina / monster.max_stamina;
|
||||
local stamina = get_stamina_method:call(stamina_param);
|
||||
if stamina ~= nil then
|
||||
monster.stamina = stamina;
|
||||
else
|
||||
error_handler.report("large_monster.update_stamina", "Failed to Access Data: stamina");
|
||||
return;
|
||||
end
|
||||
|
||||
local max_stamina = get_max_stamina_method:call(stamina_param);
|
||||
if max_stamina ~= nil then
|
||||
monster.max_stamina = max_stamina;
|
||||
else
|
||||
error_handler.report("large_monster.update_stamina", "Failed to Access Data: max_stamina");
|
||||
return;
|
||||
end
|
||||
|
||||
monster.missing_stamina = max_stamina - stamina;
|
||||
if max_stamina ~= 0 then
|
||||
monster.stamina_percentage = stamina / max_stamina;
|
||||
end
|
||||
end
|
||||
|
||||
@@ -608,7 +687,7 @@ function this.update_stamina_timer(enemy, monster, stamina_param)
|
||||
if stamina_param == nil then
|
||||
stamina_param = get_stamina_param_method:call(enemy);
|
||||
if stamina_param == nil then
|
||||
customization_menu.status = "No stamina param";
|
||||
error_handler.report("large_monster.update_stamina_timer", "Failed to Access Data: stamina_param");
|
||||
return;
|
||||
end
|
||||
end
|
||||
@@ -616,24 +695,41 @@ function this.update_stamina_timer(enemy, monster, stamina_param)
|
||||
local is_tired = is_tired_method:call(stamina_param, false);
|
||||
if is_tired ~= nil then
|
||||
monster.is_tired = is_tired;
|
||||
else
|
||||
error_handler.report("large_monster.update_stamina_timer", "Failed to Access Data: is_tired");
|
||||
return;
|
||||
end
|
||||
|
||||
if not is_tired then
|
||||
return;
|
||||
end
|
||||
|
||||
local tired_timer = get_remaining_tired_time_method:call(stamina_param);
|
||||
if tired_timer ~= nil then
|
||||
monster.tired_timer = tired_timer;
|
||||
else
|
||||
error_handler.report("large_monster.update_stamina_timer", "Failed to Access Data: tired_timer");
|
||||
return;
|
||||
end
|
||||
|
||||
monster.tired_timer = get_remaining_tired_time_method:call(stamina_param) or monster.tired_timer;
|
||||
monster.tired_duration = get_total_tired_time_method:call(stamina_param) or monster.tired_duration;
|
||||
local tired_duration = get_total_tired_time_method:call(stamina_param);
|
||||
if tired_duration ~= nil then
|
||||
monster.tired_duration = tired_duration;
|
||||
else
|
||||
error_handler.report("large_monster.update_stamina_timer", "Failed to Access Data: tired_duration");
|
||||
return;
|
||||
end
|
||||
|
||||
if monster.is_tired then
|
||||
monster.tired_total_seconds_left = monster.tired_timer;
|
||||
if monster.tired_total_seconds_left < 0 then
|
||||
monster.tired_total_seconds_left = 0;
|
||||
end
|
||||
monster.tired_total_seconds_left = tired_timer;
|
||||
if monster.tired_total_seconds_left < 0 then
|
||||
monster.tired_total_seconds_left = 0;
|
||||
end
|
||||
|
||||
monster.tired_minutes_left = math.floor(monster.tired_total_seconds_left / 60);
|
||||
monster.tired_seconds_left = monster.tired_total_seconds_left - 60 * monster.tired_minutes_left;
|
||||
monster.tired_minutes_left = math.floor(monster.tired_total_seconds_left / 60);
|
||||
monster.tired_seconds_left = monster.tired_total_seconds_left - 60 * monster.tired_minutes_left;
|
||||
|
||||
if monster.tired_duration ~= 0 then
|
||||
monster.tired_timer_percentage = monster.tired_total_seconds_left / monster.tired_duration;
|
||||
end
|
||||
if tired_duration ~= 0 then
|
||||
monster.tired_timer_percentage = monster.tired_total_seconds_left / tired_duration;
|
||||
end
|
||||
end
|
||||
|
||||
@@ -655,17 +751,41 @@ function this.update_rage(enemy, monster, anger_param)
|
||||
if anger_param == nil then
|
||||
anger_param = get_anger_param_method:call(enemy);
|
||||
if anger_param == nil then
|
||||
customization_menu.status = "No anger param";
|
||||
error_handler.report("large_monster.update_rage", "Failed to Access Data: anger_param");
|
||||
return;
|
||||
end
|
||||
end
|
||||
|
||||
local is_in_rage = is_anger_method:call(anger_param);
|
||||
if is_in_rage ~= nil then
|
||||
monster.is_in_rage = is_in_rage;
|
||||
else
|
||||
error_handler.report("large_monster.update_rage", "Failed to Access Data: is_in_rage");
|
||||
return;
|
||||
end
|
||||
|
||||
monster.rage_point = get_anger_point_method:call(anger_param) or monster.rage_point;
|
||||
monster.rage_limit = get_limit_anger_method:call(anger_param) or monster.rage_limit;
|
||||
if is_in_rage then
|
||||
return;
|
||||
end
|
||||
|
||||
local rage_point = get_anger_point_method:call(anger_param);
|
||||
if rage_point ~= nil then
|
||||
monster.rage_point = rage_point;
|
||||
else
|
||||
error_handler.report("large_monster.update_rage", "Failed to Access Data: rage_point");
|
||||
return;
|
||||
end
|
||||
|
||||
if monster.rage_limit ~= 0 then
|
||||
monster.rage_percentage = monster.rage_point / monster.rage_limit;
|
||||
local rage_limit = get_limit_anger_method:call(anger_param);
|
||||
if rage_limit ~= nil then
|
||||
monster.rage_limit = rage_limit;
|
||||
else
|
||||
error_handler.report("large_monster.update_rage", "Failed to Access Data: rage_limit");
|
||||
return;
|
||||
end
|
||||
|
||||
if rage_limit ~= 0 then
|
||||
monster.rage_percentage = rage_point / rage_limit;
|
||||
end
|
||||
end
|
||||
|
||||
@@ -687,7 +807,7 @@ function this.update_rage_timer(enemy, monster, anger_param)
|
||||
if anger_param == nil then
|
||||
anger_param = get_anger_param_method:call(enemy);
|
||||
if anger_param == nil then
|
||||
customization_menu.status = "No anger param";
|
||||
error_handler.report("large_monster.update_rage_timer", "Failed to Access Data: anger_param");
|
||||
return;
|
||||
end
|
||||
end
|
||||
@@ -695,23 +815,41 @@ function this.update_rage_timer(enemy, monster, anger_param)
|
||||
local is_in_rage = is_anger_method:call(anger_param);
|
||||
if is_in_rage ~= nil then
|
||||
monster.is_in_rage = is_in_rage;
|
||||
else
|
||||
error_handler.report("large_monster.update_rage_timer", "Failed to Access Data: is_in_rage");
|
||||
return;
|
||||
end
|
||||
|
||||
monster.rage_timer = get_remaining_anger_time_method:call(anger_param) or monster.rage_timer;
|
||||
monster.rage_duration = get_total_anger_time_method:call(anger_param) or monster.rage_duration;
|
||||
if not is_in_rage then
|
||||
return;
|
||||
end
|
||||
|
||||
if monster.is_in_rage then
|
||||
monster.rage_total_seconds_left = monster.rage_timer;
|
||||
if monster.rage_total_seconds_left < 0 then
|
||||
monster.rage_total_seconds_left = 0;
|
||||
end
|
||||
local rage_timer = get_remaining_anger_time_method:call(anger_param);
|
||||
if rage_timer ~= nil then
|
||||
monster.rage_timer = rage_timer;
|
||||
else
|
||||
error_handler.report("large_monster.update_rage_timer", "Failed to Access Data: rage_timer");
|
||||
return;
|
||||
end
|
||||
|
||||
monster.rage_minutes_left = math.floor(monster.rage_total_seconds_left / 60);
|
||||
monster.rage_seconds_left = monster.rage_total_seconds_left - 60 * monster.rage_minutes_left;
|
||||
local rage_duration = get_total_anger_time_method:call(anger_param);
|
||||
if rage_duration ~= nil then
|
||||
monster.rage_duration = rage_duration;
|
||||
else
|
||||
error_handler.report("large_monster.update_rage_timer", "Failed to Access Data: rage_duration");
|
||||
return;
|
||||
end
|
||||
|
||||
if monster.rage_duration ~= 0 then
|
||||
monster.rage_timer_percentage = monster.rage_total_seconds_left / monster.rage_duration;
|
||||
end
|
||||
monster.rage_total_seconds_left = rage_timer;
|
||||
if monster.rage_total_seconds_left < 0 then
|
||||
monster.rage_total_seconds_left = 0;
|
||||
end
|
||||
|
||||
monster.rage_minutes_left = math.floor(monster.rage_total_seconds_left / 60);
|
||||
monster.rage_seconds_left = monster.rage_total_seconds_left - 60 * monster.rage_minutes_left;
|
||||
|
||||
if rage_duration ~= 0 then
|
||||
monster.rage_timer_percentage = monster.rage_total_seconds_left / rage_duration;
|
||||
end
|
||||
end
|
||||
|
||||
@@ -745,31 +883,32 @@ function this.update_parts(enemy, monster, physical_param)
|
||||
if physical_param == nil then
|
||||
physical_param = get_physical_param_method:call(enemy);
|
||||
if physical_param == nil then
|
||||
customization_menu.status = "No physical param";
|
||||
error_handler.report("large_monster.update_parts", "Failed to Access Data: physical_param");
|
||||
return;
|
||||
end
|
||||
end
|
||||
|
||||
local damage_param = get_damage_param_method:call(enemy);
|
||||
if damage_param == nil then
|
||||
customization_menu.status = "No damage param";
|
||||
error_handler.report("large_monster.update_parts", "Failed to Access Data: damage_param");
|
||||
return;
|
||||
end
|
||||
|
||||
local enemy_parts_damage_info = enemy_parts_damage_info_field:get_data(damage_param);
|
||||
if enemy_parts_damage_info == nil then
|
||||
customization_menu.status = "No parts damage info";
|
||||
error_handler.report("large_monster.update_parts", "Failed to Access Data: enemy_parts_damage_info");
|
||||
return;
|
||||
end
|
||||
|
||||
local core_parts_array = get_part_info_array_method:call(enemy_parts_damage_info);
|
||||
if core_parts_array == nil then
|
||||
customization_menu.status = "No parts damage info array";
|
||||
error_handler.report("large_monster.update_parts", "Failed to Access Data: core_parts_array");
|
||||
return;
|
||||
end
|
||||
|
||||
local core_parts_array_length = 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;
|
||||
end
|
||||
|
||||
@@ -778,7 +917,8 @@ function this.update_parts(enemy, monster, physical_param)
|
||||
|
||||
local enemy_parts_info = get_value_method:call(core_parts_array, i);
|
||||
if enemy_parts_info == nil then
|
||||
goto continue
|
||||
error_handler.report("large_monster.update_parts", "Failed to Access Data: enemy_parts_info No. " .. tostring(i));
|
||||
goto continue;
|
||||
end
|
||||
|
||||
local part = monster.parts[part_id];
|
||||
@@ -795,52 +935,90 @@ function this.update_parts(enemy, monster, physical_param)
|
||||
if cached_config.dynamic.body_parts.part_health.visibility
|
||||
or cached_config.static.body_parts.part_health.visibility
|
||||
or cached_config.highlighted.body_parts.part_health.visibility then
|
||||
|
||||
local part_vital = get_vital_method:call(physical_param, 1, i);
|
||||
if part_vital ~= nil then
|
||||
local part_current = get_current_method:call(part_vital) or -1;
|
||||
local part_max = get_max_method:call(part_vital) or -1;
|
||||
|
||||
body_part.update_flinch(part, part_current, part_max);
|
||||
local part_current = get_current_method:call(part_vital);
|
||||
if part_current == nil then
|
||||
error_handler.report("large_monster.update_parts", string.format("Failed to Access Data: enemy_parts_info No. %d -> part_current", i));
|
||||
end
|
||||
|
||||
local part_max = get_max_method:call(part_vital);
|
||||
if part_max == nil then
|
||||
error_handler.report("large_monster.update_parts", string.format("Failed to Access Data: enemy_parts_info No. %d -> part_max", i));
|
||||
end
|
||||
|
||||
if part_current ~= nil and part_max ~= nil then
|
||||
body_part.update_flinch(part, part_current, part_max);
|
||||
end
|
||||
else
|
||||
error_handler.report("large_monster.update_parts", string.format("Failed to Access Data: enemy_parts_info No. %d -> part_vital", i));
|
||||
end
|
||||
end
|
||||
|
||||
if cached_config.dynamic.body_parts.part_break.visibility
|
||||
or cached_config.static.body_parts.part_break.visibility
|
||||
or cached_config.highlighted.body_parts.part_break.visibility then
|
||||
|
||||
local part_break_vital = get_vital_method:call(physical_param, 2, i);
|
||||
if part_break_vital ~= nil then
|
||||
local part_break_current = get_current_method:call(part_break_vital) or -1;
|
||||
local part_break_max = get_max_method:call(part_break_vital) or -1;
|
||||
local part_break_count = -1;
|
||||
local part_break_max_count = -1;
|
||||
|
||||
if enemy_parts_info ~= nil then
|
||||
part_break_count = get_parts_break_damage_level_method:call(enemy_parts_info) or part_break_count;
|
||||
part_break_max_count = get_parts_break_damage_max_level_method:call(enemy_parts_info) or part_break_max_count;
|
||||
local part_break_current = get_current_method:call(part_break_vital);
|
||||
if part_break_current == nil then
|
||||
error_handler.report("large_monster.update_parts", string.format("Failed to Access Data: enemy_parts_info No. %d -> part_break_current", i));
|
||||
end
|
||||
|
||||
body_part.update_break(part, part_break_current, part_break_max, part_break_count, part_break_max_count)
|
||||
local part_break_max = get_max_method:call(part_break_vital);
|
||||
if part_break_max == nil then
|
||||
error_handler.report("large_monster.update_parts", string.format("Failed to Access Data: enemy_parts_info No. %d -> part_break_max", i));
|
||||
end
|
||||
|
||||
local part_break_count = get_parts_break_damage_level_method:call(enemy_parts_info);
|
||||
if part_break_count == nil then
|
||||
error_handler.report("large_monster.update_parts", string.format("Failed to Access Data: enemy_parts_info No. %d -> part_break_count", i));
|
||||
end
|
||||
|
||||
local part_break_max_count = get_parts_break_damage_max_level_method:call(enemy_parts_info);
|
||||
if part_break_max_count == nil then
|
||||
error_handler.report("large_monster.update_parts", string.format("Failed to Access Data: enemy_parts_info No. %d -> part_break_max_count", i));
|
||||
end
|
||||
|
||||
if part_break_current ~= nil and part_break_max ~= nil and part_break_count ~= nil and part_break_max_count ~= nil then
|
||||
body_part.update_break(part, part_break_current, part_break_max, part_break_count, part_break_max_count);
|
||||
end
|
||||
else
|
||||
error_handler.report("large_monster.update_parts", string.format("Failed to Access Data: enemy_parts_info No. %d -> part_break_vital", i));
|
||||
end
|
||||
end
|
||||
|
||||
if cached_config.dynamic.body_parts.part_loss.visibility
|
||||
or cached_config.static.body_parts.part_loss.visibility
|
||||
or cached_config.highlighted.body_parts.part_loss.visibility then
|
||||
|
||||
local part_loss_vital = get_vital_method:call(physical_param, 3, i);
|
||||
if part_loss_vital ~= nil then
|
||||
local part_loss_current = get_current_method:call(part_loss_vital) or -1;
|
||||
local part_loss_max = get_max_method:call(part_loss_vital) or -1;
|
||||
local is_severed = false;
|
||||
|
||||
if enemy_parts_info ~= nil then
|
||||
local _is_severed = get_parts_loss_state_method:call(enemy_parts_info);
|
||||
if _is_severed ~= nil then
|
||||
is_severed = _is_severed;
|
||||
end
|
||||
local part_loss_current = get_current_method:call(part_loss_vital);
|
||||
if part_loss_current == nil then
|
||||
error_handler.report("large_monster.update_parts", string.format("Failed to Access Data: enemy_parts_info No. %d -> part_loss_current", i));
|
||||
end
|
||||
|
||||
body_part.update_loss(part, part_loss_current, part_loss_max, is_severed);
|
||||
local part_loss_max = get_max_method:call(part_loss_vital);
|
||||
if part_loss_max == nil then
|
||||
error_handler.report("large_monster.update_parts", string.format("Failed to Access Data: enemy_parts_info No. %d -> part_loss_max", i));
|
||||
end
|
||||
|
||||
local is_severed = get_parts_loss_state_method:call(enemy_parts_info);
|
||||
if is_severed == nil then
|
||||
error_handler.report("large_monster.update_parts", string.format("Failed to Access Data: enemy_parts_info No. %d -> is_severed", i));
|
||||
end
|
||||
|
||||
if part_loss_current ~= nil and part_loss_max ~= nil and is_severed ~= nil then
|
||||
body_part.update_loss(part, part_loss_current, part_loss_max, is_severed);
|
||||
end
|
||||
else
|
||||
error_handler.report("large_monster.update_parts", string.format("Failed to Access Data: enemy_parts_info No. %d -> part_loss_vital", i));
|
||||
end
|
||||
end
|
||||
|
||||
@@ -878,12 +1056,13 @@ function this.update_anomaly_parts(enemy, monster, mystery_param)
|
||||
|
||||
local core_parts_array = core_parts_array_field:get_data(mystery_param);
|
||||
if core_parts_array == nil then
|
||||
customization_menu.status = "No core parts array";
|
||||
error_handler.report("large_monster.update_anomaly_parts", "Failed to Access Data: core_parts_array");
|
||||
return;
|
||||
end
|
||||
|
||||
local core_parts_array_length = 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;
|
||||
end
|
||||
|
||||
@@ -892,7 +1071,8 @@ function this.update_anomaly_parts(enemy, monster, mystery_param)
|
||||
|
||||
local core_part = get_value_method:call(core_parts_array, i);
|
||||
if core_part == nil then
|
||||
goto continue
|
||||
error_handler.report("large_monster.update_anomaly_parts", "Failed to Access Data: core_part No. " .. tostring(i));
|
||||
goto continue;
|
||||
end
|
||||
|
||||
local part = monster.parts[part_id];
|
||||
@@ -907,27 +1087,43 @@ function this.update_anomaly_parts(enemy, monster, mystery_param)
|
||||
end
|
||||
|
||||
local part_vital = core_parts_get_vital_method:call(core_part);
|
||||
if part_vital == nil then
|
||||
error_handler.report("large_monster.update_anomaly_parts", "Failed to Access Data: part_vital No. " .. tostring(i));
|
||||
return;
|
||||
end
|
||||
|
||||
local part_is_active = core_parts_get_is_active_method:call(core_part);
|
||||
if part_is_active == nil then
|
||||
error_handler.report("large_monster.update_anomaly_parts", "Failed to Access Data: part_is_active No. " .. tostring(i));
|
||||
return;
|
||||
end
|
||||
|
||||
--local part_dying_vital_threshold = core_parts_get_dying_vital_threashold_method:call(core_part);
|
||||
|
||||
if part_is_active == nil then
|
||||
part_is_active = false;
|
||||
local part_current = get_current_method:call(part_vital);
|
||||
if part_current == nil then
|
||||
error_handler.report("large_monster.update_anomaly_parts", "Failed to Access Data: part_current No. " .. tostring(i));
|
||||
goto continue;
|
||||
end
|
||||
|
||||
if part_vital ~= nil then
|
||||
local part_current = get_current_method:call(part_vital) or -1;
|
||||
local part_max = get_max_method:call(part_vital) or -1;
|
||||
local part_is_enabled = is_enable_method:call(part_vital);
|
||||
|
||||
|
||||
if not part_is_enabled then
|
||||
goto continue;
|
||||
end
|
||||
|
||||
body_part.update_anomaly(part, core_part, part_current, part_max, part_is_active);
|
||||
|
||||
local part_max = get_max_method:call(part_vital);
|
||||
if part_max == nil then
|
||||
error_handler.report("large_monster.update_anomaly_parts", "Failed to Access Data: part_max No. " .. tostring(i));
|
||||
goto continue;
|
||||
end
|
||||
|
||||
local part_is_enabled = is_enable_method:call(part_vital);
|
||||
if part_is_enabled == nil then
|
||||
error_handler.report("large_monster.update_anomaly_parts", "Failed to Access Data: part_is_enabled No. " .. tostring(i));
|
||||
goto continue;
|
||||
end
|
||||
|
||||
if not part_is_enabled then
|
||||
goto continue;
|
||||
end
|
||||
|
||||
body_part.update_anomaly(part, core_part, part_current, part_max, part_is_active);
|
||||
|
||||
::continue::
|
||||
end
|
||||
end
|
||||
@@ -1054,6 +1250,7 @@ function this.init_dependencies()
|
||||
players = require("MHR_Overlay.Damage_Meter.players");
|
||||
time = require("MHR_Overlay.Game_Handler.time");
|
||||
ailment_buildup = require("MHR_Overlay.Monsters.ailment_buildup");
|
||||
error_handler = require("MHR_Overlay.Misc.error_handler");
|
||||
end
|
||||
|
||||
function this.init_module()
|
||||
|
||||
@@ -6,6 +6,7 @@ local config;
|
||||
local ailments;
|
||||
local players;
|
||||
local quest_status;
|
||||
local error_handler;
|
||||
|
||||
local sdk = sdk;
|
||||
local tostring = tostring;
|
||||
@@ -118,8 +119,8 @@ function this.update_large_monster(enemy)
|
||||
local cached_config = config.current_config.large_monster_UI;
|
||||
|
||||
if not cached_config.dynamic.enabled and
|
||||
not cached_config.static.enabled and
|
||||
not cached_config.highlighted.enabled then
|
||||
not cached_config.static.enabled and
|
||||
not cached_config.highlighted.enabled then
|
||||
return;
|
||||
end
|
||||
|
||||
@@ -202,11 +203,13 @@ end
|
||||
function this.update_health(enemy_damage_check)
|
||||
local enemy = get_ref_enemy:call(enemy_damage_check);
|
||||
if enemy == nil then
|
||||
error_handler.report("monster_hook.update_health", "Failed to Access Data: enemy");
|
||||
return;
|
||||
end
|
||||
|
||||
local is_large = is_boss_enemy_method:call(enemy);
|
||||
if is_large == nil then
|
||||
error_handler.report("monster_hook.update_health", "Failed to Access Data: is_large");
|
||||
return;
|
||||
end
|
||||
|
||||
@@ -229,6 +232,7 @@ function this.update_stamina(stamina_param, stamina_sub)
|
||||
|
||||
local enemy = get_enemy_method:call(stamina_param);
|
||||
if enemy == nil then
|
||||
error_handler.report("monster_hook.update_stamina", "Failed to Access Data: enemy");
|
||||
return;
|
||||
end
|
||||
|
||||
@@ -262,6 +266,7 @@ function this.init_dependencies()
|
||||
ailments = require("MHR_Overlay.Monsters.ailments");
|
||||
players = require("MHR_Overlay.Damage_Meter.players");
|
||||
quest_status = require("MHR_Overlay.Game_Handler.quest_status");
|
||||
error_handler = require("MHR_Overlay.Misc.error_handler");
|
||||
end
|
||||
|
||||
function this.init_module()
|
||||
|
||||
@@ -12,6 +12,7 @@ local ailments;
|
||||
local ailment_UI_entity;
|
||||
local ailment_buildup;
|
||||
local ailment_buildup_UI_entity;
|
||||
local error_handler;
|
||||
|
||||
local sdk = sdk;
|
||||
local tostring = tostring;
|
||||
@@ -98,16 +99,18 @@ local get_enemy_name_message_method = message_manager_type_def:get_method("getEn
|
||||
function this.init(monster, enemy)
|
||||
local enemy_type = enemy_type_field:get_data(enemy);
|
||||
if enemy_type == nil then
|
||||
customization_menu.status = "No enemy type";
|
||||
error_handler.report("small_monster.init", "Failed to Access Data: enemy_type");
|
||||
return;
|
||||
end
|
||||
|
||||
monster.id = enemy_type;
|
||||
|
||||
local enemy_name = get_enemy_name_message_method:call(singletons.message_manager, enemy_type);
|
||||
if enemy_name ~= nil then
|
||||
monster.name = enemy_name;
|
||||
if enemy_name == nil then
|
||||
error_handler.report("small_monster.init", "Failed to Access Data: enemy_name");
|
||||
end
|
||||
|
||||
monster.name = enemy_name;
|
||||
end
|
||||
|
||||
function this.init_UI(monster)
|
||||
@@ -175,9 +178,11 @@ function this.update_position(enemy, monster)
|
||||
end
|
||||
|
||||
local position = get_pos_field:call(enemy);
|
||||
if position ~= nil then
|
||||
monster.position = position;
|
||||
if position == nil then
|
||||
error_handler.report("small_monster.update_position", "Failed to Access Data: position");
|
||||
end
|
||||
|
||||
monster.position = position;
|
||||
end
|
||||
|
||||
function this.update(enemy, monster)
|
||||
@@ -188,6 +193,8 @@ function this.update(enemy, monster)
|
||||
local dead_or_captured = check_die_method:call(enemy);
|
||||
if dead_or_captured ~= nil then
|
||||
monster.dead_or_captured = dead_or_captured;
|
||||
else
|
||||
error_handler.report("small_monster.update", "Failed to Access Data: dead_or_captured");
|
||||
end
|
||||
|
||||
pcall(ailments.update_ailments, enemy, monster);
|
||||
@@ -200,23 +207,35 @@ function this.update_health(enemy, monster)
|
||||
|
||||
local physical_param = get_physical_param_method:call(enemy);
|
||||
if physical_param == nil then
|
||||
customization_menu.status = "No physical param";
|
||||
error_handler.report("small_monster.update_health", "Failed to Access Data: physical_param");
|
||||
return;
|
||||
end
|
||||
|
||||
local vital_param = get_vital_method:call(physical_param, 0, 0);
|
||||
if vital_param == nil then
|
||||
customization_menu.status = "No vital param";
|
||||
error_handler.report("small_monster.update_health", "Failed to Access Data: vital_param");
|
||||
return;
|
||||
end
|
||||
|
||||
monster.health = get_current_method:call(vital_param) or monster.health;
|
||||
monster.max_health = get_max_method:call(vital_param) or monster.max_health;
|
||||
local health = get_current_method:call(vital_param);
|
||||
if health ~= nil then
|
||||
monster.health = health;
|
||||
else
|
||||
error_handler.report("small_monster.update_health", "Failed to Access Data: health");
|
||||
return;
|
||||
end
|
||||
|
||||
monster.missing_health = monster.max_health - monster.health;
|
||||
if monster.max_health ~= 0 then
|
||||
monster.health_percentage = monster.health / monster.max_health;
|
||||
monster.capture_percentage = monster.capture_health / monster.max_health;
|
||||
local max_health = get_max_method:call(vital_param);
|
||||
if max_health ~= nil then
|
||||
monster.max_health = max_health;
|
||||
else
|
||||
error_handler.report("small_monster.update_health", "Failed to Access Data: max_health");
|
||||
return;
|
||||
end
|
||||
|
||||
monster.missing_health = max_health - health;
|
||||
if max_health ~= 0 then
|
||||
monster.health_percentage = health / max_health;
|
||||
end
|
||||
end
|
||||
|
||||
@@ -262,6 +281,7 @@ function this.init_dependencies()
|
||||
ailment_UI_entity = require("MHR_Overlay.UI.UI_Entities.ailment_UI_entity");
|
||||
ailment_buildup = require("MHR_Overlay.Monsters.ailment_buildup");
|
||||
ailment_buildup_UI_entity = require("MHR_Overlay.UI.UI_Entities.ailment_buildup_UI_entity");
|
||||
error_handler = require("MHR_Overlay.Misc.error_handler");
|
||||
end
|
||||
|
||||
function this.init_module()
|
||||
|
||||
Reference in New Issue
Block a user