Add Small and Large Monster Head Tracking

This commit is contained in:
GreenComfyTea
2024-05-06 18:44:33 +03:00
parent 874c89daa5
commit 4caa69930d
13 changed files with 416 additions and 223 deletions

View File

@@ -320,18 +320,20 @@ function this.init_default()
dynamic_positioning = { dynamic_positioning = {
enabled = true, enabled = true,
max_distance = 300, head_tracking = true,
opacity_falloff = true, opacity_falloff = true,
max_distance = 300,
world_offset = { world_offset = {
x = 0, x = 0,
y = 3, y = 1,
z = 0 z = 0
}, },
viewport_offset = { viewport_offset = {
x = -50, x = -50,
y = 0 y = -30
} }
}, },
@@ -1022,23 +1024,24 @@ function this.init_default()
enabled = true, enabled = true,
settings = { settings = {
head_tracking = true,
hide_dead_or_captured = true, hide_dead_or_captured = true,
render_highlighted_monster = true, render_highlighted_monster = true,
render_not_highlighted_monsters = true, render_not_highlighted_monsters = true,
max_distance = 300,
opacity_falloff = true, opacity_falloff = true,
max_distance = 300,
time_limit = 15 time_limit = 15
}, },
world_offset = { world_offset = {
x = 0, x = 0,
y = 6, y = 2,
z = 0 z = 0
}, },
viewport_offset = { viewport_offset = {
x = -100, x = -100,
y = 0 y = -30
}, },
monster_name_label = { monster_name_label = {

View File

@@ -902,6 +902,8 @@ this.default_language = {
infinite_buffs_location = "Infinite Buffs Location", infinite_buffs_location = "Infinite Buffs Location",
effect_level = "Effect Level", effect_level = "Effect Level",
head_tracking = "Head Tracking"
}, },
}; };

View File

