mirror of
https://github.com/GreenComfyTea/MHR-Overlay.git
synced 2026-01-24 04:18:11 -08:00
Hooks wrapped with pcalls.
This commit is contained in:
@@ -18,7 +18,7 @@ local get_elemental_damage_method = enemy_calc_damage_info_type_def:get_method("
|
||||
local get_condition_damage_method = enemy_calc_damage_info_type_def:get_method("get_ConditionDamage");
|
||||
|
||||
sdk.hook(enemy_character_base_after_calc_damage_damage_side, function(args)
|
||||
damage_hook.update_damage(args);
|
||||
pcall(damage_hook.update_damage, args);
|
||||
end, function(retval)
|
||||
return retval;
|
||||
end);
|
||||
|
||||
@@ -17,6 +17,12 @@ local village_area_manager_type_def = sdk.find_type_definition("snow.VillageArea
|
||||
local check_current_area_training_area_method = village_area_manager_type_def:get_method("checkCurrentArea_TrainingArea");
|
||||
|
||||
sdk.hook(on_changed_game_status, function(args)
|
||||
pcall(quest_status.update(args));
|
||||
end, function(retval)
|
||||
return retval;
|
||||
end);
|
||||
|
||||
function quest_status.update(args)
|
||||
local new_quest_status = sdk.to_int64(args[3]);
|
||||
if new_quest_status ~= nil then
|
||||
if (quest_status.index < 2 and new_quest_status == 2) or
|
||||
@@ -31,10 +37,7 @@ sdk.hook(on_changed_game_status, function(args)
|
||||
|
||||
quest_status.index = new_quest_status;
|
||||
end
|
||||
|
||||
end, function(retval)
|
||||
return retval;
|
||||
end);
|
||||
end
|
||||
|
||||
function quest_status.init()
|
||||
if singletons.quest_manager == nil then
|
||||
|
||||
@@ -9,7 +9,7 @@ local enemy_character_base_type_def_update_method = enemy_character_base_type_de
|
||||
local is_boss_enemy_method = sdk.find_type_definition("snow.enemy.EnemyCharacterBase"):get_method("get_isBossEnemy");
|
||||
|
||||
sdk.hook(enemy_character_base_type_def_update_method, function(args)
|
||||
monster.update_monster(sdk.to_managed_object(args[2]));
|
||||
pcall(monster.update_monster, sdk.to_managed_object(args[2]));
|
||||
end, function(retval)
|
||||
return retval;
|
||||
end);
|
||||
|
||||
Reference in New Issue
Block a user