Implemented Endemic Life UI.

This commit is contained in:
GreenComfyTea
2022-04-21 17:09:10 +03:00
parent 46a76a6a10
commit b94cffa073
26 changed files with 759 additions and 73 deletions

View File

@@ -15,6 +15,9 @@ local ailments = require("MHR_Overlay.Monsters.ailments");
local player = require("MHR_Overlay.Damage_Meter.player");
local damage_hook = require("MHR_Overlay.Damage_Meter.damage_hook");
local env_creature_hook = require("MHR_Overlay.Endemic_Life.env_creature_hook");
local env_creature = require("MHR_Overlay.Endemic_Life.env_creature");
local body_part = require("MHR_Overlay.Monsters.body_part");
local large_monster = require("MHR_Overlay.Monsters.large_monster");
local monster_hook = require("MHR_Overlay.Monsters.monster_hook");
@@ -31,6 +34,7 @@ local health_UI_entity = require("MHR_Overlay.UI.UI_Entities.health_UI_entity");
local stamina_UI_entity = require("MHR_Overlay.UI.UI_Entities.stamina_UI_entity");
local rage_UI_entity = require("MHR_Overlay.UI.UI_Entities.rage_UI_entity");
local ailment_UI_entity = require("MHR_Overlay.UI.UI_Entities.ailment_UI_entity");
local env_creature_UI = require("MHR_Overlay.UI.Modules.env_creature_UI");
local customization_menu = require("MHR_Overlay.UI.customization_menu");
local drawing = require("MHR_Overlay.UI.drawing");
@@ -52,16 +56,19 @@ health_UI_entity.init_module();
stamina_UI_entity.init_module();
rage_UI_entity.init_module();
ailment_UI_entity.init_module();
damage_hook.init_module();
player.init_module();
ailments.init_module();
env_creature_hook.init_module();
env_creature.init_module();
body_part.init_module();
ailments.init_module();
large_monster.init_module();
monster_hook.init_module();
small_monster.init_module();
customization_menu.init_module();
body_part_UI_entity.init_module();
damage_meter_UI.init_module();
@@ -69,6 +76,7 @@ drawing.init_module();
large_monster_UI.init_module();
small_monster_UI.init_module();
time_UI.init_module();
env_creature_UI.init_module();
keyboard.init_module();
@@ -144,6 +152,13 @@ end, function()
customization_menu.status = "Damage meter drawing function threw an exception";
end
end
if config.current_config.endemic_life_UI.enabled and config.current_config.global_settings.module_visibility.training_area.endemic_life_UI then
local success = pcall(env_creature_UI.draw);
if not success then
customization_menu.status = "Endemic life drawing function threw an exception";
end
end
end
elseif quest_status.is_result_screen then
if config.current_config.small_monster_UI.enabled and config.current_config.global_settings.module_visibility.quest_result_screen.small_monster_UI then
@@ -177,6 +192,13 @@ end, function()
customization_menu.status = "Damage meter drawing function threw an exception";
end
end
if config.current_config.endemic_life_UI.enabled and config.current_config.global_settings.module_visibility.quest_result_screen.endemic_life_UI then
local success = pcall(env_creature_UI.draw);
if not success then
customization_menu.status = "Endemic life drawing function threw an exception";
end
end
elseif quest_status.index == 2 then
if config.current_config.small_monster_UI.enabled and config.current_config.global_settings.module_visibility.during_quest.small_monster_UI then
@@ -212,6 +234,13 @@ end, function()
customization_menu.status = "Damage meter drawing function threw an exception";
end
end
if config.current_config.endemic_life_UI.enabled and config.current_config.global_settings.module_visibility.during_quest.endemic_life_UI then
local success = pcall(env_creature_UI.draw);
if not success then
customization_menu.status = "Endemic life drawing function threw an exception";
end
end
end
--snow.player.PlayerManager ->

View File

@@ -0,0 +1,134 @@
local env_creature = {};
local drawing;
local customization_menu;
local singletons;
local config;
local table_helpers;
env_creature.list = {};
function env_creature.new(REcreature)
local creature = {};
creature.life = 0;
creature.name = "Env Creature";
creature.is_inactive = true;
creature.game_object = nil;
creature.transform = nil;
creature.position = Vector3f.new(0, 0, 0);
creature.distance = 0;
env_creature.init(creature, REcreature);
env_creature.init_UI(creature);
if env_creature.list[REcreature] == nil then
env_creature.list[REcreature] = creature;
end
return creature;
end
function env_creature.get_creature(REcreature)
if env_creature.list[REcreature] == nil then
env_creature.list[REcreature] = env_creature.new(REcreature);
end
return env_creature.list[REcreature];
end
local environment_creature_base_type_def = sdk.find_type_definition("snow.envCreature.EnvironmentCreatureBase");
local creature_type_field = environment_creature_base_type_def:get_field("_Type");
local creature_is_inactive_field = environment_creature_base_type_def:get_field("<Muteki>k__BackingField");
local message_manager_type_def = sdk.find_type_definition("snow.gui.MessageManager");
local get_env_creature_name_message_method = message_manager_type_def:get_method("getEnvCreatureNameMessage");
function env_creature.init(creature, REcreature)
local creature_type = creature_type_field:get_data(REcreature);
if creature_type == nil then
customization_menu.status = "No env creature type";
return;
end
local creature_name = get_env_creature_name_message_method:call(singletons.message_manager, creature_type);
if creature_name ~= nil then
creature.name = creature_name;
end
end
function env_creature.init_UI(creature)
creature.name_label = table_helpers.deep_copy(config.current_config.endemic_life_UI.creature_name_label);
creature.name_label.offset.x = creature.name_label.offset.x * config.current_config.global_settings.modifiers.global_scale_modifier;
creature.name_label.offset.y = creature.name_label.offset.y * config.current_config.global_settings.modifiers.global_scale_modifier;
end
local get_game_object_method = sdk.find_type_definition("via.Component"):get_method("get_GameObject");
local get_transform_method = sdk.find_type_definition("via.GameObject"):get_method("get_Transform");
local get_position_method = sdk.find_type_definition("via.Transform"):get_method("get_Position");
function env_creature.update(REcreature)
if REcreature == nil then
return;
end
local creature = env_creature.get_creature(REcreature);
if creature.game_object == nil then
creature.game_object = get_game_object_method:call(REcreature);
if creature.game_object == nil then
customization_menu.status = "No enemy game object";
return;
end
end
if creature.transform == nil then
creature.transform = get_transform_method:call(creature.game_object);
if creature.transform == nil then
customization_menu.status = "No enemy transform";
return;
end
end
local position = get_position_method:call(creature.transform);
if position == nil then
customization_menu.status = "No enemy position";
return;
end
creature.position = position;
local is_inactive = creature_is_inactive_field:get_data(REcreature);
if is_inactive ~= nil then
creature.is_inactive = is_inactive;
end
end
function env_creature.draw(creature, position_on_screen, opacity_scale)
local text_width, text_height = drawing.font:measure(creature.name);
position_on_screen.x = position_on_screen.x - text_width / 2;
drawing.draw_label(creature.name_label, position_on_screen, opacity_scale, creature.name);
end
function env_creature.init_list()
env_creature.list = {};
end
function env_creature.init_module()
singletons = require("MHR_Overlay.Game_Handler.singletons");
customization_menu = require("MHR_Overlay.UI.customization_menu");
config = require("MHR_Overlay.Misc.config");
table_helpers = require("MHR_Overlay.Misc.table_helpers");
--health_UI_entity = require("MHR_Overlay.UI.UI_Entities.health_UI_entity");
--stamina_UI_entity = require("MHR_Overlay.UI.UI_Entities.stamina_UI_entity");
--screen = require("MHR_Overlay.Game_Handler.screen");
drawing = require("MHR_Overlay.UI.drawing");
--ailments = require("MHR_Overlay.Monsters.ailments");
--ailment_UI_entity = require("MHR_Overlay.UI.UI_Entities.ailment_UI_entity");
end
return env_creature;