@@ -64,6 +64,126 @@ this.monster_ids = {
risen_chameleos = 2073 risen_chameleos = 2073
} }
local enemy_character_base_type_def = sdk.find_type_definition("snow.enemy.EnemyCharacterBase");
local enemy_type_field = enemy_character_base_type_def:get_field("<EnemyType>k__BackingField");
local get_monster_list_register_scale_method = enemy_character_base_type_def:get_method("get_MonsterListRegisterScale");
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");
local enemy_manager_type_def = sdk.find_type_definition("snow.enemy.EnemyManager");
local find_enemy_size_info_method = enemy_manager_type_def:get_method("findEnemySizeInfo");
local size_info_type_def = find_enemy_size_info_method:get_return_type();
local get_small_border_method = size_info_type_def:get_method("get_SmallBorder");
local get_big_border_method = size_info_type_def:get_method("get_BigBorder");
local get_king_border_method = size_info_type_def:get_method("get_KingBorder");
local get_set_info_method = enemy_character_base_type_def:get_method("get_SetInfo");
local set_info_type = get_set_info_method:get_return_type();
local get_unique_id_method = set_info_type:get_method("get_UniqueId");
local get_physical_param_method = enemy_character_base_type_def:get_method("get_PhysicalParam");
local get_stamina_param_method = enemy_character_base_type_def:get_method("get_StaminaParam");
local get_anger_param_method = enemy_character_base_type_def:get_method("get_AngerParam");
local get_damage_param_method = enemy_character_base_type_def:get_method("get_DamageParam");
local get_mystery_param_method = enemy_character_base_type_def:get_method("get_MysteryParam");
local get_mario_param_method = enemy_character_base_type_def:get_method("get_MarioParam");
local check_die_method = enemy_character_base_type_def:get_method("checkDie");
local is_disp_icon_mini_map_method = enemy_character_base_type_def:get_method("isDispIconMiniMap");
local get_ref_mesh_method = enemy_character_base_type_def:get_method("get_RefMesh");
local mesh_type_def = get_ref_mesh_method:get_return_type();
local get_game_object_method = mesh_type_def:get_method("get_GameObject");
local game_object_type_def = get_game_object_method:get_return_type();
local get_transform_method = game_object_type_def:get_method("get_Transform");
local transform_type_def = get_transform_method:get_return_type();
local get_joint_by_name_method = transform_type_def:get_method("getJointByName");
local joint_type_def = get_joint_by_name_method:get_return_type();
local get_position_method = joint_type_def:get_method("get_Position");
local physical_param_type_def = get_physical_param_method:get_return_type();
local get_vital_method = physical_param_type_def:get_method("getVital");
local get_capture_hp_vital_method = physical_param_type_def:get_method("get_CaptureHpVital");
local vital_param_type_def = get_vital_method:get_return_type();
local get_current_method = vital_param_type_def:get_method("get_Current");
local get_max_method = vital_param_type_def:get_method("get_Max");
local is_enable_method = vital_param_type_def:get_method("isEnable");
local stamina_param_type_def = get_stamina_param_method:get_return_type();
local is_tired_method = stamina_param_type_def:get_method("isTired");
local get_stamina_method = stamina_param_type_def:get_method("getStamina");
local get_max_stamina_method = stamina_param_type_def:get_method("getMaxStamina");
local get_remaining_tired_time_method = stamina_param_type_def:get_method("getStaminaRemainingTime");
local get_total_tired_time_method = stamina_param_type_def:get_method("get_TiredSec");
local anger_param_type_def = get_anger_param_method:get_return_type();
local is_anger_method = anger_param_type_def:get_method("isAnger");
local get_anger_point_method = anger_param_type_def:get_method("get_AngerPoint");
local get_limit_anger_method = anger_param_type_def:get_method("get_LimitAnger");
local get_remaining_anger_time_method = anger_param_type_def:get_method("getAngerRemainingTime");
local get_total_anger_time_method = anger_param_type_def:get_method("get_TimerAnger");
local mario_param_type_def = get_mario_param_method:get_return_type();
local get_is_marionette_method = mario_param_type_def:get_method("get_IsMarionette");
local get_mario_player_index_method = mario_param_type_def:get_method("get_MarioPlayerIndex");
local get_pos_field = enemy_character_base_type_def:get_method("get_Pos");
local system_array_type_def = sdk.find_type_definition("System.Array");
local get_length_method = system_array_type_def:get_method("get_Length");
local get_value_method = system_array_type_def:get_method("GetValue(System.Int32)");
-- Lucent Nargacuga
local em037_02Character_type_def = sdk.find_type_definition("snow.enemy.em037.Em037_02Character");
local is_stealth_method = em037_02Character_type_def:get_method("isStealth");
-- Risen Chameleos and CHameleos
local Em025Character_base_type_Def = sdk.find_type_definition("snow.enemy.em025.Em025CharacterBase");
local get_stealth_ctrl_method = Em025Character_base_type_Def:get_method("get_StealthCtrl");
local stealth_ctrl_type_def = get_stealth_ctrl_method:get_return_type();
local get_current_status_method = stealth_ctrl_type_def:get_method("get_CurrentStatus");
local damage_param_type_def = get_damage_param_method:get_return_type();
local enemy_parts_damage_info_field = damage_param_type_def:get_field("_EnemyPartsDamageInfo");
local enemy_parts_damage_info_type_def = enemy_parts_damage_info_field:get_type();
local get_part_info_array_method = enemy_parts_damage_info_type_def:get_method("get_PartsInfo");
local enemy_parts_info_type_def = sdk.find_type_definition("snow.enemy.EnemyDamageParam.EnemyPartsDamageInfo.EnemyPartsInfo");
local get_parts_break_damage_level_method = enemy_parts_info_type_def:get_method("get_PartsBreakDamageLevel");
local get_parts_break_damage_max_level_method = enemy_parts_info_type_def:get_method("get_PartsBreakDamageMaxLevel");
local get_parts_loss_state_method = enemy_parts_info_type_def:get_method("get_PartsLossState");
local mystery_param_type_def = get_mystery_param_method:get_return_type();
local core_parts_array_field = mystery_param_type_def:get_field("CoreParts");
local enemy_mystery_core_parts_type_def = sdk.find_type_definition("snow.enemy.EnemyMysteryCoreParts");
local core_parts_get_vital_method = enemy_mystery_core_parts_type_def:get_method("get_Vital");
local core_parts_get_is_active_method = enemy_mystery_core_parts_type_def:get_method("get_IsActive");
local core_parts_get_dying_vital_threashold_method = enemy_mystery_core_parts_type_def:get_method("get_DyingVitalThreashold");
local on_break_method = enemy_mystery_core_parts_type_def:get_method("onBreak");
local gui_manager_type_def = sdk.find_type_definition("snow.gui.GuiManager");
local get_tg_camera_method = gui_manager_type_def:get_method("get_refGuiHud_TgCamera");
local tg_camera_type_def = get_tg_camera_method:get_return_type();
local get_targeting_enemy_index_field = tg_camera_type_def:get_field("OldTargetingEmIndex");
local lobby_manager_type_def = sdk.find_type_definition("snow.LobbyManager");
local receive_quest_hunter_info_method = lobby_manager_type_def:get_method("receiveQuestHunterInfo");
function this.new(enemy) function this.new(enemy)
local monster = {}; local monster = {};
@@ -116,7 +236,10 @@ function this.new(enemy)
monster.rage_seconds_left = 0; monster.rage_seconds_left = 0;
monster.rage_timer_percentage = 0; monster.rage_timer_percentage = 0;
monster.head_joint = nil;
monster.position = Vector3f.new(0, 0, 0); monster.position = Vector3f.new(0, 0, 0);
monster.head_position = Vector3f.new(0, 0, 0);
monster.distance = 0; monster.distance = 0;
monster.name = "Large Monster"; monster.name = "Large Monster";
@@ -166,116 +289,10 @@ function this.get_monster(enemy)
return monster; return monster;
end end
local enemy_character_base_type_def = sdk.find_type_definition("snow.enemy.EnemyCharacterBase");
local enemy_type_field = enemy_character_base_type_def:get_field("<EnemyType>k__BackingField");
local get_monster_list_register_scale_method = enemy_character_base_type_def:get_method("get_MonsterListRegisterScale");
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");
local enemy_manager_type_def = sdk.find_type_definition("snow.enemy.EnemyManager");
local find_enemy_size_info_method = enemy_manager_type_def:get_method("findEnemySizeInfo");
local size_info_type = find_enemy_size_info_method:get_return_type();
local get_small_border_method = size_info_type:get_method("get_SmallBorder");
local get_big_border_method = size_info_type:get_method("get_BigBorder");
local get_king_border_method = size_info_type:get_method("get_KingBorder");
local get_set_info_method = enemy_character_base_type_def:get_method("get_SetInfo");
local set_info_type = get_set_info_method:get_return_type();
local get_unique_id_method = set_info_type:get_method("get_UniqueId");
local get_physical_param_method = enemy_character_base_type_def:get_method("get_PhysicalParam");
local get_stamina_param_method = enemy_character_base_type_def:get_method("get_StaminaParam");
local get_anger_param_method = enemy_character_base_type_def:get_method("get_AngerParam");
local get_damage_param_method = enemy_character_base_type_def:get_method("get_DamageParam");
local get_mystery_param_method = enemy_character_base_type_def:get_method("get_MysteryParam");
local get_mario_param_method = enemy_character_base_type_def:get_method("get_MarioParam");
local check_die_method = enemy_character_base_type_def:get_method("checkDie");
local is_disp_icon_mini_map_method = enemy_character_base_type_def:get_method("isDispIconMiniMap");
local physical_param_type = get_physical_param_method:get_return_type();
local get_vital_method = physical_param_type:get_method("getVital");
local get_capture_hp_vital_method = physical_param_type:get_method("get_CaptureHpVital");
local vital_param_type = get_vital_method:get_return_type();
local get_current_method = vital_param_type:get_method("get_Current");
local get_max_method = vital_param_type:get_method("get_Max");
local is_enable_method = vital_param_type:get_method("isEnable");
local stamina_param_type = get_stamina_param_method:get_return_type();
local is_tired_method = stamina_param_type:get_method("isTired");
local get_stamina_method = stamina_param_type:get_method("getStamina");
local get_max_stamina_method = stamina_param_type:get_method("getMaxStamina");
local get_remaining_tired_time_method = stamina_param_type:get_method("getStaminaRemainingTime");
local get_total_tired_time_method = stamina_param_type:get_method("get_TiredSec");
local anger_param_type = get_anger_param_method:get_return_type();
local is_anger_method = anger_param_type:get_method("isAnger");
local get_anger_point_method = anger_param_type:get_method("get_AngerPoint");
local get_limit_anger_method = anger_param_type:get_method("get_LimitAnger");
local get_remaining_anger_time_method = anger_param_type:get_method("getAngerRemainingTime");
local get_total_anger_time_method = anger_param_type:get_method("get_TimerAnger");
local mario_param_type = get_mario_param_method:get_return_type();
local get_is_marionette_method = mario_param_type:get_method("get_IsMarionette");
local get_mario_player_index_method = mario_param_type:get_method("get_MarioPlayerIndex");
local get_pos_field = enemy_character_base_type_def:get_method("get_Pos");
local system_array_type_def = sdk.find_type_definition("System.Array");
local get_length_method = system_array_type_def:get_method("get_Length");
local get_value_method = system_array_type_def:get_method("GetValue(System.Int32)");
-- Lucent Nargacuga
local em037_02Character_type_def = sdk.find_type_definition("snow.enemy.em037.Em037_02Character");
local is_stealth_method = em037_02Character_type_def:get_method("isStealth");
-- Risen Chameleos and CHameleos
local Em025Character_base_type_Def = sdk.find_type_definition("snow.enemy.em025.Em025CharacterBase");
local get_stealth_ctrl_method = Em025Character_base_type_Def:get_method("get_StealthCtrl");
local stealth_ctrl_type_def = get_stealth_ctrl_method:get_return_type();
local get_current_status_method = stealth_ctrl_type_def:get_method("get_CurrentStatus");
local damage_param_type_def = get_damage_param_method:get_return_type();
local enemy_parts_damage_info_field = damage_param_type_def:get_field("_EnemyPartsDamageInfo");
local enemy_parts_damage_info_type_def = enemy_parts_damage_info_field:get_type();
local get_part_info_array_method = enemy_parts_damage_info_type_def:get_method("get_PartsInfo");
local enemy_parts_info_type_def = sdk.find_type_definition("snow.enemy.EnemyDamageParam.EnemyPartsDamageInfo.EnemyPartsInfo");
local get_parts_break_damage_level_method = enemy_parts_info_type_def:get_method("get_PartsBreakDamageLevel");
local get_parts_break_damage_max_level_method = enemy_parts_info_type_def:get_method("get_PartsBreakDamageMaxLevel");
local get_parts_loss_state_method = enemy_parts_info_type_def:get_method("get_PartsLossState");
local mystery_param_type_def = get_mystery_param_method:get_return_type();
local core_parts_array_field = mystery_param_type_def:get_field("CoreParts");
local enemy_mystery_core_parts_type_def = sdk.find_type_definition("snow.enemy.EnemyMysteryCoreParts");
local core_parts_get_vital_method = enemy_mystery_core_parts_type_def:get_method("get_Vital");
local core_parts_get_is_active_method = enemy_mystery_core_parts_type_def:get_method("get_IsActive");
local core_parts_get_dying_vital_threashold_method = enemy_mystery_core_parts_type_def:get_method("get_DyingVitalThreashold");
local on_break_method = enemy_mystery_core_parts_type_def:get_method("onBreak");
local gui_manager_type_def = sdk.find_type_definition("snow.gui.GuiManager");
local get_tg_camera_method = gui_manager_type_def:get_method("get_refGuiHud_TgCamera");
local tg_camera_type_def = get_tg_camera_method:get_return_type();
local get_targeting_enemy_index_field = tg_camera_type_def:get_field("OldTargetingEmIndex");
local lobby_manager_type_def = sdk.find_type_definition("snow.LobbyManager");
local receive_quest_hunter_info_method = lobby_manager_type_def:get_method("receiveQuestHunterInfo");
function this.init(monster, enemy) function this.init(monster, enemy)
local monster_id = enemy_type_field:get_data(enemy); local monster_id = enemy_type_field:get_data(enemy);
if monster_id == nil then if monster_id == nil then
error_handler.report("large_monster.init", "Failed to access Data: enemy_type"); error_handler.report("large_monster.init", "Failed to Access Data: enemy_type");
return; return;
end end
@@ -289,7 +306,7 @@ function this.init(monster, enemy)
if enemy_name ~= nil then if enemy_name ~= nil then
monster.name = enemy_name; monster.name = enemy_name;
else else
error_handler.report("large_monster.init", "Failed to access Data: enemy_name"); error_handler.report("large_monster.init", "Failed to Access Data: enemy_name");
end end
if monster_id ~= this.monster_ids.toadversary then if monster_id ~= this.monster_ids.toadversary then
@@ -299,10 +316,10 @@ function this.init(monster, enemy)
if unique_id ~= nil then if unique_id ~= nil then
monster.unique_id = unique_id; monster.unique_id = unique_id;
else else
error_handler.report("large_monster.init", "Failed to access Data: unique_id"); error_handler.report("large_monster.init", "Failed to Access Data: unique_id");
end end
else else
error_handler.report("large_monster.init", "Failed to access Data: set_info"); error_handler.report("large_monster.init", "Failed to Access Data: set_info");
end end
local size_info = find_enemy_size_info_method:call(singletons.enemy_manager, monster_id); local size_info = find_enemy_size_info_method:call(singletons.enemy_manager, monster_id);
@@ -316,25 +333,25 @@ function this.init(monster, enemy)
if small_border ~= nil then if small_border ~= nil then
monster.small_border = small_border; monster.small_border = small_border;
else else
error_handler.report("large_monster.init", "Failed to access Data: small_border"); error_handler.report("large_monster.init", "Failed to Access Data: small_border");
end end
if big_border ~= nil then if big_border ~= nil then
monster.big_border = big_border; monster.big_border = big_border;
else else
error_handler.report("large_monster.init", "Failed to access Data: big_border"); error_handler.report("large_monster.init", "Failed to Access Data: big_border");
end end
if king_border ~= nil then if king_border ~= nil then
monster.king_border = king_border; monster.king_border = king_border;
else else
error_handler.report("large_monster.init", "Failed to access Data: king_border"); error_handler.report("large_monster.init", "Failed to Access Data: king_border");
end end
if size ~= nil then if size ~= nil then
monster.size = size; monster.size = size;
else else
error_handler.report("large_monster.init", "Failed to access Data: size"); error_handler.report("large_monster.init", "Failed to Access Data: size");
end end
if monster.size <= monster.small_border then if monster.size <= monster.small_border then
@@ -345,7 +362,7 @@ function this.init(monster, enemy)
monster.crown = language.current_language.UI.silver; monster.crown = language.current_language.UI.silver;
end end
else else
error_handler.report("large_monster.init", "Failed to access Data: size_info"); error_handler.report("large_monster.init", "Failed to Access Data: size_info");
end end
end end
@@ -360,13 +377,13 @@ function this.init(monster, enemy)
if is_capture_enable_ ~= nil then if is_capture_enable_ ~= nil then
is_capture_enable = is_capture_enable_; is_capture_enable = is_capture_enable_;
else else
error_handler.report("large_monster.init", "Failed to access Data: is_capture_enable_"); error_handler.report("large_monster.init", "Failed to Access Data: is_capture_enable_");
end end
else else
error_handler.report("large_monster.init", "Failed to access Data: capture_param"); error_handler.report("large_monster.init", "Failed to Access Data: capture_param");
end end
else else
error_handler.report("large_monster.init", "Failed to access Data: damage_param"); error_handler.report("large_monster.init", "Failed to Access Data: damage_param");
end end
local mystery_param = get_mystery_param_method:call(enemy); local mystery_param = get_mystery_param_method:call(enemy);
@@ -374,6 +391,8 @@ function this.init(monster, enemy)
monster.is_anomaly = is_anomaly; monster.is_anomaly = is_anomaly;
monster.is_capturable = is_capture_enable and not is_anomaly; monster.is_capturable = is_capture_enable and not is_anomaly;
this.update_head_joint(enemy, monster);
end end
function this.init_UI(monster, monster_UI, cached_config) function this.init_UI(monster, monster_UI, cached_config)
@@ -478,10 +497,71 @@ function this.update_position(enemy, monster)
local position = get_pos_field:call(enemy); local position = get_pos_field:call(enemy);
if position == nil then if position == nil then
error_handler.report("large_monster.update_position", "Failed to access Data: position"); error_handler.report("large_monster.update_position", "Failed to Access Data: position");
end end
monster.position = position; monster.position = position;
this.update_head_position(enemy, monster);
end
function this.update_head_joint(enemy, monster)
local mesh = get_ref_mesh_method:call(enemy);
if mesh == nil then
error_handler.report("large_monster.update_head_joint", "Failed to Access Data: Mesh");
return;
end
local game_object = get_game_object_method:call(mesh);
if game_object == nil then
error_handler.report("large_monster.update_head_joint", "Failed to Access Data: GameObject");
return;
end
local transform = get_transform_method:call(game_object);
if transform == nil then
error_handler.report("large_monster.update_head_joint", "Failed to Access Data: Transform");
return;
end
local head_joint = get_joint_by_name_method:call(transform, "Head_00")
or get_joint_by_name_method:call(transform, "Head")
or get_joint_by_name_method:call(transform, "Spine_00")
or get_joint_by_name_method:call(transform, "head")
or get_joint_by_name_method:call(transform, "root");
if head_joint == nil then
-- local joints = transform:get_Joints();
-- local out = "";
-- for i = 0, joints:get_Length() - 1 do
-- local joint = joints[i];
-- local joint_name = joint:get_Name();
-- out = out .. joint_name .. "\n";
-- end
-- error_handler.report(monster.name, out);
error_handler.report("large_monster.update_head_joint", "Failed to Access Data: HeadJoint");
return;
end
monster.head_joint = head_joint;
end
function this.update_head_position(enemy, monster)
if monster.head_joint == nil then
return;
end
local head_position = get_position_method:call(monster.head_joint);
if head_position == nil then
error_handler.report("large_monster.update_head_position", "Failed to Access Data: HeadPosition");
return;
end
monster.head_position = head_position;
end end
-- Code by coavins -- Code by coavins
@@ -490,20 +570,20 @@ function this.update_all_riders()
-- get marionette rider -- get marionette rider
local mario_param = get_mario_param_method:call(enemy); local mario_param = get_mario_param_method:call(enemy);
if mario_param == nil then if mario_param == nil then
error_handler.report("large_monster.update_all_riders", "Failed to access Data: mario_param"); error_handler.report("large_monster.update_all_riders", "Failed to Access Data: mario_param");
goto continue; goto continue;
end end
local is_marionette = get_is_marionette_method:call(mario_param); local is_marionette = get_is_marionette_method:call(mario_param);
if is_marionette == nil then if is_marionette == nil then
error_handler.report("large_monster.update_all_riders", "Failed to access Data: is_marionette"); error_handler.report("large_monster.update_all_riders", "Failed to Access Data: is_marionette");
goto continue; goto continue;
end end
if is_marionette then if is_marionette then
local player_id = get_mario_player_index_method:call(mario_param); local player_id = get_mario_player_index_method:call(mario_param);
if player_id == nil then if player_id == nil then
error_handler.report("large_monster.update_all_riders", "Failed to access Data: player_id"); error_handler.report("large_monster.update_all_riders", "Failed to Access Data: player_id");
goto continue; goto continue;
end end
@@ -529,14 +609,14 @@ function this.update(enemy, monster)
if dead_or_captured ~= nil then if dead_or_captured ~= nil then
monster.dead_or_captured = dead_or_captured; monster.dead_or_captured = dead_or_captured;
else else
error_handler.report("large_monster.update", "Failed to access Data: dead_or_captured"); error_handler.report("large_monster.update", "Failed to Access Data: dead_or_captured");
end end
local is_disp_icon_mini_map = is_disp_icon_mini_map_method:call(enemy); local is_disp_icon_mini_map = is_disp_icon_mini_map_method:call(enemy);
if is_disp_icon_mini_map ~= nil then if is_disp_icon_mini_map ~= nil then
monster.is_disp_icon_mini_map = is_disp_icon_mini_map; monster.is_disp_icon_mini_map = is_disp_icon_mini_map;
else else
error_handler.report("large_monster.update", "Failed to access Data: is_disp_icon_mini_map"); error_handler.report("large_monster.update", "Failed to Access Data: is_disp_icon_mini_map");
end end
if monster.id == this.monster_ids.lucent_nargacuga or monster.id == this.monster_ids.chameleos or monster.id == this.monster_ids.risen_chameleos then if monster.id == this.monster_ids.lucent_nargacuga or monster.id == this.monster_ids.chameleos or monster.id == this.monster_ids.risen_chameleos then
@@ -550,7 +630,7 @@ function this.update(enemy, monster)
if is_stealth == nil then if is_stealth == nil then
monster.is_stealth = is_stealth; monster.is_stealth = is_stealth;
else else
error_handler.report("large_monster.update", "Failed to access Data: is_stealth"); error_handler.report("large_monster.update", "Failed to Access Data: is_stealth");
end end
-- Chameleos and Risen Chameleos -- Chameleos and Risen Chameleos
@@ -560,14 +640,14 @@ function this.update(enemy, monster)
local status = get_current_status_method:call(stealth_controller); local status = get_current_status_method:call(stealth_controller);
if status == nil then if status == nil then
error_handler.report("large_monster.update", "Failed to access Data: status"); error_handler.report("large_monster.update", "Failed to Access Data: status");
elseif status >= 2 then elseif status >= 2 then
monster.is_stealth = true; monster.is_stealth = true;
else else
monster.is_stealth = false; monster.is_stealth = false;
end end
else else
error_handler.report("large_monster.update", "Failed to access Data: stealth_controller"); error_handler.report("large_monster.update", "Failed to Access Data: stealth_controller");
end end
end end
end end
@@ -592,13 +672,13 @@ function this.update_health(enemy, monster)
local physical_param = get_physical_param_method:call(enemy); local physical_param = get_physical_param_method:call(enemy);
if physical_param == nil then if physical_param == nil then
error_handler.report("large_monster.update_health", "Failed to access Data: physical_param"); error_handler.report("large_monster.update_health", "Failed to Access Data: physical_param");
return nil; return nil;
end end
local vital_param = get_vital_method:call(physical_param, 0, 0); local vital_param = get_vital_method:call(physical_param, 0, 0);
if vital_param == nil then if vital_param == nil then
error_handler.report("large_monster.update_health", "Failed to access Data: vital_param"); error_handler.report("large_monster.update_health", "Failed to Access Data: vital_param");
return nil; return nil;
end end
@@ -606,21 +686,21 @@ function this.update_health(enemy, monster)
if health ~= nil then if health ~= nil then
monster.health = health; monster.health = health;
else else
error_handler.report("large_monster.update_health", "Failed to access Data: health"); error_handler.report("large_monster.update_health", "Failed to Access Data: health");
end end
local max_health = get_max_method:call(vital_param); local max_health = get_max_method:call(vital_param);
if max_health ~= nil then if max_health ~= nil then
monster.max_health = max_health; monster.max_health = max_health;
else else
error_handler.report("large_monster.update_health", "Failed to access Data: max_health"); error_handler.report("large_monster.update_health", "Failed to Access Data: max_health");
end end
local capture_health = get_capture_hp_vital_method:call(physical_param); local capture_health = get_capture_hp_vital_method:call(physical_param);
if capture_health ~= nil then if capture_health ~= nil then
monster.capture_health = capture_health; monster.capture_health = capture_health;
else else
error_handler.report("large_monster.update_health", "Failed to access Data: capture_health"); error_handler.report("large_monster.update_health", "Failed to Access Data: capture_health");
end end
monster.missing_health = max_health - health; monster.missing_health = max_health - health;
@@ -652,7 +732,7 @@ function this.update_stamina(enemy, monster, stamina_param)
if stamina_param == nil then 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 if stamina_param == nil then
error_handler.report("large_monster.update_stamina", "Failed to access Data: stamina_param"); error_handler.report("large_monster.update_stamina", "Failed to Access Data: stamina_param");
return; return;
end end
end end
@@ -661,7 +741,7 @@ function this.update_stamina(enemy, monster, stamina_param)
if is_tired ~= nil then if is_tired ~= nil then
monster.is_tired = is_tired; monster.is_tired = is_tired;
else else
error_handler.report("large_monster.update_stamina", "Failed to access Data: is_tired"); error_handler.report("large_monster.update_stamina", "Failed to Access Data: is_tired");
return; return;
end end
@@ -673,7 +753,7 @@ function this.update_stamina(enemy, monster, stamina_param)
if stamina ~= nil then if stamina ~= nil then
monster.stamina = stamina; monster.stamina = stamina;
else else
error_handler.report("large_monster.update_stamina", "Failed to access Data: stamina"); error_handler.report("large_monster.update_stamina", "Failed to Access Data: stamina");
return; return;
end end
@@ -681,7 +761,7 @@ function this.update_stamina(enemy, monster, stamina_param)
if max_stamina ~= nil then if max_stamina ~= nil then
monster.max_stamina = max_stamina; monster.max_stamina = max_stamina;
else else
error_handler.report("large_monster.update_stamina", "Failed to access Data: max_stamina"); error_handler.report("large_monster.update_stamina", "Failed to Access Data: max_stamina");
return; return;
end end
@@ -709,7 +789,7 @@ function this.update_stamina_timer(enemy, monster, stamina_param)
if stamina_param == nil then 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 if stamina_param == nil then
error_handler.report("large_monster.update_stamina_timer", "Failed to access Data: stamina_param"); error_handler.report("large_monster.update_stamina_timer", "Failed to Access Data: stamina_param");
return; return;
end end
end end
@@ -718,7 +798,7 @@ function this.update_stamina_timer(enemy, monster, stamina_param)
if is_tired ~= nil then if is_tired ~= nil then
monster.is_tired = is_tired; monster.is_tired = is_tired;
else else
error_handler.report("large_monster.update_stamina_timer", "Failed to access Data: is_tired"); error_handler.report("large_monster.update_stamina_timer", "Failed to Access Data: is_tired");
return; return;
end end
@@ -730,7 +810,7 @@ function this.update_stamina_timer(enemy, monster, stamina_param)
if tired_timer ~= nil then if tired_timer ~= nil then
monster.tired_timer = tired_timer; monster.tired_timer = tired_timer;
else else
error_handler.report("large_monster.update_stamina_timer", "Failed to access Data: tired_timer"); error_handler.report("large_monster.update_stamina_timer", "Failed to Access Data: tired_timer");
return; return;
end end
@@ -738,7 +818,7 @@ function this.update_stamina_timer(enemy, monster, stamina_param)
if tired_duration ~= nil then if tired_duration ~= nil then
monster.tired_duration = tired_duration; monster.tired_duration = tired_duration;
else else
error_handler.report("large_monster.update_stamina_timer", "Failed to access Data: tired_duration"); error_handler.report("large_monster.update_stamina_timer", "Failed to Access Data: tired_duration");
return; return;
end end
@@ -773,7 +853,7 @@ function this.update_rage(enemy, monster, anger_param)
if anger_param == nil then if anger_param == nil then
anger_param = get_anger_param_method:call(enemy); anger_param = get_anger_param_method:call(enemy);
if anger_param == nil then if anger_param == nil then
error_handler.report("large_monster.update_rage", "Failed to access Data: anger_param"); error_handler.report("large_monster.update_rage", "Failed to Access Data: anger_param");
return; return;
end end
end end
@@ -782,7 +862,7 @@ function this.update_rage(enemy, monster, anger_param)
if is_in_rage ~= nil then if is_in_rage ~= nil then
monster.is_in_rage = is_in_rage; monster.is_in_rage = is_in_rage;
else else
error_handler.report("large_monster.update_rage", "Failed to access Data: is_in_rage"); error_handler.report("large_monster.update_rage", "Failed to Access Data: is_in_rage");
return; return;
end end
@@ -794,7 +874,7 @@ function this.update_rage(enemy, monster, anger_param)
if rage_point ~= nil then if rage_point ~= nil then
monster.rage_point = rage_point; monster.rage_point = rage_point;
else else
error_handler.report("large_monster.update_rage", "Failed to access Data: rage_point"); error_handler.report("large_monster.update_rage", "Failed to Access Data: rage_point");
return; return;
end end
@@ -802,7 +882,7 @@ function this.update_rage(enemy, monster, anger_param)
if rage_limit ~= nil then if rage_limit ~= nil then
monster.rage_limit = rage_limit; monster.rage_limit = rage_limit;
else else
error_handler.report("large_monster.update_rage", "Failed to access Data: rage_limit"); error_handler.report("large_monster.update_rage", "Failed to Access Data: rage_limit");
return; return;
end end
@@ -829,7 +909,7 @@ function this.update_rage_timer(enemy, monster, anger_param)
if anger_param == nil then if anger_param == nil then
anger_param = get_anger_param_method:call(enemy); anger_param = get_anger_param_method:call(enemy);
if anger_param == nil then if anger_param == nil then
error_handler.report("large_monster.update_rage_timer", "Failed to access Data: anger_param"); error_handler.report("large_monster.update_rage_timer", "Failed to Access Data: anger_param");
return; return;
end end
end end
@@ -838,7 +918,7 @@ function this.update_rage_timer(enemy, monster, anger_param)
if is_in_rage ~= nil then if is_in_rage ~= nil then
monster.is_in_rage = is_in_rage; monster.is_in_rage = is_in_rage;
else else
error_handler.report("large_monster.update_rage_timer", "Failed to access Data: is_in_rage"); error_handler.report("large_monster.update_rage_timer", "Failed to Access Data: is_in_rage");
return; return;
end end
@@ -850,7 +930,7 @@ function this.update_rage_timer(enemy, monster, anger_param)
if rage_timer ~= nil then if rage_timer ~= nil then
monster.rage_timer = rage_timer; monster.rage_timer = rage_timer;
else else
error_handler.report("large_monster.update_rage_timer", "Failed to access Data: rage_timer"); error_handler.report("large_monster.update_rage_timer", "Failed to Access Data: rage_timer");
return; return;
end end
@@ -858,7 +938,7 @@ function this.update_rage_timer(enemy, monster, anger_param)
if rage_duration ~= nil then if rage_duration ~= nil then
monster.rage_duration = rage_duration; monster.rage_duration = rage_duration;
else else
error_handler.report("large_monster.update_rage_timer", "Failed to access Data: rage_duration"); error_handler.report("large_monster.update_rage_timer", "Failed to Access Data: rage_duration");
return; return;
end end
@@ -905,32 +985,32 @@ function this.update_parts(enemy, monster, physical_param)
if physical_param == nil then if physical_param == nil then
physical_param = get_physical_param_method:call(enemy); physical_param = get_physical_param_method:call(enemy);
if physical_param == nil then if physical_param == nil then
error_handler.report("large_monster.update_parts", "Failed to access Data: physical_param"); error_handler.report("large_monster.update_parts", "Failed to Access Data: physical_param");
return; return;
end end
end end
local damage_param = get_damage_param_method:call(enemy); local damage_param = get_damage_param_method:call(enemy);
if damage_param == nil then if damage_param == nil then
error_handler.report("large_monster.update_parts", "Failed to access Data: damage_param"); error_handler.report("large_monster.update_parts", "Failed to Access Data: damage_param");
return; return;
end end
local enemy_parts_damage_info = enemy_parts_damage_info_field:get_data(damage_param); local enemy_parts_damage_info = enemy_parts_damage_info_field:get_data(damage_param);
if enemy_parts_damage_info == nil then if enemy_parts_damage_info == nil then
error_handler.report("large_monster.update_parts", "Failed to access Data: enemy_parts_damage_info"); error_handler.report("large_monster.update_parts", "Failed to Access Data: enemy_parts_damage_info");
return; return;
end end
local core_parts_array = get_part_info_array_method:call(enemy_parts_damage_info); local core_parts_array = get_part_info_array_method:call(enemy_parts_damage_info);
if core_parts_array == nil then if core_parts_array == nil then
error_handler.report("large_monster.update_parts", "Failed to access Data: core_parts_array"); error_handler.report("large_monster.update_parts", "Failed to Access Data: core_parts_array");
return; return;
end end
local core_parts_array_length = get_length_method:call(core_parts_array); local core_parts_array_length = get_length_method:call(core_parts_array);
if core_parts_array_length == nil then if core_parts_array_length == nil then
error_handler.report("large_monster.update_parts", "Failed to access Data: core_parts_array_length"); error_handler.report("large_monster.update_parts", "Failed to Access Data: core_parts_array_length");
return; return;
end end
@@ -939,7 +1019,7 @@ function this.update_parts(enemy, monster, physical_param)
local enemy_parts_info = get_value_method:call(core_parts_array, i); local enemy_parts_info = get_value_method:call(core_parts_array, i);
if enemy_parts_info == nil then if enemy_parts_info == nil then
error_handler.report("large_monster.update_parts", "Failed to access Data: enemy_parts_info No. " .. tostring(i)); error_handler.report("large_monster.update_parts", "Failed to Access Data: enemy_parts_info No. " .. tostring(i));
goto continue; goto continue;
end end
@@ -963,19 +1043,19 @@ function this.update_parts(enemy, monster, physical_param)
local part_current = get_current_method:call(part_vital); local part_current = get_current_method:call(part_vital);
if part_current == nil then 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)); error_handler.report("large_monster.update_parts", string.format("Failed to Access Data: enemy_parts_info No. %d -> part_current", i));
end end
local part_max = get_max_method:call(part_vital); local part_max = get_max_method:call(part_vital);
if part_max == nil then 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)); error_handler.report("large_monster.update_parts", string.format("Failed to Access Data: enemy_parts_info No. %d -> part_max", i));
end end
if part_current ~= nil and part_max ~= nil then if part_current ~= nil and part_max ~= nil then
body_part.update_flinch(part, part_current, part_max); body_part.update_flinch(part, part_current, part_max);
end end
else else
error_handler.report("large_monster.update_parts", string.format("Failed to access Data: enemy_parts_info No. %d -> part_vital", i)); error_handler.report("large_monster.update_parts", string.format("Failed to Access Data: enemy_parts_info No. %d -> part_vital", i));
end end
end end
@@ -988,29 +1068,29 @@ function this.update_parts(enemy, monster, physical_param)
local part_break_current = get_current_method:call(part_break_vital); local part_break_current = get_current_method:call(part_break_vital);
if part_break_current == nil then 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)); error_handler.report("large_monster.update_parts", string.format("Failed to Access Data: enemy_parts_info No. %d -> part_break_current", i));
end end
local part_break_max = get_max_method:call(part_break_vital); local part_break_max = get_max_method:call(part_break_vital);
if part_break_max == nil then 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)); error_handler.report("large_monster.update_parts", string.format("Failed to Access Data: enemy_parts_info No. %d -> part_break_max", i));
end end
local part_break_count = get_parts_break_damage_level_method:call(enemy_parts_info); local part_break_count = get_parts_break_damage_level_method:call(enemy_parts_info);
if part_break_count == nil then 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)); error_handler.report("large_monster.update_parts", string.format("Failed to Access Data: enemy_parts_info No. %d -> part_break_count", i));
end end
local part_break_max_count = get_parts_break_damage_max_level_method:call(enemy_parts_info); local part_break_max_count = get_parts_break_damage_max_level_method:call(enemy_parts_info);
if part_break_max_count == nil then 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)); error_handler.report("large_monster.update_parts", string.format("Failed to Access Data: enemy_parts_info No. %d -> part_break_max_count", i));
end end
if part_break_current ~= nil and part_break_max ~= nil and part_break_count ~= nil and part_break_max_count ~= nil then 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); body_part.update_break(part, part_break_current, part_break_max, part_break_count, part_break_max_count);
end end
else else
error_handler.report("large_monster.update_parts", string.format("Failed to access Data: enemy_parts_info No. %d -> part_break_vital", i)); error_handler.report("large_monster.update_parts", string.format("Failed to Access Data: enemy_parts_info No. %d -> part_break_vital", i));
end end
end end
@@ -1023,24 +1103,24 @@ function this.update_parts(enemy, monster, physical_param)
local part_loss_current = get_current_method:call(part_loss_vital); local part_loss_current = get_current_method:call(part_loss_vital);
if part_loss_current == nil then 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)); error_handler.report("large_monster.update_parts", string.format("Failed to Access Data: enemy_parts_info No. %d -> part_loss_current", i));
end end
local part_loss_max = get_max_method:call(part_loss_vital); local part_loss_max = get_max_method:call(part_loss_vital);
if part_loss_max == nil then 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)); error_handler.report("large_monster.update_parts", string.format("Failed to Access Data: enemy_parts_info No. %d -> part_loss_max", i));
end end
local is_severed = get_parts_loss_state_method:call(enemy_parts_info); local is_severed = get_parts_loss_state_method:call(enemy_parts_info);
if is_severed == nil then 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)); error_handler.report("large_monster.update_parts", string.format("Failed to Access Data: enemy_parts_info No. %d -> is_severed", i));
end end
if part_loss_current ~= nil and part_loss_max ~= nil and is_severed ~= nil then 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); body_part.update_loss(part, part_loss_current, part_loss_max, is_severed);
end end
else else
error_handler.report("large_monster.update_parts", string.format("Failed to access Data: enemy_parts_info No. %d -> part_loss_vital", i)); error_handler.report("large_monster.update_parts", string.format("Failed to Access Data: enemy_parts_info No. %d -> part_loss_vital", i));
end end
end end
@@ -1078,13 +1158,13 @@ function this.update_anomaly_parts(enemy, monster, mystery_param)
local core_parts_array = core_parts_array_field:get_data(mystery_param); local core_parts_array = core_parts_array_field:get_data(mystery_param);
if core_parts_array == nil then if core_parts_array == nil then
error_handler.report("large_monster.update_anomaly_parts", "Failed to access Data: core_parts_array"); error_handler.report("large_monster.update_anomaly_parts", "Failed to Access Data: core_parts_array");
return; return;
end end
local core_parts_array_length = get_length_method:call(core_parts_array); local core_parts_array_length = get_length_method:call(core_parts_array);
if core_parts_array_length == nil then if core_parts_array_length == nil then
error_handler.report("large_monster.update_anomaly_parts", "Failed to access Data: core_parts_array_length"); error_handler.report("large_monster.update_anomaly_parts", "Failed to Access Data: core_parts_array_length");
return; return;
end end
@@ -1093,7 +1173,7 @@ function this.update_anomaly_parts(enemy, monster, mystery_param)
local core_part = get_value_method:call(core_parts_array, i); local core_part = get_value_method:call(core_parts_array, i);
if core_part == nil then if core_part == nil then
error_handler.report("large_monster.update_anomaly_parts", "Failed to access Data: core_part No. " .. tostring(i)); error_handler.report("large_monster.update_anomaly_parts", "Failed to Access Data: core_part No. " .. tostring(i));
goto continue; goto continue;
end end
@@ -1110,13 +1190,13 @@ function this.update_anomaly_parts(enemy, monster, mystery_param)
local part_vital = core_parts_get_vital_method:call(core_part); local part_vital = core_parts_get_vital_method:call(core_part);
if part_vital == nil then if part_vital == nil then
error_handler.report("large_monster.update_anomaly_parts", "Failed to access Data: part_vital No. " .. tostring(i)); error_handler.report("large_monster.update_anomaly_parts", "Failed to Access Data: part_vital No. " .. tostring(i));
return; return;
end end
local part_is_active = core_parts_get_is_active_method:call(core_part); local part_is_active = core_parts_get_is_active_method:call(core_part);
if part_is_active == nil then if part_is_active == nil then
error_handler.report("large_monster.update_anomaly_parts", "Failed to access Data: part_is_active No. " .. tostring(i)); error_handler.report("large_monster.update_anomaly_parts", "Failed to Access Data: part_is_active No. " .. tostring(i));
return; return;
end end
@@ -1124,19 +1204,19 @@ function this.update_anomaly_parts(enemy, monster, mystery_param)
local part_current = get_current_method:call(part_vital); local part_current = get_current_method:call(part_vital);
if part_current == nil then if part_current == nil then
error_handler.report("large_monster.update_anomaly_parts", "Failed to access Data: part_current No. " .. tostring(i)); error_handler.report("large_monster.update_anomaly_parts", "Failed to Access Data: part_current No. " .. tostring(i));
goto continue; goto continue;
end end
local part_max = get_max_method:call(part_vital); local part_max = get_max_method:call(part_vital);
if part_max == nil then if part_max == nil then
error_handler.report("large_monster.update_anomaly_parts", "Failed to access Data: part_max No. " .. tostring(i)); error_handler.report("large_monster.update_anomaly_parts", "Failed to Access Data: part_max No. " .. tostring(i));
goto continue; goto continue;
end end
local part_is_enabled = is_enable_method:call(part_vital); local part_is_enabled = is_enable_method:call(part_vital);
if part_is_enabled == nil then if part_is_enabled == nil then
error_handler.report("large_monster.update_anomaly_parts", "Failed to access Data: part_is_enabled No. " .. tostring(i)); error_handler.report("large_monster.update_anomaly_parts", "Failed to Access Data: part_is_enabled No. " .. tostring(i));
goto continue; goto continue;
end end
@@ -1159,19 +1239,19 @@ function this.update_highlighted_id()
end end
if singletons.gui_manager == nil then if singletons.gui_manager == nil then
error_handler.report("large_monster.update_highlighted_id", "Failed to access Data: gui_manager"); error_handler.report("large_monster.update_highlighted_id", "Failed to Access Data: gui_manager");
return; return;
end end
local gui_hud_target_camera = get_tg_camera_method:call(singletons.gui_manager); local gui_hud_target_camera = get_tg_camera_method:call(singletons.gui_manager);
if gui_hud_target_camera == nil then if gui_hud_target_camera == nil then
error_handler.report("large_monster.update_highlighted_id", "Failed to access Data: gui_hud_target_camera"); error_handler.report("large_monster.update_highlighted_id", "Failed to Access Data: gui_hud_target_camera");
return; return;
end end
local highlighted_id = get_targeting_enemy_index_field:get_data(gui_hud_target_camera); local highlighted_id = get_targeting_enemy_index_field:get_data(gui_hud_target_camera);
if highlighted_id == nil then if highlighted_id == nil then
error_handler.report("large_monster_UI.update_highlighted_id", "Failed to access Data: highlighted_id"); error_handler.report("large_monster_UI.update_highlighted_id", "Failed to Access Data: highlighted_id");
return; return;
end end

