mirror of
https://github.com/GreenComfyTea/MHR-Overlay.git
synced 2026-01-24 04:18:11 -08:00
Utilize this keyword everywhere
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user