mirror of
https://github.com/GreenComfyTea/MHR-Overlay.git
synced 2026-01-25 04:48:22 -08:00
Utilize this keyword everywhere
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
local ailment_buildup = {};
|
||||
local this = {};
|
||||
|
||||
local players;
|
||||
local language;
|
||||
@@ -42,7 +42,7 @@ local os = os;
|
||||
local ValueType = ValueType;
|
||||
local package = package;
|
||||
|
||||
function ailment_buildup.draw(monster, ailment_buildup_UI, cached_config, ailment_buildups_position_on_screen, opacity_scale)
|
||||
function this.draw(monster, ailment_buildup_UI, cached_config, ailment_buildups_position_on_screen, opacity_scale)
|
||||
|
||||
local cached_config = cached_config.ailment_buildups;
|
||||
local cached_damage_meter_UI_config = config.current_config.damage_meter_UI;
|
||||
@@ -231,7 +231,7 @@ function ailment_buildup.draw(monster, ailment_buildup_UI, cached_config, ailmen
|
||||
|
||||
end
|
||||
|
||||
function ailment_buildup.init_module()
|
||||
function this.init_module()
|
||||
players = require("MHR_Overlay.Damage_Meter.players");
|
||||
language = require("MHR_Overlay.Misc.language");
|
||||
config = require("MHR_Overlay.Misc.config");
|
||||
@@ -243,4 +243,4 @@ function ailment_buildup.init_module()
|
||||
drawing = require("MHR_Overlay.UI.drawing");
|
||||
end
|
||||
|
||||
return ailment_buildup;
|
||||
return this;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
local ailment_hook = {};
|
||||
local this = {};
|
||||
|
||||
local small_monster;
|
||||
local large_monster;
|
||||
@@ -60,7 +60,7 @@ local blast_param_type = blast_param_field:get_type();
|
||||
local blast_damage_method = blast_param_type:get_method("get_BlastDamage");
|
||||
local blast_adjust_rate_method = blast_param_type:get_method("get_BlastDamageAdjustRateByEnemyLv");
|
||||
|
||||
function ailment_hook.poison_proc(poison_param)
|
||||
function this.poison_proc(poison_param)
|
||||
if poison_param == nil then
|
||||
return;
|
||||
end
|
||||
@@ -88,7 +88,7 @@ function ailment_hook.poison_proc(poison_param)
|
||||
ailments.clear_ailment_contribution(monster, ailments.poison_id);
|
||||
end
|
||||
|
||||
function ailment_hook.blast_proc(blast_param)
|
||||
function this.blast_proc(blast_param)
|
||||
if blast_param == nil then
|
||||
return;
|
||||
end
|
||||
@@ -118,7 +118,7 @@ function ailment_hook.blast_proc(blast_param)
|
||||
ailments.clear_ailment_contribution(monster, ailments.blast_id);
|
||||
end
|
||||
|
||||
function ailment_hook.stock_damage()
|
||||
function this.stock_damage()
|
||||
for enemy, monster in pairs(large_monster.list) do
|
||||
local damage_param = damage_param_field:get_data(enemy);
|
||||
if damage_param == nil then
|
||||
@@ -144,29 +144,29 @@ function ailment_hook.stock_damage()
|
||||
end
|
||||
end
|
||||
|
||||
function ailment_hook.init_module()
|
||||
function this.init_module()
|
||||
small_monster = require("MHR_Overlay.Monsters.small_monster");
|
||||
large_monster = require("MHR_Overlay.Monsters.large_monster");
|
||||
config = require("MHR_Overlay.Misc.config");
|
||||
ailments = require("MHR_Overlay.Monsters.ailments");
|
||||
|
||||
sdk.hook(stock_damage_method, function(args)
|
||||
pcall(ailment_hook.stock_damage, sdk.to_managed_object(args[2]));
|
||||
pcall(this.stock_damage, sdk.to_managed_object(args[2]));
|
||||
end, function(retval)
|
||||
return retval;
|
||||
end);
|
||||
|
||||
sdk.hook(on_poison_activate_proc_method, function(args)
|
||||
pcall(ailment_hook.poison_proc, sdk.to_managed_object(args[2]));
|
||||
pcall(this.poison_proc, sdk.to_managed_object(args[2]));
|
||||
end, function(retval)
|
||||
return retval;
|
||||
end);
|
||||
|
||||
sdk.hook(on_blast_activate_proc_method, function(args)
|
||||
pcall(ailment_hook.blast_proc, sdk.to_managed_object(args[2]));
|
||||
pcall(this.blast_proc, sdk.to_managed_object(args[2]));
|
||||
end, function(retval)
|
||||
return retval;
|
||||
end);
|
||||
end
|
||||
|
||||
return ailment_hook;
|
||||
return this;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
local ailments = {};
|
||||
local this = {};
|
||||
|
||||
local players;
|
||||
local language;
|
||||
@@ -60,29 +60,29 @@ local package = package;
|
||||
--15 Koyashi
|
||||
--16 SteelFang
|
||||
|
||||
ailments.paralyze_id = 0;
|
||||
ailments.sleep_id = 1;
|
||||
ailments.stun_id = 2;
|
||||
ailments.flash_id = 3;
|
||||
ailments.poison_id = 4;
|
||||
ailments.blast_id = 5;
|
||||
ailments.exhaust_id = 6;
|
||||
ailments.ride_id = 7;
|
||||
ailments.water_id = 8;
|
||||
ailments.fire_id = 9;
|
||||
ailments.ice_id = 10;
|
||||
ailments.thunder_id = 11;
|
||||
ailments.fall_trap_id = 12;
|
||||
ailments.shock_trap_id = 13;
|
||||
ailments.capture_id = 14 --tranq bomb
|
||||
ailments.koyashi_id = 15; --dung bomb
|
||||
ailments.steel_fang_id = 16;
|
||||
this.paralyze_id = 0;
|
||||
this.sleep_id = 1;
|
||||
this.stun_id = 2;
|
||||
this.flash_id = 3;
|
||||
this.poison_id = 4;
|
||||
this.blast_id = 5;
|
||||
this.exhaust_id = 6;
|
||||
this.ride_id = 7;
|
||||
this.water_id = 8;
|
||||
this.fire_id = 9;
|
||||
this.ice_id = 10;
|
||||
this.thunder_id = 11;
|
||||
this.fall_trap_id = 12;
|
||||
this.shock_trap_id = 13;
|
||||
this.capture_id = 14 --tranq bomb
|
||||
this.koyashi_id = 15; --dung bomb
|
||||
this.steel_fang_id = 16;
|
||||
|
||||
ailments.fall_quick_sand_id = 17;
|
||||
ailments.fall_otomo_trap_id = 18;
|
||||
ailments.shock_otomo_trap_id = 19;
|
||||
this.fall_quick_sand_id = 17;
|
||||
this.fall_otomo_trap_id = 18;
|
||||
this.shock_otomo_trap_id = 19;
|
||||
|
||||
function ailments.new(_ailments, ailment_id)
|
||||
function this.new(_ailments, ailment_id)
|
||||
local new_ailment = {}
|
||||
new_ailment = {};
|
||||
|
||||
@@ -105,140 +105,140 @@ function ailments.new(_ailments, ailment_id)
|
||||
|
||||
new_ailment.last_change_time = time.total_elapsed_script_seconds;
|
||||
|
||||
if ailment_id == ailments.paralyze_id then
|
||||
if ailment_id == this.paralyze_id then
|
||||
new_ailment.name = language.current_language.ailments.paralysis;
|
||||
elseif ailment_id == ailments.sleep_id then
|
||||
elseif ailment_id == this.sleep_id then
|
||||
new_ailment.name = language.current_language.ailments.sleep;
|
||||
elseif ailment_id == ailments.stun_id then
|
||||
elseif ailment_id == this.stun_id then
|
||||
new_ailment.name = language.current_language.ailments.stun;
|
||||
elseif ailment_id == ailments.flash_id then
|
||||
elseif ailment_id == this.flash_id then
|
||||
new_ailment.name = language.current_language.ailments.flash;
|
||||
elseif ailment_id == ailments.poison_id then
|
||||
elseif ailment_id == this.poison_id then
|
||||
new_ailment.name = language.current_language.ailments.poison;
|
||||
elseif ailment_id == ailments.blast_id then
|
||||
elseif ailment_id == this.blast_id then
|
||||
new_ailment.name = language.current_language.ailments.blast;
|
||||
elseif ailment_id == ailments.exhaust_id then
|
||||
elseif ailment_id == this.exhaust_id then
|
||||
new_ailment.name = language.current_language.ailments.exhaust;
|
||||
elseif ailment_id == ailments.ride_id then
|
||||
elseif ailment_id == this.ride_id then
|
||||
new_ailment.name = language.current_language.ailments.ride;
|
||||
elseif ailment_id == ailments.water_id then
|
||||
elseif ailment_id == this.water_id then
|
||||
new_ailment.name = language.current_language.ailments.waterblight;
|
||||
elseif ailment_id == ailments.fire_id then
|
||||
elseif ailment_id == this.fire_id then
|
||||
new_ailment.name = language.current_language.ailments.fireblight;
|
||||
elseif ailment_id == ailments.ice_id then
|
||||
elseif ailment_id == this.ice_id then
|
||||
new_ailment.name = language.current_language.ailments.iceblight;
|
||||
elseif ailment_id == ailments.thunder_id then
|
||||
elseif ailment_id == this.thunder_id then
|
||||
new_ailment.name = language.current_language.ailments.thunderblight;
|
||||
elseif ailment_id == ailments.fall_trap_id then
|
||||
elseif ailment_id == this.fall_trap_id then
|
||||
new_ailment.name = language.current_language.ailments.fall_trap;
|
||||
elseif ailment_id == ailments.shock_trap_id then
|
||||
elseif ailment_id == this.shock_trap_id then
|
||||
new_ailment.name = language.current_language.ailments.shock_trap;
|
||||
elseif ailment_id == ailments.capture_id then
|
||||
elseif ailment_id == this.capture_id then
|
||||
new_ailment.name = language.current_language.ailments.tranq_bomb;
|
||||
elseif ailment_id == ailments.koyashi_id then
|
||||
elseif ailment_id == this.koyashi_id then
|
||||
new_ailment.name = language.current_language.ailments.dung_bomb;
|
||||
elseif ailment_id == ailments.steel_fang_id then
|
||||
elseif ailment_id == this.steel_fang_id then
|
||||
new_ailment.name = language.current_language.ailments.steel_fang;
|
||||
elseif ailment_id == ailments.fall_quick_sand_id then
|
||||
elseif ailment_id == this.fall_quick_sand_id then
|
||||
new_ailment.name = language.current_language.ailments.quick_sand;
|
||||
elseif ailment_id == ailments.fall_otomo_trap_id then
|
||||
elseif ailment_id == this.fall_otomo_trap_id then
|
||||
new_ailment.name = language.current_language.ailments.fall_otomo_trap;
|
||||
elseif ailment_id == ailments.shock_otomo_trap_id then
|
||||
elseif ailment_id == this.shock_otomo_trap_id then
|
||||
new_ailment.name = language.current_language.ailments.shock_otomo_trap;
|
||||
end
|
||||
|
||||
_ailments[ailment_id] = new_ailment;
|
||||
end
|
||||
|
||||
function ailments.init_ailments()
|
||||
function this.init_ailments()
|
||||
local _ailments = {};
|
||||
|
||||
ailments.new(_ailments, ailments.paralyze_id);
|
||||
ailments.new(_ailments, ailments.sleep_id);
|
||||
ailments.new(_ailments, ailments.stun_id);
|
||||
ailments.new(_ailments, ailments.flash_id);
|
||||
ailments.new(_ailments, ailments.poison_id);
|
||||
ailments.new(_ailments, ailments.blast_id);
|
||||
ailments.new(_ailments, ailments.exhaust_id);
|
||||
ailments.new(_ailments, ailments.ride_id);
|
||||
ailments.new(_ailments, ailments.water_id);
|
||||
ailments.new(_ailments, ailments.fire_id);
|
||||
ailments.new(_ailments, ailments.ice_id);
|
||||
ailments.new(_ailments, ailments.thunder_id);
|
||||
this.new(_ailments, this.paralyze_id);
|
||||
this.new(_ailments, this.sleep_id);
|
||||
this.new(_ailments, this.stun_id);
|
||||
this.new(_ailments, this.flash_id);
|
||||
this.new(_ailments, this.poison_id);
|
||||
this.new(_ailments, this.blast_id);
|
||||
this.new(_ailments, this.exhaust_id);
|
||||
this.new(_ailments, this.ride_id);
|
||||
this.new(_ailments, this.water_id);
|
||||
this.new(_ailments, this.fire_id);
|
||||
this.new(_ailments, this.ice_id);
|
||||
this.new(_ailments, this.thunder_id);
|
||||
|
||||
ailments.new(_ailments, ailments.fall_trap_id);
|
||||
ailments.new(_ailments, ailments.shock_trap_id);
|
||||
ailments.new(_ailments, ailments.capture_id); --tranq bomb
|
||||
ailments.new(_ailments, ailments.koyashi_id); --dung bomb
|
||||
ailments.new(_ailments, ailments.steel_fang_id);
|
||||
this.new(_ailments, this.fall_trap_id);
|
||||
this.new(_ailments, this.shock_trap_id);
|
||||
this.new(_ailments, this.capture_id); --tranq bomb
|
||||
this.new(_ailments, this.koyashi_id); --dung bomb
|
||||
this.new(_ailments, this.steel_fang_id);
|
||||
--ailments.new(_ailments, ailments.fall_quick_sand_id);
|
||||
--ailments.new(_ailments, ailments.fall_otomo_trap_id);
|
||||
--ailments.new(_ailments, ailments.shock_otomo_trap_id);
|
||||
|
||||
_ailments[ailments.poison_id].buildup = {};
|
||||
_ailments[ailments.poison_id].buildup_share = {};
|
||||
_ailments[ailments.poison_id].cached_buildup_share = {};
|
||||
_ailments[this.poison_id].buildup = {};
|
||||
_ailments[this.poison_id].buildup_share = {};
|
||||
_ailments[this.poison_id].cached_buildup_share = {};
|
||||
|
||||
_ailments[ailments.blast_id].buildup = {};
|
||||
_ailments[ailments.blast_id].buildup_share = {};
|
||||
_ailments[this.blast_id].buildup = {};
|
||||
_ailments[this.blast_id].buildup_share = {};
|
||||
|
||||
_ailments[ailments.stun_id].buildup = {};
|
||||
_ailments[ailments.stun_id].buildup_share = {};
|
||||
_ailments[this.stun_id].buildup = {};
|
||||
_ailments[this.stun_id].buildup_share = {};
|
||||
|
||||
_ailments[ailments.poison_id].otomo_buildup = {};
|
||||
_ailments[ailments.poison_id].otomo_buildup_share = {};
|
||||
_ailments[ailments.poison_id].cached_otomo_buildup_share = {};
|
||||
_ailments[this.poison_id].otomo_buildup = {};
|
||||
_ailments[this.poison_id].otomo_buildup_share = {};
|
||||
_ailments[this.poison_id].cached_otomo_buildup_share = {};
|
||||
|
||||
_ailments[ailments.blast_id].otomo_buildup = {};
|
||||
_ailments[ailments.blast_id].otomo_buildup_share = {};
|
||||
_ailments[this.blast_id].otomo_buildup = {};
|
||||
_ailments[this.blast_id].otomo_buildup_share = {};
|
||||
|
||||
_ailments[ailments.stun_id].otomo_buildup = {};
|
||||
_ailments[ailments.stun_id].otomo_buildup_share = {};
|
||||
_ailments[this.stun_id].otomo_buildup = {};
|
||||
_ailments[this.stun_id].otomo_buildup_share = {};
|
||||
|
||||
return _ailments;
|
||||
end
|
||||
|
||||
function ailments.init_ailment_names(_ailments)
|
||||
function this.init_ailment_names(_ailments)
|
||||
for ailment_id, ailment in pairs(_ailments) do
|
||||
if ailment_id == ailments.paralyze_id then
|
||||
if ailment_id == this.paralyze_id then
|
||||
ailment.name = language.current_language.ailments.paralysis;
|
||||
elseif ailment_id == ailments.sleep_id then
|
||||
elseif ailment_id == this.sleep_id then
|
||||
ailment.name = language.current_language.ailments.sleep;
|
||||
elseif ailment_id == ailments.stun_id then
|
||||
elseif ailment_id == this.stun_id then
|
||||
ailment.name = language.current_language.ailments.stun;
|
||||
elseif ailment_id == ailments.flash_id then
|
||||
elseif ailment_id == this.flash_id then
|
||||
ailment.name = language.current_language.ailments.flash;
|
||||
elseif ailment_id == ailments.poison_id then
|
||||
elseif ailment_id == this.poison_id then
|
||||
ailment.name = language.current_language.ailments.poison;
|
||||
elseif ailment_id == ailments.blast_id then
|
||||
elseif ailment_id == this.blast_id then
|
||||
ailment.name = language.current_language.ailments.blast;
|
||||
elseif ailment_id == ailments.exhaust_id then
|
||||
elseif ailment_id == this.exhaust_id then
|
||||
ailment.name = language.current_language.ailments.exhaust;
|
||||
elseif ailment_id == ailments.ride_id then
|
||||
elseif ailment_id == this.ride_id then
|
||||
ailment.name = language.current_language.ailments.ride;
|
||||
elseif ailment_id == ailments.water_id then
|
||||
elseif ailment_id == this.water_id then
|
||||
ailment.name = language.current_language.ailments.waterblight;
|
||||
elseif ailment_id == ailments.fire_id then
|
||||
elseif ailment_id == this.fire_id then
|
||||
ailment.name = language.current_language.ailments.fireblight;
|
||||
elseif ailment_id == ailments.ice_id then
|
||||
elseif ailment_id == this.ice_id then
|
||||
ailment.name = language.current_language.ailments.iceblight;
|
||||
elseif ailment_id == ailments.thunder_id then
|
||||
elseif ailment_id == this.thunder_id then
|
||||
ailment.name = language.current_language.ailments.thunderblight;
|
||||
elseif ailment_id == ailments.fall_trap_id then
|
||||
elseif ailment_id == this.fall_trap_id then
|
||||
ailment.name = language.current_language.ailments.fall_trap;
|
||||
elseif ailment_id == ailments.shock_trap_id then
|
||||
elseif ailment_id == this.shock_trap_id then
|
||||
ailment.name = language.current_language.ailments.shock_trap;
|
||||
elseif ailment_id == ailments.capture_id then
|
||||
elseif ailment_id == this.capture_id then
|
||||
ailment.name = language.current_language.ailments.tranq_bomb;
|
||||
elseif ailment_id == ailments.koyashi_id then
|
||||
elseif ailment_id == this.koyashi_id then
|
||||
ailment.name = language.current_language.ailments.dung_bomb;
|
||||
elseif ailment_id == ailments.steel_fang_id then
|
||||
elseif ailment_id == this.steel_fang_id then
|
||||
ailment.name = language.current_language.ailments.steel_fang;
|
||||
elseif ailment_id == ailments.fall_quick_sand_id then
|
||||
elseif ailment_id == this.fall_quick_sand_id then
|
||||
ailment.name = language.current_language.ailments.quick_sand;
|
||||
elseif ailment_id == ailments.fall_otomo_trap_id then
|
||||
elseif ailment_id == this.fall_otomo_trap_id then
|
||||
ailment.name = language.current_language.ailments.fall_otomo_trap;
|
||||
elseif ailment_id == ailments.shock_otomo_trap_id then
|
||||
elseif ailment_id == this.shock_otomo_trap_id then
|
||||
ailment.name = language.current_language.ailments.shock_otomo_trap;
|
||||
end
|
||||
end
|
||||
@@ -274,7 +274,7 @@ 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 ailments.update_ailments(enemy, monster)
|
||||
function this.update_ailments(enemy, monster)
|
||||
if enemy == nil then
|
||||
return;
|
||||
end
|
||||
@@ -283,7 +283,7 @@ function ailments.update_ailments(enemy, monster)
|
||||
return;
|
||||
end
|
||||
|
||||
ailments.update_stun_poison_blast_ailments(monster, damage_param);
|
||||
this.update_stun_poison_blast_ailments(monster, damage_param);
|
||||
|
||||
if not config.current_config.large_monster_UI.dynamic.ailments.visibility
|
||||
and not config.current_config.large_monster_UI.static.ailments.visibility
|
||||
@@ -307,7 +307,7 @@ function ailments.update_ailments(enemy, monster)
|
||||
end
|
||||
|
||||
for id = 0, condition_param_array_length - 1 do
|
||||
if id == ailments.stun_id or id == ailments.poison_id or id == ailments.blast_id then
|
||||
if id == this.stun_id or id == this.poison_id or id == this.blast_id then
|
||||
goto continue
|
||||
end
|
||||
|
||||
@@ -316,29 +316,29 @@ function ailments.update_ailments(enemy, monster)
|
||||
goto continue
|
||||
end
|
||||
|
||||
ailments.update_ailment(monster, ailment_param, id);
|
||||
this.update_ailment(monster, ailment_param, id);
|
||||
::continue::
|
||||
end
|
||||
end
|
||||
|
||||
function ailments.update_stun_poison_blast_ailments(monster, damage_param)
|
||||
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
|
||||
ailments.update_ailment(monster, stun_param, ailments.stun_id);
|
||||
this.update_ailment(monster, stun_param, this.stun_id);
|
||||
end
|
||||
|
||||
local poison_param = poison_param_field:get_data(damage_param);
|
||||
if poison_param ~= nil then
|
||||
ailments.update_ailment(monster, poison_param, ailments.poison_id);
|
||||
this.update_ailment(monster, poison_param, this.poison_id);
|
||||
end
|
||||
|
||||
local blast_param = blast_param_field:get_data(damage_param);
|
||||
if blast_param ~= nil then
|
||||
ailments.update_ailment(monster, blast_param, ailments.blast_id);
|
||||
this.update_ailment(monster, blast_param, this.blast_id);
|
||||
end
|
||||
end
|
||||
|
||||
function ailments.update_ailment(monster, ailment_param, id)
|
||||
function this.update_ailment(monster, ailment_param, id)
|
||||
local is_enable = get_is_enable_method:call(ailment_param);
|
||||
local activate_count_array = get_activate_count_method:call(ailment_param);
|
||||
local buildup_array = get_stock_method:call(ailment_param);
|
||||
@@ -413,17 +413,17 @@ function ailments.update_ailment(monster, ailment_param, id)
|
||||
end
|
||||
|
||||
if is_enable ~= monster.ailments[id].is_enable then
|
||||
ailments.update_last_change_time(monster, id);
|
||||
this.update_last_change_time(monster, id);
|
||||
end
|
||||
|
||||
monster.ailments[id].is_enable = is_enable;
|
||||
|
||||
if activate_count ~= nil then
|
||||
if activate_count ~= monster.ailments[id].activate_count then
|
||||
ailments.update_last_change_time(monster, id);
|
||||
this.update_last_change_time(monster, id);
|
||||
|
||||
if id == ailments.stun_id then
|
||||
ailments.clear_ailment_contribution(monster, ailments.stun_id);
|
||||
if id == this.stun_id then
|
||||
this.clear_ailment_contribution(monster, this.stun_id);
|
||||
end
|
||||
end
|
||||
|
||||
@@ -432,7 +432,7 @@ function ailments.update_ailment(monster, ailment_param, id)
|
||||
|
||||
if buildup ~= nil then
|
||||
if buildup ~= monster.ailments[id].total_buildup then
|
||||
ailments.update_last_change_time(monster, id);
|
||||
this.update_last_change_time(monster, id);
|
||||
end
|
||||
|
||||
monster.ailments[id].total_buildup = buildup;
|
||||
@@ -440,7 +440,7 @@ function ailments.update_ailment(monster, ailment_param, id)
|
||||
|
||||
if buildup_limit ~= nil then
|
||||
if buildup_limit ~= monster.ailments[id].buildup_limit then
|
||||
ailments.update_last_change_time(monster, id);
|
||||
this.update_last_change_time(monster, id);
|
||||
end
|
||||
|
||||
monster.ailments[id].buildup_limit = buildup_limit;
|
||||
@@ -452,7 +452,7 @@ function ailments.update_ailment(monster, ailment_param, id)
|
||||
|
||||
if timer ~= nil then
|
||||
if timer ~= monster.ailments[id].timer then
|
||||
ailments.update_last_change_time(monster, id);
|
||||
this.update_last_change_time(monster, id);
|
||||
end
|
||||
|
||||
monster.ailments[id].timer = timer;
|
||||
@@ -460,7 +460,7 @@ function ailments.update_ailment(monster, ailment_param, id)
|
||||
|
||||
if is_active ~= nil then
|
||||
if is_active ~= monster.ailments[id].is_active then
|
||||
ailments.update_last_change_time(monster, id);
|
||||
this.update_last_change_time(monster, id);
|
||||
end
|
||||
|
||||
monster.ailments[id].is_active = is_active;
|
||||
@@ -468,7 +468,7 @@ function ailments.update_ailment(monster, ailment_param, id)
|
||||
|
||||
if duration ~= nil and not monster.ailments[id].is_active then
|
||||
if duration ~= monster.ailments[id].duration then
|
||||
ailments.update_last_change_time(monster, id);
|
||||
this.update_last_change_time(monster, id);
|
||||
end
|
||||
|
||||
monster.ailments[id].duration = duration;
|
||||
@@ -495,12 +495,12 @@ function ailments.update_ailment(monster, ailment_param, id)
|
||||
end
|
||||
end
|
||||
|
||||
function ailments.update_last_change_time(monster, id)
|
||||
function this.update_last_change_time(monster, id)
|
||||
monster.ailments[id].last_change_time = time.total_elapsed_script_seconds;
|
||||
end
|
||||
|
||||
-- Code by coavins
|
||||
function ailments.update_poison(monster, poison_param)
|
||||
function this.update_poison(monster, poison_param)
|
||||
if monster == nil then
|
||||
return;
|
||||
end
|
||||
@@ -511,95 +511,95 @@ function ailments.update_poison(monster, poison_param)
|
||||
if is_damage then
|
||||
local poison_damage = poison_damage_field:get_data(poison_param);
|
||||
|
||||
ailments.apply_ailment_damage(monster, ailments.poison_id, poison_damage);
|
||||
this.apply_ailment_damage(monster, this.poison_id, poison_damage);
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function ailments.draw(monster, ailment_UI, cached_config, ailments_position_on_screen, opacity_scale)
|
||||
function this.draw(monster, ailment_UI, cached_config, ailments_position_on_screen, opacity_scale)
|
||||
local cached_config = cached_config.ailments;
|
||||
local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
|
||||
|
||||
--sort parts here
|
||||
local displayed_ailments = {};
|
||||
for id, ailment in pairs(monster.ailments) do
|
||||
if id == ailments.paralyze_id then
|
||||
if id == this.paralyze_id then
|
||||
if not cached_config.filter.paralysis then
|
||||
goto continue
|
||||
end
|
||||
elseif id == ailments.sleep_id then
|
||||
elseif id == this.sleep_id then
|
||||
if not cached_config.filter.sleep then
|
||||
goto continue
|
||||
end
|
||||
elseif id == ailments.stun_id then
|
||||
elseif id == this.stun_id then
|
||||
if not cached_config.filter.stun then
|
||||
goto continue
|
||||
end
|
||||
elseif id == ailments.flash_id then
|
||||
elseif id == this.flash_id then
|
||||
if not cached_config.filter.flash then
|
||||
goto continue
|
||||
end
|
||||
elseif id == ailments.poison_id then
|
||||
elseif id == this.poison_id then
|
||||
if not cached_config.filter.poison then
|
||||
goto continue
|
||||
end
|
||||
elseif id == ailments.blast_id then
|
||||
elseif id == this.blast_id then
|
||||
if not cached_config.filter.blast then
|
||||
goto continue
|
||||
end
|
||||
elseif id == ailments.exhaust_id then
|
||||
elseif id == this.exhaust_id then
|
||||
if not cached_config.filter.exhaust then
|
||||
goto continue
|
||||
end
|
||||
elseif id == ailments.ride_id then
|
||||
elseif id == this.ride_id then
|
||||
if not cached_config.filter.ride then
|
||||
goto continue
|
||||
end
|
||||
elseif id == ailments.water_id then
|
||||
elseif id == this.water_id then
|
||||
if not cached_config.filter.waterblight then
|
||||
goto continue
|
||||
end
|
||||
elseif id == ailments.fire_id then
|
||||
elseif id == this.fire_id then
|
||||
if not cached_config.filter.fireblight then
|
||||
goto continue
|
||||
end
|
||||
elseif id == ailments.ice_id then
|
||||
elseif id == this.ice_id then
|
||||
if not cached_config.filter.iceblight then
|
||||
goto continue
|
||||
end
|
||||
elseif id == ailments.thunder_id then
|
||||
elseif id == this.thunder_id then
|
||||
if not cached_config.filter.thunderblight then
|
||||
goto continue
|
||||
end
|
||||
elseif id == ailments.fall_trap_id then
|
||||
elseif id == this.fall_trap_id then
|
||||
if not cached_config.filter.fall_trap then
|
||||
goto continue
|
||||
end
|
||||
elseif id == ailments.shock_trap_id then
|
||||
elseif id == this.shock_trap_id then
|
||||
if not cached_config.filter.shock_trap then
|
||||
goto continue
|
||||
end
|
||||
elseif id == ailments.capture_id then
|
||||
elseif id == this.capture_id then
|
||||
if not cached_config.filter.tranq_bomb then
|
||||
goto continue
|
||||
end
|
||||
elseif id == ailments.koyashi_id then
|
||||
elseif id == this.koyashi_id then
|
||||
if not cached_config.filter.dung_bomb then
|
||||
goto continue
|
||||
end
|
||||
elseif id == ailments.steel_fang_id then
|
||||
elseif id == this.steel_fang_id then
|
||||
if not cached_config.filter.steel_fang then
|
||||
goto continue
|
||||
end
|
||||
elseif id == ailments.fall_quick_sand_id then
|
||||
elseif id == this.fall_quick_sand_id then
|
||||
if not cached_config.filter.quick_sand then
|
||||
goto continue
|
||||
end
|
||||
elseif id == ailments.fall_otomo_trap_id then
|
||||
elseif id == this.fall_otomo_trap_id then
|
||||
if not cached_config.filter.fall_otomo_trap then
|
||||
goto continue
|
||||
end
|
||||
elseif id == ailments.shock_otomo_trap_id then
|
||||
elseif id == this.shock_otomo_trap_id then
|
||||
if not cached_config.filter.shock_otomo_trap then
|
||||
goto continue
|
||||
end
|
||||
@@ -685,9 +685,9 @@ function ailments.draw(monster, ailment_UI, cached_config, ailments_position_on_
|
||||
|
||||
end
|
||||
|
||||
function ailments.apply_ailment_buildup(monster, player, otomo, ailment_type, ailment_buildup)
|
||||
function this.apply_ailment_buildup(monster, player, otomo, ailment_type, ailment_buildup)
|
||||
if monster == nil or
|
||||
(ailment_type ~= ailments.poison_id and ailment_type ~= ailments.blast_id and ailment_type ~= ailments.stun_id)
|
||||
(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
|
||||
return;
|
||||
end
|
||||
@@ -709,11 +709,11 @@ function ailments.apply_ailment_buildup(monster, player, otomo, ailment_type, ai
|
||||
end
|
||||
|
||||
|
||||
ailments.calculate_ailment_contribution(monster, ailment_type);
|
||||
this.calculate_ailment_contribution(monster, ailment_type);
|
||||
end
|
||||
|
||||
-- Code by coavins
|
||||
function ailments.calculate_ailment_contribution(monster, ailment_type)
|
||||
function this.calculate_ailment_contribution(monster, ailment_type)
|
||||
-- get total
|
||||
local total = 0;
|
||||
for player, player_buildup in pairs(monster.ailments[ailment_type].buildup) do
|
||||
@@ -739,7 +739,7 @@ function ailments.calculate_ailment_contribution(monster, ailment_type)
|
||||
end
|
||||
end
|
||||
|
||||
function ailments.clear_ailment_contribution(monster, ailment_type)
|
||||
function this.clear_ailment_contribution(monster, ailment_type)
|
||||
monster.ailments[ailment_type].buildup = {};
|
||||
monster.ailments[ailment_type].otomo_buildup = {};
|
||||
|
||||
@@ -748,7 +748,7 @@ function ailments.clear_ailment_contribution(monster, ailment_type)
|
||||
end
|
||||
|
||||
-- Code by coavins
|
||||
function ailments.apply_ailment_damage(monster, ailment_type, ailment_damage)
|
||||
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
|
||||
return;
|
||||
@@ -759,13 +759,13 @@ function ailments.apply_ailment_damage(monster, ailment_type, ailment_damage)
|
||||
local buildup_share = monster.ailments[ailment_type].buildup_share;
|
||||
local otomo_buildup_share = monster.ailments[ailment_type].otomo_buildup_share;
|
||||
|
||||
if ailment_type == ailments.poison_id then
|
||||
if ailment_type == this.poison_id then
|
||||
damage_source_type = "poison";
|
||||
otomo_damage_source_type = "otomo poison";
|
||||
buildup_share = monster.ailments[ailment_type].cached_buildup_share;
|
||||
otomo_buildup_share = monster.ailments[ailment_type].cached_otomo_buildup_share;
|
||||
|
||||
elseif ailment_type == ailments.blast_id then
|
||||
elseif ailment_type == this.blast_id then
|
||||
damage_source_type = "blast";
|
||||
otomo_damage_source_type = "otomo blast";
|
||||
else
|
||||
@@ -813,7 +813,7 @@ function ailments.apply_ailment_damage(monster, ailment_type, ailment_damage)
|
||||
players.update_damage(players.total, damage_source_type, monster.is_large, damage_object);
|
||||
end
|
||||
|
||||
function ailments.init_module()
|
||||
function this.init_module()
|
||||
players = require("MHR_Overlay.Damage_Meter.players");
|
||||
non_players = require("MHR_Overlay.Damage_Meter.non_players");
|
||||
language = require("MHR_Overlay.Misc.language");
|
||||
@@ -825,4 +825,4 @@ function ailments.init_module()
|
||||
large_monster = require("MHR_Overlay.Monsters.large_monster");
|
||||
end
|
||||
|
||||
return ailments;
|
||||
return this;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
local body_part = {};
|
||||
local this = {};
|
||||
|
||||
local singletons;
|
||||
local customization_menu;
|
||||
@@ -44,9 +44,9 @@ local os = os;
|
||||
local ValueType = ValueType;
|
||||
local package = package;
|
||||
|
||||
body_part.list = {};
|
||||
this.list = {};
|
||||
|
||||
function body_part.new(id, name)
|
||||
function this.new(id, name)
|
||||
local part = {};
|
||||
|
||||
part.id = id;
|
||||
@@ -73,7 +73,7 @@ function body_part.new(id, name)
|
||||
return part;
|
||||
end
|
||||
|
||||
function body_part.update_flinch(part, part_current, part_max)
|
||||
function this.update_flinch(part, part_current, part_max)
|
||||
if part_current > part.health then
|
||||
part.flinch_count = part.flinch_count + 1;
|
||||
end
|
||||
@@ -94,7 +94,7 @@ function body_part.update_flinch(part, part_current, part_max)
|
||||
end
|
||||
end
|
||||
|
||||
function body_part.update_break(part, part_break_current, part_break_max, part_break_count, part_break_max_count)
|
||||
function this.update_break(part, part_break_current, part_break_max, part_break_count, part_break_max_count)
|
||||
|
||||
if part.break_health ~= part_break_current then
|
||||
part.last_change_time = time.total_elapsed_script_seconds;
|
||||
@@ -123,7 +123,7 @@ function body_part.update_break(part, part_break_current, part_break_max, part_b
|
||||
end
|
||||
end
|
||||
|
||||
function body_part.update_loss(part, part_loss_current, part_loss_max, is_severed)
|
||||
function this.update_loss(part, part_loss_current, part_loss_max, is_severed)
|
||||
if part.loss_health ~= part_loss_current then
|
||||
part.last_change_time = time.total_elapsed_script_seconds;
|
||||
end
|
||||
@@ -147,7 +147,7 @@ function body_part.update_loss(part, part_loss_current, part_loss_max, is_severe
|
||||
|
||||
end
|
||||
|
||||
function body_part.draw(monster, part_UI, cached_config, parts_position_on_screen, opacity_scale)
|
||||
function this.draw(monster, part_UI, cached_config, parts_position_on_screen, opacity_scale)
|
||||
local cached_config = cached_config.body_parts;
|
||||
local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
|
||||
|
||||
@@ -340,7 +340,7 @@ function body_part.draw(monster, part_UI, cached_config, parts_position_on_scree
|
||||
return last_part_position_on_screen;
|
||||
end
|
||||
|
||||
function body_part.init_module()
|
||||
function this.init_module()
|
||||
singletons = require("MHR_Overlay.Game_Handler.singletons");
|
||||
customization_menu = require("MHR_Overlay.UI.customization_menu");
|
||||
config = require("MHR_Overlay.Misc.config");
|
||||
@@ -354,4 +354,4 @@ function body_part.init_module()
|
||||
time = require("MHR_Overlay.Game_Handler.time");
|
||||
end
|
||||
|
||||
return body_part;
|
||||
return this;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
local large_monster = {};
|
||||
local this = {};
|
||||
|
||||
local singletons;
|
||||
local customization_menu;
|
||||
@@ -52,9 +52,9 @@ local os = os;
|
||||
local ValueType = ValueType;
|
||||
local package = package;
|
||||
|
||||
large_monster.list = {};
|
||||
this.list = {};
|
||||
|
||||
function large_monster.new(enemy)
|
||||
function this.new(enemy)
|
||||
local monster = {};
|
||||
monster.enemy = enemy;
|
||||
monster.is_large = true;
|
||||
@@ -124,35 +124,35 @@ function large_monster.new(enemy)
|
||||
monster.static_UI = {};
|
||||
monster.highlighted_UI = {};
|
||||
|
||||
large_monster.init(monster, enemy);
|
||||
large_monster.init_UI(monster, monster.dynamic_UI, config.current_config.large_monster_UI.dynamic);
|
||||
large_monster.init_UI(monster, monster.static_UI, config.current_config.large_monster_UI.static);
|
||||
large_monster.init_UI(monster, monster.highlighted_UI, config.current_config.large_monster_UI.highlighted);
|
||||
this.init(monster, enemy);
|
||||
this.init_UI(monster, monster.dynamic_UI, config.current_config.large_monster_UI.dynamic);
|
||||
this.init_UI(monster, monster.static_UI, config.current_config.large_monster_UI.static);
|
||||
this.init_UI(monster, monster.highlighted_UI, config.current_config.large_monster_UI.highlighted);
|
||||
|
||||
large_monster.update_position(enemy, monster);
|
||||
this.update_position(enemy, monster);
|
||||
|
||||
local physical_param = large_monster.update_health(enemy, monster);
|
||||
local physical_param = this.update_health(enemy, monster);
|
||||
|
||||
large_monster.update_stamina(enemy, monster, nil);
|
||||
large_monster.update_stamina_timer(enemy, monster, nil);
|
||||
this.update_stamina(enemy, monster, nil);
|
||||
this.update_stamina_timer(enemy, monster, nil);
|
||||
|
||||
large_monster.update_rage(enemy, monster, nil);
|
||||
large_monster.update_rage_timer(enemy, monster, nil);
|
||||
this.update_rage(enemy, monster, nil);
|
||||
this.update_rage_timer(enemy, monster, nil);
|
||||
|
||||
large_monster.update(enemy, monster);
|
||||
pcall(large_monster.update_parts, enemy, monster, physical_param);
|
||||
this.update(enemy, monster);
|
||||
pcall(this.update_parts, enemy, monster, physical_param);
|
||||
|
||||
if large_monster.list[enemy] == nil then
|
||||
large_monster.list[enemy] = monster;
|
||||
if this.list[enemy] == nil then
|
||||
this.list[enemy] = monster;
|
||||
end
|
||||
|
||||
return monster;
|
||||
end
|
||||
|
||||
function large_monster.get_monster(enemy)
|
||||
local monster = large_monster.list[enemy];
|
||||
function this.get_monster(enemy)
|
||||
local monster = this.list[enemy];
|
||||
if monster == nil then
|
||||
monster = large_monster.new(enemy);
|
||||
monster = this.new(enemy);
|
||||
end
|
||||
return monster;
|
||||
end
|
||||
@@ -178,7 +178,7 @@ local get_set_info_method = enemy_character_base_type_def:get_method("get_SetInf
|
||||
local set_info_type = get_set_info_method:get_return_type();
|
||||
local get_unique_id_method = set_info_type:get_method("get_UniqueId");
|
||||
|
||||
function large_monster.init(monster, enemy)
|
||||
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";
|
||||
@@ -257,7 +257,7 @@ function large_monster.init(monster, enemy)
|
||||
monster.is_capturable = is_capture_enable and not is_anomaly;
|
||||
end
|
||||
|
||||
function large_monster.init_UI(monster, monster_UI, cached_config)
|
||||
function this.init_UI(monster, monster_UI, cached_config)
|
||||
local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
|
||||
|
||||
monster_UI.monster_name_label = utils.table.deep_copy(cached_config.monster_name_label);
|
||||
@@ -383,7 +383,7 @@ 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 large_monster.update_position(enemy, monster)
|
||||
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
|
||||
return;
|
||||
@@ -396,8 +396,8 @@ function large_monster.update_position(enemy, monster)
|
||||
end
|
||||
|
||||
-- Code by coavins
|
||||
function large_monster.update_all_riders()
|
||||
for enemy, monster in pairs(large_monster.list) do
|
||||
function this.update_all_riders()
|
||||
for enemy, monster in pairs(this.list) do
|
||||
-- get marionette rider
|
||||
local mario_param = enemy:get_field("<MarioParam>k__BackingField");
|
||||
if mario_param ~= nil then
|
||||
@@ -422,7 +422,7 @@ function large_monster.update_all_riders()
|
||||
|
||||
end
|
||||
|
||||
function large_monster.update(enemy, monster)
|
||||
function this.update(enemy, monster)
|
||||
local cached_config = config.current_config.large_monster_UI;
|
||||
|
||||
if not cached_config.dynamic.enabled
|
||||
@@ -471,7 +471,7 @@ function large_monster.update(enemy, monster)
|
||||
pcall(ailments.update_ailments, enemy, monster);
|
||||
end
|
||||
|
||||
function large_monster.update_health(enemy, monster)
|
||||
function this.update_health(enemy, monster)
|
||||
local cached_config = config.current_config.large_monster_UI;
|
||||
|
||||
if not cached_config.dynamic.enabled
|
||||
@@ -511,7 +511,7 @@ function large_monster.update_health(enemy, monster)
|
||||
return physical_param;
|
||||
end
|
||||
|
||||
function large_monster.update_stamina(enemy, monster, stamina_param)
|
||||
function this.update_stamina(enemy, monster, stamina_param)
|
||||
local cached_config = config.current_config.large_monster_UI;
|
||||
|
||||
if not cached_config.dynamic.enabled
|
||||
@@ -548,7 +548,7 @@ function large_monster.update_stamina(enemy, monster, stamina_param)
|
||||
end
|
||||
end
|
||||
|
||||
function large_monster.update_stamina_timer(enemy, monster, stamina_param)
|
||||
function this.update_stamina_timer(enemy, monster, stamina_param)
|
||||
local cached_config = config.current_config.large_monster_UI;
|
||||
|
||||
if not cached_config.dynamic.enabled
|
||||
@@ -595,7 +595,7 @@ function large_monster.update_stamina_timer(enemy, monster, stamina_param)
|
||||
end
|
||||
end
|
||||
|
||||
function large_monster.update_rage(enemy, monster, anger_param)
|
||||
function this.update_rage(enemy, monster, anger_param)
|
||||
local cached_config = config.current_config.large_monster_UI;
|
||||
|
||||
if not cached_config.dynamic.enabled
|
||||
@@ -627,7 +627,7 @@ function large_monster.update_rage(enemy, monster, anger_param)
|
||||
end
|
||||
end
|
||||
|
||||
function large_monster.update_rage_timer(enemy, monster, anger_param)
|
||||
function this.update_rage_timer(enemy, monster, anger_param)
|
||||
local cached_config = config.current_config.large_monster_UI;
|
||||
|
||||
if not cached_config.dynamic.enabled
|
||||
@@ -673,7 +673,7 @@ function large_monster.update_rage_timer(enemy, monster, anger_param)
|
||||
end
|
||||
end
|
||||
|
||||
function large_monster.update_parts(enemy, monster, physical_param)
|
||||
function this.update_parts(enemy, monster, physical_param)
|
||||
local cached_config = config.current_config.large_monster_UI;
|
||||
|
||||
if not cached_config.dynamic.enabled
|
||||
@@ -807,7 +807,7 @@ function large_monster.update_parts(enemy, monster, physical_param)
|
||||
end
|
||||
end
|
||||
|
||||
function large_monster.draw(monster, type, cached_config, position_on_screen, opacity_scale)
|
||||
function this.draw(monster, type, cached_config, position_on_screen, opacity_scale)
|
||||
local monster_UI;
|
||||
|
||||
if type == "dynamic" then
|
||||
@@ -904,11 +904,11 @@ function large_monster.draw(monster, type, cached_config, position_on_screen, op
|
||||
drawing.draw_label(monster_UI.monster_name_label, position_on_screen, opacity_scale, monster_name_text);
|
||||
end
|
||||
|
||||
function large_monster.init_list()
|
||||
large_monster.list = {};
|
||||
function this.init_list()
|
||||
this.list = {};
|
||||
end
|
||||
|
||||
function large_monster.init_module()
|
||||
function this.init_module()
|
||||
singletons = require("MHR_Overlay.Game_Handler.singletons");
|
||||
customization_menu = require("MHR_Overlay.UI.customization_menu");
|
||||
language = require("MHR_Overlay.Misc.language");
|
||||
@@ -931,4 +931,4 @@ function large_monster.init_module()
|
||||
ailment_buildup = require("MHR_Overlay.Monsters.ailment_buildup");
|
||||
end
|
||||
|
||||
return large_monster;
|
||||
return this;
|
||||
@@ -1,4 +1,4 @@
|
||||
local monster_hook = {};
|
||||
local this = {};
|
||||
|
||||
local small_monster;
|
||||
local large_monster;
|
||||
@@ -87,7 +87,7 @@ re.on_pre_application_entry("UpdateBehavior", function()
|
||||
end
|
||||
end)
|
||||
|
||||
function monster_hook.update_monster(enemy)
|
||||
function this.update_monster(enemy)
|
||||
if enemy == nil then
|
||||
return;
|
||||
end
|
||||
@@ -108,13 +108,13 @@ function monster_hook.update_monster(enemy)
|
||||
end
|
||||
|
||||
if is_large then
|
||||
monster_hook.update_large_monster(enemy);
|
||||
this.update_large_monster(enemy);
|
||||
else
|
||||
monster_hook.update_small_monster(enemy);
|
||||
this.update_small_monster(enemy);
|
||||
end
|
||||
end
|
||||
|
||||
function monster_hook.update_large_monster(enemy)
|
||||
function this.update_large_monster(enemy)
|
||||
local cached_config = config.current_config.large_monster_UI;
|
||||
|
||||
if not cached_config.dynamic.enabled and
|
||||
@@ -161,7 +161,7 @@ function monster_hook.update_large_monster(enemy)
|
||||
large_monster.update(enemy, monster);
|
||||
end
|
||||
|
||||
function monster_hook.update_small_monster(enemy)
|
||||
function this.update_small_monster(enemy)
|
||||
if not config.current_config.small_monster_UI.enabled then
|
||||
return;
|
||||
end
|
||||
@@ -198,7 +198,7 @@ function monster_hook.update_small_monster(enemy)
|
||||
end
|
||||
end
|
||||
|
||||
function monster_hook.update_health(enemy_damage_check)
|
||||
function this.update_health(enemy_damage_check)
|
||||
local enemy = get_ref_enemy:call(enemy_damage_check);
|
||||
if enemy == nil then
|
||||
return;
|
||||
@@ -220,7 +220,7 @@ function monster_hook.update_health(enemy_damage_check)
|
||||
end
|
||||
end
|
||||
|
||||
function monster_hook.update_stamina(stamina_param, stamina_sub)
|
||||
function this.update_stamina(stamina_param, stamina_sub)
|
||||
if stamina_sub <= 0 then
|
||||
return;
|
||||
end
|
||||
@@ -234,12 +234,12 @@ function monster_hook.update_stamina(stamina_param, stamina_sub)
|
||||
large_monster.update_stamina(enemy, monster, stamina_param);
|
||||
end
|
||||
|
||||
function monster_hook.update_stamina_timer(stamina_param, enemy)
|
||||
function this.update_stamina_timer(stamina_param, enemy)
|
||||
local monster = large_monster.get_monster(enemy);
|
||||
large_monster.update_stamina_timer(enemy, monster, stamina_param);
|
||||
end
|
||||
|
||||
function monster_hook.update_rage(anger_param, anger_add, enemy)
|
||||
function this.update_rage(anger_param, anger_add, enemy)
|
||||
if anger_add <= 0 then
|
||||
return;
|
||||
end
|
||||
@@ -248,12 +248,12 @@ function monster_hook.update_rage(anger_param, anger_add, enemy)
|
||||
large_monster.update_rage(enemy, monster, anger_param);
|
||||
end
|
||||
|
||||
function monster_hook.update_rage_timer(anger_param, enemy)
|
||||
function this.update_rage_timer(anger_param, enemy)
|
||||
local monster = large_monster.get_monster(enemy);
|
||||
large_monster.update_rage_timer(enemy, monster, anger_param);
|
||||
end
|
||||
|
||||
function monster_hook.init_module()
|
||||
function this.init_module()
|
||||
small_monster = require("MHR_Overlay.Monsters.small_monster");
|
||||
large_monster = require("MHR_Overlay.Monsters.large_monster");
|
||||
config = require("MHR_Overlay.Misc.config");
|
||||
@@ -262,29 +262,29 @@ function monster_hook.init_module()
|
||||
quest_status = require("MHR_Overlay.Game_Handler.quest_status");
|
||||
|
||||
sdk.hook(enemy_character_base_update_method, function(args)
|
||||
pcall(monster_hook.update_monster, sdk.to_managed_object(args[2]));
|
||||
pcall(this.update_monster, sdk.to_managed_object(args[2]));
|
||||
end, function(retval)
|
||||
return retval;
|
||||
end);
|
||||
|
||||
sdk.hook(damage_check_update_param_update_method, function(args)
|
||||
pcall(monster_hook.update_health, sdk.to_managed_object(args[2]));
|
||||
pcall(this.update_health, sdk.to_managed_object(args[2]));
|
||||
end, function(retval)
|
||||
return retval;
|
||||
end);
|
||||
|
||||
sdk.hook(stamina_sub_method, function(args)
|
||||
pcall(monster_hook.update_stamina, sdk.to_managed_object(args[2]), sdk.to_float(args[3]));
|
||||
pcall(this.update_stamina, sdk.to_managed_object(args[2]), sdk.to_float(args[3]));
|
||||
end, function(retval)
|
||||
return retval;
|
||||
end);
|
||||
|
||||
sdk.hook(anger_add_method, function(args)
|
||||
pcall(monster_hook.update_rage, sdk.to_managed_object(args[2]), sdk.to_float(args[3]),
|
||||
pcall(this.update_rage, sdk.to_managed_object(args[2]), sdk.to_float(args[3]),
|
||||
sdk.to_managed_object(args[4]));
|
||||
end, function(retval)
|
||||
return retval;
|
||||
end);
|
||||
end
|
||||
|
||||
return monster_hook;
|
||||
return this;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
local small_monster = {};
|
||||
local this = {};
|
||||
|
||||
local singletons;
|
||||
local customization_menu;
|
||||
@@ -45,9 +45,9 @@ local os = os;
|
||||
local ValueType = ValueType;
|
||||
local package = package;
|
||||
|
||||
small_monster.list = {};
|
||||
this.list = {};
|
||||
|
||||
function small_monster.new(enemy)
|
||||
function this.new(enemy)
|
||||
local monster = {};
|
||||
monster.is_large = false;
|
||||
|
||||
@@ -66,24 +66,24 @@ function small_monster.new(enemy)
|
||||
|
||||
monster.UI = {};
|
||||
|
||||
small_monster.init(monster, enemy);
|
||||
small_monster.init_UI(monster);
|
||||
this.init(monster, enemy);
|
||||
this.init_UI(monster);
|
||||
|
||||
small_monster.update_position(enemy, monster);
|
||||
small_monster.update_health(enemy, monster);
|
||||
small_monster.update(enemy, monster);
|
||||
this.update_position(enemy, monster);
|
||||
this.update_health(enemy, monster);
|
||||
this.update(enemy, monster);
|
||||
|
||||
if small_monster.list[enemy] == nil then
|
||||
small_monster.list[enemy] = monster;
|
||||
if this.list[enemy] == nil then
|
||||
this.list[enemy] = monster;
|
||||
end
|
||||
|
||||
return monster;
|
||||
end
|
||||
|
||||
function small_monster.get_monster(enemy)
|
||||
local monster = small_monster.list[enemy];
|
||||
function this.get_monster(enemy)
|
||||
local monster = this.list[enemy];
|
||||
if monster == nil then
|
||||
monster = small_monster.new(enemy);
|
||||
monster = this.new(enemy);
|
||||
end
|
||||
|
||||
return monster;
|
||||
@@ -95,7 +95,7 @@ local enemy_type_field = enemy_character_base_type_def:get_field("<EnemyType>k__
|
||||
local message_manager_type_def = sdk.find_type_definition("snow.gui.MessageManager");
|
||||
local get_enemy_name_message_method = message_manager_type_def:get_method("getEnemyNameMessage");
|
||||
|
||||
function small_monster.init(monster, enemy)
|
||||
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";
|
||||
@@ -110,7 +110,7 @@ function small_monster.init(monster, enemy)
|
||||
end
|
||||
end
|
||||
|
||||
function small_monster.init_UI(monster)
|
||||
function this.init_UI(monster)
|
||||
local cached_config = config.current_config.small_monster_UI;
|
||||
local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
|
||||
|
||||
@@ -163,7 +163,7 @@ local get_max_method = vital_param_type:get_method("get_Max");
|
||||
|
||||
local get_pos_field = enemy_character_base_type_def:get_method("get_Pos");
|
||||
|
||||
function small_monster.update_position(enemy, monster)
|
||||
function this.update_position(enemy, monster)
|
||||
local cached_config = config.current_config.small_monster_UI;
|
||||
|
||||
if not cached_config.enabled then
|
||||
@@ -180,7 +180,7 @@ function small_monster.update_position(enemy, monster)
|
||||
end
|
||||
end
|
||||
|
||||
function small_monster.update(enemy, monster)
|
||||
function this.update(enemy, monster)
|
||||
if not config.current_config.small_monster_UI.enabled then
|
||||
return;
|
||||
end
|
||||
@@ -193,7 +193,7 @@ function small_monster.update(enemy, monster)
|
||||
pcall(ailments.update_ailments, enemy, monster);
|
||||
end
|
||||
|
||||
function small_monster.update_health(enemy, monster)
|
||||
function this.update_health(enemy, monster)
|
||||
if not config.current_config.small_monster_UI.enabled or not config.current_config.small_monster_UI.health.visibility then
|
||||
return;
|
||||
end
|
||||
@@ -220,7 +220,7 @@ function small_monster.update_health(enemy, monster)
|
||||
end
|
||||
end
|
||||
|
||||
function small_monster.draw(monster, cached_config, position_on_screen, opacity_scale)
|
||||
function this.draw(monster, cached_config, position_on_screen, opacity_scale)
|
||||
local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
|
||||
|
||||
drawing.draw_label(monster.UI.name_label, position_on_screen, opacity_scale, monster.name);
|
||||
@@ -245,11 +245,11 @@ function small_monster.draw(monster, cached_config, position_on_screen, opacity_
|
||||
ailment_buildup.draw(monster, monster.UI.ailment_buildup_UI, cached_config, ailment_buildups_position_on_screen, opacity_scale);
|
||||
end
|
||||
|
||||
function small_monster.init_list()
|
||||
small_monster.list = {};
|
||||
function this.init_list()
|
||||
this.list = {};
|
||||
end
|
||||
|
||||
function small_monster.init_module()
|
||||
function this.init_module()
|
||||
singletons = require("MHR_Overlay.Game_Handler.singletons");
|
||||
customization_menu = require("MHR_Overlay.UI.customization_menu");
|
||||
config = require("MHR_Overlay.Misc.config");
|
||||
@@ -264,4 +264,4 @@ function small_monster.init_module()
|
||||
ailment_buildup_UI_entity = require("MHR_Overlay.UI.UI_Entities.ailment_buildup_UI_entity");
|
||||
end
|
||||
|
||||
return small_monster;
|
||||
return this;
|
||||
|
||||
Reference in New Issue
Block a user