View File

@@ -48,6 +48,39 @@ local package = package;
this.list = {}; this.list = {};
local enemy_character_base_type_def = sdk.find_type_definition("snow.enemy.EnemyCharacterBase");
local enemy_type_field = enemy_character_base_type_def:get_field("<EnemyType>k__BackingField");
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");
local get_ref_mesh_method = enemy_character_base_type_def:get_method("get_RefMesh");
local mesh_type_def = get_ref_mesh_method:get_return_type();
local get_game_object_method = mesh_type_def:get_method("get_GameObject");
local game_object_type_def = get_game_object_method:get_return_type();
local get_transform_method = game_object_type_def:get_method("get_Transform");
local transform_type_def = get_transform_method:get_return_type();
local get_joint_by_name_method = transform_type_def:get_method("getJointByName");
local joint_type_def = get_joint_by_name_method:get_return_type();
local get_position_method = joint_type_def:get_method("get_Position");
local get_physical_param_method = enemy_character_base_type_def:get_method("get_PhysicalParam");
local check_die_method = enemy_character_base_type_def:get_method("checkDie");
local physical_param_type = get_physical_param_method:get_return_type();
local get_vital_method = physical_param_type:get_method("getVital");
local vital_param_type = get_vital_method:get_return_type();
local get_current_method = vital_param_type:get_method("get_Current");
local get_max_method = vital_param_type:get_method("get_Max");
local get_pos_method = enemy_character_base_type_def:get_method("get_Pos");
function this.new(enemy) function this.new(enemy)
local monster = {}; local monster = {};
monster.is_large = false; monster.is_large = false;
@@ -58,7 +91,10 @@ function this.new(enemy)
monster.missing_health = 0; monster.missing_health = 0;
monster.capture_health = 0; monster.capture_health = 0;
monster.head_joint = nil;
monster.position = Vector3f.new(0, 0, 0); monster.position = Vector3f.new(0, 0, 0);
monster.head_position = Vector3f.new(0, 0, 0);
monster.distance = 0; monster.distance = 0;
monster.name = "Small Monster"; monster.name = "Small Monster";
@@ -89,16 +125,10 @@ function this.get_monster(enemy)
return monster; return monster;
end end
local enemy_character_base_type_def = sdk.find_type_definition("snow.enemy.EnemyCharacterBase");
local enemy_type_field = enemy_character_base_type_def:get_field("<EnemyType>k__BackingField");
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 this.init(monster, enemy) function this.init(monster, enemy)
local enemy_type = enemy_type_field:get_data(enemy); local enemy_type = enemy_type_field:get_data(enemy);
if enemy_type == nil then if enemy_type == nil then
error_handler.report("small_monster.init", "Failed to access Data: enemy_type"); error_handler.report("small_monster.init", "Failed to Access Data: enemy_type");
return; return;
end end
@@ -106,10 +136,12 @@ function this.init(monster, enemy)
local enemy_name = get_enemy_name_message_method:call(singletons.message_manager, enemy_type); local enemy_name = get_enemy_name_message_method:call(singletons.message_manager, enemy_type);
if enemy_name == nil then if enemy_name == nil then
error_handler.report("small_monster.init", "Failed to access Data: enemy_name"); error_handler.report("small_monster.init", "Failed to Access Data: enemy_name");
end end
monster.name = enemy_name; monster.name = enemy_name;
this.update_head_joint(enemy, monster);
end end
function this.init_UI(monster) function this.init_UI(monster)
@@ -153,18 +185,6 @@ function this.init_UI(monster)
); );
end end
local get_physical_param_method = enemy_character_base_type_def:get_method("get_PhysicalParam");
local check_die_method = enemy_character_base_type_def:get_method("checkDie");
local physical_param_type = get_physical_param_method:get_return_type();
local get_vital_method = physical_param_type:get_method("getVital");
local vital_param_type = get_vital_method:get_return_type();
local get_current_method = vital_param_type:get_method("get_Current");
local get_max_method = vital_param_type:get_method("get_Max");
local get_pos_method = enemy_character_base_type_def:get_method("get_Pos");
function this.update_position(enemy, monster) function this.update_position(enemy, monster)
local cached_config = config.current_config.small_monster_UI; local cached_config = config.current_config.small_monster_UI;
@@ -179,10 +199,71 @@ function this.update_position(enemy, monster)
local position = get_pos_method:call(enemy); local position = get_pos_method:call(enemy);
if position == nil then if position == nil then
error_handler.report("small_monster.update_position", "Failed to access Data: position"); error_handler.report("small_monster.update_position", "Failed to Access Data: position");
end end
monster.position = position; monster.position = position;
this.update_head_position(enemy, monster);
end
function this.update_head_joint(enemy, monster)
local mesh = get_ref_mesh_method:call(enemy);
if mesh == nil then
error_handler.report("small_monster.update_head_joint", "Failed to Access Data: Mesh");
return;
end
local game_object = get_game_object_method:call(mesh);
if game_object == nil then
error_handler.report("small_monster.update_head_joint", "Failed to Access Data: GameObject");
return;
end
local transform = get_transform_method:call(game_object);
if transform == nil then
error_handler.report("small_monster.update_head_joint", "Failed to Access Data: Transform");
return;
end
local head_joint = get_joint_by_name_method:call(transform, "Head_00")
or get_joint_by_name_method:call(transform, "Head")
or get_joint_by_name_method:call(transform, "Spine_00")
or get_joint_by_name_method:call(transform, "head")
or get_joint_by_name_method:call(transform, "root");
if head_joint == nil then
-- local out = "";
-- local joints = transform:get_Joints();
-- for i = 0, joints:get_Length() - 1 do
-- local joint = joints[i];
-- local joint_name = joint:get_Name();
-- out = out .. joint_name .. "\n";
-- end
-- error_handler.report(monster.name, out);
error_handler.report("small_monster.update_head_joint", "Failed to Access Data: HeadJoint");
return;
end
monster.head_joint = head_joint;
end
function this.update_head_position(enemy, monster)
if monster.head_joint == nil then
return;
end
local head_position = get_position_method:call(monster.head_joint);
if head_position == nil then
error_handler.report("small_monster.update_head_position", "Failed to Access Data: HeadPosition");
return;
end
monster.head_position = head_position;
end end
function this.update(enemy, monster) function this.update(enemy, monster)
@@ -194,7 +275,7 @@ function this.update(enemy, monster)
if dead_or_captured ~= nil then if dead_or_captured ~= nil then
monster.dead_or_captured = dead_or_captured; monster.dead_or_captured = dead_or_captured;
else else
error_handler.report("small_monster.update", "Failed to access Data: dead_or_captured"); error_handler.report("small_monster.update", "Failed to Access Data: dead_or_captured");
end end
pcall(ailments.update_ailments, enemy, monster); pcall(ailments.update_ailments, enemy, monster);
@@ -207,13 +288,13 @@ function this.update_health(enemy, monster)
local physical_param = get_physical_param_method:call(enemy); local physical_param = get_physical_param_method:call(enemy);
if physical_param == nil then if physical_param == nil then
error_handler.report("small_monster.update_health", "Failed to access Data: physical_param"); error_handler.report("small_monster.update_health", "Failed to Access Data: physical_param");
return; return;
end end
local vital_param = get_vital_method:call(physical_param, 0, 0); local vital_param = get_vital_method:call(physical_param, 0, 0);
if vital_param == nil then if vital_param == nil then
error_handler.report("small_monster.update_health", "Failed to access Data: vital_param"); error_handler.report("small_monster.update_health", "Failed to Access Data: vital_param");
return; return;
end end
@@ -221,7 +302,7 @@ function this.update_health(enemy, monster)
if health ~= nil then if health ~= nil then
monster.health = health; monster.health = health;
else else
error_handler.report("small_monster.update_health", "Failed to access Data: health"); error_handler.report("small_monster.update_health", "Failed to Access Data: health");
return; return;
end end
@@ -229,7 +310,7 @@ function this.update_health(enemy, monster)
if max_health ~= nil then if max_health ~= nil then
monster.max_health = max_health; monster.max_health = max_health;
else else
error_handler.report("small_monster.update_health", "Failed to access Data: max_health"); error_handler.report("small_monster.update_health", "Failed to Access Data: max_health");
return; return;
end end