View File

@@ -0,0 +1,26 @@
local env_creature_hook = {};
local env_creature;
local config;
local environment_creature_base_type_def = sdk.find_type_definition("snow.envCreature.EnvironmentCreatureBase");
local environment_creature_base_update_method = environment_creature_base_type_def:get_method("update");
sdk.hook(environment_creature_base_update_method, function(args)
pcall(env_creature_hook.update_env_creature, sdk.to_managed_object(args[2]));
end, function(retval)
return retval;
end);
function env_creature_hook.update_env_creature(REcreature)
if not config.current_config.endemic_life_UI.enabled then
return;
end
env_creature.update(REcreature);
end
function env_creature_hook.init_module()
config = require("MHR_Overlay.Misc.config");
env_creature = require("MHR_Overlay.Endemic_Life.env_creature");
end
return env_creature_hook;

View File

@@ -436,6 +436,17 @@ function keyboard.register_hotkey(hard_keyboard)
return true;
end
end
elseif customization_menu.endemic_life_UI_waiting_for_key then
for key, key_name in pairs(keyboard.keys) do
if get_release_method:call(hard_keyboard, key) then
config.current_config.global_settings.hotkeys_with_modifiers.endemic_life_UI.ctrl = keyboard.hotkey_modifiers_down.ctrl;
config.current_config.global_settings.hotkeys_with_modifiers.endemic_life_UI.shift = keyboard.hotkey_modifiers_down.shift;
config.current_config.global_settings.hotkeys_with_modifiers.endemic_life_UI.alt = keyboard.hotkey_modifiers_down.alt;
config.current_config.global_settings.hotkeys_with_modifiers.endemic_life_UI.key = key;
customization_menu.endemic_life_UI_waiting_for_key = false;
return true;
end
end
end
return false;
@@ -524,6 +535,14 @@ function keyboard.check_hotkeys(hard_keyboard)
config.current_config.damage_meter_UI.enabled = not config.current_config.damage_meter_UI.enabled;
end
end
if not (config.current_config.global_settings.hotkeys_with_modifiers.endemic_life_UI.ctrl and not keyboard.hotkey_modifiers_down.ctrl)
and not (config.current_config.global_settings.hotkeys_with_modifiers.endemic_life_UI.shift and not keyboard.hotkey_modifiers_down.shift)
and not (config.current_config.global_settings.hotkeys_with_modifiers.endemic_life_UI.alt and not keyboard.hotkey_modifiers_down.alt) then
if get_release_method:call(hard_keyboard, math.tointeger(config.current_config.global_settings.hotkeys_with_modifiers.endemic_life_UI.key)) then
config.current_config.endemic_life_UI.enabled = not config.current_config.endemic_life_UI.enabled;
end
end
end
function keyboard.get_hotkey_name(hotkey)

View File

@@ -40,7 +40,8 @@ function config.init()
large_monster_static_UI = true,
large_monster_highlighted_UI = true,
time_UI = true,
damage_meter_UI = true
damage_meter_UI = true,
endemic_life_UI = true,
},
quest_result_screen = {
@@ -49,14 +50,16 @@ function config.init()
large_monster_static_UI = true,
large_monster_highlighted_UI = true,
time_UI = true,
damage_meter_UI = true
damage_meter_UI = true,
endemic_life_UI = false
},
training_area = {
large_monster_dynamic_UI = true,
large_monster_static_UI = true,
large_monster_highlighted_UI = true,
damage_meter_UI = true
damage_meter_UI = true,
endemic_life_UI = true
}
},
@@ -115,6 +118,13 @@ function config.init()
ctrl = false,
alt = false,
key = 0
},
endemic_life_UI = {
shift = false,
ctrl = false,
alt = false,
key = 0
}
}
},
@@ -977,6 +987,11 @@ function config.init()
offset = {
x = 10,
y = 111
},
relative_offset = {
x = 0,
y = 45
},
@@ -1603,6 +1618,11 @@ function config.init()
offset = {
x = 10,
y = 73
},
relative_offset = {
x = 0,
y = 45
},
@@ -2211,6 +2231,11 @@ function config.init()
offset = {
x = 10,
y = 111
},
relative_offset = {
x = 0,
y = 45
},
@@ -2226,7 +2251,7 @@ function config.init()
hide_all_active_ailments = false,
hide_disabled_ailments = true,
offset_is_relative_to_parts = true,
time_limit = 0
time_limit = 15
},
sorting = {
@@ -2649,6 +2674,47 @@ function config.init()
background = 0xA7000000
}
}
},
endemic_life_UI = {
enabled = true,
settings = {
hide_inactive_creatures = true,
max_distance = 300,
opacity_falloff = true,
},
world_offset = {
x = 0,
y = 1,
z = 0
},
viewport_offset = {
x = 0,
y = 0
},
creature_name_label = {
visibility = true,
text = "%s",
offset = {
x = 0,
y = 0
},
color = 0xFFf4f3ab,
shadow = {
visibility = true,
offset = {
x = 1,
y = 1
},
color = 0xFF000000
}
},
}
};
end

View File

@@ -103,6 +103,7 @@ language.default_language = {
large_monster_UI = "Large Monster UI",
time_UI = "Time UI",
damage_meter_UI = "Damage Meter UI",
endemic_life_UI = "Endemic Life UI",
large_monster_dynamic_UI = "Large Monster Dynamic UI",
large_monster_static_UI = "Large Monster Static UI",
@@ -295,8 +296,12 @@ language.default_language = {
time_limit = "Time Limit (seconds)",
ailment_name_label = "Ailment Name Label",
ailment_name = "Ailment Name",
activation_count = "Activation Count"
activation_count = "Activation Count",
creature_name_label = "Creature Name Label",
hide_inactive_creatures = "Hide Inactive Creatures",
relative_offset = "Relative Offset"
}
};

View File