View File

@@ -65,7 +65,7 @@ function this.update(dynamic_enabled, static_enabled, highlighted_enabled)
local cached_config = config.current_config.large_monster_UI; local cached_config = config.current_config.large_monster_UI;
if singletons.enemy_manager == nil then if singletons.enemy_manager == nil then
error_handler.report("large_monster_UI.update", "Failed to access Data: enemy_manager"); error_handler.report("large_monster_UI.update", "Failed to Access Data: enemy_manager");
return; return;
end end
@@ -73,7 +73,7 @@ function this.update(dynamic_enabled, static_enabled, highlighted_enabled)
local enemy_count = get_boss_enemy_count_method:call(singletons.enemy_manager); local enemy_count = get_boss_enemy_count_method:call(singletons.enemy_manager);
if enemy_count == nil then if enemy_count == nil then
error_handler.report("large_monster_UI.update", "Failed to access Data: enemy_count"); error_handler.report("large_monster_UI.update", "Failed to Access Data: enemy_count");
return; return;
end end
@@ -81,7 +81,7 @@ function this.update(dynamic_enabled, static_enabled, highlighted_enabled)
for i = 0, enemy_count - 1 do for i = 0, enemy_count - 1 do
local enemy = get_boss_enemy_method:call(singletons.enemy_manager, i); local enemy = get_boss_enemy_method:call(singletons.enemy_manager, i);
if enemy == nil then if enemy == nil then
error_handler.report("large_monster_UI.update", "Failed to access Data: enemy No. " .. tostring(i)); error_handler.report("large_monster_UI.update", "Failed to Access Data: enemy No. " .. tostring(i));
goto continue; goto continue;
end end
@@ -337,7 +337,13 @@ function this.draw_dynamic(cached_config)
local i = 0; local i = 0;
for _, monster in ipairs(displayed_dynamic_monsters) do for _, monster in ipairs(displayed_dynamic_monsters) do
local world_offset = Vector3f.new(cached_config.world_offset.x, cached_config.world_offset.y, cached_config.world_offset.z); local world_offset = Vector3f.new(cached_config.world_offset.x, cached_config.world_offset.y, cached_config.world_offset.z);
local position_on_screen = draw.world_to_screen(monster.position + world_offset);
local position_on_screen;
if cached_config.settings.head_tracking then
position_on_screen = draw.world_to_screen(monster.head_position + world_offset);
else
position_on_screen = draw.world_to_screen(monster.position + world_offset);
end
if position_on_screen == nil then if position_on_screen == nil then
goto continue; goto continue;

View File

@@ -126,7 +126,8 @@ end
function this.draw() function this.draw()
local cached_config = config.current_config.small_monster_UI; local cached_config = config.current_config.small_monster_UI;
local is_dynamic_positioning_enabled = cached_config.dynamic_positioning.enabled; local dynamic_positioning_config = cached_config.dynamic_positioning;
local is_dynamic_positioning_enabled = dynamic_positioning_config.enabled;
local i = 0; local i = 0;
for _, monster in ipairs(displayed_monsters) do for _, monster in ipairs(displayed_monsters) do
@@ -134,19 +135,23 @@ function this.draw()
if is_dynamic_positioning_enabled then if is_dynamic_positioning_enabled then
local world_offset = Vector3f.new( local world_offset = Vector3f.new(
cached_config.dynamic_positioning.world_offset.x, dynamic_positioning_config.world_offset.x,
cached_config.dynamic_positioning.world_offset.y, dynamic_positioning_config.world_offset.y,
cached_config.dynamic_positioning.world_offset.z dynamic_positioning_config.world_offset.z
); );
position_on_screen = draw.world_to_screen(monster.position + world_offset); if dynamic_positioning_config.head_tracking then
position_on_screen = draw.world_to_screen(monster.head_position + world_offset);
else
position_on_screen = draw.world_to_screen(monster.position + world_offset);
end
if position_on_screen == nil then if position_on_screen == nil then
goto continue; goto continue;
end end
position_on_screen.x = position_on_screen.x + cached_config.dynamic_positioning.viewport_offset.x; position_on_screen.x = position_on_screen.x + dynamic_positioning_config.viewport_offset.x;
position_on_screen.y = position_on_screen.y + cached_config.dynamic_positioning.viewport_offset.y; position_on_screen.y = position_on_screen.y + dynamic_positioning_config.viewport_offset.y;
else else
position_on_screen = screen.calculate_absolute_coordinates(cached_config.static_position); position_on_screen = screen.calculate_absolute_coordinates(cached_config.static_position);
if cached_config.settings.orientation == "Horizontal" then if cached_config.settings.orientation == "Horizontal" then
@@ -157,9 +162,9 @@ function this.draw()
end end
local opacity_scale = 1; local opacity_scale = 1;
if is_dynamic_positioning_enabled and cached_config.dynamic_positioning.opacity_falloff then if is_dynamic_positioning_enabled and dynamic_positioning_config.opacity_falloff then
monster.distance = (players.myself_position - monster.position):length(); monster.distance = (players.myself_position - monster.position):length();
opacity_scale = 1 - (monster.distance / cached_config.dynamic_positioning.max_distance); opacity_scale = 1 - (monster.distance / dynamic_positioning_config.max_distance);
end end
small_monster.draw(monster, cached_config, position_on_screen, opacity_scale); small_monster.draw(monster, cached_config, position_on_screen, opacity_scale);