@@ -61,6 +61,9 @@ function ailments.new(_ailments, ailment_id)
_ailments[ailment_id].duration = 100000;
_ailments[ailment_id].timer_percentage = 0;
_ailments[ailment_id].minutes_left = 0;
_ailments[ailment_id].seconds_left = 0;
_ailments[ailment_id].is_active = false;
_ailments[ailment_id].activate_count = 0;
@@ -205,18 +208,34 @@ function ailments.update_ailments(enemy, monster)
local is_active = get_is_active_method:call(ailment_param);
if is_enable ~= nil then
if is_enable ~= monster.ailments[id].is_enable then
ailments.update_last_change_time(monster, id);
end
monster.ailments[id].is_enable = is_enable;
end
if activate_count ~= nil then
if activate_count ~= monster.ailments[id].activate_count then
ailments.update_last_change_time(monster, id);
end
monster.ailments[id].activate_count = activate_count;
end
if buildup ~= nil then
if buildup ~= monster.ailments[id].total_buildup then
ailments.update_last_change_time(monster, id);
end
monster.ailments[id].total_buildup = buildup;
end
if buildup_limit ~= nil then
if buildup_limit ~= monster.ailments[id].buildup_limit then
ailments.update_last_change_time(monster, id);
end
monster.ailments[id].buildup_limit = buildup_limit;
end
@@ -225,25 +244,64 @@ function ailments.update_ailments(enemy, monster)
end
if timer ~= nil then
if timer ~= monster.ailments[id].timer then
ailments.update_last_change_time(monster, id);
end
monster.ailments[id].timer = timer;
end
if duration ~= nil then
if is_active ~= nil then
if is_active ~= monster.ailments[id].is_active then
ailments.update_last_change_time(monster, id);
end
monster.ailments[id].is_active = is_active;
end
if duration ~= nil and not monster.ailments[id].is_active then
if duration ~= monster.ailments[id].duration then
xy = tostring(monster.ailments[id].is_active) .. " " .. tostring(monster.ailments[id].duration) .. " -> " .. tostring(duration);
ailments.update_last_change_time(monster, id);
end
monster.ailments[id].duration = duration;
end
if timer ~= nil and duration ~= nil then
if duration ~= 0 then
monster.ailments[id].timer_percentage = timer / duration;
if duration ~= 0 then
monster.ailments[id].timer_percentage = timer / monster.ailments[id].duration;
end
if is_active then
if timer < 0 then
timer = 0;
end
local minutes_left = math.floor(timer / 60);
local seconds_left = timer - 60 * minutes_left;
if duration ~= 0 then
monster.ailments[id].timer_percentage = timer / monster.ailments[id].duration;
end
monster.ailments[id].minutes_left = minutes_left;
monster.ailments[id].seconds_left = seconds_left;
end
if is_active ~= nil then
if is_active ~= monster.ailments[id].is_active then
ailments.update_last_change_time(monster, id);
end
monster.ailments[id].is_active = is_active;
end
end
end
function ailments.update_last_change_time(monster, id)
monster.ailments[id].last_change_time = time.total_elapsed_seconds;
end
-- Code by coavins
function ailments.update_poison_blast(enemy, is_large)
if enemy == nil then
@@ -301,11 +359,11 @@ function ailments.draw_dynamic(monster, ailments_position_on_screen, opacity_sca
--sort parts here
local displayed_ailments = {};
for REpart, ailment in pairs(monster.ailments) do
if config.current_config.large_monster_UI.dynamic.ailments.settings.hide_ailments_with_zero_buildup and ailment.total_buildup == 0 and ailment.buildup_limit ~= 0 and ailment.activate_count == 0 then
if config.current_config.large_monster_UI.dynamic.ailments.settings.hide_ailments_with_zero_buildup and ailment.total_buildup == 0 and ailment.buildup_limit ~= 0 and ailment.activate_count == 0 and not ailment.is_active then
goto continue;
end
if config.current_config.large_monster_UI.dynamic.ailments.settings.hide_inactive_ailments_with_no_buildup_support and ailment.buildup_limit == 0 then
if config.current_config.large_monster_UI.dynamic.ailments.settings.hide_inactive_ailments_with_no_buildup_support and ailment.buildup_limit == 0 and not ailment.is_active then
goto continue;
end
@@ -321,7 +379,7 @@ function ailments.draw_dynamic(monster, ailments_position_on_screen, opacity_sca
goto continue;
end
if config.current_config.large_monster_UI.dynamic.ailments.settings.time_limit ~= 0 and time.total_elapsed_seconds - ailment.last_change_time > config.current_config.large_monster_UI.dynamic.ailments.settings.time_limit then
if config.current_config.large_monster_UI.dynamic.ailments.settings.time_limit ~= 0 and time.total_elapsed_seconds - ailment.last_change_time > config.current_config.large_monster_UI.dynamic.ailments.settings.time_limit and not ailment.is_active then
goto continue;
end
@@ -374,14 +432,15 @@ function ailments.draw_dynamic(monster, ailments_position_on_screen, opacity_sca
end
function ailments.draw_static(monster, ailments_position_on_screen, opacity_scale)
--sort parts here
local displayed_ailments = {};
for REpart, ailment in pairs(monster.ailments) do
if config.current_config.large_monster_UI.static.ailments.settings.hide_ailments_with_zero_buildup and ailment.total_buildup == 0 and ailment.buildup_limit ~= 0 and ailment.activate_count == 0 then
if config.current_config.large_monster_UI.static.ailments.settings.hide_ailments_with_zero_buildup and ailment.total_buildup == 0 and ailment.buildup_limit ~= 0 and ailment.activate_count == 0 and not ailment.is_active then
goto continue;
end
if config.current_config.large_monster_UI.static.ailments.settings.hide_inactive_ailments_with_no_buildup_support and ailment.buildup_limit == 0 then
if config.current_config.large_monster_UI.static.ailments.settings.hide_inactive_ailments_with_no_buildup_support and ailment.buildup_limit == 0 and not ailment.is_active then
goto continue;
end
@@ -397,7 +456,7 @@ function ailments.draw_static(monster, ailments_position_on_screen, opacity_scal
goto continue;
end
if config.current_config.large_monster_UI.static.ailments.settings.time_limit ~= 0 and time.total_elapsed_seconds - ailment.last_change_time > config.current_config.large_monster_UI.static.ailments.settings.time_limit then
if config.current_config.large_monster_UI.static.ailments.settings.time_limit ~= 0 and time.total_elapsed_seconds - ailment.last_change_time > config.current_config.large_monster_UI.static.ailments.settings.time_limit and not ailment.is_active then
goto continue;
end
@@ -452,11 +511,11 @@ function ailments.draw_highlighted(monster, ailments_position_on_screen, opacity
--sort parts here
local displayed_ailments = {};
for id, ailment in pairs(monster.ailments) do
if config.current_config.large_monster_UI.highlighted.ailments.settings.hide_ailments_with_zero_buildup and ailment.total_buildup == 0 and ailment.buildup_limit ~= 0 and ailment.activate_count == 0 then
if config.current_config.large_monster_UI.highlighted.ailments.settings.hide_ailments_with_zero_buildup and ailment.total_buildup == 0 and ailment.buildup_limit ~= 0 and ailment.activate_count == 0 and not ailment.is_active then
goto continue;
end
if config.current_config.large_monster_UI.highlighted.ailments.settings.hide_inactive_ailments_with_no_buildup_support and ailment.buildup_limit == 0 then
if config.current_config.large_monster_UI.highlighted.ailments.settings.hide_inactive_ailments_with_no_buildup_support and ailment.buildup_limit == 0 and not ailment.is_active then
goto continue;
end
@@ -472,7 +531,7 @@ function ailments.draw_highlighted(monster, ailments_position_on_screen, opacity
goto continue;
end
if config.current_config.large_monster_UI.highlighted.ailments.settings.time_limit ~= 0 and time.total_elapsed_seconds - ailment.last_change_time > config.current_config.large_monster_UI.highlighted.ailments.settings.time_limit then
if config.current_config.large_monster_UI.highlighted.ailments.settings.time_limit ~= 0 and time.total_elapsed_seconds - ailment.last_change_time > config.current_config.large_monster_UI.highlighted.ailments.settings.time_limit and not ailment.is_active then
goto continue;
end
@@ -526,11 +585,11 @@ function ailments.draw_small(monster, ailments_position_on_screen, opacity_scale
--sort parts here
local displayed_ailments = {};
for REpart, ailment in pairs(monster.ailments) do
if config.current_config.small_monster_UI.ailments.settings.hide_ailments_with_zero_buildup and ailment.total_buildup == 0 and ailment.buildup_limit ~= 0 and ailment.activate_count == 0 then
if config.current_config.small_monster_UI.ailments.settings.hide_ailments_with_zero_buildup and ailment.total_buildup == 0 and ailment.buildup_limit ~= 0 and ailment.activate_count == 0 and not ailment.is_active then
goto continue;
end
if config.current_config.small_monster_UI.ailments.settings.hide_inactive_ailments_with_no_buildup_support and ailment.buildup_limit == 0 then
if config.current_config.small_monster_UI.ailments.settings.hide_inactive_ailments_with_no_buildup_support and ailment.buildup_limit == 0 and not ailment.is_active then
goto continue;
end
@@ -546,7 +605,7 @@ function ailments.draw_small(monster, ailments_position_on_screen, opacity_scale
goto continue;
end
if config.current_config.small_monster_UI.ailments.settings.time_limit ~= 0 and time.total_elapsed_seconds - ailment.last_change_time > config.current_config.small_monster_UI.ailments.settings.time_limit then
if config.current_config.small_monster_UI.ailments.settings.time_limit ~= 0 and time.total_elapsed_seconds - ailment.last_change_time > config.current_config.small_monster_UI.ailments.settings.time_limit and not ailment.is_active then
goto continue;
end

View File

@@ -54,8 +54,8 @@ function large_monster.new(enemy)
monster.rage_seconds_left = 0;
monster.rage_timer_percentage = 0;
monster.game_object = nil
monster.transform = nil
monster.game_object = nil;
monster.transform = nil;
monster.position = Vector3f.new(0, 0, 0);
monster.distance = 0;
@@ -123,6 +123,7 @@ function large_monster.init(monster, enemy)
if enemy_name ~= nil then
monster.name = enemy_name;
end
local set_info = get_set_info_method:call(enemy);
if set_info ~= nil then
local unique_id = get_unique_id_method:call(set_info);
@@ -371,7 +372,7 @@ function large_monster.update_position(enemy)
-- as these are pretty much guaranteed to stay constant
-- as long as the enemy is alive
if monster.game_object == nil then
monster.game_object = get_game_object_method:call(enemy)
monster.game_object = get_game_object_method:call(enemy);
if monster.game_object == nil then
customization_menu.status = "No enemy game object";
return;
@@ -379,14 +380,14 @@ function large_monster.update_position(enemy)
end
if monster.transform == nil then
monster.transform = get_transform_method:call(monster.game_object)
monster.transform = get_transform_method:call(monster.game_object);
if monster.transform == nil then
customization_menu.status = "No enemy transform";
return;
end
end
local position = get_position_method:call(monster.transform)
local position = get_position_method:call(monster.transform);
if not position then
customization_menu.status = "No enemy position";
return;
@@ -688,10 +689,11 @@ function large_monster.draw_dynamic(monster, position_on_screen, opacity_scale)
local last_part_position_on_screen = body_part.draw_dynamic(monster, parts_position_on_screen, opacity_scale);
if config.current_config.large_monster_UI.dynamic.ailments.settings.offset_is_relative_to_parts then
if last_part_position_on_screen == nil then
ailments_position_on_screen = parts_position_on_screen;
else
ailments_position_on_screen.y = last_part_position_on_screen.y + config.current_config.large_monster_UI.dynamic.ailments.offset.y * config.current_config.global_settings.modifiers.global_scale_modifier;
if last_part_position_on_screen ~= nil then
ailments_position_on_screen = {
x = last_part_position_on_screen.x + config.current_config.large_monster_UI.highlighted.ailments.relative_offset.x * config.current_config.global_settings.modifiers.global_scale_modifier,
y = last_part_position_on_screen.y + config.current_config.large_monster_UI.highlighted.ailments.relative_offset.y * config.current_config.global_settings.modifiers.global_scale_modifier
};
end
end
@@ -699,6 +701,7 @@ function large_monster.draw_dynamic(monster, position_on_screen, opacity_scale)
end
function large_monster.draw_static(monster, position_on_screen, opacity_scale)
local monster_name_text = "";
if config.current_config.large_monster_UI.static.monster_name_label.include.monster_name then
monster_name_text = string.format("%s ", monster.name);
@@ -721,6 +724,7 @@ function large_monster.draw_static(monster, position_on_screen, opacity_scale)
else
monster.health_static_UI.bar.colors = config.current_config.large_monster_UI.static.health.bar.normal_colors;
end
drawing.draw_label(monster.static_name_label, position_on_screen, opacity_scale, monster_name_text);
@@ -758,10 +762,11 @@ function large_monster.draw_static(monster, position_on_screen, opacity_scale)
local last_part_position_on_screen = body_part.draw_static(monster, parts_position_on_screen, opacity_scale);
if config.current_config.large_monster_UI.static.ailments.settings.offset_is_relative_to_parts then
if last_part_position_on_screen == nil then
ailments_position_on_screen = parts_position_on_screen;
else
ailments_position_on_screen.y = last_part_position_on_screen.y + config.current_config.large_monster_UI.static.ailments.offset.y * config.current_config.global_settings.modifiers.global_scale_modifier;
if last_part_position_on_screen ~= nil then
ailments_position_on_screen = {
x = last_part_position_on_screen.x + config.current_config.large_monster_UI.highlighted.ailments.relative_offset.x * config.current_config.global_settings.modifiers.global_scale_modifier,
y = last_part_position_on_screen.y + config.current_config.large_monster_UI.highlighted.ailments.relative_offset.y * config.current_config.global_settings.modifiers.global_scale_modifier
};
end
end
@@ -829,15 +834,11 @@ function large_monster.draw_highlighted(monster, position_on_screen, opacity_sca
local last_part_position_on_screen = body_part.draw_highlighted(monster, parts_position_on_screen, opacity_scale);
if config.current_config.large_monster_UI.highlighted.ailments.settings.offset_is_relative_to_parts then
if last_part_position_on_screen == nil then
if last_part_position_on_screen ~= nil then
ailments_position_on_screen = {
x = position_on_screen.x + config.current_config.large_monster_UI.highlighted.ailments.offset.x * config.current_config.global_settings.modifiers.global_scale_modifier,
y = parts_position_on_screen.y + config.current_config.large_monster_UI.highlighted.ailments.offset.y * config.current_config.global_settings.modifiers.global_scale_modifier
x = last_part_position_on_screen.x + config.current_config.large_monster_UI.highlighted.ailments.relative_offset.x * config.current_config.global_settings.modifiers.global_scale_modifier,
y = last_part_position_on_screen.y + config.current_config.large_monster_UI.highlighted.ailments.relative_offset.y * config.current_config.global_settings.modifiers.global_scale_modifier
};
else
ailments_position_on_screen.y = last_part_position_on_screen.y + config.current_config.large_monster_UI.highlighted.ailments.offset.y * config.current_config.global_settings.modifiers.global_scale_modifier;
end
end

View File

@@ -1,16 +1,16 @@
local monster = {};
local monster_hook = {};
local small_monster;
local large_monster;
local config;
local ailments;
local enemy_character_base_type_def = sdk.find_type_definition("snow.enemy.EnemyCharacterBase");
local enemy_character_base_type_def_update_method = enemy_character_base_type_def:get_method("update");
local enemy_character_base_update_method = enemy_character_base_type_def:get_method("update");
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)
pcall(monster.update_monster, sdk.to_managed_object(args[2]));
sdk.hook(enemy_character_base_update_method, function(args)
pcall(monster_hook.update_monster, sdk.to_managed_object(args[2]));
end, function(retval)
return retval;
end);
@@ -47,7 +47,7 @@ re.on_pre_application_entry("UpdateBehavior", function()
end
end)
function monster.update_monster(enemy)
function monster_hook.update_monster(enemy)
if enemy == nil then
return;
end
@@ -71,13 +71,13 @@ function monster.update_monster(enemy)
ailments.update_poison_blast(enemy, is_large);
if is_large then
monster.update_large_monster(enemy);
monster_hook.update_large_monster(enemy);
else
monster.update_small_monster(enemy);
monster_hook.update_small_monster(enemy);
end
end
function monster.update_large_monster(enemy)
function monster_hook.update_large_monster(enemy)
if not config.current_config.large_monster_UI.dynamic.enabled and
not config.current_config.large_monster_UI.static.enabled and
not config.current_config.large_monster_UI.highlighted.enabled then
@@ -111,7 +111,7 @@ function monster.update_large_monster(enemy)
large_monster.update(enemy);
end
function monster.update_small_monster(enemy)
function monster_hook.update_small_monster(enemy)
if not config.current_config.small_monster_UI.enabled then
return;
end
@@ -141,11 +141,11 @@ function monster.update_small_monster(enemy)
small_monster.update(enemy);
end
function monster.init_module()
function monster_hook.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");
end
return monster;
return monster_hook;

View File

@@ -27,8 +27,8 @@ function small_monster.new(enemy)
monster.stamina_percentage = 0;
monster.missing_stamina = 0;
monster.game_object = nil
monster.transform = nil
monster.game_object = nil;
monster.transform = nil;
monster.position = Vector3f.new(0, 0, 0);
monster.distance = 0;
@@ -54,14 +54,22 @@ function small_monster.get_monster(enemy)
return small_monster.list[enemy];
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 small_monster.init(monster, enemy)
local enemy_type = enemy:get_field("<EnemyType>k__BackingField");
local enemy_type = enemy_type_field:get_data(enemy);
if enemy_type == nil then
customization_menu.status = "No enemy type";
return;
end
local enemy_name = singletons.message_manager:call("getEnemyNameMessage", enemy_type);
monster.id = enemy_type;
local enemy_name = get_enemy_name_message_method:call(singletons.message_manager, enemy_type);
if enemy_name ~= nil then
monster.name = enemy_name;
end

View File

@@ -0,0 +1,81 @@
local env_creature_UI = {};
local singletons;
local config;
local customization_menu;
local large_monster;
local screen;
local player;
local drawing;
local table_helpers;
local health_UI_entity;
local stamina_UI_entity;
local rage_UI_entity;
local env_creature;
local enemy_manager_type_def = sdk.find_type_definition("snow.enemy.EnemyManager");
local get_boss_enemy_count_method = enemy_manager_type_def:get_method("getBossEnemyCount");
local get_boss_enemy_method = enemy_manager_type_def:get_method("getBossEnemy");
function env_creature_UI.draw()
if singletons.enemy_manager == nil then
return;
end
for _, creature in pairs(env_creature.list) do
if config.current_config.endemic_life_UI.settings.max_distance == 0 then
break;
end
if config.current_config.endemic_life_UI.settings.hide_inactive_creatures and creature.is_inactive then
goto continue;
end
local position_on_screen = {};
local world_offset = Vector3f.new(config.current_config.endemic_life_UI.world_offset.x, config.current_config.endemic_life_UI.world_offset.y, config.current_config.endemic_life_UI.world_offset.z);
position_on_screen = draw.world_to_screen(creature.position + world_offset);
if position_on_screen == nil then
goto continue;
end
position_on_screen.x = position_on_screen.x + config.current_config.endemic_life_UI.viewport_offset.x * config.current_config.global_settings.modifiers.global_scale_modifier;
position_on_screen.y = position_on_screen.y + config.current_config.endemic_life_UI.viewport_offset.y * config.current_config.global_settings.modifiers.global_scale_modifier;
creature.distance = (player.myself_position - creature.position):length();
local opacity_scale = 1;
if creature.distance > config.current_config.endemic_life_UI.settings.max_distance then
goto continue;
end
if config.current_config.endemic_life_UI.settings.opacity_falloff then
opacity_scale = 1 - (creature.distance / config.current_config.endemic_life_UI.settings.max_distance);
end
env_creature.draw(creature, position_on_screen, opacity_scale);
::continue::
end
end
function env_creature_UI.init_module()
singletons = require("MHR_Overlay.Game_Handler.singletons");
config = require("MHR_Overlay.Misc.config");
customization_menu = require("MHR_Overlay.UI.customization_menu");
large_monster = require("MHR_Overlay.Monsters.large_monster");
screen = require("MHR_Overlay.Game_Handler.screen");
player = require("MHR_Overlay.Damage_Meter.player");
drawing = require("MHR_Overlay.UI.drawing");
table_helpers = require("MHR_Overlay.Misc.table_helpers");
health_UI_entity = require("MHR_Overlay.UI.UI_Entities.health_UI_entity");
stamina_UI_entity = require("MHR_Overlay.UI.UI_Entities.stamina_UI_entity");
rage_UI_entity = require("MHR_Overlay.UI.UI_Entities.rage_UI_entity");
env_creature = require("MHR_Overlay.Endemic_Life.env_creature");
end
return env_creature_UI;

View File

@@ -15,6 +15,12 @@ local enemy_manager_type_def = sdk.find_type_definition("snow.enemy.EnemyManager
local get_boss_enemy_count_method = enemy_manager_type_def:get_method("getBossEnemyCount");
local get_boss_enemy_method = enemy_manager_type_def:get_method("getBossEnemy");
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 = get_tg_camera_method:get_return_type();
local get_targeting_enemy_index_field = tg_camera_type:get_field("OldTargetingEmIndex");
function large_monster_UI.draw(dynamic_enabled, static_enabled, highlighted_enabled)
if singletons.enemy_manager == nil then
return;
@@ -27,9 +33,9 @@ function large_monster_UI.draw(dynamic_enabled, static_enabled, highlighted_enab
local highlighted_monster = nil;
if singletons.gui_manager ~= nil then
local gui_hud_target_camera = singletons.gui_manager:call("get_refGuiHud_TgCamera");
local gui_hud_target_camera = get_tg_camera_method:call(singletons.gui_manager);
if gui_hud_target_camera ~= nil then
highlighted_id = gui_hud_target_camera:get_field("OldTargetingEmIndex");
highlighted_id = get_targeting_enemy_index_field:get_data(gui_hud_target_camera);
if highlighted_id == nil then
highlighted_id = -1;
@@ -37,6 +43,7 @@ function large_monster_UI.draw(dynamic_enabled, static_enabled, highlighted_enab
end
end
local enemy_count = get_boss_enemy_count_method:call(singletons.enemy_manager);
if enemy_count == nil then
return;

View File

@@ -56,7 +56,7 @@ function ailment_UI_entity.draw_dynamic(ailment, ailment_UI, position_on_screen,
drawing.draw_label(ailment_UI.name_label, position_on_screen, opacity_scale, ailment_name);
drawing.draw_label(ailment_UI.text_label, position_on_screen, opacity_scale, language.current_language.UI.buildup);
drawing.draw_label(ailment_UI.timer_label, position_on_screen, opacity_scale, 0, ailment.timer);
drawing.draw_label(ailment_UI.timer_label, position_on_screen, opacity_scale, ailment.minutes_left, ailment.seconds_left);
else
drawing.draw_bar(ailment_UI.bar, position_on_screen, opacity_scale, ailment.buildup_percentage);
@@ -85,7 +85,7 @@ function ailment_UI_entity.draw_static(ailment, ailment_UI, position_on_screen,
drawing.draw_label(ailment_UI.name_label, position_on_screen, opacity_scale, ailment_name);
drawing.draw_label(ailment_UI.text_label, position_on_screen, opacity_scale, language.current_language.UI.buildup);
drawing.draw_label(ailment_UI.timer_label, position_on_screen, opacity_scale, 0, ailment.timer);
drawing.draw_label(ailment_UI.timer_label, position_on_screen, opacity_scale, ailment.minutes_left, ailment.seconds_left);
else
drawing.draw_bar(ailment_UI.bar, position_on_screen, opacity_scale, ailment.buildup_percentage);
@@ -114,7 +114,7 @@ function ailment_UI_entity.draw_highlighted(ailment, ailment_UI, position_on_scr
drawing.draw_label(ailment_UI.name_label, position_on_screen, opacity_scale, ailment_name);
drawing.draw_label(ailment_UI.text_label, position_on_screen, opacity_scale, language.current_language.UI.buildup);
drawing.draw_label(ailment_UI.timer_label, position_on_screen, opacity_scale, 0, ailment.timer);
drawing.draw_label(ailment_UI.timer_label, position_on_screen, opacity_scale, ailment.minutes_left, ailment.seconds_left);
else
drawing.draw_bar(ailment_UI.bar, position_on_screen, opacity_scale, ailment.buildup_percentage);
@@ -143,7 +143,7 @@ function ailment_UI_entity.draw_small(ailment, ailment_UI, position_on_screen, o
drawing.draw_label(ailment_UI.name_label, position_on_screen, opacity_scale, ailment_name);
drawing.draw_label(ailment_UI.text_label, position_on_screen, opacity_scale, language.current_language.UI.buildup);
drawing.draw_label(ailment_UI.timer_label, position_on_screen, opacity_scale, 0, ailment.timer);
drawing.draw_label(ailment_UI.timer_label, position_on_screen, opacity_scale, ailment.minutes_left, ailment.seconds_left);
else
drawing.draw_bar(ailment_UI.bar, position_on_screen, opacity_scale, ailment.buildup_percentage);

View File

@@ -6,6 +6,7 @@ local screen;
local player;
local large_monster;
local small_monster;
local env_creature;
local language;
local part_names;
local time_UI;
@@ -105,6 +106,7 @@ customization_menu.large_monster_highlighted_UI_waiting_for_key = false;
customization_menu.time_UI_waiting_for_key = false;
customization_menu.damage_meter_UI_waiting_for_key = false;
customization_menu.endemic_life_UI_waiting_for_key = false;
function customization_menu.reload_font(pop_push)
local success, new_font = pcall(imgui.load_font, language.current_language.font_name, config.current_config.global_settings.menu_font.size, customization_menu.font_range);
@@ -266,8 +268,8 @@ function customization_menu.draw()
local large_monster_static_UI_changed = false;
local large_monster_highlighted_UI_changed = false;
local time_UI_changed = false;
local damage_meter_UI_changed = false;
local endemic_life_UI_changed = false;
local status_string = tostring(customization_menu.status);
imgui.text(language.current_language.customization_menu.status .. ": " .. status_string);
@@ -301,6 +303,10 @@ function customization_menu.draw()
config.current_config.damage_meter_UI.enabled);
config_changed = config_changed or changed;
changed, config.current_config.endemic_life_UI.enabled = imgui.checkbox(language.current_language.customization_menu.endemic_life_UI,
config.current_config.endemic_life_UI.enabled);
config_changed = config_changed or changed;
imgui.tree_pop();
end
@@ -320,7 +326,8 @@ function customization_menu.draw()
or customization_menu.large_monster_static_UI_waiting_for_key
or customization_menu.large_monster_highlighted_UI_waiting_for_key
or customization_menu.time_UI_waiting_for_key
or customization_menu.damage_meter_UI_waiting_for_key;
or customization_menu.damage_meter_UI_waiting_for_key
or customization_menu.endemic_life_UI_waiting_for_key;
if not is_any_other_waiting then
customization_menu.all_UI_waiting_for_key = true;
@@ -347,7 +354,8 @@ function customization_menu.draw()
or customization_menu.large_monster_static_UI_waiting_for_key
or customization_menu.large_monster_highlighted_UI_waiting_for_key
or customization_menu.time_UI_waiting_for_key
or customization_menu.damage_meter_UI_waiting_for_key;
or customization_menu.damage_meter_UI_waiting_for_key
or customization_menu.endemic_life_UI_waiting_for_key;
@@ -376,7 +384,8 @@ function customization_menu.draw()
or customization_menu.large_monster_static_UI_waiting_for_key
or customization_menu.large_monster_highlighted_UI_waiting_for_key
or customization_menu.time_UI_waiting_for_key
or customization_menu.damage_meter_UI_waiting_for_key;
or customization_menu.damage_meter_UI_waiting_for_key
or customization_menu.endemic_life_UI_waiting_for_key;
if not is_any_other_waiting then
customization_menu.large_monster_UI_waiting_for_key = true;
@@ -403,7 +412,8 @@ function customization_menu.draw()
or customization_menu.large_monster_static_UI_waiting_for_key
or customization_menu.large_monster_highlighted_UI_waiting_for_key
or customization_menu.time_UI_waiting_for_key
or customization_menu.damage_meter_UI_waiting_for_key;
or customization_menu.damage_meter_UI_waiting_for_key
or customization_menu.endemic_life_UI_waiting_for_key;
if not is_any_other_waiting then
customization_menu.large_monster_dynamic_UI_waiting_for_key = true;
@@ -430,7 +440,8 @@ function customization_menu.draw()
or customization_menu.large_monster_dynamic_UI_waiting_for_key
or customization_menu.large_monster_highlighted_UI_waiting_for_key
or customization_menu.time_UI_waiting_for_key
or customization_menu.damage_meter_UI_waiting_for_key;
or customization_menu.damage_meter_UI_waiting_for_key
or customization_menu.endemic_life_UI_waiting_for_key;
if not is_any_other_waiting then
customization_menu.large_monster_static_UI_waiting_for_key = true;
@@ -457,7 +468,8 @@ function customization_menu.draw()
or customization_menu.large_monster_dynamic_UI_waiting_for_key
or customization_menu.large_monster_static_UI_waiting_for_key
or customization_menu.time_UI_waiting_for_key
or customization_menu.damage_meter_UI_waiting_for_key;
or customization_menu.damage_meter_UI_waiting_for_key
or customization_menu.endemic_life_UI_waiting_for_key;
if not is_any_other_waiting then
customization_menu.large_monster_highlighted_UI_waiting_for_key = true;
@@ -484,7 +496,8 @@ function customization_menu.draw()
or customization_menu.large_monster_dynamic_UI_waiting_for_key
or customization_menu.large_monster_static_UI_waiting_for_key
or customization_menu.large_monster_highlighted_UI_waiting_for_key
or customization_menu.damage_meter_UI_waiting_for_key;
or customization_menu.damage_meter_UI_waiting_for_key
or customization_menu.endemic_life_UI_waiting_for_key;
if not is_any_other_waiting then
customization_menu.time_UI_waiting_for_key = true;
@@ -511,7 +524,8 @@ function customization_menu.draw()
or customization_menu.large_monster_dynamic_UI_waiting_for_key
or customization_menu.large_monster_static_UI_waiting_for_key
or customization_menu.large_monster_highlighted_UI_waiting_for_key
or customization_menu.time_UI_waiting_for_key;
or customization_menu.time_UI_waiting_for_key
or customization_menu.endemic_life_UI_waiting_for_key;
if not is_any_other_waiting then
customization_menu.damage_meter_UI_waiting_for_key = true;
@@ -523,6 +537,33 @@ function customization_menu.draw()
if customization_menu.endemic_life_UI_waiting_for_key then
if imgui.button(language.current_language.customization_menu.press_any_key) then
config.current_config.global_settings.hotkeys_with_modifiers.endemic_life_UI.key = 0;
config.current_config.global_settings.hotkeys_with_modifiers.endemic_life_UI.ctrl = false;
config.current_config.global_settings.hotkeys_with_modifiers.endemic_life_UI.shift = false;
config.current_config.global_settings.hotkeys_with_modifiers.endemic_life_UI.alt = false;
customization_menu.endemic_life_UI_waiting_for_key = false;
end
elseif imgui.button(language.current_language.customization_menu.endemic_life_UI) then
local is_any_other_waiting = customization_menu.all_UI_waiting_for_key
or customization_menu.small_monster_UI_waiting_for_key
or customization_menu.large_monster_UI_waiting_for_key
or customization_menu.large_monster_dynamic_UI_waiting_for_key
or customization_menu.large_monster_static_UI_waiting_for_key
or customization_menu.large_monster_highlighted_UI_waiting_for_key
or customization_menu.time_UI_waiting_for_key
or customization_menu.endemic_life_UI_waiting_for_key;
if not is_any_other_waiting then
customization_menu.endemic_life_UI_waiting_for_key = true;
end
end
imgui.same_line();
imgui.text(keyboard.get_hotkey_name(config.current_config.global_settings.hotkeys_with_modifiers.endemic_life_UI));
imgui.tree_pop();
end
@@ -675,6 +716,11 @@ function customization_menu.draw()
language.current_language.customization_menu.damage_meter_UI, config.current_config.global_settings.module_visibility.during_quest.damage_meter_UI);
config_changed = config_changed or changed;
changed, config.current_config.global_settings.module_visibility.during_quest.endemic_life_UI = imgui.checkbox(
language.current_language.customization_menu.endemic_life_UI, config.current_config.global_settings.module_visibility.during_quest.endemic_life_UI);
config_changed = config_changed or changed;
imgui.tree_pop();
end
@@ -710,6 +756,10 @@ function customization_menu.draw()
config.current_config.global_settings.module_visibility.quest_result_screen.damage_meter_UI);
config_changed = config_changed or changed;
changed, config.current_config.global_settings.module_visibility.during_quest.endemic_life_UI = imgui.checkbox(
language.current_language.customization_menu.endemic_life_UI, config.current_config.global_settings.module_visibility.during_quest.endemic_life_UI);
config_changed = config_changed or changed;
imgui.tree_pop();
end
@@ -729,6 +779,10 @@ function customization_menu.draw()
language.current_language.customization_menu.damage_meter_UI, config.current_config.global_settings.module_visibility.training_area.damage_meter_UI);
config_changed = config_changed or changed;
changed, config.current_config.global_settings.module_visibility.during_quest.endemic_life_UI = imgui.checkbox(
language.current_language.customization_menu.endemic_life_UI, config.current_config.global_settings.module_visibility.during_quest.endemic_life_UI);
config_changed = config_changed or changed;
imgui.tree_pop();
end
@@ -3531,6 +3585,20 @@ function customization_menu.draw()
imgui.tree_pop();
end
if imgui.tree_node(language.current_language.customization_menu.relative_offset) then
changed, config.current_config.large_monster_UI.dynamic.ailments.relative_offset.x = imgui.drag_float(language.current_language.customization_menu.x,
config.current_config.large_monster_UI.dynamic.ailments.relative_offset.x, 0.1, -screen.width, screen.width, "%.1f");
config_changed = config_changed or changed;
large_monster_dynamic_UI_changed = large_monster_dynamic_UI_changed or changed;
changed, config.current_config.large_monster_UI.dynamic.ailments.relative_offset.y = imgui.drag_float(language.current_language.customization_menu.y,
config.current_config.large_monster_UI.dynamic.ailments.relative_offset.y, 0.1, -screen.height, screen.height, "%.1f");
config_changed = config_changed or changed;
large_monster_dynamic_UI_changed = large_monster_dynamic_UI_changed or changed;
imgui.tree_pop();
end
if imgui.tree_node(language.current_language.customization_menu.spacing) then
changed, config.current_config.large_monster_UI.dynamic.ailments.spacing.x = imgui.drag_float(language.current_language.customization_menu.x,
@@ -5622,6 +5690,20 @@ function customization_menu.draw()
imgui.tree_pop();
end
if imgui.tree_node(language.current_language.customization_menu.relative_offset) then
changed, config.current_config.large_monster_UI.static.ailments.relative_offset.x = imgui.drag_float(language.current_language.customization_menu.x,
config.current_config.large_monster_UI.static.ailments.relative_offset.x, 0.1, -screen.width, screen.width, "%.1f");
config_changed = config_changed or changed;
large_monster_static_UI_changed = large_monster_static_UI_changed or changed;
changed, config.current_config.large_monster_UI.static.ailments.relative_offset.y = imgui.drag_float(language.current_language.customization_menu.y,
config.current_config.large_monster_UI.static.ailments.relative_offset.y, 0.1, -screen.height, screen.height, "%.1f");
config_changed = config_changed or changed;
large_monster_static_UI_changed = large_monster_static_UI_changed or changed;
imgui.tree_pop();
end
if imgui.tree_node(language.current_language.customization_menu.spacing) then
changed, config.current_config.large_monster_UI.static.ailments.spacing.x = imgui.drag_float(language.current_language.customization_menu.x,
@@ -7641,6 +7723,20 @@ function customization_menu.draw()
imgui.tree_pop();
end
if imgui.tree_node(language.current_language.customization_menu.relative_offset) then
changed, config.current_config.large_monster_UI.highlighted.ailments.relative_offset.x = imgui.drag_float(language.current_language.customization_menu.x,
config.current_config.large_monster_UI.highlighted.ailments.relative_offset.x, 0.1, -screen.width, screen.width, "%.1f");
config_changed = config_changed or changed;
large_monster_highlighted_UI_changed = large_monster_highlighted_UI_changed or changed;
changed, config.current_config.large_monster_UI.highlighted.ailments.relative_offset.y = imgui.drag_float(language.current_language.customization_menu.y,
config.current_config.large_monster_UI.highlighted.ailments.relative_offset.y, 0.1, -screen.height, screen.height, "%.1f");
config_changed = config_changed or changed;
large_monster_highlighted_UI_changed = large_monster_highlighted_UI_changed or changed;
imgui.tree_pop();
end
if imgui.tree_node(language.current_language.customization_menu.spacing) then
changed, config.current_config.large_monster_UI.highlighted.ailments.spacing.x = imgui.drag_float(language.current_language.customization_menu.x,
@@ -9149,6 +9245,133 @@ function customization_menu.draw()
imgui.tree_pop();
end
if imgui.tree_node(language.current_language.customization_menu.endemic_life_UI) then
changed, config.current_config.endemic_life_UI.enabled =
imgui.checkbox(language.current_language.customization_menu.enabled, config.current_config.endemic_life_UI.enabled);
config_changed = config_changed or changed;
endemic_life_UI_changed = endemic_life_UI_changed or changed;
if imgui.tree_node(language.current_language.customization_menu.settings) then
changed, config.current_config.endemic_life_UI.settings.hide_inactive_creatures = imgui.checkbox(language.current_language.customization_menu.hide_inactive_creatures, config.current_config.
endemic_life_UI.settings.hide_inactive_creatures);
config_changed = config_changed or changed;
changed, config.current_config.endemic_life_UI.settings.opacity_falloff =
imgui.checkbox(language.current_language.customization_menu.opacity_falloff, config.current_config.endemic_life_UI.settings.opacity_falloff);
config_changed = config_changed or changed;
endemic_life_UI_changed = endemic_life_UI_changed or changed;
changed, config.current_config.endemic_life_UI.settings.max_distance =
imgui.drag_float(language.current_language.customization_menu.max_distance, config.current_config.endemic_life_UI.settings.max_distance, 1, 0, 10000,
"%.0f");
config_changed = config_changed or changed;
endemic_life_UI_changed = endemic_life_UI_changed or changed;
imgui.tree_pop();
end
if imgui.tree_node(language.current_language.customization_menu.world_offset) then
changed, config.current_config.endemic_life_UI.world_offset.x = imgui.drag_float(language.current_language.customization_menu.x,
config.current_config.endemic_life_UI.world_offset.x, 0.1, -100, 100, "%.1f");
config_changed = config_changed or changed;
endemic_life_UI_changed = endemic_life_UI_changed or changed;
changed, config.current_config.endemic_life_UI.world_offset.y = imgui.drag_float(language.current_language.customization_menu.y,
config.current_config.endemic_life_UI.world_offset.y, 0.1, -100, 100, "%.1f");
config_changed = config_changed or changed;
endemic_life_UI_changed = endemic_life_UI_changed or changed;
changed, config.current_config.endemic_life_UI.world_offset.z = imgui.drag_float(language.current_language.customization_menu.z,
config.current_config.endemic_life_UI.world_offset.z, 0.1, -100, 100, "%.1f");
config_changed = config_changed or changed;
endemic_life_UI_changed = endemic_life_UI_changed or changed;
imgui.tree_pop();
end
if imgui.tree_node(language.current_language.customization_menu.viewport_offset) then
changed, config.current_config.endemic_life_UI.viewport_offset.x = imgui.drag_float(language.current_language.customization_menu.x,
config.current_config.endemic_life_UI.viewport_offset.x, 0.1, -screen.width, screen.width, "%.1f");
config_changed = config_changed or changed;
endemic_life_UI_changed = endemic_life_UI_changed or changed;
changed, config.current_config.endemic_life_UI.viewport_offset.y = imgui.drag_float(language.current_language.customization_menu.y,
config.current_config.endemic_life_UI.viewport_offset.y, 0.1, -screen.height, screen.height, "%.1f");
config_changed = config_changed or changed;
endemic_life_UI_changed = endemic_life_UI_changed or changed;
imgui.tree_pop();
end
if imgui.tree_node(language.current_language.customization_menu.creature_name_label) then
changed, config.current_config.endemic_life_UI.creature_name_label.visibility = imgui.checkbox(language.current_language.customization_menu.visible,
config.current_config.endemic_life_UI.creature_name_label.visibility);
config_changed = config_changed or changed;
endemic_life_UI_changed = endemic_life_UI_changed or changed;
if imgui.tree_node(language.current_language.customization_menu.offset) then
changed, config.current_config.endemic_life_UI.creature_name_label.offset.x = imgui.drag_float(language.current_language.customization_menu.x,
config.current_config.endemic_life_UI.creature_name_label.offset.x, 0.1, -screen.width, screen.width,
"%.1f");
config_changed = config_changed or changed;
endemic_life_UI_changed = endemic_life_UI_changed or changed;
changed, config.current_config.endemic_life_UI.creature_name_label.offset.y = imgui.drag_float(language.current_language.customization_menu.y,
config.current_config.endemic_life_UI.creature_name_label.offset.y, 0.1, -screen.height, screen.height,
"%.1f");
config_changed = config_changed or changed;
endemic_life_UI_changed = endemic_life_UI_changed or changed;
imgui.tree_pop();
end
if imgui.tree_node(language.current_language.customization_menu.color) then
changed, config.current_config.endemic_life_UI.creature_name_label.color = imgui.color_picker_argb("", config.current_config.endemic_life_UI.creature_name_label.color, customization_menu.color_picker_flags);
config_changed = config_changed or changed;
endemic_life_UI_changed = endemic_life_UI_changed or changed;
imgui.tree_pop();
end
if imgui.tree_node(language.current_language.customization_menu.shadow) then
changed, config.current_config.endemic_life_UI.creature_name_label.shadow.visibility = imgui.checkbox(
language.current_language.customization_menu.visible, config.current_config.endemic_life_UI.creature_name_label.shadow.visibility);
config_changed = config_changed or changed;
endemic_life_UI_changed = endemic_life_UI_changed or changed;
if imgui.tree_node(language.current_language.customization_menu.offset) then
changed, config.current_config.endemic_life_UI.creature_name_label.shadow.offset.x = imgui.drag_float(language.current_language.customization_menu.x,
config.current_config.endemic_life_UI.creature_name_label.shadow.offset.x, 0.1, -screen.width,
screen.width, "%.1f");
config_changed = config_changed or changed;
endemic_life_UI_changed = endemic_life_UI_changed or changed;
changed, config.current_config.endemic_life_UI.creature_name_label.shadow.offset.y = imgui.drag_float(language.current_language.customization_menu.y,
config.current_config.endemic_life_UI.creature_name_label.shadow.offset.y, 0.1, -screen.height,
screen.height, "%.1f");
config_changed = config_changed or changed;
endemic_life_UI_changed = endemic_life_UI_changed or changed;
imgui.tree_pop();
end
if imgui.tree_node(language.current_language.customization_menu.color) then
changed, config.current_config.endemic_life_UI.creature_name_label.shadow.color = imgui.color_picker_argb("", config.current_config.endemic_life_UI.creature_name_label.shadow.color, customization_menu.color_picker_flags);
config_changed = config_changed or changed;
endemic_life_UI_changed = endemic_life_UI_changed or changed;
imgui.tree_pop();
end
imgui.tree_pop();
end
imgui.tree_pop();
end
imgui.tree_pop();
end
imgui.end_window();
imgui.pop_font(customization_menu.font);
@@ -9187,6 +9410,13 @@ function customization_menu.draw()
end
end
if endemic_life_UI_changed or modifiers_changed then
for _, creature in pairs(env_creature.list) do
env_creature.init_UI(creature);
end
end
if config_changed then
config.save();
end
@@ -9200,6 +9430,7 @@ function customization_menu.init_module()
player = require("MHR_Overlay.Damage_Meter.player");
small_monster = require("MHR_Overlay.Monsters.small_monster");
large_monster = require("MHR_Overlay.Monsters.large_monster");
env_creature = require("MHR_Overlay.Endemic_Life.env_creature");
part_names = require("MHR_Overlay.Misc.part_names");
time_UI = require("MHR_Overlay.UI.Modules.time_UI");
keyboard = require("MHR_Overlay.Game_Handler.keyboard");

View File

@@ -88,6 +88,10 @@ function drawing.draw_bar(bar, position, opacity_scale, percentage)
percentage = 1;
end
if percentage < 0 then
percentage = 0;
end
local position_x = position.x + bar.offset.x;
local position_y = position.y + bar.offset.y;
local foreground_width = bar.size.width * percentage;