View File

@@ -1338,6 +1338,11 @@ function this.draw_small_monster_UI()
config_changed = config_changed or changed; config_changed = config_changed or changed;
changed, cached_config.dynamic_positioning.head_tracking = imgui.checkbox(
language.current_language.customization_menu.head_tracking, cached_config.dynamic_positioning.head_tracking);
config_changed = config_changed or changed;
changed, cached_config.dynamic_positioning.opacity_falloff = changed, cached_config.dynamic_positioning.opacity_falloff =
imgui.checkbox(language.current_language.customization_menu.opacity_falloff, imgui.checkbox(language.current_language.customization_menu.opacity_falloff,
cached_config.dynamic_positioning.opacity_falloff); cached_config.dynamic_positioning.opacity_falloff);
@@ -1479,6 +1484,11 @@ function this.draw_large_monster_dynamic_UI()
config_changed = config_changed or changed; config_changed = config_changed or changed;
if imgui.tree_node(language.current_language.customization_menu.settings) then if imgui.tree_node(language.current_language.customization_menu.settings) then
changed, cached_config.settings.head_tracking = imgui.checkbox(
language.current_language.customization_menu.head_tracking, cached_config.settings.head_tracking);
config_changed = config_changed or changed;
changed, cached_config.settings.hide_dead_or_captured = imgui.checkbox( changed, cached_config.settings.hide_dead_or_captured = imgui.checkbox(
language.current_language.customization_menu.hide_dead_or_captured, cached_config.settings.hide_dead_or_captured); language.current_language.customization_menu.hide_dead_or_captured, cached_config.settings.hide_dead_or_captured);

View File

@@ -165,6 +165,7 @@
"global_position_modifier": "Global Position Modifier", "global_position_modifier": "Global Position Modifier",
"global_scale_modifier": "Global Scale Modifier", "global_scale_modifier": "Global Scale Modifier",
"global_settings": "Global Settings", "global_settings": "Global Settings",
"head_tracking": "Head Tracking",
"health": "Health", "health": "Health",
"health_anomaly_filter": "Health + Anomaly Core", "health_anomaly_filter": "Health + Anomaly Core",
"health_break_anomaly_filter": "Health + Break + Anomaly Core", "health_break_anomaly_filter": "Health + Break + Anomaly Core",

View File

@@ -165,6 +165,7 @@
"global_position_modifier": "全体的な位置の調整", "global_position_modifier": "全体的な位置の調整",
"global_scale_modifier": "全体的なスケールの調整", "global_scale_modifier": "全体的なスケールの調整",
"global_settings": "全体設定", "global_settings": "全体設定",
"head_tracking": "Head Tracking",
"health": "体力", "health": "体力",
"health_anomaly_filter": "Health + Anomaly Core", "health_anomaly_filter": "Health + Anomaly Core",
"health_break_anomaly_filter": "Health + Break + Anomaly Core", "health_break_anomaly_filter": "Health + Break + Anomaly Core",

View File

@@ -165,6 +165,7 @@
"global_position_modifier": "전역 위치 배율", "global_position_modifier": "전역 위치 배율",
"global_scale_modifier": "전역 크기 배율", "global_scale_modifier": "전역 크기 배율",
"global_settings": "전역 설정", "global_settings": "전역 설정",
"head_tracking": "Head Tracking",
"health": "체력", "health": "체력",
"health_anomaly_filter": "체력 + 괴이핵", "health_anomaly_filter": "체력 + 괴이핵",
"health_break_anomaly_filter": "체력 + 파괴 + 괴이핵", "health_break_anomaly_filter": "체력 + 파괴 + 괴이핵",

View File

@@ -165,6 +165,7 @@
"global_position_modifier": "Глобальный модификатор расположения", "global_position_modifier": "Глобальный модификатор расположения",
"global_scale_modifier": "Глобальный модификатор размера", "global_scale_modifier": "Глобальный модификатор размера",
"global_settings": "Общие настройки", "global_settings": "Общие настройки",
"head_tracking": "Head Tracking",
"health": "Здоровье", "health": "Здоровье",
"health_anomaly_filter": "Здоровье + Ядро аномалии", "health_anomaly_filter": "Здоровье + Ядро аномалии",
"health_break_anomaly_filter": "Здоровье + Повреждение + Ядро аномалии", "health_break_anomaly_filter": "Здоровье + Повреждение + Ядро аномалии",

View File

@@ -165,6 +165,7 @@
"global_position_modifier": "全局位置更改", "global_position_modifier": "全局位置更改",
"global_scale_modifier": "全局比例更改", "global_scale_modifier": "全局比例更改",
"global_settings": "全局设定", "global_settings": "全局设定",
"head_tracking": "Head Tracking",
"health": "生命", "health": "生命",
"health_anomaly_filter": "Health + Anomaly Core", "health_anomaly_filter": "Health + Anomaly Core",
"health_break_anomaly_filter": "Health + Break + Anomaly Core", "health_break_anomaly_filter": "Health + Break + Anomaly Core",

View File

@@ -165,6 +165,7 @@
"global_position_modifier": "全域位置更改", "global_position_modifier": "全域位置更改",
"global_scale_modifier": "全域比例更改", "global_scale_modifier": "全域比例更改",
"global_settings": "全域設定", "global_settings": "全域設定",
"head_tracking": "Head Tracking",
"health": "血量", "health": "血量",
"health_anomaly_filter": "Health + Anomaly Core", "health_anomaly_filter": "Health + Anomaly Core",
"health_break_anomaly_filter": "Health + Break + Anomaly Core", "health_break_anomaly_filter": "Health + Break + Anomaly Core",