Release v1.11

1) Cache config access function-wide where possible;
2) Break and Sever values added to parts;
3) Hooks are now applied in init_module instead of global space;
4) Added checks for submodule (health, stamina, etc) visibility. If not visible, do not pull data.
This commit is contained in:
GreenComfyTea
2022-06-20 13:01:10 +03:00
parent 286c54aa55
commit f64d6c84d3
31 changed files with 1617 additions and 1539 deletions

View File

@@ -22,12 +22,6 @@ local get_elemental_damage_method = enemy_calc_damage_info_type_def:get_method("
local get_condition_damage_method = enemy_calc_damage_info_type_def:get_method("get_ConditionDamage"); local get_condition_damage_method = enemy_calc_damage_info_type_def:get_method("get_ConditionDamage");
local get_condition_type_method = enemy_calc_damage_info_type_def:get_method("get_ConditionDamageType"); local get_condition_type_method = enemy_calc_damage_info_type_def:get_method("get_ConditionDamageType");
sdk.hook(enemy_character_base_after_calc_damage_damage_side, function(args)
pcall(damage_hook.update_damage, args);
end, function(retval)
return retval;
end);
function damage_hook.update_damage(args) function damage_hook.update_damage(args)
local enemy = sdk.to_managed_object(args[2]); local enemy = sdk.to_managed_object(args[2]);
if enemy == nil then if enemy == nil then
@@ -109,9 +103,6 @@ function damage_hook.update_damage(args)
end end
local attacking_player = player.get_player(attacker_id); local attacking_player = player.get_player(attacker_id);
if attacking_player == nil then
--return;
end
local monster; local monster;
if is_large_monster then if is_large_monster then
@@ -138,6 +129,12 @@ function damage_hook.init_module()
small_monster = require("MHR_Overlay.Monsters.small_monster"); small_monster = require("MHR_Overlay.Monsters.small_monster");
large_monster = require("MHR_Overlay.Monsters.large_monster"); large_monster = require("MHR_Overlay.Monsters.large_monster");
ailments = require("MHR_Overlay.Monsters.ailments"); ailments = require("MHR_Overlay.Monsters.ailments");
sdk.hook(enemy_character_base_after_calc_damage_damage_side, function(args)
pcall(damage_hook.update_damage, args);
end, function(retval)
return retval;
end);
end end
return damage_hook; return damage_hook;

View File

@@ -191,70 +191,72 @@ function player.update_display(_player)
_player.display.elemental_damage = 0; _player.display.elemental_damage = 0;
_player.display.ailment_damage = 0; _player.display.ailment_damage = 0;
if config.current_config.damage_meter_UI.tracked_monster_types.small_monsters then local cached_config = config.current_config.damage_meter_UI;
if config.current_config.damage_meter_UI.tracked_damage_types.player_damage then
if cached_config.tracked_monster_types.small_monsters then
if cached_config.tracked_damage_types.player_damage then
player.merge_damage(_player.display, _player.small_monsters); player.merge_damage(_player.display, _player.small_monsters);
end end
if config.current_config.damage_meter_UI.tracked_damage_types.bomb_damage then if cached_config.tracked_damage_types.bomb_damage then
player.merge_damage(_player.display, _player.small_monsters.bombs); player.merge_damage(_player.display, _player.small_monsters.bombs);
end end
if config.current_config.damage_meter_UI.tracked_damage_types.kunai_damage then if cached_config.tracked_damage_types.kunai_damage then
player.merge_damage(_player.display, _player.small_monsters.kunai); player.merge_damage(_player.display, _player.small_monsters.kunai);
end end
if config.current_config.damage_meter_UI.tracked_damage_types.installation_damage then if cached_config.tracked_damage_types.installation_damage then
player.merge_damage(_player.display, _player.small_monsters.installations); player.merge_damage(_player.display, _player.small_monsters.installations);
end end
if config.current_config.damage_meter_UI.tracked_damage_types.otomo_damage then if cached_config.tracked_damage_types.otomo_damage then
player.merge_damage(_player.display, _player.small_monsters.otomo); player.merge_damage(_player.display, _player.small_monsters.otomo);
end end
if config.current_config.damage_meter_UI.tracked_damage_types.monster_damage then if cached_config.tracked_damage_types.monster_damage then
player.merge_damage(_player.display, _player.small_monsters.monster); player.merge_damage(_player.display, _player.small_monsters.monster);
end end
if config.current_config.damage_meter_UI.tracked_damage_types.poison_damage then if cached_config.tracked_damage_types.poison_damage then
player.merge_damage(_player.display, _player.small_monsters.poison); player.merge_damage(_player.display, _player.small_monsters.poison);
end end
if config.current_config.damage_meter_UI.tracked_damage_types.blast_damage then if cached_config.tracked_damage_types.blast_damage then
player.merge_damage(_player.display, _player.small_monsters.blast); player.merge_damage(_player.display, _player.small_monsters.blast);
end end
end end
if config.current_config.damage_meter_UI.tracked_monster_types.large_monsters then if cached_config.tracked_monster_types.large_monsters then
if config.current_config.damage_meter_UI.tracked_damage_types.player_damage then if cached_config.tracked_damage_types.player_damage then
player.merge_damage(_player.display, _player.large_monsters); player.merge_damage(_player.display, _player.large_monsters);
end end
if config.current_config.damage_meter_UI.tracked_damage_types.bomb_damage then if cached_config.tracked_damage_types.bomb_damage then
player.merge_damage(_player.display, _player.large_monsters.bombs); player.merge_damage(_player.display, _player.large_monsters.bombs);
end end
if config.current_config.damage_meter_UI.tracked_damage_types.kunai_damage then if cached_config.tracked_damage_types.kunai_damage then
player.merge_damage(_player.display, _player.large_monsters.kunai); player.merge_damage(_player.display, _player.large_monsters.kunai);
end end
if config.current_config.damage_meter_UI.tracked_damage_types.installation_damage then if cached_config.tracked_damage_types.installation_damage then
player.merge_damage(_player.display, _player.large_monsters.installations); player.merge_damage(_player.display, _player.large_monsters.installations);
end end
if config.current_config.damage_meter_UI.tracked_damage_types.otomo_damage then if cached_config.tracked_damage_types.otomo_damage then
player.merge_damage(_player.display, _player.large_monsters.otomo); player.merge_damage(_player.display, _player.large_monsters.otomo);
end end
if config.current_config.damage_meter_UI.tracked_damage_types.monster_damage then if cached_config.tracked_damage_types.monster_damage then
player.merge_damage(_player.display, _player.large_monsters.monster); player.merge_damage(_player.display, _player.large_monsters.monster);
end end
if config.current_config.damage_meter_UI.tracked_damage_types.poison_damage then if cached_config.tracked_damage_types.poison_damage then
player.merge_damage(_player.display, _player.large_monsters.poison); player.merge_damage(_player.display, _player.large_monsters.poison);
end end
if config.current_config.damage_meter_UI.tracked_damage_types.blast_damage then if cached_config.tracked_damage_types.blast_damage then
player.merge_damage(_player.display, _player.large_monsters.blast); player.merge_damage(_player.display, _player.large_monsters.blast);
end end
end end
@@ -498,32 +500,37 @@ function player.update_player_list_on_quest()
end end
function player.init_UI(_player) function player.init_UI(_player)
local cached_config = config.current_config.damage_meter_UI;
_player.damage_UI = damage_UI_entity.new( _player.damage_UI = damage_UI_entity.new(
config.current_config.damage_meter_UI.damage_bar, cached_config.damage_bar,
config.current_config.damage_meter_UI.highlighted_damage_bar, cached_config.highlighted_damage_bar,
config.current_config.damage_meter_UI.player_name_label, cached_config.player_name_label,
config.current_config.damage_meter_UI.dps_label, cached_config.dps_label,
config.current_config.damage_meter_UI.hunter_rank_label, cached_config.hunter_rank_label,
config.current_config.damage_meter_UI.damage_value_label, cached_config.damage_value_label,
config.current_config.damage_meter_UI.damage_percentage_label cached_config.damage_percentage_label
); );
end end
function player.init_total_UI(_player) function player.init_total_UI(_player)
local cached_config = config.current_config.damage_meter_UI;
local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
_player.damage_UI = { _player.damage_UI = {
total_damage_label = table_helpers.deep_copy(config.current_config.damage_meter_UI.total_damage_label), total_damage_label = table_helpers.deep_copy(cached_config.total_damage_label),
total_damage_value_label = table_helpers.deep_copy(config.current_config.damage_meter_UI.total_damage_value_label), total_damage_value_label = table_helpers.deep_copy(cached_config.total_damage_value_label),
total_dps_label = table_helpers.deep_copy(config.current_config.damage_meter_UI.total_dps_label) total_dps_label = table_helpers.deep_copy(cached_config.total_dps_label)
}; };
_player.damage_UI.total_damage_label.offset.x = _player.damage_UI.total_damage_label.offset.x * config.current_config.global_settings.modifiers.global_scale_modifier; _player.damage_UI.total_damage_label.offset.x = _player.damage_UI.total_damage_label.offset.x * global_scale_modifier;
_player.damage_UI.total_damage_label.offset.y = _player.damage_UI.total_damage_label.offset.y * config.current_config.global_settings.modifiers.global_scale_modifier; _player.damage_UI.total_damage_label.offset.y = _player.damage_UI.total_damage_label.offset.y * global_scale_modifier;
_player.damage_UI.total_damage_value_label.offset.x = _player.damage_UI.total_damage_value_label.offset.x * config.current_config.global_settings.modifiers.global_scale_modifier; _player.damage_UI.total_damage_value_label.offset.x = _player.damage_UI.total_damage_value_label.offset.x * global_scale_modifier;
_player.damage_UI.total_damage_value_label.offset.y = _player.damage_UI.total_damage_value_label.offset.y * config.current_config.global_settings.modifiers.global_scale_modifier; _player.damage_UI.total_damage_value_label.offset.y = _player.damage_UI.total_damage_value_label.offset.y * global_scale_modifier;
_player.damage_UI.total_dps_label.offset.x = _player.damage_UI.total_dps_label.offset.x * config.current_config.global_settings.modifiers.global_scale_modifier; _player.damage_UI.total_dps_label.offset.x = _player.damage_UI.total_dps_label.offset.x * global_scale_modifier;
_player.damage_UI.total_dps_label.offset.y = _player.damage_UI.total_dps_label.offset.y * config.current_config.global_settings.modifiers.global_scale_modifier; _player.damage_UI.total_dps_label.offset.y = _player.damage_UI.total_dps_label.offset.y * global_scale_modifier;
end end
function player.draw(_player, position_on_screen, opacity_scale, top_damage, top_dps) function player.draw(_player, position_on_screen, opacity_scale, top_damage, top_dps)

View File

@@ -62,13 +62,11 @@ end
function env_creature.init_UI(creature) 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 = 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; local global_scale_modifier = 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"); creature.name_label.offset.x = creature.name_label.offset.x * global_scale_modifier;
--local get_transform_method = sdk.find_type_definition("via.GameObject"):get_method("get_Transform"); creature.name_label.offset.y = creature.name_label.offset.y * global_scale_modifier;
--local get_position_method = sdk.find_type_definition("via.Transform"):get_method("get_Position"); end
function env_creature.update(REcreature) function env_creature.update(REcreature)
if not config.current_config.endemic_life_UI.enabled then if not config.current_config.endemic_life_UI.enabled then
@@ -82,33 +80,6 @@ function env_creature.update(REcreature)
creature.position = position; creature.position = position;
end end
--[[
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); local is_inactive = creature_is_inactive_field:get_data(REcreature);
if is_inactive ~= nil then if is_inactive ~= nil then
creature.is_inactive = is_inactive; creature.is_inactive = is_inactive;

View File

@@ -5,11 +5,6 @@ local time;
local environment_creature_base_type_def = sdk.find_type_definition("snow.envCreature.EnvironmentCreatureBase"); 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"); 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) function env_creature_hook.update_env_creature(REcreature)
if not config.current_config.endemic_life_UI.enabled then if not config.current_config.endemic_life_UI.enabled then
@@ -23,6 +18,12 @@ function env_creature_hook.init_module()
config = require("MHR_Overlay.Misc.config"); config = require("MHR_Overlay.Misc.config");
env_creature = require("MHR_Overlay.Endemic_Life.env_creature"); env_creature = require("MHR_Overlay.Endemic_Life.env_creature");
time = require("MHR_Overlay.Game_Handler.time"); time = require("MHR_Overlay.Game_Handler.time");
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);
end end
return env_creature_hook; return env_creature_hook;

View File

@@ -348,13 +348,15 @@ function keyboard.check_modifiers(hard_keyboard)
end end
function keyboard.register_hotkey(hard_keyboard) function keyboard.register_hotkey(hard_keyboard)
local cached_config = config.current_config.global_settings.hotkeys_with_modifiers;
if customization_menu.all_UI_waiting_for_key then if customization_menu.all_UI_waiting_for_key then
for key, key_name in pairs(keyboard.keys) do for key, key_name in pairs(keyboard.keys) do
if get_release_method:call(hard_keyboard, key) then if get_release_method:call(hard_keyboard, key) then
config.current_config.global_settings.hotkeys_with_modifiers.all_UI.ctrl = keyboard.hotkey_modifiers_down.ctrl; cached_config.all_UI.ctrl = keyboard.hotkey_modifiers_down.ctrl;
config.current_config.global_settings.hotkeys_with_modifiers.all_UI.shift = keyboard.hotkey_modifiers_down.shift; cached_config.all_UI.shift = keyboard.hotkey_modifiers_down.shift;
config.current_config.global_settings.hotkeys_with_modifiers.all_UI.alt = keyboard.hotkey_modifiers_down.alt; cached_config.all_UI.alt = keyboard.hotkey_modifiers_down.alt;
config.current_config.global_settings.hotkeys_with_modifiers.all_UI.key = key; cached_config.all_UI.key = key;
customization_menu.all_UI_waiting_for_key = false; customization_menu.all_UI_waiting_for_key = false;
return true; return true;
end end
@@ -362,10 +364,10 @@ function keyboard.register_hotkey(hard_keyboard)
elseif customization_menu.small_monster_UI_waiting_for_key then elseif customization_menu.small_monster_UI_waiting_for_key then
for key, key_name in pairs(keyboard.keys) do for key, key_name in pairs(keyboard.keys) do
if get_release_method:call(hard_keyboard, key) then if get_release_method:call(hard_keyboard, key) then
config.current_config.global_settings.hotkeys_with_modifiers.small_monster_UI.ctrl = keyboard.hotkey_modifiers_down.ctrl; cached_config.small_monster_UI.ctrl = keyboard.hotkey_modifiers_down.ctrl;
config.current_config.global_settings.hotkeys_with_modifiers.small_monster_UI.shift = keyboard.hotkey_modifiers_down.shift; cached_config.small_monster_UI.shift = keyboard.hotkey_modifiers_down.shift;
config.current_config.global_settings.hotkeys_with_modifiers.small_monster_UI.alt = keyboard.hotkey_modifiers_down.alt; cached_config.small_monster_UI.alt = keyboard.hotkey_modifiers_down.alt;
config.current_config.global_settings.hotkeys_with_modifiers.small_monster_UI.key = key; cached_config.small_monster_UI.key = key;
customization_menu.small_monster_UI_waiting_for_key = false; customization_menu.small_monster_UI_waiting_for_key = false;
return true; return true;
end end
@@ -373,10 +375,10 @@ function keyboard.register_hotkey(hard_keyboard)
elseif customization_menu.large_monster_UI_waiting_for_key then elseif customization_menu.large_monster_UI_waiting_for_key then
for key, key_name in pairs(keyboard.keys) do for key, key_name in pairs(keyboard.keys) do
if get_release_method:call(hard_keyboard, key) then if get_release_method:call(hard_keyboard, key) then
config.current_config.global_settings.hotkeys_with_modifiers.large_monster_UI.ctrl = keyboard.hotkey_modifiers_down.ctrl; cached_config.large_monster_UI.ctrl = keyboard.hotkey_modifiers_down.ctrl;
config.current_config.global_settings.hotkeys_with_modifiers.large_monster_UI.shift = keyboard.hotkey_modifiers_down.shift; cached_config.large_monster_UI.shift = keyboard.hotkey_modifiers_down.shift;
config.current_config.global_settings.hotkeys_with_modifiers.large_monster_UI.alt = keyboard.hotkey_modifiers_down.alt; cached_config.large_monster_UI.alt = keyboard.hotkey_modifiers_down.alt;
config.current_config.global_settings.hotkeys_with_modifiers.large_monster_UI.key = key; cached_config.large_monster_UI.key = key;
customization_menu.large_monster_UI_waiting_for_key = false; customization_menu.large_monster_UI_waiting_for_key = false;
return true; return true;
end end
@@ -384,10 +386,10 @@ function keyboard.register_hotkey(hard_keyboard)
elseif customization_menu.large_monster_dynamic_UI_waiting_for_key then elseif customization_menu.large_monster_dynamic_UI_waiting_for_key then
for key, key_name in pairs(keyboard.keys) do for key, key_name in pairs(keyboard.keys) do
if get_release_method:call(hard_keyboard, key) then if get_release_method:call(hard_keyboard, key) then
config.current_config.global_settings.hotkeys_with_modifiers.large_monster_dynamic_UI.ctrl = keyboard.hotkey_modifiers_down.ctrl; cached_config.large_monster_dynamic_UI.ctrl = keyboard.hotkey_modifiers_down.ctrl;
config.current_config.global_settings.hotkeys_with_modifiers.large_monster_dynamic_UI.shift = keyboard.hotkey_modifiers_down.shift; cached_config.large_monster_dynamic_UI.shift = keyboard.hotkey_modifiers_down.shift;
config.current_config.global_settings.hotkeys_with_modifiers.large_monster_dynamic_UI.alt = keyboard.hotkey_modifiers_down.alt; cached_config.large_monster_dynamic_UI.alt = keyboard.hotkey_modifiers_down.alt;
config.current_config.global_settings.hotkeys_with_modifiers.large_monster_dynamic_UI.key = key; cached_config.large_monster_dynamic_UI.key = key;
customization_menu.large_monster_dynamic_UI_waiting_for_key = false; customization_menu.large_monster_dynamic_UI_waiting_for_key = false;
return true; return true;
end end
@@ -395,10 +397,10 @@ function keyboard.register_hotkey(hard_keyboard)
elseif customization_menu.large_monster_static_UI_waiting_for_key then elseif customization_menu.large_monster_static_UI_waiting_for_key then
for key, key_name in pairs(keyboard.keys) do for key, key_name in pairs(keyboard.keys) do
if get_release_method:call(hard_keyboard, key) then if get_release_method:call(hard_keyboard, key) then
config.current_config.global_settings.hotkeys_with_modifiers.large_monster_static_UI.ctrl = keyboard.hotkey_modifiers_down.ctrl; cached_config.large_monster_static_UI.ctrl = keyboard.hotkey_modifiers_down.ctrl;
config.current_config.global_settings.hotkeys_with_modifiers.large_monster_static_UI.shift = keyboard.hotkey_modifiers_down.shift; cached_config.large_monster_static_UI.shift = keyboard.hotkey_modifiers_down.shift;
config.current_config.global_settings.hotkeys_with_modifiers.large_monster_static_UI.alt = keyboard.hotkey_modifiers_down.alt; cached_config.large_monster_static_UI.alt = keyboard.hotkey_modifiers_down.alt;
config.current_config.global_settings.hotkeys_with_modifiers.large_monster_static_UI.key = key; cached_config.large_monster_static_UI.key = key;
customization_menu.large_monster_static_UI_waiting_for_key = false; customization_menu.large_monster_static_UI_waiting_for_key = false;
return true; return true;
end end
@@ -406,10 +408,10 @@ function keyboard.register_hotkey(hard_keyboard)
elseif customization_menu.large_monster_highlighted_UI_waiting_for_key then elseif customization_menu.large_monster_highlighted_UI_waiting_for_key then
for key, key_name in pairs(keyboard.keys) do for key, key_name in pairs(keyboard.keys) do
if get_release_method:call(hard_keyboard, key) then if get_release_method:call(hard_keyboard, key) then
config.current_config.global_settings.hotkeys_with_modifiers.large_monster_highlighted_UI.ctrl = keyboard.hotkey_modifiers_down.ctrl; cached_config.large_monster_highlighted_UI.ctrl = keyboard.hotkey_modifiers_down.ctrl;
config.current_config.global_settings.hotkeys_with_modifiers.large_monster_highlighted_UI.shift = keyboard.hotkey_modifiers_down.shift; cached_config.large_monster_highlighted_UI.shift = keyboard.hotkey_modifiers_down.shift;
config.current_config.global_settings.hotkeys_with_modifiers.large_monster_highlighted_UI.alt = keyboard.hotkey_modifiers_down.alt; cached_config.large_monster_highlighted_UI.alt = keyboard.hotkey_modifiers_down.alt;
config.current_config.global_settings.hotkeys_with_modifiers.large_monster_highlighted_UI.key = key; cached_config.large_monster_highlighted_UI.key = key;
customization_menu.large_monster_highlighted_UI_waiting_for_key = false; customization_menu.large_monster_highlighted_UI_waiting_for_key = false;
return true; return true;
end end
@@ -417,10 +419,10 @@ function keyboard.register_hotkey(hard_keyboard)
elseif customization_menu.time_UI_waiting_for_key then elseif customization_menu.time_UI_waiting_for_key then
for key, key_name in pairs(keyboard.keys) do for key, key_name in pairs(keyboard.keys) do
if get_release_method:call(hard_keyboard, key) then if get_release_method:call(hard_keyboard, key) then
config.current_config.global_settings.hotkeys_with_modifiers.time_UI.ctrl = keyboard.hotkey_modifiers_down.ctrl; cached_config.time_UI.ctrl = keyboard.hotkey_modifiers_down.ctrl;
config.current_config.global_settings.hotkeys_with_modifiers.time_UI.shift = keyboard.hotkey_modifiers_down.shift; cached_config.time_UI.shift = keyboard.hotkey_modifiers_down.shift;
config.current_config.global_settings.hotkeys_with_modifiers.time_UI.alt = keyboard.hotkey_modifiers_down.alt; cached_config.time_UI.alt = keyboard.hotkey_modifiers_down.alt;
config.current_config.global_settings.hotkeys_with_modifiers.time_UI.key = key; cached_config.time_UI.key = key;
customization_menu.time_UI_waiting_for_key = false; customization_menu.time_UI_waiting_for_key = false;
return true; return true;
end end
@@ -428,10 +430,10 @@ function keyboard.register_hotkey(hard_keyboard)
elseif customization_menu.damage_meter_UI_waiting_for_key then elseif customization_menu.damage_meter_UI_waiting_for_key then
for key, key_name in pairs(keyboard.keys) do for key, key_name in pairs(keyboard.keys) do
if get_release_method:call(hard_keyboard, key) then if get_release_method:call(hard_keyboard, key) then
config.current_config.global_settings.hotkeys_with_modifiers.damage_meter_UI.ctrl = keyboard.hotkey_modifiers_down.ctrl; cached_config.damage_meter_UI.ctrl = keyboard.hotkey_modifiers_down.ctrl;
config.current_config.global_settings.hotkeys_with_modifiers.damage_meter_UI.shift = keyboard.hotkey_modifiers_down.shift; cached_config.damage_meter_UI.shift = keyboard.hotkey_modifiers_down.shift;
config.current_config.global_settings.hotkeys_with_modifiers.damage_meter_UI.alt = keyboard.hotkey_modifiers_down.alt; cached_config.damage_meter_UI.alt = keyboard.hotkey_modifiers_down.alt;
config.current_config.global_settings.hotkeys_with_modifiers.damage_meter_UI.key = key; cached_config.damage_meter_UI.key = key;
customization_menu.damage_meter_UI_waiting_for_key = false; customization_menu.damage_meter_UI_waiting_for_key = false;
return true; return true;
end end
@@ -439,10 +441,10 @@ function keyboard.register_hotkey(hard_keyboard)
elseif customization_menu.endemic_life_UI_waiting_for_key then elseif customization_menu.endemic_life_UI_waiting_for_key then
for key, key_name in pairs(keyboard.keys) do for key, key_name in pairs(keyboard.keys) do
if get_release_method:call(hard_keyboard, key) then 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; cached_config.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; cached_config.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; cached_config.endemic_life_UI.alt = keyboard.hotkey_modifiers_down.alt;
config.current_config.global_settings.hotkeys_with_modifiers.endemic_life_UI.key = key; cached_config.endemic_life_UI.key = key;
customization_menu.endemic_life_UI_waiting_for_key = false; customization_menu.endemic_life_UI_waiting_for_key = false;
return true; return true;
end end
@@ -453,10 +455,12 @@ function keyboard.register_hotkey(hard_keyboard)
end end
function keyboard.check_hotkeys(hard_keyboard) function keyboard.check_hotkeys(hard_keyboard)
if not (config.current_config.global_settings.hotkeys_with_modifiers.all_UI.ctrl and not keyboard.hotkey_modifiers_down.ctrl) local cached_config = config.current_config.global_settings.hotkeys_with_modifiers;
and not (config.current_config.global_settings.hotkeys_with_modifiers.all_UI.shift and not keyboard.hotkey_modifiers_down.shift)
and not (config.current_config.global_settings.hotkeys_with_modifiers.all_UI.alt and not keyboard.hotkey_modifiers_down.alt) then if not (cached_config.all_UI.ctrl and not keyboard.hotkey_modifiers_down.ctrl)
if get_release_method:call(hard_keyboard, math.tointeger(config.current_config.global_settings.hotkeys_with_modifiers.all_UI.key)) then and not (cached_config.all_UI.shift and not keyboard.hotkey_modifiers_down.shift)
and not (cached_config.all_UI.alt and not keyboard.hotkey_modifiers_down.alt) then
if get_release_method:call(hard_keyboard, math.tointeger(cached_config.all_UI.key)) then
local is_any_enabled = config.current_config.time_UI.enabled local is_any_enabled = config.current_config.time_UI.enabled
or config.current_config.small_monster_UI.enabled or config.current_config.small_monster_UI.enabled
@@ -474,18 +478,18 @@ function keyboard.check_hotkeys(hard_keyboard)
end end
end end
if not (config.current_config.global_settings.hotkeys_with_modifiers.small_monster_UI.ctrl and not keyboard.hotkey_modifiers_down.ctrl) if not (cached_config.small_monster_UI.ctrl and not keyboard.hotkey_modifiers_down.ctrl)
and not (config.current_config.global_settings.hotkeys_with_modifiers.small_monster_UI.shift and not keyboard.hotkey_modifiers_down.shift) and not (cached_config.small_monster_UI.shift and not keyboard.hotkey_modifiers_down.shift)
and not (config.current_config.global_settings.hotkeys_with_modifiers.small_monster_UI.alt and not keyboard.hotkey_modifiers_down.alt) then and not (cached_config.small_monster_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.small_monster_UI.key)) then if get_release_method:call(hard_keyboard, math.tointeger(cached_config.small_monster_UI.key)) then
config.current_config.small_monster_UI.enabled = not config.current_config.small_monster_UI.enabled; config.current_config.small_monster_UI.enabled = not config.current_config.small_monster_UI.enabled;
end end
end end
if not (config.current_config.global_settings.hotkeys_with_modifiers.large_monster_UI.ctrl and not keyboard.hotkey_modifiers_down.ctrl) if not (cached_config.large_monster_UI.ctrl and not keyboard.hotkey_modifiers_down.ctrl)
and not (config.current_config.global_settings.hotkeys_with_modifiers.large_monster_UI.shift and not keyboard.hotkey_modifiers_down.shift) and not (cached_config.large_monster_UI.shift and not keyboard.hotkey_modifiers_down.shift)
and not (config.current_config.global_settings.hotkeys_with_modifiers.large_monster_UI.alt and not keyboard.hotkey_modifiers_down.alt) then and not (cached_config.large_monster_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.large_monster_UI.key)) then if get_release_method:call(hard_keyboard, math.tointeger(cached_config.large_monster_UI.key)) then
local is_any_enabled = config.current_config.large_monster_UI.dynamic.enabled local is_any_enabled = config.current_config.large_monster_UI.dynamic.enabled
or config.current_config.large_monster_UI.static.enabled or config.current_config.large_monster_UI.static.enabled
or config.current_config.large_monster_UI.highlighted.enabled; or config.current_config.large_monster_UI.highlighted.enabled;
@@ -496,50 +500,50 @@ function keyboard.check_hotkeys(hard_keyboard)
end end
end end
if not (config.current_config.global_settings.hotkeys_with_modifiers.large_monster_dynamic_UI.ctrl and not keyboard.hotkey_modifiers_down.ctrl) if not (cached_config.large_monster_dynamic_UI.ctrl and not keyboard.hotkey_modifiers_down.ctrl)
and not (config.current_config.global_settings.hotkeys_with_modifiers.large_monster_dynamic_UI.shift and not keyboard.hotkey_modifiers_down.shift) and not (cached_config.large_monster_dynamic_UI.shift and not keyboard.hotkey_modifiers_down.shift)
and not (config.current_config.global_settings.hotkeys_with_modifiers.large_monster_dynamic_UI.alt and not keyboard.hotkey_modifiers_down.alt) then and not (cached_config.large_monster_dynamic_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.large_monster_dynamic_UI.key)) then if get_release_method:call(hard_keyboard, math.tointeger(cached_config.large_monster_dynamic_UI.key)) then
config.current_config.large_monster_UI.dynamic.enabled = not config.current_config.large_monster_UI.dynamic.enabled; config.current_config.large_monster_UI.dynamic.enabled = not config.current_config.large_monster_UI.dynamic.enabled;
end end
end end
if not (config.current_config.global_settings.hotkeys_with_modifiers.large_monster_static_UI.ctrl and not keyboard.hotkey_modifiers_down.ctrl) if not (cached_config.large_monster_static_UI.ctrl and not keyboard.hotkey_modifiers_down.ctrl)
and not (config.current_config.global_settings.hotkeys_with_modifiers.large_monster_static_UI.shift and not keyboard.hotkey_modifiers_down.shift) and not (cached_config.large_monster_static_UI.shift and not keyboard.hotkey_modifiers_down.shift)
and not (config.current_config.global_settings.hotkeys_with_modifiers.large_monster_static_UI.alt and not keyboard.hotkey_modifiers_down.alt) then and not (cached_config.large_monster_static_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.large_monster_static_UI.key)) then if get_release_method:call(hard_keyboard, math.tointeger(cached_config.large_monster_static_UI.key)) then
config.current_config.large_monster_UI.static.enabled = not config.current_config.large_monster_UI.static.enabled; config.current_config.large_monster_UI.static.enabled = not config.current_config.large_monster_UI.static.enabled;
end end
end end
if not (config.current_config.global_settings.hotkeys_with_modifiers.large_monster_highlighted_UI.ctrl and not keyboard.hotkey_modifiers_down.ctrl) if not (cached_config.large_monster_highlighted_UI.ctrl and not keyboard.hotkey_modifiers_down.ctrl)
and not (config.current_config.global_settings.hotkeys_with_modifiers.large_monster_highlighted_UI.shift and not keyboard.hotkey_modifiers_down.shift) and not (cached_config.large_monster_highlighted_UI.shift and not keyboard.hotkey_modifiers_down.shift)
and not (config.current_config.global_settings.hotkeys_with_modifiers.large_monster_highlighted_UI.alt and not keyboard.hotkey_modifiers_down.alt) then and not (cached_config.large_monster_highlighted_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.large_monster_highlighted_UI.key)) then if get_release_method:call(hard_keyboard, math.tointeger(cached_config.large_monster_highlighted_UI.key)) then
config.current_config.large_monster_UI.highlighted.enabled = not config.current_config.large_monster_UI.highlighted.enabled; config.current_config.large_monster_UI.highlighted.enabled = not config.current_config.large_monster_UI.highlighted.enabled;
end end
end end
if not (config.current_config.global_settings.hotkeys_with_modifiers.time_UI.ctrl and not keyboard.hotkey_modifiers_down.ctrl) if not (cached_config.time_UI.ctrl and not keyboard.hotkey_modifiers_down.ctrl)
and not (config.current_config.global_settings.hotkeys_with_modifiers.time_UI.shift and not keyboard.hotkey_modifiers_down.shift) and not (cached_config.time_UI.shift and not keyboard.hotkey_modifiers_down.shift)
and not (config.current_config.global_settings.hotkeys_with_modifiers.time_UI.alt and not keyboard.hotkey_modifiers_down.alt) then and not (cached_config.time_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.time_UI.key)) then if get_release_method:call(hard_keyboard, math.tointeger(cached_config.time_UI.key)) then
config.current_config.time_UI.enabled = not config.current_config.time_UI.enabled; config.current_config.time_UI.enabled = not config.current_config.time_UI.enabled;
end end
end end
if not (config.current_config.global_settings.hotkeys_with_modifiers.damage_meter_UI.ctrl and not keyboard.hotkey_modifiers_down.ctrl) if not (cached_config.damage_meter_UI.ctrl and not keyboard.hotkey_modifiers_down.ctrl)
and not (config.current_config.global_settings.hotkeys_with_modifiers.damage_meter_UI.shift and not keyboard.hotkey_modifiers_down.shift) and not (cached_config.damage_meter_UI.shift and not keyboard.hotkey_modifiers_down.shift)
and not (config.current_config.global_settings.hotkeys_with_modifiers.damage_meter_UI.alt and not keyboard.hotkey_modifiers_down.alt) then and not (cached_config.damage_meter_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.damage_meter_UI.key)) then if get_release_method:call(hard_keyboard, math.tointeger(cached_config.damage_meter_UI.key)) then
config.current_config.damage_meter_UI.enabled = not config.current_config.damage_meter_UI.enabled; config.current_config.damage_meter_UI.enabled = not config.current_config.damage_meter_UI.enabled;
end end
end end
if not (config.current_config.global_settings.hotkeys_with_modifiers.endemic_life_UI.ctrl and not keyboard.hotkey_modifiers_down.ctrl) if not (cached_config.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 (cached_config.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 and not (cached_config.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 if get_release_method:call(hard_keyboard, math.tointeger(cached_config.endemic_life_UI.key)) then
config.current_config.endemic_life_UI.enabled = not config.current_config.endemic_life_UI.enabled; config.current_config.endemic_life_UI.enabled = not config.current_config.endemic_life_UI.enabled;
end end
end end

View File

@@ -41,10 +41,6 @@ function quest_status.update(args)
end end
end end
sdk.hook(on_changed_game_status, function(args)
pcall(quest_status.update, args);
end, function(retval) return retval; end);
function quest_status.init() function quest_status.init()
if singletons.quest_manager == nil then if singletons.quest_manager == nil then
return; return;
@@ -121,6 +117,10 @@ function quest_status.init_module()
time = require("MHR_Overlay.Game_Handler.time"); time = require("MHR_Overlay.Game_Handler.time");
quest_status.init(); quest_status.init();
sdk.hook(on_changed_game_status, function(args)
pcall(quest_status.update, args);
end, function(retval) return retval; end);
end end
return quest_status; return quest_status;

View File

@@ -65,9 +65,11 @@ function screen.get_game_window_size()
end end
function screen.calculate_absolute_coordinates(position) function screen.calculate_absolute_coordinates(position)
local global_position_modifier = config.current_config.global_settings.modifiers.global_position_modifier;
local _position = { local _position = {
x = position.x * config.current_config.global_settings.modifiers.global_position_modifier; x = position.x * global_position_modifier;
y = position.y * config.current_config.global_settings.modifiers.global_position_modifier; y = position.y * global_position_modifier;
} }
-- top left -- top left

View File

@@ -43,21 +43,23 @@ function time.tick()
end end
function time.update_players_dps() function time.update_players_dps()
local cached_config = config.current_config.damage_meter_UI.settings;
local new_total_dps = 0; local new_total_dps = 0;
for _, _player in pairs(player.list) do for _, _player in pairs(player.list) do
if _player.join_time == -1 then if _player.join_time == -1 then
_player.join_time = time.total_elapsed_seconds; _player.join_time = time.total_elapsed_seconds;
end end
if config.current_config.damage_meter_UI.settings.dps_mode == "Quest Time" then if cached_config.dps_mode == "Quest Time" then
if time.total_elapsed_seconds > 0 then if time.total_elapsed_seconds > 0 then
_player.dps = _player.display.total_damage / time.total_elapsed_seconds; _player.dps = _player.display.total_damage / time.total_elapsed_seconds;
end end
elseif config.current_config.damage_meter_UI.settings.dps_mode == "Join Time" then elseif cached_config.dps_mode == "Join Time" then
if time.total_elapsed_seconds - _player.join_time > 0 then if time.total_elapsed_seconds - _player.join_time > 0 then
_player.dps = _player.display.total_damage / (time.total_elapsed_seconds - _player.join_time); _player.dps = _player.display.total_damage / (time.total_elapsed_seconds - _player.join_time);
end end
elseif config.current_config.damage_meter_UI.settings.dps_mode == "First Hit" then elseif cached_config.dps_mode == "First Hit" then
if time.total_elapsed_seconds - _player.first_hit_time > 0 then if time.total_elapsed_seconds - _player.first_hit_time > 0 then
_player.dps = _player.display.total_damage / (time.total_elapsed_seconds - _player.first_hit_time); _player.dps = _player.display.total_damage / (time.total_elapsed_seconds - _player.first_hit_time);
end end

View File

@@ -734,6 +734,7 @@ function config.init()
include = { include = {
monster_name = true, monster_name = true,
monster_id = false,
crown = true, crown = true,
size = true, size = true,
crown_thresholds = false crown_thresholds = false
@@ -1050,7 +1051,7 @@ function config.init()
} }
}, },
parts = { body_parts = {
visibility = false, visibility = false,
offset = { offset = {
@@ -1742,6 +1743,7 @@ function config.init()
include = { include = {
monster_name = true, monster_name = true,
monster_id = false,
crown = true, crown = true,
size = true, size = true,
crown_thresholds = false crown_thresholds = false
@@ -2058,7 +2060,7 @@ function config.init()
} }
}, },
parts = { body_parts = {
visibility = false, visibility = false,
offset = { offset = {
@@ -2732,6 +2734,7 @@ function config.init()
include = { include = {
monster_name = true, monster_name = true,
monster_id = false,
crown = true, crown = true,
size = true, size = true,
crown_thresholds = false crown_thresholds = false

View File

@@ -41,6 +41,11 @@ language.default_language = {
right_cutwing = "Cutwing R", right_cutwing = "Cutwing R",
head_mud = "Head (Mud)", head_mud = "Head (Mud)",
body_mud = "Body (Mud)",
arms_mud = "Arms (Mud)",
torso_mud = "Torso (Mud)",
left_leg_mud = "Leg L (Mud)",
right_leg_mud = "Leg R (Mud)",
tail_mud = "Tail (Mud)", tail_mud = "Tail (Mud)",
tail_windsac = "Tail (Windsac)", tail_windsac = "Tail (Windsac)",
@@ -54,7 +59,9 @@ language.default_language = {
dorsal_fin = "Dorsal Fin", dorsal_fin = "Dorsal Fin",
carapace = "Carapace", carapace = "Carapace",
spinning = "Spinning", spinning = "Spinning",
rock = "Rock" rock = "Rock",
tail_tip = "Tail Tip"
}, },
ailments = { ailments = {
@@ -327,7 +334,9 @@ language.default_language = {
break_health = "Break Health", break_health = "Break Health",
break_health_percentage = "Break Health Percentage", break_health_percentage = "Break Health Percentage",
loss_health = "Sever Health", loss_health = "Sever Health",
loss_health_percentage = "Sever Health Percentage" loss_health_percentage = "Sever Health Percentage",
monster_id = "Monster ID"
} }
}; };

View File

@@ -11,29 +11,32 @@ local table_helpers;
local drawing; local drawing;
function ailment_buildup.draw_dynamic(monster, ailment_buildups_position_on_screen, opacity_scale) function ailment_buildup.draw_dynamic(monster, ailment_buildups_position_on_screen, opacity_scale)
if not config.current_config.large_monster_UI.dynamic.ailment_buildups.visibility then local cached_config = config.current_config.large_monster_UI.dynamic.ailment_buildups;
local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
if not cached_config.visibility then
return; return;
end end
for id, ailment in pairs(monster.ailments) do for id, ailment in pairs(monster.ailments) do
if id == ailments.stun_id then if id == ailments.stun_id then
if not config.current_config.large_monster_UI.dynamic.ailment_buildups.filter.stun then if not cached_config.filter.stun then
goto continue; goto continue;
end end
elseif id == ailments.poison_id then elseif id == ailments.poison_id then
if not config.current_config.large_monster_UI.dynamic.ailment_buildups.filter.poison then if not cached_config.filter.poison then
goto continue; goto continue;
end end
elseif id == ailments.blast_id then elseif id == ailments.blast_id then
if not config.current_config.large_monster_UI.dynamic.ailment_buildups.filter.blast then if not cached_config.filter.blast then
goto continue; goto continue;
end end
else else
goto continue; goto continue;
end end
if config.current_config.large_monster_UI.dynamic.ailment_buildups.settings.time_limit ~= 0 and time.total_elapsed_seconds - ailment.last_change_time > config.current_config.large_monster_UI.dynamic.ailment_buildups.settings.time_limit then if cached_config.settings.time_limit ~= 0 and time.total_elapsed_seconds - ailment.last_change_time > cached_config.settings.time_limit then
goto continue; goto continue;
end end
@@ -61,8 +64,8 @@ function ailment_buildup.draw_dynamic(monster, ailment_buildups_position_on_scre
goto continue; goto continue;
end end
if config.current_config.large_monster_UI.dynamic.ailment_buildups.sorting.type == "Normal" then if cached_config.sorting.type == "Normal" then
if config.current_config.large_monster_UI.dynamic.ailment_buildups.sorting.reversed_order then if cached_config.sorting.reversed_order then
table.sort(displayed_players, function(left, right) table.sort(displayed_players, function(left, right)
return left.id < right.id; return left.id < right.id;
end); end);
@@ -71,8 +74,8 @@ function ailment_buildup.draw_dynamic(monster, ailment_buildups_position_on_scre
return left.id > right.id; return left.id > right.id;
end); end);
end end
elseif config.current_config.large_monster_UI.dynamic.ailment_buildups.sorting.type == "Buildup" then elseif cached_config.sorting.type == "Buildup" then
if config.current_config.large_monster_UI.dynamic.ailment_buildups.sorting.reversed_order then if cached_config.sorting.reversed_order then
table.sort(displayed_players, function(left, right) table.sort(displayed_players, function(left, right)
return left.buildup < right.buildup; return left.buildup < right.buildup;
end); end);
@@ -81,8 +84,8 @@ function ailment_buildup.draw_dynamic(monster, ailment_buildups_position_on_scre
return left.buildup > right.buildup; return left.buildup > right.buildup;
end); end);
end end
elseif config.current_config.large_monster_UI.dynamic.ailment_buildups.sorting.type == "Buildup Percentage" then elseif cached_config.sorting.type == "Buildup Percentage" then
if config.current_config.large_monster_UI.dynamic.ailment_buildups.sorting.reversed_order then if cached_config.sorting.reversed_order then
table.sort(displayed_players, function(left, right) table.sort(displayed_players, function(left, right)
return left.buildup_share < right.buildup_share; return left.buildup_share < right.buildup_share;
end); end);
@@ -94,10 +97,10 @@ function ailment_buildup.draw_dynamic(monster, ailment_buildups_position_on_scre
end end
local ailment_name = ""; local ailment_name = "";
if config.current_config.large_monster_UI.dynamic.ailment_buildups.ailment_name_label.include.ailment_name then if cached_config.ailment_name_label.include.ailment_name then
ailment_name = ailment.name .. " "; ailment_name = ailment.name .. " ";
end end
if config.current_config.large_monster_UI.dynamic.ailment_buildups.ailment_name_label.include.activation_count and ailment.activate_count ~= 0 then if cached_config.ailment_name_label.include.activation_count and ailment.activate_count ~= 0 then
ailment_name = ailment_name .. "x" .. tostring(ailment.activate_count); ailment_name = ailment_name .. "x" .. tostring(ailment.activate_count);
end end
@@ -107,8 +110,8 @@ function ailment_buildup.draw_dynamic(monster, ailment_buildups_position_on_scre
local last_j = 0; local last_j = 0;
for j, _player in ipairs(displayed_players) do for j, _player in ipairs(displayed_players) do
local ailment_buildup_position_on_screen = { local ailment_buildup_position_on_screen = {
x = ailment_buildups_position_on_screen.x + config.current_config.large_monster_UI.dynamic.ailment_buildups.player_spacing.x * (j - 1) * config.current_config.global_settings.modifiers.global_scale_modifier, x = ailment_buildups_position_on_screen.x + cached_config.player_spacing.x * (j - 1) * global_scale_modifier,
y = ailment_buildups_position_on_screen.y + config.current_config.large_monster_UI.dynamic.ailment_buildups.player_spacing.y * (j - 1) * config.current_config.global_settings.modifiers.global_scale_modifier; y = ailment_buildups_position_on_screen.y + cached_config.player_spacing.y * (j - 1) * global_scale_modifier;
}; };
ailment_buildup_UI_entity.draw_dynamic(_player, monster.ailments[ailments.stun_id].ailment_buildup_dynamic_UI, ailment_buildup_position_on_screen, opacity_scale, top_buildup); ailment_buildup_UI_entity.draw_dynamic(_player, monster.ailments[ailments.stun_id].ailment_buildup_dynamic_UI, ailment_buildup_position_on_screen, opacity_scale, top_buildup);
@@ -119,8 +122,8 @@ function ailment_buildup.draw_dynamic(monster, ailment_buildups_position_on_scre
local total_buildup_position_on_screen = { local total_buildup_position_on_screen = {
x = ailment_buildups_position_on_screen.x + config.current_config.large_monster_UI.dynamic.ailment_buildups.player_spacing.x * last_j * config.current_config.global_settings.modifiers.global_scale_modifier, x = ailment_buildups_position_on_screen.x + cached_config.player_spacing.x * last_j * global_scale_modifier,
y = ailment_buildups_position_on_screen.y + config.current_config.large_monster_UI.dynamic.ailment_buildups.player_spacing.y * last_j * config.current_config.global_settings.modifiers.global_scale_modifier; y = ailment_buildups_position_on_screen.y + cached_config.player_spacing.y * last_j * global_scale_modifier;
}; };
drawing.draw_label(monster.ailments[ailments.stun_id].ailment_buildup_dynamic_UI.total_buildup_label, total_buildup_position_on_screen, opacity_scale, language.current_language.UI.total_buildup); drawing.draw_label(monster.ailments[ailments.stun_id].ailment_buildup_dynamic_UI.total_buildup_label, total_buildup_position_on_screen, opacity_scale, language.current_language.UI.total_buildup);
@@ -128,8 +131,8 @@ function ailment_buildup.draw_dynamic(monster, ailment_buildups_position_on_scre
drawing.draw_label(monster.ailments[ailments.stun_id].ailment_buildup_dynamic_UI.total_buildup_value_label, total_buildup_position_on_screen, opacity_scale, total_buildup); drawing.draw_label(monster.ailments[ailments.stun_id].ailment_buildup_dynamic_UI.total_buildup_value_label, total_buildup_position_on_screen, opacity_scale, total_buildup);
ailment_buildups_position_on_screen = { ailment_buildups_position_on_screen = {
x = total_buildup_position_on_screen.x + config.current_config.large_monster_UI.dynamic.ailment_buildups.ailment_spacing.x * config.current_config.global_settings.modifiers.global_scale_modifier, x = total_buildup_position_on_screen.x + cached_config.ailment_spacing.x * global_scale_modifier,
y = total_buildup_position_on_screen.y + 17 + config.current_config.large_monster_UI.dynamic.ailment_buildups.ailment_spacing.y * config.current_config.global_settings.modifiers.global_scale_modifier y = total_buildup_position_on_screen.y + 17 + cached_config.ailment_spacing.y * global_scale_modifier
}; };
::continue:: ::continue::
@@ -139,29 +142,32 @@ function ailment_buildup.draw_dynamic(monster, ailment_buildups_position_on_scre
end end
function ailment_buildup.draw_static(monster, ailment_buildups_position_on_screen, opacity_scale) function ailment_buildup.draw_static(monster, ailment_buildups_position_on_screen, opacity_scale)
if not config.current_config.large_monster_UI.static.ailment_buildups.visibility then local cached_config = config.current_config.large_monster_UI.static.ailment_buildups;
local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
if not cached_config.visibility then
return; return;
end end
for id, ailment in pairs(monster.ailments) do for id, ailment in pairs(monster.ailments) do
if id == ailments.stun_id then if id == ailments.stun_id then
if not config.current_config.large_monster_UI.static.ailment_buildups.filter.stun then if not cached_config.filter.stun then
goto continue; goto continue;
end end
elseif id == ailments.poison_id then elseif id == ailments.poison_id then
if not config.current_config.large_monster_UI.static.ailment_buildups.filter.poison then if not cached_config.filter.poison then
goto continue; goto continue;
end end
elseif id == ailments.blast_id then elseif id == ailments.blast_id then
if not config.current_config.large_monster_UI.static.ailment_buildups.filter.blast then if not cached_config.filter.blast then
goto continue; goto continue;
end end
else else
goto continue; goto continue;
end end
if config.current_config.large_monster_UI.static.ailment_buildups.settings.time_limit ~= 0 and time.total_elapsed_seconds - ailment.last_change_time > config.current_config.large_monster_UI.static.ailment_buildups.settings.time_limit then if cached_config.settings.time_limit ~= 0 and time.total_elapsed_seconds - ailment.last_change_time > cached_config.settings.time_limit then
goto continue; goto continue;
end end
@@ -189,8 +195,8 @@ function ailment_buildup.draw_static(monster, ailment_buildups_position_on_scree
goto continue; goto continue;
end end
if config.current_config.large_monster_UI.static.ailment_buildups.sorting.type == "Normal" then if cached_config.sorting.type == "Normal" then
if config.current_config.large_monster_UI.static.ailment_buildups.sorting.reversed_order then if cached_config.sorting.reversed_order then
table.sort(displayed_players, function(left, right) table.sort(displayed_players, function(left, right)
return left.id < right.id; return left.id < right.id;
end); end);
@@ -199,8 +205,8 @@ function ailment_buildup.draw_static(monster, ailment_buildups_position_on_scree
return left.id > right.id; return left.id > right.id;
end); end);
end end
elseif config.current_config.large_monster_UI.static.ailment_buildups.sorting.type == "Buildup" then elseif cached_config.sorting.type == "Buildup" then
if config.current_config.large_monster_UI.static.ailment_buildups.sorting.reversed_order then if cached_config.sorting.reversed_order then
table.sort(displayed_players, function(left, right) table.sort(displayed_players, function(left, right)
return left.buildup < right.buildup; return left.buildup < right.buildup;
end); end);
@@ -209,8 +215,8 @@ function ailment_buildup.draw_static(monster, ailment_buildups_position_on_scree
return left.buildup > right.buildup; return left.buildup > right.buildup;
end); end);
end end
elseif config.current_config.large_monster_UI.static.ailment_buildups.sorting.type == "Buildup Percentage" then elseif cached_config.sorting.type == "Buildup Percentage" then
if config.current_config.large_monster_UI.static.ailment_buildups.sorting.reversed_order then if cached_config.sorting.reversed_order then
table.sort(displayed_players, function(left, right) table.sort(displayed_players, function(left, right)
return left.buildup_share < right.buildup_share; return left.buildup_share < right.buildup_share;
end); end);
@@ -222,10 +228,10 @@ function ailment_buildup.draw_static(monster, ailment_buildups_position_on_scree
end end
local ailment_name = ""; local ailment_name = "";
if config.current_config.large_monster_UI.static.ailment_buildups.ailment_name_label.include.ailment_name then if cached_config.ailment_name_label.include.ailment_name then
ailment_name = ailment.name .. " "; ailment_name = ailment.name .. " ";
end end
if config.current_config.large_monster_UI.static.ailment_buildups.ailment_name_label.include.activation_count and ailment.activate_count ~= 0 then if cached_config.ailment_name_label.include.activation_count and ailment.activate_count ~= 0 then
ailment_name = ailment_name .. "x" .. tostring(ailment.activate_count); ailment_name = ailment_name .. "x" .. tostring(ailment.activate_count);
end end
@@ -234,8 +240,8 @@ function ailment_buildup.draw_static(monster, ailment_buildups_position_on_scree
local last_j = 0; local last_j = 0;
for j, _player in ipairs(displayed_players) do for j, _player in ipairs(displayed_players) do
local ailment_buildup_position_on_screen = { local ailment_buildup_position_on_screen = {
x = ailment_buildups_position_on_screen.x + config.current_config.large_monster_UI.static.ailment_buildups.player_spacing.x * (j - 1) * config.current_config.global_settings.modifiers.global_scale_modifier, x = ailment_buildups_position_on_screen.x + cached_config.player_spacing.x * (j - 1) * global_scale_modifier,
y = ailment_buildups_position_on_screen.y + config.current_config.large_monster_UI.static.ailment_buildups.player_spacing.y * (j - 1) * config.current_config.global_settings.modifiers.global_scale_modifier; y = ailment_buildups_position_on_screen.y + cached_config.player_spacing.y * (j - 1) * global_scale_modifier;
}; };
ailment_buildup_UI_entity.draw_static(_player, monster.ailments[ailments.stun_id].ailment_buildup_static_UI, ailment_buildup_position_on_screen, opacity_scale, top_buildup); ailment_buildup_UI_entity.draw_static(_player, monster.ailments[ailments.stun_id].ailment_buildup_static_UI, ailment_buildup_position_on_screen, opacity_scale, top_buildup);
@@ -244,8 +250,8 @@ function ailment_buildup.draw_static(monster, ailment_buildups_position_on_scree
end end
local total_buildup_position_on_screen = { local total_buildup_position_on_screen = {
x = ailment_buildups_position_on_screen.x + config.current_config.large_monster_UI.static.ailment_buildups.player_spacing.x * last_j * config.current_config.global_settings.modifiers.global_scale_modifier, x = ailment_buildups_position_on_screen.x + cached_config.player_spacing.x * last_j * global_scale_modifier,
y = ailment_buildups_position_on_screen.y + config.current_config.large_monster_UI.static.ailment_buildups.player_spacing.y * last_j * config.current_config.global_settings.modifiers.global_scale_modifier; y = ailment_buildups_position_on_screen.y + cached_config.player_spacing.y * last_j * global_scale_modifier;
}; };
drawing.draw_label(monster.ailments[ailments.stun_id].ailment_buildup_static_UI.total_buildup_label, total_buildup_position_on_screen, opacity_scale, language.current_language.UI.total_buildup); drawing.draw_label(monster.ailments[ailments.stun_id].ailment_buildup_static_UI.total_buildup_label, total_buildup_position_on_screen, opacity_scale, language.current_language.UI.total_buildup);
@@ -253,8 +259,8 @@ function ailment_buildup.draw_static(monster, ailment_buildups_position_on_scree
drawing.draw_label(monster.ailments[ailments.stun_id].ailment_buildup_static_UI.total_buildup_value_label, total_buildup_position_on_screen, opacity_scale, total_buildup); drawing.draw_label(monster.ailments[ailments.stun_id].ailment_buildup_static_UI.total_buildup_value_label, total_buildup_position_on_screen, opacity_scale, total_buildup);
ailment_buildups_position_on_screen = { ailment_buildups_position_on_screen = {
x = total_buildup_position_on_screen.x + config.current_config.large_monster_UI.static.ailment_buildups.ailment_spacing.x * config.current_config.global_settings.modifiers.global_scale_modifier, x = total_buildup_position_on_screen.x + cached_config.ailment_spacing.x * global_scale_modifier,
y = total_buildup_position_on_screen.y + 17 + config.current_config.large_monster_UI.static.ailment_buildups.ailment_spacing.y * config.current_config.global_settings.modifiers.global_scale_modifier y = total_buildup_position_on_screen.y + 17 + cached_config.ailment_spacing.y * global_scale_modifier
}; };
::continue:: ::continue::
@@ -264,29 +270,32 @@ function ailment_buildup.draw_static(monster, ailment_buildups_position_on_scree
end end
function ailment_buildup.draw_highlighted(monster, ailment_buildups_position_on_screen, opacity_scale) function ailment_buildup.draw_highlighted(monster, ailment_buildups_position_on_screen, opacity_scale)
if not config.current_config.large_monster_UI.highlighted.ailment_buildups.visibility then local cached_config = config.current_config.large_monster_UI.highlighted.ailment_buildups;
local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
if not cached_config.visibility then
return; return;
end end
for id, ailment in pairs(monster.ailments) do for id, ailment in pairs(monster.ailments) do
if id == ailments.stun_id then if id == ailments.stun_id then
if not config.current_config.large_monster_UI.highlighted.ailment_buildups.filter.stun then if not cached_config.filter.stun then
goto continue; goto continue;
end end
elseif id == ailments.poison_id then elseif id == ailments.poison_id then
if not config.current_config.large_monster_UI.highlighted.ailment_buildups.filter.poison then if not cached_config.filter.poison then
goto continue; goto continue;
end end
elseif id == ailments.blast_id then elseif id == ailments.blast_id then
if not config.current_config.large_monster_UI.highlighted.ailment_buildups.filter.blast then if not cached_config.filter.blast then
goto continue; goto continue;
end end
else else
goto continue; goto continue;
end end
if config.current_config.large_monster_UI.highlighted.ailment_buildups.settings.time_limit ~= 0 and time.total_elapsed_seconds - ailment.last_change_time > config.current_config.large_monster_UI.highlighted.ailment_buildups.settings.time_limit then if cached_config.settings.time_limit ~= 0 and time.total_elapsed_seconds - ailment.last_change_time > cached_config.settings.time_limit then
goto continue; goto continue;
end end
@@ -314,8 +323,8 @@ function ailment_buildup.draw_highlighted(monster, ailment_buildups_position_on_
goto continue; goto continue;
end end
if config.current_config.large_monster_UI.highlighted.ailment_buildups.sorting.type == "Normal" then if cached_config.sorting.type == "Normal" then
if config.current_config.large_monster_UI.highlighted.ailment_buildups.sorting.reversed_order then if cached_config.sorting.reversed_order then
table.sort(displayed_players, function(left, right) table.sort(displayed_players, function(left, right)
return left.id < right.id; return left.id < right.id;
end); end);
@@ -324,8 +333,8 @@ function ailment_buildup.draw_highlighted(monster, ailment_buildups_position_on_
return left.id > right.id; return left.id > right.id;
end); end);
end end
elseif config.current_config.large_monster_UI.highlighted.ailment_buildups.sorting.type == "Buildup" then elseif cached_config.sorting.type == "Buildup" then
if config.current_config.large_monster_UI.highlighted.ailment_buildups.sorting.reversed_order then if cached_config.sorting.reversed_order then
table.sort(displayed_players, function(left, right) table.sort(displayed_players, function(left, right)
return left.buildup < right.buildup; return left.buildup < right.buildup;
end); end);
@@ -334,8 +343,8 @@ function ailment_buildup.draw_highlighted(monster, ailment_buildups_position_on_
return left.buildup > right.buildup; return left.buildup > right.buildup;
end); end);
end end
elseif config.current_config.large_monster_UI.highlighted.ailment_buildups.sorting.type == "Buildup Percentage" then elseif cached_config.sorting.type == "Buildup Percentage" then
if config.current_config.large_monster_UI.highlighted.ailment_buildups.sorting.reversed_order then if cached_config.sorting.reversed_order then
table.sort(displayed_players, function(left, right) table.sort(displayed_players, function(left, right)
return left.buildup_share < right.buildup_share; return left.buildup_share < right.buildup_share;
end); end);
@@ -347,10 +356,10 @@ function ailment_buildup.draw_highlighted(monster, ailment_buildups_position_on_
end end
local ailment_name = ""; local ailment_name = "";
if config.current_config.large_monster_UI.highlighted.ailment_buildups.ailment_name_label.include.ailment_name then if cached_config.ailment_name_label.include.ailment_name then
ailment_name = ailment.name .. " "; ailment_name = ailment.name .. " ";
end end
if config.current_config.large_monster_UI.highlighted.ailment_buildups.ailment_name_label.include.activation_count and ailment.activate_count ~= 0 then if cached_config.ailment_name_label.include.activation_count and ailment.activate_count ~= 0 then
ailment_name = ailment_name .. "x" .. tostring(ailment.activate_count); ailment_name = ailment_name .. "x" .. tostring(ailment.activate_count);
end end
@@ -359,8 +368,8 @@ function ailment_buildup.draw_highlighted(monster, ailment_buildups_position_on_
local last_j = 0; local last_j = 0;
for j, _player in ipairs(displayed_players) do for j, _player in ipairs(displayed_players) do
local ailment_buildup_position_on_screen = { local ailment_buildup_position_on_screen = {
x = ailment_buildups_position_on_screen.x + config.current_config.large_monster_UI.highlighted.ailment_buildups.player_spacing.x * (j - 1) * config.current_config.global_settings.modifiers.global_scale_modifier, x = ailment_buildups_position_on_screen.x + cached_config.player_spacing.x * (j - 1) * global_scale_modifier,
y = ailment_buildups_position_on_screen.y + config.current_config.large_monster_UI.highlighted.ailment_buildups.player_spacing.y * (j - 1) * config.current_config.global_settings.modifiers.global_scale_modifier; y = ailment_buildups_position_on_screen.y + cached_config.player_spacing.y * (j - 1) * global_scale_modifier;
}; };
ailment_buildup_UI_entity.draw_highlighted(_player, monster.ailments[ailments.stun_id].ailment_buildup_highlighted_UI, ailment_buildup_position_on_screen, opacity_scale, top_buildup); ailment_buildup_UI_entity.draw_highlighted(_player, monster.ailments[ailments.stun_id].ailment_buildup_highlighted_UI, ailment_buildup_position_on_screen, opacity_scale, top_buildup);
@@ -369,8 +378,8 @@ function ailment_buildup.draw_highlighted(monster, ailment_buildups_position_on_
end end
local total_buildup_position_on_screen = { local total_buildup_position_on_screen = {
x = ailment_buildups_position_on_screen.x + config.current_config.large_monster_UI.highlighted.ailment_buildups.player_spacing.x * last_j * config.current_config.global_settings.modifiers.global_scale_modifier, x = ailment_buildups_position_on_screen.x + cached_config.player_spacing.x * last_j * global_scale_modifier,
y = ailment_buildups_position_on_screen.y + config.current_config.large_monster_UI.highlighted.ailment_buildups.player_spacing.y * last_j * config.current_config.global_settings.modifiers.global_scale_modifier; y = ailment_buildups_position_on_screen.y + cached_config.player_spacing.y * last_j * global_scale_modifier;
}; };
drawing.draw_label(monster.ailments[ailments.stun_id].ailment_buildup_highlighted_UI.total_buildup_label, total_buildup_position_on_screen, opacity_scale, language.current_language.UI.total_buildup); drawing.draw_label(monster.ailments[ailments.stun_id].ailment_buildup_highlighted_UI.total_buildup_label, total_buildup_position_on_screen, opacity_scale, language.current_language.UI.total_buildup);
@@ -378,8 +387,8 @@ function ailment_buildup.draw_highlighted(monster, ailment_buildups_position_on_
drawing.draw_label(monster.ailments[ailments.stun_id].ailment_buildup_highlighted_UI.total_buildup_value_label, total_buildup_position_on_screen, opacity_scale, total_buildup); drawing.draw_label(monster.ailments[ailments.stun_id].ailment_buildup_highlighted_UI.total_buildup_value_label, total_buildup_position_on_screen, opacity_scale, total_buildup);
ailment_buildups_position_on_screen = { ailment_buildups_position_on_screen = {
x = total_buildup_position_on_screen.x + config.current_config.large_monster_UI.highlighted.ailment_buildups.ailment_spacing.x * config.current_config.global_settings.modifiers.global_scale_modifier, x = total_buildup_position_on_screen.x + cached_config.ailment_spacing.x * global_scale_modifier,
y = total_buildup_position_on_screen.y + 17 + config.current_config.large_monster_UI.highlighted.ailment_buildups.ailment_spacing.y * config.current_config.global_settings.modifiers.global_scale_modifier y = total_buildup_position_on_screen.y + 17 + cached_config.ailment_spacing.y * global_scale_modifier
}; };
::continue:: ::continue::
@@ -389,29 +398,32 @@ function ailment_buildup.draw_highlighted(monster, ailment_buildups_position_on_
end end
function ailment_buildup.draw_small(monster, ailment_buildups_position_on_screen, opacity_scale) function ailment_buildup.draw_small(monster, ailment_buildups_position_on_screen, opacity_scale)
if not config.current_config.small_monster_UI.ailment_buildups.visibility then local cached_config = config.current_config.small_monster_UI.ailment_buildups;
local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
if not cached_config.visibility then
return; return;
end end
for id, ailment in pairs(monster.ailments) do for id, ailment in pairs(monster.ailments) do
if id == ailments.stun_id then if id == ailments.stun_id then
if not config.current_config.small_monster_UI.ailment_buildups.filter.stun then if not cached_config.filter.stun then
goto continue; goto continue;
end end
elseif id == ailments.poison_id then elseif id == ailments.poison_id then
if not config.current_config.small_monster_UI.ailment_buildups.filter.poison then if not cached_config.filter.poison then
goto continue; goto continue;
end end
elseif id == ailments.blast_id then elseif id == ailments.blast_id then
if not config.current_config.small_monster_UI.ailment_buildups.filter.blast then if not cached_config.filter.blast then
goto continue; goto continue;
end end
else else
goto continue; goto continue;
end end
if config.current_config.small_monster_UI.ailment_buildups.settings.time_limit ~= 0 and time.total_elapsed_seconds - ailment.last_change_time > config.current_config.small_monster_UI.ailment_buildups.settings.time_limit then if cached_config.settings.time_limit ~= 0 and time.total_elapsed_seconds - ailment.last_change_time > cached_config.settings.time_limit then
goto continue; goto continue;
end end
@@ -439,8 +451,8 @@ function ailment_buildup.draw_small(monster, ailment_buildups_position_on_screen
goto continue; goto continue;
end end
if config.current_config.small_monster_UI.ailment_buildups.sorting.type == "Normal" then if cached_config.sorting.type == "Normal" then
if config.current_config.small_monster_UI.ailment_buildups.sorting.reversed_order then if cached_config.sorting.reversed_order then
table.sort(displayed_players, function(left, right) table.sort(displayed_players, function(left, right)
return left.id < right.id; return left.id < right.id;
end); end);
@@ -449,8 +461,8 @@ function ailment_buildup.draw_small(monster, ailment_buildups_position_on_screen
return left.id > right.id; return left.id > right.id;
end); end);
end end
elseif config.current_config.small_monster_UI.ailment_buildups.sorting.type == "Buildup" then elseif cached_config.sorting.type == "Buildup" then
if config.current_config.small_monster_UI.ailment_buildups.sorting.reversed_order then if cached_config.sorting.reversed_order then
table.sort(displayed_players, function(left, right) table.sort(displayed_players, function(left, right)
return left.buildup < right.buildup; return left.buildup < right.buildup;
end); end);
@@ -459,8 +471,8 @@ function ailment_buildup.draw_small(monster, ailment_buildups_position_on_screen
return left.buildup > right.buildup; return left.buildup > right.buildup;
end); end);
end end
elseif config.current_config.small_monster_UI.ailment_buildups.sorting.type == "Buildup Percentage" then elseif cached_config.sorting.type == "Buildup Percentage" then
if config.current_config.small_monster_UI.ailment_buildups.sorting.reversed_order then if cached_config.sorting.reversed_order then
table.sort(displayed_players, function(left, right) table.sort(displayed_players, function(left, right)
return left.buildup_share < right.buildup_share; return left.buildup_share < right.buildup_share;
end); end);
@@ -472,10 +484,10 @@ function ailment_buildup.draw_small(monster, ailment_buildups_position_on_screen
end end
local ailment_name = ""; local ailment_name = "";
if config.current_config.small_monster_UI.ailment_buildups.ailment_name_label.include.ailment_name then if cached_config.ailment_name_label.include.ailment_name then
ailment_name = ailment.name .. " "; ailment_name = ailment.name .. " ";
end end
if config.current_config.small_monster_UI.ailment_buildups.ailment_name_label.include.activation_count and ailment.activate_count ~= 0 then if cached_config.ailment_name_label.include.activation_count and ailment.activate_count ~= 0 then
ailment_name = ailment_name .. "x" .. tostring(ailment.activate_count); ailment_name = ailment_name .. "x" .. tostring(ailment.activate_count);
end end
@@ -484,8 +496,8 @@ function ailment_buildup.draw_small(monster, ailment_buildups_position_on_screen
local last_j = 0; local last_j = 0;
for j, _player in ipairs(displayed_players) do for j, _player in ipairs(displayed_players) do
local ailment_buildup_position_on_screen = { local ailment_buildup_position_on_screen = {
x = ailment_buildups_position_on_screen.x + config.current_config.small_monster_UI.ailment_buildups.player_spacing.x * (j - 1) * config.current_config.global_settings.modifiers.global_scale_modifier, x = ailment_buildups_position_on_screen.x + cached_config.player_spacing.x * (j - 1) * global_scale_modifier,
y = ailment_buildups_position_on_screen.y + config.current_config.small_monster_UI.ailment_buildups.player_spacing.y * (j - 1) * config.current_config.global_settings.modifiers.global_scale_modifier; y = ailment_buildups_position_on_screen.y + cached_config.player_spacing.y * (j - 1) * global_scale_modifier;
}; };
ailment_buildup_UI_entity.draw_small(_player, monster.ailments[ailments.stun_id].ailment_buildup_small_UI, ailment_buildup_position_on_screen, opacity_scale, top_buildup); ailment_buildup_UI_entity.draw_small(_player, monster.ailments[ailments.stun_id].ailment_buildup_small_UI, ailment_buildup_position_on_screen, opacity_scale, top_buildup);
@@ -494,8 +506,8 @@ function ailment_buildup.draw_small(monster, ailment_buildups_position_on_screen
end end
local total_buildup_position_on_screen = { local total_buildup_position_on_screen = {
x = ailment_buildups_position_on_screen.x + config.current_config.small_monster_UI.ailment_buildups.player_spacing.x * last_j * config.current_config.global_settings.modifiers.global_scale_modifier, x = ailment_buildups_position_on_screen.x + cached_config.player_spacing.x * last_j * global_scale_modifier,
y = ailment_buildups_position_on_screen.y + config.current_config.small_monster_UI.ailment_buildups.player_spacing.y * last_j * config.current_config.global_settings.modifiers.global_scale_modifier; y = ailment_buildups_position_on_screen.y + cached_config.player_spacing.y * last_j * global_scale_modifier;
}; };
drawing.draw_label(monster.ailments[ailments.stun_id].ailment_buildup_small_UI.total_buildup_label, total_buildup_position_on_screen, opacity_scale, language.current_language.UI.total_buildup); drawing.draw_label(monster.ailments[ailments.stun_id].ailment_buildup_small_UI.total_buildup_label, total_buildup_position_on_screen, opacity_scale, language.current_language.UI.total_buildup);
@@ -503,8 +515,8 @@ function ailment_buildup.draw_small(monster, ailment_buildups_position_on_screen
drawing.draw_label(monster.ailments[ailments.stun_id].ailment_buildup_small_UI.total_buildup_value_label, total_buildup_position_on_screen, opacity_scale, total_buildup); drawing.draw_label(monster.ailments[ailments.stun_id].ailment_buildup_small_UI.total_buildup_value_label, total_buildup_position_on_screen, opacity_scale, total_buildup);
ailment_buildups_position_on_screen = { ailment_buildups_position_on_screen = {
x = total_buildup_position_on_screen.x + config.current_config.small_monster_UI.ailment_buildups.ailment_spacing.x * config.current_config.global_settings.modifiers.global_scale_modifier, x = total_buildup_position_on_screen.x + cached_config.ailment_spacing.x * global_scale_modifier,
y = total_buildup_position_on_screen.y + 17 + config.current_config.small_monster_UI.ailment_buildups.ailment_spacing.y * config.current_config.global_settings.modifiers.global_scale_modifier y = total_buildup_position_on_screen.y + 17 + cached_config.ailment_spacing.y * global_scale_modifier
}; };
::continue:: ::continue::

View File

@@ -20,18 +20,6 @@ local stock_damage_method = enemy_damage_param_type_def:get_method("stockDamage"
local poison_param_field = enemy_damage_param_type_def:get_field("_PoisonParam"); local poison_param_field = enemy_damage_param_type_def:get_field("_PoisonParam");
local blast_param_field = enemy_damage_param_type_def:get_field("_BlastParam"); local blast_param_field = enemy_damage_param_type_def:get_field("_BlastParam");
sdk.hook(stock_damage_method, function(args)
pcall(ailment_hook.stock_damage);
end, function(retval)
return retval;
end);
sdk.hook(on_poison_activate_proc_method, function(args)
pcall(ailment_hook.poison_proc, sdk.to_managed_object(args[2]));
end, function(retval)
return retval;
end);
function ailment_hook.poison_proc(poison_param) function ailment_hook.poison_proc(poison_param)
if poison_param == nil then if poison_param == nil then
return; return;
@@ -54,7 +42,7 @@ function ailment_hook.poison_proc(poison_param)
monster = small_monster.get_monster(enemy); monster = small_monster.get_monster(enemy);
end end
monster.ailments[ailments.poison_id].cashed_buildup_share = monster.ailments[ailments.poison_id].buildup_share; monster.ailments[ailments.poison_id].cached_buildup_share = monster.ailments[ailments.poison_id].buildup_share;
ailments.clear_ailment_contribution(monster, ailments.poison_id); ailments.clear_ailment_contribution(monster, ailments.poison_id);
end end
@@ -92,6 +80,18 @@ function ailment_hook.init_module()
config = require("MHR_Overlay.Misc.config"); config = require("MHR_Overlay.Misc.config");
ailments = require("MHR_Overlay.Monsters.ailments"); ailments = require("MHR_Overlay.Monsters.ailments");
table_helpers = require("MHR_Overlay.Misc.table_helpers"); table_helpers = require("MHR_Overlay.Misc.table_helpers");
sdk.hook(stock_damage_method, function(args)
pcall(ailment_hook.stock_damage);
end, function(retval)
return retval;
end);
sdk.hook(on_poison_activate_proc_method, function(args)
pcall(ailment_hook.poison_proc, sdk.to_managed_object(args[2]));
end, function(retval)
return retval;
end);
end end
return ailment_hook; return ailment_hook;

View File

@@ -140,7 +140,7 @@ function ailments.init_ailments()
_ailments[ailments.poison_id].buildup = {}; _ailments[ailments.poison_id].buildup = {};
_ailments[ailments.poison_id].buildup_share = {}; _ailments[ailments.poison_id].buildup_share = {};
_ailments[ailments.poison_id].cashed_buildup_share = {}; _ailments[ailments.poison_id].cached_buildup_share = {};
_ailments[ailments.blast_id].buildup = {}; _ailments[ailments.blast_id].buildup = {};
_ailments[ailments.blast_id].buildup_share = {}; _ailments[ailments.blast_id].buildup_share = {};
@@ -161,54 +161,62 @@ function ailments.init_ailment_buildup_UI(_ailments)
end end
function ailments.init_ailment_buildup_dynamic_UI(_ailments) function ailments.init_ailment_buildup_dynamic_UI(_ailments)
local cached_config = config.current_config.large_monster_UI.dynamic.ailment_buildups;
_ailments[ailments.stun_id].ailment_buildup_dynamic_UI = ailment_buildup_UI_entity.new( _ailments[ailments.stun_id].ailment_buildup_dynamic_UI = ailment_buildup_UI_entity.new(
config.current_config.large_monster_UI.dynamic.ailment_buildups.buildup_bar, cached_config.buildup_bar,
config.current_config.large_monster_UI.dynamic.ailment_buildups.highlighted_buildup_bar, cached_config.highlighted_buildup_bar,
config.current_config.large_monster_UI.dynamic.ailment_buildups.ailment_name_label, cached_config.ailment_name_label,
config.current_config.large_monster_UI.dynamic.ailment_buildups.player_name_label, cached_config.player_name_label,
config.current_config.large_monster_UI.dynamic.ailment_buildups.buildup_value_label, cached_config.buildup_value_label,
config.current_config.large_monster_UI.dynamic.ailment_buildups.buildup_percentage_label, cached_config.buildup_percentage_label,
config.current_config.large_monster_UI.dynamic.ailment_buildups.total_buildup_label, cached_config.total_buildup_label,
config.current_config.large_monster_UI.dynamic.ailment_buildups.total_buildup_value_label cached_config.total_buildup_value_label
); );
end end
function ailments.init_ailment_buildup_static_UI(_ailments) function ailments.init_ailment_buildup_static_UI(_ailments)
local cached_config = config.current_config.large_monster_UI.static.ailment_buildups;
_ailments[ailments.stun_id].ailment_buildup_static_UI = ailment_buildup_UI_entity.new( _ailments[ailments.stun_id].ailment_buildup_static_UI = ailment_buildup_UI_entity.new(
config.current_config.large_monster_UI.static.ailment_buildups.buildup_bar, cached_config.buildup_bar,
config.current_config.large_monster_UI.static.ailment_buildups.highlighted_buildup_bar, cached_config.highlighted_buildup_bar,
config.current_config.large_monster_UI.static.ailment_buildups.ailment_name_label, cached_config.ailment_name_label,
config.current_config.large_monster_UI.static.ailment_buildups.player_name_label, cached_config.player_name_label,
config.current_config.large_monster_UI.static.ailment_buildups.buildup_value_label, cached_config.buildup_value_label,
config.current_config.large_monster_UI.static.ailment_buildups.buildup_percentage_label, cached_config.buildup_percentage_label,
config.current_config.large_monster_UI.static.ailment_buildups.total_buildup_label, cached_config.total_buildup_label,
config.current_config.large_monster_UI.static.ailment_buildups.total_buildup_value_label cached_config.total_buildup_value_label
); );
end end
function ailments.init_ailment_buildup_highlighted_UI(_ailments) function ailments.init_ailment_buildup_highlighted_UI(_ailments)
local cached_config = config.current_config.large_monster_UI.highlighted.ailment_buildups;
_ailments[ailments.stun_id].ailment_buildup_highlighted_UI = ailment_buildup_UI_entity.new( _ailments[ailments.stun_id].ailment_buildup_highlighted_UI = ailment_buildup_UI_entity.new(
config.current_config.large_monster_UI.highlighted.ailment_buildups.buildup_bar, cached_config.buildup_bar,
config.current_config.large_monster_UI.highlighted.ailment_buildups.highlighted_buildup_bar, cached_config.highlighted_buildup_bar,
config.current_config.large_monster_UI.highlighted.ailment_buildups.ailment_name_label, cached_config.ailment_name_label,
config.current_config.large_monster_UI.highlighted.ailment_buildups.player_name_label, cached_config.player_name_label,
config.current_config.large_monster_UI.highlighted.ailment_buildups.buildup_value_label, cached_config.buildup_value_label,
config.current_config.large_monster_UI.highlighted.ailment_buildups.buildup_percentage_label, cached_config.buildup_percentage_label,
config.current_config.large_monster_UI.highlighted.ailment_buildups.total_buildup_label, cached_config.total_buildup_label,
config.current_config.large_monster_UI.highlighted.ailment_buildups.total_buildup_value_label cached_config.total_buildup_value_label
); );
end end
function ailments.init_ailment_buildup_small_UI(_ailments) function ailments.init_ailment_buildup_small_UI(_ailments)
local cached_config = config.current_config.small_monster_UI.ailment_buildups;
_ailments[ailments.stun_id].ailment_buildup_small_UI = ailment_buildup_UI_entity.new( _ailments[ailments.stun_id].ailment_buildup_small_UI = ailment_buildup_UI_entity.new(
config.current_config.small_monster_UI.ailment_buildups.buildup_bar, cached_config.buildup_bar,
config.current_config.small_monster_UI.ailment_buildups.highlighted_buildup_bar, cached_config.highlighted_buildup_bar,
config.current_config.small_monster_UI.ailment_buildups.ailment_name_label, cached_config.ailment_name_label,
config.current_config.small_monster_UI.ailment_buildups.player_name_label, cached_config.player_name_label,
config.current_config.small_monster_UI.ailment_buildups.buildup_value_label, cached_config.buildup_value_label,
config.current_config.small_monster_UI.ailment_buildups.buildup_percentage_label, cached_config.buildup_percentage_label,
config.current_config.small_monster_UI.ailment_buildups.total_buildup_label, cached_config.total_buildup_label,
config.current_config.small_monster_UI.ailment_buildups.total_buildup_value_label cached_config.total_buildup_value_label
); );
end end
@@ -253,7 +261,7 @@ function ailments.update_ailments(enemy, monster)
end end
ailments.update_stun_poison_blast_ailments(monster, damage_param); ailments.update_stun_poison_blast_ailments(monster, damage_param);
if not config.current_config.large_monster_UI.dynamic.ailments.visibility if not config.current_config.large_monster_UI.dynamic.ailments.visibility
and not config.current_config.large_monster_UI.static.ailments.visibility and not config.current_config.large_monster_UI.static.ailments.visibility
and not config.current_config.large_monster_UI.highlighted.ailments.visibility and not config.current_config.large_monster_UI.highlighted.ailments.visibility
@@ -276,6 +284,7 @@ function ailments.update_ailments(enemy, monster)
return; return;
end end
for index, ailment_param in ipairs(condition_param_table) do for index, ailment_param in ipairs(condition_param_table) do
local id = index - 1; local id = index - 1;
if id == ailments.stun_id or id == ailments.poison_id or id == ailments.blast_id then if id == ailments.stun_id or id == ailments.poison_id or id == ailments.blast_id then
@@ -307,7 +316,7 @@ end
function ailments.update_ailment(monster, ailment_param, id) function ailments.update_ailment(monster, ailment_param, id)
local is_enable = get_is_enable_method:call(ailment_param); local is_enable = get_is_enable_method:call(ailment_param);
local activate_count = get_activate_count_method:call(ailment_param):get_element(0):get_field("mValue"); local activate_count = get_activate_count_method:call(ailment_param):get_element(0):get_field("mValue") or 0;
local buildup = get_stock_method:call(ailment_param):get_element(0):get_field("mValue"); local buildup = get_stock_method:call(ailment_param):get_element(0):get_field("mValue");
local buildup_limit = get_limit_method:call(ailment_param):get_element(0):get_field("mValue"); local buildup_limit = get_limit_method:call(ailment_param):get_element(0):get_field("mValue");
local timer = get_active_timer_method:call(ailment_param); local timer = get_active_timer_method:call(ailment_param);
@@ -315,13 +324,16 @@ function ailments.update_ailment(monster, ailment_param, id)
local is_active = get_is_active_method:call(ailment_param); local is_active = get_is_active_method:call(ailment_param);
if is_enable ~= nil then if is_enable ~= nil then
if is_enable ~= monster.ailments[id].is_enable then is_enable = true;
ailments.update_last_change_time(monster, id);
end
monster.ailments[id].is_enable = is_enable;
end end
if is_enable ~= monster.ailments[id].is_enable then
ailments.update_last_change_time(monster, id);
end
monster.ailments[id].is_enable = is_enable;
if activate_count ~= nil then if activate_count ~= nil then
if activate_count ~= monster.ailments[id].activate_count then if activate_count ~= monster.ailments[id].activate_count then
ailments.update_last_change_time(monster, id); ailments.update_last_change_time(monster, id);
@@ -435,30 +447,33 @@ function ailments.update_poison_blast(monster, poison_param, blast_param)
end end
function ailments.draw_dynamic(monster, ailments_position_on_screen, opacity_scale) function ailments.draw_dynamic(monster, ailments_position_on_screen, opacity_scale)
local cached_config = config.current_config.large_monster_UI.dynamic.ailments;
local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
--sort parts here --sort parts here
local displayed_ailments = {}; local displayed_ailments = {};
for REpart, ailment in pairs(monster.ailments) do 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 and not ailment.is_active then if cached_config.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; goto continue;
end end
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 if cached_config.settings.hide_inactive_ailments_with_no_buildup_support and ailment.buildup_limit == 0 and not ailment.is_active then
goto continue; goto continue;
end end
if config.current_config.large_monster_UI.dynamic.ailments.settings.hide_all_inactive_ailments and not ailment.is_active then if cached_config.settings.hide_all_inactive_ailments and not ailment.is_active then
goto continue; goto continue;
end end
if config.current_config.large_monster_UI.dynamic.ailments.settings.hide_all_active_ailments and ailment.is_active then if cached_config.settings.hide_all_active_ailments and ailment.is_active then
goto continue; goto continue;
end end
if config.current_config.large_monster_UI.dynamic.ailments.settings.hide_disabled_ailments and not ailment.is_enable then if cached_config.settings.hide_disabled_ailments and not ailment.is_enable then
goto continue; goto continue;
end 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 and not ailment.is_active then if cached_config.settings.time_limit ~= 0 and time.total_elapsed_seconds - ailment.last_change_time > cached_config.settings.time_limit and not ailment.is_active then
goto continue; goto continue;
end end
@@ -467,8 +482,8 @@ function ailments.draw_dynamic(monster, ailments_position_on_screen, opacity_sca
end end
if config.current_config.large_monster_UI.dynamic.ailments.sorting.type == "Normal" then if cached_config.sorting.type == "Normal" then
if config.current_config.large_monster_UI.dynamic.ailments.sorting.reversed_order then if cached_config.sorting.reversed_order then
table.sort(displayed_ailments, function(left, right) table.sort(displayed_ailments, function(left, right)
return left.id > right.id; return left.id > right.id;
end); end);
@@ -477,8 +492,8 @@ function ailments.draw_dynamic(monster, ailments_position_on_screen, opacity_sca
return left.id < right.id; return left.id < right.id;
end); end);
end end
elseif config.current_config.large_monster_UI.dynamic.ailments.sorting.type == "Buildup" then elseif cached_config.sorting.type == "Buildup" then
if config.current_config.large_monster_UI.dynamic.ailments.sorting.reversed_order then if cached_config.sorting.reversed_order then
table.sort(displayed_ailments, function(left, right) table.sort(displayed_ailments, function(left, right)
return left.total_buildup > right.total_buildup; return left.total_buildup > right.total_buildup;
end); end);
@@ -487,8 +502,8 @@ function ailments.draw_dynamic(monster, ailments_position_on_screen, opacity_sca
return left.total_buildup < right.total_buildup; return left.total_buildup < right.total_buildup;
end); end);
end end
elseif config.current_config.large_monster_UI.dynamic.ailments.sorting.type == "Buildup Percentage" then elseif cached_config.sorting.type == "Buildup Percentage" then
if config.current_config.large_monster_UI.dynamic.ailments.sorting.reversed_order then if cached_config.sorting.reversed_order then
table.sort(displayed_ailments, function(left, right) table.sort(displayed_ailments, function(left, right)
return left.buildup_percentage > right.buildup_percentage; return left.buildup_percentage > right.buildup_percentage;
end); end);
@@ -501,8 +516,8 @@ function ailments.draw_dynamic(monster, ailments_position_on_screen, opacity_sca
for j, ailment in ipairs(displayed_ailments) do for j, ailment in ipairs(displayed_ailments) do
local ailment_position_on_screen = { local ailment_position_on_screen = {
x = ailments_position_on_screen.x + config.current_config.large_monster_UI.dynamic.ailments.spacing.x * (j - 1) * config.current_config.global_settings.modifiers.global_scale_modifier, x = ailments_position_on_screen.x + cached_config.spacing.x * (j - 1) * global_scale_modifier,
y = ailments_position_on_screen.y + config.current_config.large_monster_UI.dynamic.ailments.spacing.y * (j - 1) * config.current_config.global_settings.modifiers.global_scale_modifier; y = ailments_position_on_screen.y + cached_config.spacing.y * (j - 1) * global_scale_modifier;
} }
ailment_UI_entity.draw_dynamic(ailment, monster.ailment_dynamic_UI, ailment_position_on_screen, opacity_scale); ailment_UI_entity.draw_dynamic(ailment, monster.ailment_dynamic_UI, ailment_position_on_screen, opacity_scale);
end end
@@ -511,31 +526,33 @@ function ailments.draw_dynamic(monster, ailments_position_on_screen, opacity_sca
end end
function ailments.draw_static(monster, ailments_position_on_screen, opacity_scale) function ailments.draw_static(monster, ailments_position_on_screen, opacity_scale)
local cached_config = config.current_config.large_monster_UI.static.ailments;
local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
--sort parts here --sort parts here
local displayed_ailments = {}; local displayed_ailments = {};
for REpart, ailment in pairs(monster.ailments) do 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 and not ailment.is_active then if cached_config.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; goto continue;
end end
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 if cached_config.settings.hide_inactive_ailments_with_no_buildup_support and ailment.buildup_limit == 0 and not ailment.is_active then
goto continue; goto continue;
end end
if config.current_config.large_monster_UI.static.ailments.settings.hide_all_inactive_ailments and not ailment.is_active then if cached_config.settings.hide_all_inactive_ailments and not ailment.is_active then
goto continue; goto continue;
end end
if config.current_config.large_monster_UI.static.ailments.settings.hide_all_active_ailments and ailment.is_active then if cached_config.settings.hide_all_active_ailments and ailment.is_active then
goto continue; goto continue;
end end
if config.current_config.large_monster_UI.static.ailments.settings.hide_disabled_ailments and not ailment.is_enable then if cached_config.settings.hide_disabled_ailments and not ailment.is_enable then
goto continue; goto continue;
end 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 and not ailment.is_active then if cached_config.settings.time_limit ~= 0 and time.total_elapsed_seconds - ailment.last_change_time > cached_config.settings.time_limit and not ailment.is_active then
goto continue; goto continue;
end end
@@ -544,8 +561,8 @@ function ailments.draw_static(monster, ailments_position_on_screen, opacity_scal
end end
if config.current_config.large_monster_UI.static.ailments.sorting.type == "Normal" then if cached_config.sorting.type == "Normal" then
if config.current_config.large_monster_UI.static.ailments.sorting.reversed_order then if cached_config.sorting.reversed_order then
table.sort(displayed_ailments, function(left, right) table.sort(displayed_ailments, function(left, right)
return left.id > right.id; return left.id > right.id;
end); end);
@@ -554,8 +571,8 @@ function ailments.draw_static(monster, ailments_position_on_screen, opacity_scal
return left.id < right.id; return left.id < right.id;
end); end);
end end
elseif config.current_config.large_monster_UI.static.ailments.sorting.type == "Buildup" then elseif cached_config.sorting.type == "Buildup" then
if config.current_config.large_monster_UI.static.ailments.sorting.reversed_order then if cached_config.sorting.reversed_order then
table.sort(displayed_ailments, function(left, right) table.sort(displayed_ailments, function(left, right)
return left.total_buildup > right.total_buildup; return left.total_buildup > right.total_buildup;
end); end);
@@ -564,8 +581,8 @@ function ailments.draw_static(monster, ailments_position_on_screen, opacity_scal
return left.total_buildup < right.total_buildup; return left.total_buildup < right.total_buildup;
end); end);
end end
elseif config.current_config.large_monster_UI.static.ailments.sorting.type == "Buildup Percentage" then elseif cached_config.sorting.type == "Buildup Percentage" then
if config.current_config.large_monster_UI.static.ailments.sorting.reversed_order then if cached_config.sorting.reversed_order then
table.sort(displayed_ailments, function(left, right) table.sort(displayed_ailments, function(left, right)
return left.buildup_percentage > right.buildup_percentage; return left.buildup_percentage > right.buildup_percentage;
end); end);
@@ -578,8 +595,8 @@ function ailments.draw_static(monster, ailments_position_on_screen, opacity_scal
for j, ailment in ipairs(displayed_ailments) do for j, ailment in ipairs(displayed_ailments) do
local ailment_position_on_screen = { local ailment_position_on_screen = {
x = ailments_position_on_screen.x + config.current_config.large_monster_UI.static.ailments.spacing.x * (j - 1) * config.current_config.global_settings.modifiers.global_scale_modifier, x = ailments_position_on_screen.x + cached_config.spacing.x * (j - 1) * global_scale_modifier,
y = ailments_position_on_screen.y + config.current_config.large_monster_UI.static.ailments.spacing.y * (j - 1) * config.current_config.global_settings.modifiers.global_scale_modifier; y = ailments_position_on_screen.y + cached_config.spacing.y * (j - 1) * global_scale_modifier;
} }
ailment_UI_entity.draw_static(ailment, monster.ailment_static_UI, ailment_position_on_screen, opacity_scale); ailment_UI_entity.draw_static(ailment, monster.ailment_static_UI, ailment_position_on_screen, opacity_scale);
@@ -587,30 +604,33 @@ function ailments.draw_static(monster, ailments_position_on_screen, opacity_scal
end end
function ailments.draw_highlighted(monster, ailments_position_on_screen, opacity_scale) function ailments.draw_highlighted(monster, ailments_position_on_screen, opacity_scale)
local cached_config = config.current_config.large_monster_UI.highlighted.ailments;
local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
--sort parts here --sort parts here
local displayed_ailments = {}; local displayed_ailments = {};
for id, ailment in pairs(monster.ailments) do 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 and not ailment.is_active then if cached_config.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; goto continue;
end end
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 if cached_config.settings.hide_inactive_ailments_with_no_buildup_support and ailment.buildup_limit == 0 and not ailment.is_active then
goto continue; goto continue;
end end
if config.current_config.large_monster_UI.highlighted.ailments.settings.hide_all_inactive_ailments and not ailment.is_active then if cached_config.settings.hide_all_inactive_ailments and not ailment.is_active then
goto continue; goto continue;
end end
if config.current_config.large_monster_UI.highlighted.ailments.settings.hide_all_active_ailments and ailment.is_active then if cached_config.settings.hide_all_active_ailments and ailment.is_active then
goto continue; goto continue;
end end
if config.current_config.large_monster_UI.highlighted.ailments.settings.hide_disabled_ailments and not ailment.is_enable then if cached_config.settings.hide_disabled_ailments and not ailment.is_enable then
goto continue; goto continue;
end 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 and not ailment.is_active then if cached_config.settings.time_limit ~= 0 and time.total_elapsed_seconds - ailment.last_change_time > cached_config.settings.time_limit and not ailment.is_active then
goto continue; goto continue;
end end
@@ -618,8 +638,8 @@ function ailments.draw_highlighted(monster, ailments_position_on_screen, opacity
::continue:: ::continue::
end end
if config.current_config.large_monster_UI.highlighted.ailments.sorting.type == "Normal" then if cached_config.sorting.type == "Normal" then
if config.current_config.large_monster_UI.highlighted.ailments.sorting.reversed_order then if cached_config.sorting.reversed_order then
table.sort(displayed_ailments, function(left, right) table.sort(displayed_ailments, function(left, right)
return left.id > right.id; return left.id > right.id;
end); end);
@@ -628,8 +648,8 @@ function ailments.draw_highlighted(monster, ailments_position_on_screen, opacity
return left.id < right.id; return left.id < right.id;
end); end);
end end
elseif config.current_config.large_monster_UI.highlighted.ailments.sorting.type == "Buildup" then elseif cached_config.sorting.type == "Buildup" then
if config.current_config.large_monster_UI.highlighted.ailments.sorting.reversed_order then if cached_config.sorting.reversed_order then
table.sort(displayed_ailments, function(left, right) table.sort(displayed_ailments, function(left, right)
return left.total_buildup > right.total_buildup; return left.total_buildup > right.total_buildup;
end); end);
@@ -638,8 +658,8 @@ function ailments.draw_highlighted(monster, ailments_position_on_screen, opacity
return left.total_buildup < right.total_buildup; return left.total_buildup < right.total_buildup;
end); end);
end end
elseif config.current_config.large_monster_UI.highlighted.ailments.sorting.type == "Buildup Percentage" then elseif cached_config.sorting.type == "Buildup Percentage" then
if config.current_config.large_monster_UI.highlighted.ailments.sorting.reversed_order then if cached_config.sorting.reversed_order then
table.sort(displayed_ailments, function(left, right) table.sort(displayed_ailments, function(left, right)
return left.buildup_percentage > right.buildup_percentage; return left.buildup_percentage > right.buildup_percentage;
end); end);
@@ -652,8 +672,8 @@ function ailments.draw_highlighted(monster, ailments_position_on_screen, opacity
for j, ailment in ipairs(displayed_ailments) do for j, ailment in ipairs(displayed_ailments) do
local ailment_position_on_screen = { local ailment_position_on_screen = {
x = ailments_position_on_screen.x + config.current_config.large_monster_UI.highlighted.ailments.spacing.x * (j - 1) * config.current_config.global_settings.modifiers.global_scale_modifier, x = ailments_position_on_screen.x + cached_config.spacing.x * (j - 1) * global_scale_modifier,
y = ailments_position_on_screen.y + config.current_config.large_monster_UI.highlighted.ailments.spacing.y * (j - 1) * config.current_config.global_settings.modifiers.global_scale_modifier; y = ailments_position_on_screen.y + cached_config.spacing.y * (j - 1) * global_scale_modifier;
} }
ailment_UI_entity.draw_highlighted(ailment, monster.ailment_highlighted_UI, ailment_position_on_screen, opacity_scale); ailment_UI_entity.draw_highlighted(ailment, monster.ailment_highlighted_UI, ailment_position_on_screen, opacity_scale);
@@ -661,30 +681,33 @@ function ailments.draw_highlighted(monster, ailments_position_on_screen, opacity
end end
function ailments.draw_small(monster, ailments_position_on_screen, opacity_scale) function ailments.draw_small(monster, ailments_position_on_screen, opacity_scale)
local cached_config = config.current_config.small_monster_UI.ailments;
local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
--sort parts here --sort parts here
local displayed_ailments = {}; local displayed_ailments = {};
for REpart, ailment in pairs(monster.ailments) do 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 and not ailment.is_active then if cached_config.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; goto continue;
end end
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 if cached_config.settings.hide_inactive_ailments_with_no_buildup_support and ailment.buildup_limit == 0 and not ailment.is_active then
goto continue; goto continue;
end end
if config.current_config.small_monster_UI.ailments.settings.hide_all_inactive_ailments and not ailment.is_active then if cached_config.settings.hide_all_inactive_ailments and not ailment.is_active then
goto continue; goto continue;
end end
if config.current_config.small_monster_UI.ailments.settings.hide_all_active_ailments and ailment.is_active then if cached_config.settings.hide_all_active_ailments and ailment.is_active then
goto continue; goto continue;
end end
if config.current_config.small_monster_UI.ailments.settings.hide_disabled_ailments and not ailment.is_enable then if cached_config.settings.hide_disabled_ailments and not ailment.is_enable then
goto continue; goto continue;
end 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 and not ailment.is_active then if cached_config.settings.time_limit ~= 0 and time.total_elapsed_seconds - ailment.last_change_time > cached_config.settings.time_limit and not ailment.is_active then
goto continue; goto continue;
end end
@@ -693,39 +716,39 @@ function ailments.draw_small(monster, ailments_position_on_screen, opacity_scale
end end
if config.current_config.small_monster_UI.ailments.sorting.type == "Normal" then if cached_config.sorting.type == "Normal" then
if config.current_config.small_monster_UI.ailments.sorting.reversed_order then if cached_config.sorting.reversed_order then
table.sort(displayed_ailments, function(left, right) table.sort(displayed_ailments, function(left, right)
if config.current_config.small_monster_UI.ailments.settings.prioritize_active_ailments and left.is_active then return false; end if cached_config.settings.prioritize_active_ailments and left.is_active then return false; end
return left.id > right.id; return left.id > right.id;
end); end);
else else
table.sort(displayed_ailments, function(left, right) table.sort(displayed_ailments, function(left, right)
if config.current_config.small_monster_UI.ailments.settings.prioritize_active_ailments and left.is_active then return true; end if cached_config.settings.prioritize_active_ailments and left.is_active then return true; end
return left.id < right.id; return left.id < right.id;
end); end);
end end
elseif config.current_config.small_monster_UI.ailments.sorting.type == "Buildup" then elseif cached_config.sorting.type == "Buildup" then
if config.current_config.small_monster_UI.ailments.sorting.reversed_order then if cached_config.sorting.reversed_order then
table.sort(displayed_ailments, function(left, right) table.sort(displayed_ailments, function(left, right)
if config.current_config.small_monster_UI.ailments.settings.prioritize_active_ailments and left.is_active then return false; end if cached_config.settings.prioritize_active_ailments and left.is_active then return false; end
return left.total_buildup > right.total_buildup; return left.total_buildup > right.total_buildup;
end); end);
else else
table.sort(displayed_ailments, function(left, right) table.sort(displayed_ailments, function(left, right)
if config.current_config.small_monster_UI.ailments.settings.prioritize_active_ailments and left.is_active then return true; end if cached_config.settings.prioritize_active_ailments and left.is_active then return true; end
return left.total_buildup < right.total_buildup; return left.total_buildup < right.total_buildup;
end); end);
end end
elseif config.current_config.small_monster_UI.ailments.sorting.type == "Buildup Percentage" then elseif cached_config.sorting.type == "Buildup Percentage" then
if config.current_config.small_monster_UI.ailments.sorting.reversed_order then if cached_config.sorting.reversed_order then
table.sort(displayed_ailments, function(left, right) table.sort(displayed_ailments, function(left, right)
if config.current_config.small_monster_UI.ailments.settings.prioritize_active_ailments and left.is_active then return false; end if cached_config.settings.prioritize_active_ailments and left.is_active then return false; end
return left.buildup_percentage > right.buildup_percentage; return left.buildup_percentage > right.buildup_percentage;
end); end);
else else
table.sort(displayed_ailments, function(left, right) table.sort(displayed_ailments, function(left, right)
if config.current_config.small_monster_UI.ailments.settings.prioritize_active_ailments and left.is_active then return true; end if cached_config.settings.prioritize_active_ailments and left.is_active then return true; end
return left.buildup_percentage < right.buildup_percentage; return left.buildup_percentage < right.buildup_percentage;
end); end);
end end
@@ -733,8 +756,8 @@ function ailments.draw_small(monster, ailments_position_on_screen, opacity_scale
for j, ailment in ipairs(displayed_ailments) do for j, ailment in ipairs(displayed_ailments) do
local ailment_position_on_screen = { local ailment_position_on_screen = {
x = ailments_position_on_screen.x + config.current_config.small_monster_UI.ailments.spacing.x * (j - 1) * config.current_config.global_settings.modifiers.global_scale_modifier, x = ailments_position_on_screen.x + cached_config.spacing.x * (j - 1) * global_scale_modifier,
y = ailments_position_on_screen.y + config.current_config.small_monster_UI.ailments.spacing.y * (j - 1) * config.current_config.global_settings.modifiers.global_scale_modifier; y = ailments_position_on_screen.y + cached_config.spacing.y * (j - 1) * global_scale_modifier;
} }

View File

@@ -46,93 +46,105 @@ end
function body_part.init_dynamic_UI(part) function body_part.init_dynamic_UI(part)
local cached_config = config.current_config.large_monster_UI.dynamic.body_parts;
part.body_part_dynamic_UI = body_part_UI_entity.new( part.body_part_dynamic_UI = body_part_UI_entity.new(
config.current_config.large_monster_UI.dynamic.body_parts.visibility, cached_config.visibility,
config.current_config.large_monster_UI.dynamic.body_parts.part_name_label, cached_config.part_name_label,
config.current_config.large_monster_UI.dynamic.body_parts.part_health.visibility, cached_config.part_health.visibility,
config.current_config.large_monster_UI.dynamic.body_parts.part_health.bar, cached_config.part_health.bar,
config.current_config.large_monster_UI.dynamic.body_parts.part_health.text_label, cached_config.part_health.text_label,
config.current_config.large_monster_UI.dynamic.body_parts.part_health.value_label, cached_config.part_health.value_label,
config.current_config.large_monster_UI.dynamic.body_parts.part_health.percentage_label, cached_config.part_health.percentage_label,
config.current_config.large_monster_UI.dynamic.body_parts.part_break.visibility, cached_config.part_break.visibility,
config.current_config.large_monster_UI.dynamic.body_parts.part_break.bar, cached_config.part_break.bar,
config.current_config.large_monster_UI.dynamic.body_parts.part_break.text_label, cached_config.part_break.text_label,
config.current_config.large_monster_UI.dynamic.body_parts.part_break.value_label, cached_config.part_break.value_label,
config.current_config.large_monster_UI.dynamic.body_parts.part_break.percentage_label, cached_config.part_break.percentage_label,
config.current_config.large_monster_UI.dynamic.body_parts.part_loss.visibility, cached_config.part_loss.visibility,
config.current_config.large_monster_UI.dynamic.body_parts.part_loss.bar, cached_config.part_loss.bar,
config.current_config.large_monster_UI.dynamic.body_parts.part_loss.text_label, cached_config.part_loss.text_label,
config.current_config.large_monster_UI.dynamic.body_parts.part_loss.value_label, cached_config.part_loss.value_label,
config.current_config.large_monster_UI.dynamic.body_parts.part_loss.percentage_label cached_config.part_loss.percentage_label
); );
end end
function body_part.init_static_UI(part) function body_part.init_static_UI(part)
local cached_config = config.current_config.large_monster_UI.static.body_parts;
part.body_part_static_UI = body_part_UI_entity.new( part.body_part_static_UI = body_part_UI_entity.new(
config.current_config.large_monster_UI.static.body_parts.visibility, cached_config.visibility,
config.current_config.large_monster_UI.static.body_parts.part_name_label, cached_config.part_name_label,
config.current_config.large_monster_UI.static.body_parts.part_health.visibility, cached_config.part_health.visibility,
config.current_config.large_monster_UI.static.body_parts.part_health.bar, cached_config.part_health.bar,
config.current_config.large_monster_UI.static.body_parts.part_health.text_label, cached_config.part_health.text_label,
config.current_config.large_monster_UI.static.body_parts.part_health.value_label, cached_config.part_health.value_label,
config.current_config.large_monster_UI.static.body_parts.part_health.percentage_label, cached_config.part_health.percentage_label,
config.current_config.large_monster_UI.static.body_parts.part_break.visibility, cached_config.part_break.visibility,
config.current_config.large_monster_UI.static.body_parts.part_break.bar, cached_config.part_break.bar,
config.current_config.large_monster_UI.static.body_parts.part_break.text_label, cached_config.part_break.text_label,
config.current_config.large_monster_UI.static.body_parts.part_break.value_label, cached_config.part_break.value_label,
config.current_config.large_monster_UI.static.body_parts.part_break.percentage_label, cached_config.part_break.percentage_label,
config.current_config.large_monster_UI.static.body_parts.part_loss.visibility, cached_config.part_loss.visibility,
config.current_config.large_monster_UI.static.body_parts.part_loss.bar, cached_config.part_loss.bar,
config.current_config.large_monster_UI.static.body_parts.part_loss.text_label, cached_config.part_loss.text_label,
config.current_config.large_monster_UI.static.body_parts.part_loss.value_label, cached_config.part_loss.value_label,
config.current_config.large_monster_UI.static.body_parts.part_loss.percentage_label cached_config.part_loss.percentage_label
); );
end end
function body_part.init_highlighted_UI(part) function body_part.init_highlighted_UI(part)
local cached_config = config.current_config.large_monster_UI.highlighted.body_parts;
part.body_part_highlighted_UI = body_part_UI_entity.new( part.body_part_highlighted_UI = body_part_UI_entity.new(
config.current_config.large_monster_UI.highlighted.body_parts.visibility, cached_config.visibility,
config.current_config.large_monster_UI.highlighted.body_parts.part_name_label, cached_config.part_name_label,
config.current_config.large_monster_UI.highlighted.body_parts.part_health.visibility, cached_config.part_health.visibility,
config.current_config.large_monster_UI.highlighted.body_parts.part_health.bar, cached_config.part_health.bar,
config.current_config.large_monster_UI.highlighted.body_parts.part_health.text_label, cached_config.part_health.text_label,
config.current_config.large_monster_UI.highlighted.body_parts.part_health.value_label, cached_config.part_health.value_label,
config.current_config.large_monster_UI.highlighted.body_parts.part_health.percentage_label, cached_config.part_health.percentage_label,
config.current_config.large_monster_UI.highlighted.body_parts.part_break.visibility, cached_config.part_break.visibility,
config.current_config.large_monster_UI.highlighted.body_parts.part_break.bar, cached_config.part_break.bar,
config.current_config.large_monster_UI.highlighted.body_parts.part_break.text_label, cached_config.part_break.text_label,
config.current_config.large_monster_UI.highlighted.body_parts.part_break.value_label, cached_config.part_break.value_label,
config.current_config.large_monster_UI.highlighted.body_parts.part_break.percentage_label, cached_config.part_break.percentage_label,
config.current_config.large_monster_UI.highlighted.body_parts.part_loss.visibility, cached_config.part_loss.visibility,
config.current_config.large_monster_UI.highlighted.body_parts.part_loss.bar, cached_config.part_loss.bar,
config.current_config.large_monster_UI.highlighted.body_parts.part_loss.text_label, cached_config.part_loss.text_label,
config.current_config.large_monster_UI.highlighted.body_parts.part_loss.value_label, cached_config.part_loss.value_label,
config.current_config.large_monster_UI.highlighted.body_parts.part_loss.percentage_label cached_config.part_loss.percentage_label
); );
end end
function body_part.update(part, part_current, part_max, part_break_current, part_break_max, part_loss_current, part_loss_max, part_break_count, part_break_max_count, is_severed) function body_part.update_flinch(part, part_current, part_max)
if part == nil then
return;
end
if part_current > part.health then if part_current > part.health then
part.flinch_count = part.flinch_count + 1; part.flinch_count = part.flinch_count + 1;
end end
if part_break_current > part.break_health then
part.break_count = part.break_count + 1;
end
if part.health ~= part_current then if part.health ~= part_current then
part.last_change_time = time.total_elapsed_seconds; part.last_change_time = time.total_elapsed_seconds;
end end
if part.max_health ~= part_max then
part.last_change_time = time.total_elapsed_seconds;
end
part.health = part_current;
part.max_health = part_max;
if part.max_health ~= 0 then
part.health_percentage = part.health / part.max_health;
end
end
function body_part.update_break(part, part_break_current, part_break_max, part_break_count, part_break_max_count)
if part.break_health ~= part_break_current then if part.break_health ~= part_break_current then
part.last_change_time = time.total_elapsed_seconds; part.last_change_time = time.total_elapsed_seconds;
end end
if part.loss_health ~= part_loss_current then if part.break_max_health ~= part_break_max then
part.last_change_time = time.total_elapsed_seconds; part.last_change_time = time.total_elapsed_seconds;
end end
@@ -143,31 +155,35 @@ function body_part.update(part, part_current, part_max, part_break_current, part
if part.break_max_count ~= part_break_max_count then if part.break_max_count ~= part_break_max_count then
part.last_change_time = time.total_elapsed_seconds; part.last_change_time = time.total_elapsed_seconds;
end end
if part.is_severed ~= is_severed then
part.last_change_time = time.total_elapsed_seconds;
end
part.health = part_current;
part.max_health = part_max;
part.break_health = part_break_current; part.break_health = part_break_current;
part.break_max_health = part_break_max; part.break_max_health = part_break_max;
part.loss_health = part_loss_current;
part.loss_max_health = part_loss_max;
part.break_count = part_break_count; part.break_count = part_break_count;
part.break_max_count = part_break_max_count; part.break_max_count = part_break_max_count;
part.is_severed = is_severed;
if part.max_health ~= 0 then
part.health_percentage = part.health / part.max_health;
end
if part.break_max_health ~= 0 then if part.break_max_health ~= 0 then
part.break_health_percentage = part.break_health / part.break_max_health; part.break_health_percentage = part.break_health / part.break_max_health;
end end
end
function body_part.update_loss(part, part_loss_current, part_loss_max, is_severed)
if part.loss_health ~= part_loss_current then
part.last_change_time = time.total_elapsed_seconds;
end
if part.loss_max_health ~= part_loss_max then
part.last_change_time = time.total_elapsed_seconds;
end
if part.is_severed ~= is_severed then
part.last_change_time = time.total_elapsed_seconds;
end
part.loss_health = part_loss_current;
part.loss_max_health = part_loss_max;
part.is_severed = is_severed;
if part.loss_max_health ~= 0 then if part.loss_max_health ~= 0 then
part.loss_health_percentage = part.loss_health / part.loss_max_health; part.loss_health_percentage = part.loss_health / part.loss_max_health;
@@ -176,22 +192,25 @@ function body_part.update(part, part_current, part_max, part_break_current, part
end end
function body_part.draw_dynamic(monster, parts_position_on_screen, opacity_scale) function body_part.draw_dynamic(monster, parts_position_on_screen, opacity_scale)
local cached_config = config.current_config.large_monster_UI.dynamic.body_parts;
local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
local displayed_parts = {}; local displayed_parts = {};
for REpart, part in pairs(monster.parts) do for REpart, part in pairs(monster.parts) do
if config.current_config.large_monster_UI.dynamic.body_parts.settings.hide_undamaged_parts if cached_config.settings.hide_undamaged_parts
and part.health == part.max_health and part.flinch_count == 0 and ((part.health == part.max_health and part.flinch_count == 0) or part.max_health < 0)
and ((part.break_health == part.break_max_health and part.break_count == 0) or part.break_max_health < 0) and ((part.break_health == part.break_max_health and part.break_count == 0) or part.break_max_health < 0)
and ((part.loss_health == part.loss_max_health and not part.is_severed) or part.loss_max_health < 0) then and ((part.loss_health == part.loss_max_health and not part.is_severed) or part.loss_max_health < 0) then
goto continue; goto continue;
end end
if (not part.body_part_dynamic_UI.flinch_visibility) if (not part.body_part_dynamic_UI.flinch_visibility or part.max_health < 0)
and (not part.body_part_dynamic_UI.break_visibility or part.break_max_health < 0 or part.break_count >= part.break_max_count) and (not part.body_part_dynamic_UI.break_visibility or part.break_max_health < 0 or part.break_count >= part.break_max_count)
and (not part.body_part_dynamic_UI.loss_visibility or part.loss_max_health < 0 or part.is_severed) then and (not part.body_part_dynamic_UI.loss_visibility or part.loss_max_health < 0 or part.is_severed) then
goto continue; goto continue;
end end
if config.current_config.large_monster_UI.dynamic.body_parts.settings.time_limit ~= 0 and time.total_elapsed_seconds - part.last_change_time > config.current_config.large_monster_UI.dynamic.body_parts.settings.time_limit then if cached_config.settings.time_limit ~= 0 and time.total_elapsed_seconds - part.last_change_time > cached_config.settings.time_limit then
goto continue; goto continue;
end end
@@ -199,8 +218,8 @@ function body_part.draw_dynamic(monster, parts_position_on_screen, opacity_scale
::continue:: ::continue::
end end
if config.current_config.large_monster_UI.dynamic.body_parts.sorting.type == "Normal" then if cached_config.sorting.type == "Normal" then
if config.current_config.large_monster_UI.dynamic.body_parts.sorting.reversed_order then if cached_config.sorting.reversed_order then
table.sort(displayed_parts, function(left, right) table.sort(displayed_parts, function(left, right)
return left.id > right.id; return left.id > right.id;
end); end);
@@ -209,8 +228,8 @@ function body_part.draw_dynamic(monster, parts_position_on_screen, opacity_scale
return left.id < right.id; return left.id < right.id;
end); end);
end end
elseif config.current_config.large_monster_UI.dynamic.body_parts.sorting.type == "Health" then elseif cached_config.sorting.type == "Health" then
if config.current_config.large_monster_UI.dynamic.body_parts.sorting.reversed_order then if cached_config.sorting.reversed_order then
table.sort(displayed_parts, function(left, right) table.sort(displayed_parts, function(left, right)
return left.health > right.health; return left.health > right.health;
end); end);
@@ -219,8 +238,8 @@ function body_part.draw_dynamic(monster, parts_position_on_screen, opacity_scale
return left.health < right.health; return left.health < right.health;
end); end);
end end
elseif config.current_config.large_monster_UI.dynamic.body_parts.sorting.type == "Health Percentage" then elseif cached_config.sorting.type == "Health Percentage" then
if config.current_config.large_monster_UI.dynamic.body_parts.sorting.reversed_order then if cached_config.sorting.reversed_order then
table.sort(displayed_parts, function(left, right) table.sort(displayed_parts, function(left, right)
return left.health_percentage > right.health_percentage; return left.health_percentage > right.health_percentage;
end); end);
@@ -229,8 +248,8 @@ function body_part.draw_dynamic(monster, parts_position_on_screen, opacity_scale
return left.health_percentage < right.health_percentage; return left.health_percentage < right.health_percentage;
end); end);
end end
elseif config.current_config.large_monster_UI.dynamic.body_parts.sorting.type == "Flinch Count" then elseif cached_config.sorting.type == "Flinch Count" then
if config.current_config.large_monster_UI.dynamic.body_parts.sorting.reversed_order then if cached_config.sorting.reversed_order then
table.sort(displayed_parts, function(left, right) table.sort(displayed_parts, function(left, right)
return left.flinch_count > right.flinch_count; return left.flinch_count > right.flinch_count;
end); end);
@@ -239,8 +258,8 @@ function body_part.draw_dynamic(monster, parts_position_on_screen, opacity_scale
return left.flinch_count < right.flinch_count; return left.flinch_count < right.flinch_count;
end); end);
end end
elseif config.current_config.large_monster_UI.dynamic.body_parts.sorting.type == "Break Health" then elseif cached_config.sorting.type == "Break Health" then
if config.current_config.large_monster_UI.dynamic.body_parts.sorting.reversed_order then if cached_config.sorting.reversed_order then
table.sort(displayed_parts, function(left, right) table.sort(displayed_parts, function(left, right)
return left.break_health > right.break_health; return left.break_health > right.break_health;
end); end);
@@ -249,8 +268,8 @@ function body_part.draw_dynamic(monster, parts_position_on_screen, opacity_scale
return left.break_health < right.break_health; return left.break_health < right.break_health;
end); end);
end end
elseif config.current_config.large_monster_UI.dynamic.body_parts.sorting.type == "Break Health Percentage" then elseif cached_config.sorting.type == "Break Health Percentage" then
if config.current_config.large_monster_UI.dynamic.body_parts.sorting.reversed_order then if cached_config.sorting.reversed_order then
table.sort(displayed_parts, function(left, right) table.sort(displayed_parts, function(left, right)
return left.break_health_percentage > right.break_health_percentage; return left.break_health_percentage > right.break_health_percentage;
end); end);
@@ -259,8 +278,8 @@ function body_part.draw_dynamic(monster, parts_position_on_screen, opacity_scale
return left.break_health_percentage < right.break_health_percentage; return left.break_health_percentage < right.break_health_percentage;
end); end);
end end
elseif config.current_config.large_monster_UI.dynamic.body_parts.sorting.type == "Break Count" then elseif cached_config.sorting.type == "Break Count" then
if config.current_config.large_monster_UI.dynamic.body_parts.sorting.reversed_order then if cached_config.sorting.reversed_order then
table.sort(displayed_parts, function(left, right) table.sort(displayed_parts, function(left, right)
return left.break_count > right.break_count; return left.break_count > right.break_count;
end); end);
@@ -269,8 +288,8 @@ function body_part.draw_dynamic(monster, parts_position_on_screen, opacity_scale
return left.break_count < right.break_count; return left.break_count < right.break_count;
end); end);
end end
elseif config.current_config.large_monster_UI.dynamic.body_parts.sorting.type == "Sever Health" then elseif cached_config.sorting.type == "Sever Health" then
if config.current_config.large_monster_UI.dynamic.body_parts.sorting.reversed_order then if cached_config.sorting.reversed_order then
table.sort(displayed_parts, function(left, right) table.sort(displayed_parts, function(left, right)
return left.loss_health > right.loss_health; return left.loss_health > right.loss_health;
end); end);
@@ -279,8 +298,8 @@ function body_part.draw_dynamic(monster, parts_position_on_screen, opacity_scale
return left.loss_health < right.loss_health; return left.loss_health < right.loss_health;
end); end);
end end
elseif config.current_config.large_monster_UI.dynamic.body_parts.sorting.type == "Sever Health Percentage" then elseif cached_config.sorting.type == "Sever Health Percentage" then
if config.current_config.large_monster_UI.dynamic.body_parts.sorting.reversed_order then if cached_config.sorting.reversed_order then
table.sort(displayed_parts, function(left, right) table.sort(displayed_parts, function(left, right)
return left.loss_health_percentage > right.loss_health_percentage; return left.loss_health_percentage > right.loss_health_percentage;
end); end);
@@ -295,8 +314,8 @@ function body_part.draw_dynamic(monster, parts_position_on_screen, opacity_scale
for j, part in ipairs(displayed_parts) do for j, part in ipairs(displayed_parts) do
local part_position_on_screen = { local part_position_on_screen = {
x = parts_position_on_screen.x + config.current_config.large_monster_UI.dynamic.body_parts.spacing.x * (j - 1) * config.current_config.global_settings.modifiers.global_scale_modifier, x = parts_position_on_screen.x + cached_config.spacing.x * (j - 1) * global_scale_modifier,
y = parts_position_on_screen.y + config.current_config.large_monster_UI.dynamic.body_parts.spacing.y * (j - 1) * config.current_config.global_settings.modifiers.global_scale_modifier; y = parts_position_on_screen.y + cached_config.spacing.y * (j - 1) * global_scale_modifier;
} }
body_part_UI_entity.draw_dynamic(part, part_position_on_screen, opacity_scale); body_part_UI_entity.draw_dynamic(part, part_position_on_screen, opacity_scale);
@@ -307,23 +326,25 @@ function body_part.draw_dynamic(monster, parts_position_on_screen, opacity_scale
end end
function body_part.draw_static(monster, parts_position_on_screen, opacity_scale) function body_part.draw_static(monster, parts_position_on_screen, opacity_scale)
local cached_config = config.current_config.large_monster_UI.static.body_parts;
local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
local displayed_parts = {}; local displayed_parts = {};
for REpart, part in pairs(monster.parts) do for REpart, part in pairs(monster.parts) do
if config.current_config.large_monster_UI.static.body_parts.settings.hide_undamaged_parts if cached_config.settings.hide_undamaged_parts
and part.health == part.max_health and part.flinch_count == 0 and ((part.health == part.max_health and part.flinch_count == 0) or part.max_health < 0)
and ((part.break_health == part.break_max_health and part.break_count == 0) or part.break_max_health < 0) and ((part.break_health == part.break_max_health and part.break_count == 0) or part.break_max_health < 0)
and ((part.loss_health == part.loss_max_health and not part.is_severed) or part.loss_max_health < 0) then and ((part.loss_health == part.loss_max_health and not part.is_severed) or part.loss_max_health < 0) then
goto continue; goto continue;
end end
if (not part.body_part_static_UI.flinch_visibility) if (not part.body_part_static_UI.flinch_visibility or part.max_health < 0)
and (not part.body_part_static_UI.break_visibility or part.break_max_health < 0 or part.break_count >= part.break_max_count) and (not part.body_part_static_UI.break_visibility or part.break_max_health < 0 or part.break_count >= part.break_max_count)
and (not part.body_part_static_UI.loss_visibility or part.loss_max_health < 0 or part.is_severed) then and (not part.body_part_static_UI.loss_visibility or part.loss_max_health < 0 or part.is_severed) then
goto continue; goto continue;
end end
if config.current_config.large_monster_UI.static.body_parts.settings.time_limit ~= 0 and time.total_elapsed_seconds - part.last_change_time > config.current_config.large_monster_UI.static.body_parts.settings.time_limit then if cached_config.settings.time_limit ~= 0 and time.total_elapsed_seconds - part.last_change_time > cached_config.settings.time_limit then
goto continue; goto continue;
end end
@@ -331,8 +352,8 @@ function body_part.draw_static(monster, parts_position_on_screen, opacity_scale)
::continue:: ::continue::
end end
if config.current_config.large_monster_UI.static.body_parts.sorting.type == "Normal" then if cached_config.sorting.type == "Normal" then
if config.current_config.large_monster_UI.static.body_parts.sorting.reversed_order then if cached_config.sorting.reversed_order then
table.sort(displayed_parts, function(left, right) table.sort(displayed_parts, function(left, right)
return left.id > right.id; return left.id > right.id;
end); end);
@@ -341,8 +362,8 @@ function body_part.draw_static(monster, parts_position_on_screen, opacity_scale)
return left.id < right.id; return left.id < right.id;
end); end);
end end
elseif config.current_config.large_monster_UI.static.body_parts.sorting.type == "Health" then elseif cached_config.sorting.type == "Health" then
if config.current_config.large_monster_UI.static.body_parts.sorting.reversed_order then if cached_config.sorting.reversed_order then
table.sort(displayed_parts, function(left, right) table.sort(displayed_parts, function(left, right)
return left.health > right.health; return left.health > right.health;
end); end);
@@ -351,8 +372,8 @@ function body_part.draw_static(monster, parts_position_on_screen, opacity_scale)
return left.health < right.health; return left.health < right.health;
end); end);
end end
elseif config.current_config.large_monster_UI.static.body_parts.sorting.type == "Health Percentage" then elseif cached_config.sorting.type == "Health Percentage" then
if config.current_config.large_monster_UI.static.body_parts.sorting.reversed_order then if cached_config.sorting.reversed_order then
table.sort(displayed_parts, function(left, right) table.sort(displayed_parts, function(left, right)
return left.health_percentage > right.health_percentage; return left.health_percentage > right.health_percentage;
end); end);
@@ -361,8 +382,8 @@ function body_part.draw_static(monster, parts_position_on_screen, opacity_scale)
return left.health_percentage < right.health_percentage; return left.health_percentage < right.health_percentage;
end); end);
end end
elseif config.current_config.large_monster_UI.static.body_parts.sorting.type == "Flinch Count" then elseif cached_config.sorting.type == "Flinch Count" then
if config.current_config.large_monster_UI.static.body_parts.sorting.reversed_order then if cached_config.sorting.reversed_order then
table.sort(displayed_parts, function(left, right) table.sort(displayed_parts, function(left, right)
return left.flinch_count > right.flinch_count; return left.flinch_count > right.flinch_count;
end); end);
@@ -371,8 +392,8 @@ function body_part.draw_static(monster, parts_position_on_screen, opacity_scale)
return left.flinch_count < right.flinch_count; return left.flinch_count < right.flinch_count;
end); end);
end end
elseif config.current_config.large_monster_UI.static.body_parts.sorting.type == "Break Health" then elseif cached_config.sorting.type == "Break Health" then
if config.current_config.large_monster_UI.static.body_parts.sorting.reversed_order then if cached_config.sorting.reversed_order then
table.sort(displayed_parts, function(left, right) table.sort(displayed_parts, function(left, right)
return left.break_health > right.break_health; return left.break_health > right.break_health;
end); end);
@@ -381,8 +402,8 @@ function body_part.draw_static(monster, parts_position_on_screen, opacity_scale)
return left.break_health < right.break_health; return left.break_health < right.break_health;
end); end);
end end
elseif config.current_config.large_monster_UI.static.body_parts.sorting.type == "Break Health Percentage" then elseif cached_config.sorting.type == "Break Health Percentage" then
if config.current_config.large_monster_UI.static.body_parts.sorting.reversed_order then if cached_config.sorting.reversed_order then
table.sort(displayed_parts, function(left, right) table.sort(displayed_parts, function(left, right)
return left.break_health_percentage > right.break_health_percentage; return left.break_health_percentage > right.break_health_percentage;
end); end);
@@ -391,8 +412,8 @@ function body_part.draw_static(monster, parts_position_on_screen, opacity_scale)
return left.break_health_percentage < right.break_health_percentage; return left.break_health_percentage < right.break_health_percentage;
end); end);
end end
elseif config.current_config.large_monster_UI.static.body_parts.sorting.type == "Break Count" then elseif cached_config.sorting.type == "Break Count" then
if config.current_config.large_monster_UI.static.body_parts.sorting.reversed_order then if cached_config.sorting.reversed_order then
table.sort(displayed_parts, function(left, right) table.sort(displayed_parts, function(left, right)
return left.break_count > right.break_count; return left.break_count > right.break_count;
end); end);
@@ -401,8 +422,8 @@ function body_part.draw_static(monster, parts_position_on_screen, opacity_scale)
return left.break_count < right.break_count; return left.break_count < right.break_count;
end); end);
end end
elseif config.current_config.large_monster_UI.static.body_parts.sorting.type == "Sever Health" then elseif cached_config.sorting.type == "Sever Health" then
if config.current_config.large_monster_UI.static.body_parts.sorting.reversed_order then if cached_config.sorting.reversed_order then
table.sort(displayed_parts, function(left, right) table.sort(displayed_parts, function(left, right)
return left.loss_health > right.loss_health; return left.loss_health > right.loss_health;
end); end);
@@ -411,8 +432,8 @@ function body_part.draw_static(monster, parts_position_on_screen, opacity_scale)
return left.loss_health < right.loss_health; return left.loss_health < right.loss_health;
end); end);
end end
elseif config.current_config.large_monster_UI.static.body_parts.sorting.type == "Sever Health Percentage" then elseif cached_config.sorting.type == "Sever Health Percentage" then
if config.current_config.large_monster_UI.static.body_parts.sorting.reversed_order then if cached_config.sorting.reversed_order then
table.sort(displayed_parts, function(left, right) table.sort(displayed_parts, function(left, right)
return left.loss_health_percentage > right.loss_health_percentage; return left.loss_health_percentage > right.loss_health_percentage;
end); end);
@@ -427,8 +448,8 @@ function body_part.draw_static(monster, parts_position_on_screen, opacity_scale)
for j, part in ipairs(displayed_parts) do for j, part in ipairs(displayed_parts) do
local part_position_on_screen = { local part_position_on_screen = {
x = parts_position_on_screen.x + config.current_config.large_monster_UI.static.body_parts.spacing.x * (j - 1) * config.current_config.global_settings.modifiers.global_scale_modifier, x = parts_position_on_screen.x + cached_config.spacing.x * (j - 1) * global_scale_modifier,
y = parts_position_on_screen.y + config.current_config.large_monster_UI.static.body_parts.spacing.y * (j - 1) * config.current_config.global_settings.modifiers.global_scale_modifier; y = parts_position_on_screen.y + cached_config.spacing.y * (j - 1) * global_scale_modifier;
} }
body_part_UI_entity.draw_static(part, part_position_on_screen, opacity_scale); body_part_UI_entity.draw_static(part, part_position_on_screen, opacity_scale);
@@ -439,22 +460,25 @@ function body_part.draw_static(monster, parts_position_on_screen, opacity_scale)
end end
function body_part.draw_highlighted(monster, parts_position_on_screen, opacity_scale) function body_part.draw_highlighted(monster, parts_position_on_screen, opacity_scale)
local cached_config = config.current_config.large_monster_UI.highlighted.body_parts;
local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
local displayed_parts = {}; local displayed_parts = {};
for REpart, part in pairs(monster.parts) do for REpart, part in pairs(monster.parts) do
if config.current_config.large_monster_UI.highlighted.body_parts.settings.hide_undamaged_parts if cached_config.settings.hide_undamaged_parts
and part.health == part.max_health and part.flinch_count == 0 and ((part.health == part.max_health and part.flinch_count == 0) or part.max_health < 0)
and ((part.break_health == part.break_max_health and part.break_count == 0) or part.break_max_health < 0) and ((part.break_health == part.break_max_health and part.break_count == 0) or part.break_max_health < 0)
and ((part.loss_health == part.loss_max_health and not part.is_severed) or part.loss_max_health < 0) then and ((part.loss_health == part.loss_max_health and not part.is_severed) or part.loss_max_health < 0) then
goto continue; goto continue;
end end
if (not part.body_part_highlighted_UI.flinch_visibility) if (not part.body_part_highlighted_UI.flinch_visibility or part.max_health < 0)
and (not part.body_part_highlighted_UI.break_visibility or part.break_max_health < 0 or part.break_count >= part.break_max_count) and (not part.body_part_highlighted_UI.break_visibility or part.break_max_health < 0 or part.break_count >= part.break_max_count)
and (not part.body_part_highlighted_UI.loss_visibility or part.loss_max_health < 0 or part.is_severed) then and (not part.body_part_highlighted_UI.loss_visibility or part.loss_max_health < 0 or part.is_severed) then
goto continue; goto continue;
end end
if config.current_config.large_monster_UI.highlighted.body_parts.settings.time_limit ~= 0 and time.total_elapsed_seconds - part.last_change_time > config.current_config.large_monster_UI.highlighted.body_parts.settings.time_limit then if cached_config.settings.time_limit ~= 0 and time.total_elapsed_seconds - part.last_change_time > cached_config.settings.time_limit then
goto continue; goto continue;
end end
@@ -462,8 +486,8 @@ function body_part.draw_highlighted(monster, parts_position_on_screen, opacity_s
::continue:: ::continue::
end end
if config.current_config.large_monster_UI.highlighted.body_parts.sorting.type == "Normal" then if cached_config.sorting.type == "Normal" then
if config.current_config.large_monster_UI.highlighted.body_parts.sorting.reversed_order then if cached_config.sorting.reversed_order then
table.sort(displayed_parts, function(left, right) table.sort(displayed_parts, function(left, right)
return left.id > right.id; return left.id > right.id;
end); end);
@@ -472,8 +496,8 @@ function body_part.draw_highlighted(monster, parts_position_on_screen, opacity_s
return left.id < right.id; return left.id < right.id;
end); end);
end end
elseif config.current_config.large_monster_UI.highlighted.body_parts.sorting.type == "Health" then elseif cached_config.sorting.type == "Health" then
if config.current_config.large_monster_UI.highlighted.body_parts.sorting.reversed_order then if cached_config.sorting.reversed_order then
table.sort(displayed_parts, function(left, right) table.sort(displayed_parts, function(left, right)
return left.health > right.health; return left.health > right.health;
end); end);
@@ -482,8 +506,8 @@ function body_part.draw_highlighted(monster, parts_position_on_screen, opacity_s
return left.health < right.health; return left.health < right.health;
end); end);
end end
elseif config.current_config.large_monster_UI.highlighted.body_parts.sorting.type == "Health Percentage" then elseif cached_config.sorting.type == "Health Percentage" then
if config.current_config.large_monster_UI.highlighted.body_parts.sorting.reversed_order then if cached_config.sorting.reversed_order then
table.sort(displayed_parts, function(left, right) table.sort(displayed_parts, function(left, right)
return left.health_percentage > right.health_percentage; return left.health_percentage > right.health_percentage;
end); end);
@@ -492,8 +516,8 @@ function body_part.draw_highlighted(monster, parts_position_on_screen, opacity_s
return left.health_percentage < right.health_percentage; return left.health_percentage < right.health_percentage;
end); end);
end end
elseif config.current_config.large_monster_UI.highlighted.body_parts.sorting.type == "Flinch Count" then elseif cached_config.sorting.type == "Flinch Count" then
if config.current_config.large_monster_UI.highlighted.body_parts.sorting.reversed_order then if cached_config.sorting.reversed_order then
table.sort(displayed_parts, function(left, right) table.sort(displayed_parts, function(left, right)
return left.flinch_count > right.flinch_count; return left.flinch_count > right.flinch_count;
end); end);
@@ -502,8 +526,8 @@ function body_part.draw_highlighted(monster, parts_position_on_screen, opacity_s
return left.flinch_count < right.flinch_count; return left.flinch_count < right.flinch_count;
end); end);
end end
elseif config.current_config.large_monster_UI.highlighted.body_parts.sorting.type == "Break Health" then elseif cached_config.sorting.type == "Break Health" then
if config.current_config.large_monster_UI.highlighted.body_parts.sorting.reversed_order then if cached_config.sorting.reversed_order then
table.sort(displayed_parts, function(left, right) table.sort(displayed_parts, function(left, right)
return left.break_health > right.break_health; return left.break_health > right.break_health;
end); end);
@@ -512,8 +536,8 @@ function body_part.draw_highlighted(monster, parts_position_on_screen, opacity_s
return left.break_health < right.break_health; return left.break_health < right.break_health;
end); end);
end end
elseif config.current_config.large_monster_UI.highlighted.body_parts.sorting.type == "Break Health Percentage" then elseif cached_config.sorting.type == "Break Health Percentage" then
if config.current_config.large_monster_UI.highlighted.body_parts.sorting.reversed_order then if cached_config.sorting.reversed_order then
table.sort(displayed_parts, function(left, right) table.sort(displayed_parts, function(left, right)
return left.break_health_percentage > right.break_health_percentage; return left.break_health_percentage > right.break_health_percentage;
end); end);
@@ -522,8 +546,8 @@ function body_part.draw_highlighted(monster, parts_position_on_screen, opacity_s
return left.break_health_percentage < right.break_health_percentage; return left.break_health_percentage < right.break_health_percentage;
end); end);
end end
elseif config.current_config.large_monster_UI.highlighted.body_parts.sorting.type == "Break Count" then elseif cached_config.sorting.type == "Break Count" then
if config.current_config.large_monster_UI.highlighted.body_parts.sorting.reversed_order then if cached_config.sorting.reversed_order then
table.sort(displayed_parts, function(left, right) table.sort(displayed_parts, function(left, right)
return left.break_count > right.break_count; return left.break_count > right.break_count;
end); end);
@@ -532,8 +556,8 @@ function body_part.draw_highlighted(monster, parts_position_on_screen, opacity_s
return left.break_count < right.break_count; return left.break_count < right.break_count;
end); end);
end end
elseif config.current_config.large_monster_UI.highlighted.body_parts.sorting.type == "Sever Health" then elseif cached_config.sorting.type == "Sever Health" then
if config.current_config.large_monster_UI.highlighted.body_parts.sorting.reversed_order then if cached_config.sorting.reversed_order then
table.sort(displayed_parts, function(left, right) table.sort(displayed_parts, function(left, right)
return left.loss_health > right.loss_health; return left.loss_health > right.loss_health;
end); end);
@@ -542,8 +566,8 @@ function body_part.draw_highlighted(monster, parts_position_on_screen, opacity_s
return left.loss_health < right.loss_health; return left.loss_health < right.loss_health;
end); end);
end end
elseif config.current_config.large_monster_UI.highlighted.body_parts.sorting.type == "Sever Health Percentage" then elseif cached_config.sorting.type == "Sever Health Percentage" then
if config.current_config.large_monster_UI.highlighted.body_parts.sorting.reversed_order then if cached_config.sorting.reversed_order then
table.sort(displayed_parts, function(left, right) table.sort(displayed_parts, function(left, right)
return left.loss_health_percentage > right.loss_health_percentage; return left.loss_health_percentage > right.loss_health_percentage;
end); end);
@@ -558,8 +582,8 @@ function body_part.draw_highlighted(monster, parts_position_on_screen, opacity_s
for j, part in ipairs(displayed_parts) do for j, part in ipairs(displayed_parts) do
local part_position_on_screen = { local part_position_on_screen = {
x = parts_position_on_screen.x + config.current_config.large_monster_UI.highlighted.body_parts.spacing.x * (j - 1) * config.current_config.global_settings.modifiers.global_scale_modifier, x = parts_position_on_screen.x + cached_config.spacing.x * (j - 1) * global_scale_modifier,
y = parts_position_on_screen.y + config.current_config.large_monster_UI.highlighted.body_parts.spacing.y * (j - 1) * config.current_config.global_settings.modifiers.global_scale_modifier; y = parts_position_on_screen.y + cached_config.spacing.y * (j - 1) * global_scale_modifier;
}; };
body_part_UI_entity.draw_highlighted(part, part_position_on_screen, opacity_scale); body_part_UI_entity.draw_highlighted(part, part_position_on_screen, opacity_scale);

File diff suppressed because it is too large Load Diff

View File

@@ -9,12 +9,6 @@ local enemy_character_base_update_method = enemy_character_base_type_def:get_met
local is_boss_enemy_method = enemy_character_base_type_def:get_method("get_isBossEnemy"); local is_boss_enemy_method = enemy_character_base_type_def:get_method("get_isBossEnemy");
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);
local tick_count = 0; local tick_count = 0;
local last_update_tick = 0; local last_update_tick = 0;
local recorded_monsters = {}; local recorded_monsters = {};
@@ -53,8 +47,8 @@ function monster_hook.update_monster(enemy)
end end
if not recorded_monsters[enemy] then if not recorded_monsters[enemy] then
num_known_monsters = num_known_monsters + 1 num_known_monsters = num_known_monsters + 1;
recorded_monsters[enemy] = true recorded_monsters[enemy] = true;
end end
-- saves on a method call. -- saves on a method call.
@@ -76,9 +70,11 @@ function monster_hook.update_monster(enemy)
end end
function monster_hook.update_large_monster(enemy) function monster_hook.update_large_monster(enemy)
if not config.current_config.large_monster_UI.dynamic.enabled and local cached_config = config.current_config.large_monster_UI;
not config.current_config.large_monster_UI.static.enabled and
not config.current_config.large_monster_UI.highlighted.enabled then if not cached_config.dynamic.enabled and
not cached_config.static.enabled and
not cached_config.highlighted.enabled then
return; return;
end end
@@ -144,6 +140,12 @@ function monster_hook.init_module()
large_monster = require("MHR_Overlay.Monsters.large_monster"); large_monster = require("MHR_Overlay.Monsters.large_monster");
config = require("MHR_Overlay.Misc.config"); config = require("MHR_Overlay.Misc.config");
ailments = require("MHR_Overlay.Monsters.ailments"); ailments = require("MHR_Overlay.Monsters.ailments");
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);
end end
return monster_hook; return monster_hook;

View File

@@ -77,52 +77,53 @@ function small_monster.init(monster, enemy)
end end
function small_monster.init_UI(monster) function small_monster.init_UI(monster)
monster.name_label = table_helpers.deep_copy(config.current_config.small_monster_UI.monster_name_label); local cached_config = config.current_config.small_monster_UI;
local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
monster.name_label.offset.x = monster.name_label.offset.x * config.current_config.global_settings.modifiers.global_scale_modifier; monster.name_label = table_helpers.deep_copy(cached_config.monster_name_label);
monster.name_label.offset.y = monster.name_label.offset.y * config.current_config.global_settings.modifiers.global_scale_modifier;
monster.name_label.offset.x = monster.name_label.offset.x * global_scale_modifier;
monster.name_label.offset.y = monster.name_label.offset.y * global_scale_modifier;
monster.health_UI = health_UI_entity.new( monster.health_UI = health_UI_entity.new(
config.current_config.small_monster_UI.health.visibility, cached_config.health.visibility,
config.current_config.small_monster_UI.health.bar, cached_config.health.bar,
config.current_config.small_monster_UI.health.text_label, cached_config.health.text_label,
config.current_config.small_monster_UI.health.value_label, cached_config.health.value_label,
config.current_config.small_monster_UI.health.percentage_label cached_config.health.percentage_label
); );
monster.stamina_UI = stamina_UI_entity.new( monster.stamina_UI = stamina_UI_entity.new(
config.current_config.small_monster_UI.stamina.visibility, cached_config.stamina.visibility,
config.current_config.small_monster_UI.stamina.bar, cached_config.stamina.bar,
config.current_config.small_monster_UI.stamina.text_label, cached_config.stamina.text_label,
config.current_config.small_monster_UI.stamina.value_label, cached_config.stamina.value_label,
config.current_config.small_monster_UI.stamina.percentage_label cached_config.stamina.percentage_label
); );
monster.ailment_UI = ailment_UI_entity.new( monster.ailment_UI = ailment_UI_entity.new(
config.current_config.small_monster_UI.ailments.visibility, cached_config.ailments.visibility,
config.current_config.small_monster_UI.ailments.bar, cached_config.ailments.bar,
config.current_config.small_monster_UI.ailments.ailment_name_label, cached_config.ailments.ailment_name_label,
config.current_config.small_monster_UI.ailments.text_label, cached_config.ailments.text_label,
config.current_config.small_monster_UI.ailments.value_label, cached_config.ailments.value_label,
config.current_config.small_monster_UI.ailments.percentage_label, cached_config.ailments.percentage_label,
config.current_config.small_monster_UI.ailments.timer_label cached_config.ailments.timer_label
); );
ailments.init_ailment_buildup_small_UI(monster.ailments); ailments.init_ailment_buildup_small_UI(monster.ailments);
end end
local enemy_character_base_type_def = sdk.find_type_definition("snow.enemy.EnemyCharacterBase");
local physical_param_field = enemy_character_base_type_def:get_field("<PhysicalParam>k__BackingField"); local physical_param_field = enemy_character_base_type_def:get_field("<PhysicalParam>k__BackingField");
local status_param_field = enemy_character_base_type_def:get_field("<StatusParam>k__BackingField");
local stamina_param_field = enemy_character_base_type_def:get_field("<StaminaParam>k__BackingField"); local stamina_param_field = enemy_character_base_type_def:get_field("<StaminaParam>k__BackingField");
local check_die_method = enemy_character_base_type_def:get_method("checkDie"); local check_die_method = enemy_character_base_type_def:get_method("checkDie");
local physical_param_type = physical_param_field:get_type(); local physical_param_type = physical_param_field:get_type();
local get_vital_method = physical_param_type:get_method("getVital"); local get_vital_method = physical_param_type:get_method("getVital");
local get_capture_hp_vital_method = physical_param_type:get_method("get_CaptureHpVital");
local get_hp_vital_method = enemy_character_base_type_def:get_method("getHpVital"); local vital_param_type = get_vital_method:get_return_type();
local get_hp_max_vital_method = enemy_character_base_type_def:get_method("getHpMaxVital"); local get_current_method = vital_param_type:get_method("get_Current");
local get_max_method = vital_param_type:get_method("get_Max");
local stamina_param_type = stamina_param_field:get_type(); local stamina_param_type = stamina_param_field:get_type();
@@ -131,61 +132,42 @@ local get_max_stamina_method = stamina_param_type:get_method("getMaxStamina");
local get_pos_field = enemy_character_base_type_def:get_method("get_Pos"); local get_pos_field = enemy_character_base_type_def:get_method("get_Pos");
--local get_gameobject_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 small_monster.update_position(enemy) function small_monster.update_position(enemy)
if not config.current_config.small_monster_UI.enabled or not config.current_config.small_monster_UI.dynamic_positioning.enabled then local cached_config = config.current_config.small_monster_UI;
if not cached_config.enabled or not cached_config.dynamic_positioning.enabled then
return; return;
end end
local monster = small_monster.get_monster(enemy); local monster = small_monster.get_monster(enemy);
if not monster then return end if monster == nil then
local position = get_pos_field:call(enemy);
if position ~= nil then
monster.position = position;
end
--[[
-- cache off the game object and transform
-- 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_gameobject_method:call(enemy)
if monster.game_object == nil then
customization_menu.status = "No enemy game object";
return;
end
end
if monster.transform == nil then
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)
if not position then
customization_menu.status = "No enemy position";
return; return;
end end
if position ~= nil then local position = get_pos_field:call(enemy) or monster.position;
monster.position = position; monster.position = position;
end
--]]
end end
function small_monster.update(enemy) function small_monster.update(enemy)
if not config.current_config.small_monster_UI.enabled then
return;
end
if enemy == nil then if enemy == nil then
return; return;
end end
if not config.current_config.small_monster_UI.enabled then local monster = small_monster.get_monster(enemy);
local dead_or_captured = check_die_method:call(enemy);
monster.dead_or_captured = (dead_or_captured == nil and false) or dead_or_captured;
small_monster.update_health(enemy, monster);
small_monster.update_stamina(enemy, monster);
ailments.update_ailments(enemy, monster);
end
function small_monster.update_health(enemy, monster)
if not config.current_config.small_monster_UI.health.visibility then
return; return;
end end
@@ -195,9 +177,24 @@ function small_monster.update(enemy)
return; return;
end end
local status_param = status_param_field:get_data(enemy) local vital_param = get_vital_method:call(physical_param, 0, 0);
if status_param == nil then if vital_param == nil then
customization_menu.status = "No status param"; customization_menu.status = "No vital param";
return;
end
monster.health = get_current_method:call(vital_param) or monster.health;
monster.max_health = get_max_method:call(vital_param) or monster.max_health;
monster.missing_health = monster.max_health - monster.health;
if monster.max_health ~= 0 then
monster.health_percentage = monster.health / monster.max_health;
monster.capture_percentage = monster.capture_health / monster.max_health;
end
end
function small_monster.update_stamina(enemy, monster)
if not config.current_config.small_monster_UI.stamina.visibility then
return; return;
end end
@@ -207,88 +204,40 @@ function small_monster.update(enemy)
return; return;
end end
local vital_param = get_vital_method:call(physical_param, 0, 0); monster.stamina = get_stamina_method:call(stamina_param) or monster.stamina;
if vital_param == nil then monster.max_stamina = get_max_stamina_method:call(stamina_param) or monster.max_stamina;
customization_menu.status = "No vital param";
return;
monster.missing_stamina = monster.max_stamina - monster.stamina;
if monster.max_stamina ~= 0 then
monster.stamina_percentage = monster.stamina / monster.max_stamina;
end end
local health = get_hp_vital_method:call(enemy);
local max_health = get_hp_max_vital_method:call(enemy);
local capture_health = get_capture_hp_vital_method:call(physical_param);
local stamina = get_stamina_method:call(stamina_param);
local max_stamina = get_max_stamina_method:call(stamina_param);
local dead_or_captured = check_die_method:call(enemy);
if dead_or_captured == nil then
return;
end
local monster = small_monster.get_monster(enemy);
if health ~= nil then
monster.health = health;
end
if max_health ~= nil then
monster.max_health = max_health;
end
if capture_health ~= nil then
monster.capture_health = capture_health;
end
if max_health ~= nil and health ~= nil then
monster.missing_health = max_health - health;
if max_health ~= 0 then
monster.health_percentage = health / max_health;
end
end
if dead_or_captured ~= nil then
monster.dead_or_captured = dead_or_captured;
end
if stamina ~= nil then
monster.stamina = stamina;
end
if max_stamina ~= nil then
monster.max_stamina = max_stamina;
end
if max_stamina ~= nil and stamina ~= nil then
monster.missing_stamina = max_stamina - stamina;
if max_stamina ~= 0 then
monster.stamina_percentage = stamina / max_stamina;
end
end
ailments.update_ailments(enemy, monster);
end end
function small_monster.draw(monster, position_on_screen, opacity_scale) function small_monster.draw(monster, position_on_screen, opacity_scale)
local cached_config = config.current_config.small_monster_UI;
local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
drawing.draw_label(monster.name_label, position_on_screen, opacity_scale, monster.name); drawing.draw_label(monster.name_label, position_on_screen, opacity_scale, monster.name);
local health_position_on_screen = { local health_position_on_screen = {
x = position_on_screen.x + config.current_config.small_monster_UI.health.offset.x * config.current_config.global_settings.modifiers.global_scale_modifier, x = position_on_screen.x + cached_config.health.offset.x * global_scale_modifier,
y = position_on_screen.y + config.current_config.small_monster_UI.health.offset.y * config.current_config.global_settings.modifiers.global_scale_modifier y = position_on_screen.y + cached_config.health.offset.y * global_scale_modifier
}; };
local stamina_position_on_screen = { local stamina_position_on_screen = {
x = position_on_screen.x + config.current_config.small_monster_UI.stamina.offset.x * config.current_config.global_settings.modifiers.global_scale_modifier, x = position_on_screen.x + cached_config.stamina.offset.x * global_scale_modifier,
y = position_on_screen.y + config.current_config.small_monster_UI.stamina.offset.y * config.current_config.global_settings.modifiers.global_scale_modifier y = position_on_screen.y + cached_config.stamina.offset.y * global_scale_modifier
}; };
local ailments_position_on_screen = { local ailments_position_on_screen = {
x = position_on_screen.x + config.current_config.small_monster_UI.ailments.offset.x * config.current_config.global_settings.modifiers.global_scale_modifier, x = position_on_screen.x + cached_config.ailments.offset.x * global_scale_modifier,
y = position_on_screen.y + config.current_config.small_monster_UI.ailments.offset.y * config.current_config.global_settings.modifiers.global_scale_modifier y = position_on_screen.y + cached_config.ailments.offset.y * global_scale_modifier
}; };
local ailment_buildups_position_on_screen = { local ailment_buildups_position_on_screen = {
x = position_on_screen.x + config.current_config.small_monster_UI.ailment_buildups.offset.x * config.current_config.global_settings.modifiers.global_scale_modifier, x = position_on_screen.x + cached_config.ailment_buildups.offset.x * global_scale_modifier,
y = position_on_screen.y + config.current_config.small_monster_UI.ailment_buildups.offset.y * config.current_config.global_settings.modifiers.global_scale_modifier y = position_on_screen.y + cached_config.ailment_buildups.offset.y * global_scale_modifier
}; };
health_UI_entity.draw(monster, monster.health_UI, health_position_on_screen, opacity_scale); health_UI_entity.draw(monster, monster.health_UI, health_position_on_screen, opacity_scale);

View File

@@ -23,6 +23,8 @@ local hunter_info_type_def = sdk.find_type_definition("snow.LobbyManager.HunterI
local member_index_field = hunter_info_type_def:get_field("_memberIndex"); local member_index_field = hunter_info_type_def:get_field("_memberIndex");
function damage_meter_UI.get_players(player_info_list) function damage_meter_UI.get_players(player_info_list)
local cached_config = config.current_config.damage_meter_UI;
-- other players -- other players
if player_info_list == nil then if player_info_list == nil then
customization_menu.status = "No player info list"; customization_menu.status = "No player info list";
@@ -52,7 +54,7 @@ function damage_meter_UI.get_players(player_info_list)
local _player = player.get_player(player_id); local _player = player.get_player(player_id);
if _player ~= nil then if _player ~= nil then
if player_id == player.myself.id and config.current_config.damage_meter_UI.settings.my_damage_bar_location ~= "Normal" then if player_id == player.myself.id and cached_config.settings.my_damage_bar_location ~= "Normal" then
goto continue; goto continue;
end end
table.insert(quest_players, _player); table.insert(quest_players, _player);
@@ -65,11 +67,15 @@ function damage_meter_UI.get_players(player_info_list)
end end
function damage_meter_UI.draw() function damage_meter_UI.draw()
local cached_config = config.current_config.damage_meter_UI;
local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
if player.total.display.total_damage == 0 and config.current_config.damage_meter_UI.settings.hide_module_if_total_damage_is_zero then if player.total.display.total_damage == 0 and cached_config.settings.hide_module_if_total_damage_is_zero then
return; return;
end end
local quest_players = {}; local quest_players = {};
if damage_meter_UI.freeze_displayed_players and damage_meter_UI.last_displayed_players ~= {} then if damage_meter_UI.freeze_displayed_players and damage_meter_UI.last_displayed_players ~= {} then
quest_players = damage_meter_UI.last_displayed_players; quest_players = damage_meter_UI.last_displayed_players;
@@ -84,15 +90,15 @@ function damage_meter_UI.draw()
if not damage_meter_UI.freeze_displayed_players then if not damage_meter_UI.freeze_displayed_players then
if #quest_players ~= 0 then if #quest_players ~= 0 then
-- sort here -- sort here
if config.current_config.damage_meter_UI.sorting.type == "Normal" and config.current_config.damage_meter_UI.sorting.reversed_order then if cached_config.sorting.type == "Normal" and cached_config.sorting.reversed_order then
local reversed_quest_players = {}; local reversed_quest_players = {};
for i = #quest_players, 1, -1 do for i = #quest_players, 1, -1 do
table.insert(reversed_quest_players, quest_players[i]); table.insert(reversed_quest_players, quest_players[i]);
end end
quest_players = reversed_quest_players; quest_players = reversed_quest_players;
elseif config.current_config.damage_meter_UI.sorting.type == "DPS" then elseif cached_config.sorting.type == "DPS" then
if config.current_config.damage_meter_UI.sorting.reversed_order then if cached_config.sorting.reversed_order then
table.sort(quest_players, function(left, right) table.sort(quest_players, function(left, right)
return left.dps < right.dps; return left.dps < right.dps;
end); end);
@@ -102,7 +108,7 @@ function damage_meter_UI.draw()
end); end);
end end
else else
if config.current_config.damage_meter_UI.sorting.reversed_order then if cached_config.sorting.reversed_order then
table.sort(quest_players, function(left, right) table.sort(quest_players, function(left, right)
return left.display.total_damage < right.display.total_damage; return left.display.total_damage < right.display.total_damage;
end); end);
@@ -114,9 +120,9 @@ function damage_meter_UI.draw()
end end
end end
if config.current_config.damage_meter_UI.settings.my_damage_bar_location == "First" then if cached_config.settings.my_damage_bar_location == "First" then
table.insert(quest_players, 1, player.myself); table.insert(quest_players, 1, player.myself);
elseif config.current_config.damage_meter_UI.settings.my_damage_bar_location == "Last" then elseif cached_config.settings.my_damage_bar_location == "Last" then
table.insert(quest_players, #quest_players + 1, player.myself); table.insert(quest_players, #quest_players + 1, player.myself);
elseif #player.list == 0 then elseif #player.list == 0 then
table.insert(quest_players, player.myself); table.insert(quest_players, player.myself);
@@ -137,19 +143,19 @@ function damage_meter_UI.draw()
end end
-- draw -- draw
local position_on_screen = screen.calculate_absolute_coordinates(config.current_config.damage_meter_UI.position); local position_on_screen = screen.calculate_absolute_coordinates(cached_config.position);
for _, _player in ipairs(quest_players) do for _, _player in ipairs(quest_players) do
if _player.display.total_damage == 0 and config.current_config.damage_meter_UI.settings.hide_player_if_player_damage_is_zero then if _player.display.total_damage == 0 and cached_config.settings.hide_player_if_player_damage_is_zero then
goto continue1 goto continue1
end end
player.draw(_player, position_on_screen, 1, top_damage, top_dps); player.draw(_player, position_on_screen, 1, top_damage, top_dps);
if config.current_config.damage_meter_UI.settings.orientation == "Horizontal" then if cached_config.settings.orientation == "Horizontal" then
position_on_screen.x = position_on_screen.x + config.current_config.damage_meter_UI.spacing.x * config.current_config.global_settings.modifiers.global_scale_modifier; position_on_screen.x = position_on_screen.x + cached_config.spacing.x * global_scale_modifier;
else else
position_on_screen.y = position_on_screen.y + config.current_config.damage_meter_UI.spacing.y * config.current_config.global_settings.modifiers.global_scale_modifier; position_on_screen.y = position_on_screen.y + cached_config.spacing.y * global_scale_modifier;
end end
::continue1:: ::continue1::
@@ -157,12 +163,12 @@ function damage_meter_UI.draw()
end end
-- draw total damage -- draw total damage
if config.current_config.damage_meter_UI.settings.hide_total_if_total_damage_is_zero and player.total.display.total_damage == 0 then if cached_config.settings.hide_total_if_total_damage_is_zero and player.total.display.total_damage == 0 then
return; return;
end end
if not config.current_config.damage_meter_UI.settings.total_damage_offset_is_relative then if not cached_config.settings.total_damage_offset_is_relative then
position_on_screen = screen.calculate_absolute_coordinates(config.current_config.damage_meter_UI.position); position_on_screen = screen.calculate_absolute_coordinates(cached_config.position);
end end
player.draw_total(position_on_screen, 1); player.draw_total(position_on_screen, 1);

View File

@@ -21,19 +21,22 @@ function env_creature_UI.draw()
return; return;
end end
local cached_config = config.current_config.endemic_life_UI;
local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
for _, creature in pairs(env_creature.list) do for _, creature in pairs(env_creature.list) do
if config.current_config.endemic_life_UI.settings.max_distance == 0 then if cached_config.settings.max_distance == 0 then
break; break;
end end
if config.current_config.endemic_life_UI.settings.hide_inactive_creatures and creature.is_inactive then if cached_config.settings.hide_inactive_creatures and creature.is_inactive then
goto continue; goto continue;
end end
local position_on_screen = {}; 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); local world_offset = Vector3f.new(cached_config.world_offset.x, cached_config.world_offset.y, cached_config.world_offset.z);
position_on_screen = draw.world_to_screen(creature.position + world_offset); position_on_screen = draw.world_to_screen(creature.position + world_offset);
@@ -41,19 +44,19 @@ function env_creature_UI.draw()
goto continue; goto continue;
end 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.x = position_on_screen.x + cached_config.viewport_offset.x * 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; position_on_screen.y = position_on_screen.y + cached_config.viewport_offset.y * global_scale_modifier;
creature.distance = (player.myself_position - creature.position):length(); creature.distance = (player.myself_position - creature.position):length();
local opacity_scale = 1; local opacity_scale = 1;
if creature.distance > config.current_config.endemic_life_UI.settings.max_distance then if creature.distance > cached_config.settings.max_distance then
goto continue; goto continue;
end end
if config.current_config.endemic_life_UI.settings.opacity_falloff then if cached_config.settings.opacity_falloff then
opacity_scale = 1 - (creature.distance / config.current_config.endemic_life_UI.settings.max_distance); opacity_scale = 1 - (creature.distance / cached_config.settings.max_distance);
end end

View File

@@ -93,58 +93,64 @@ function large_monster_UI.draw(dynamic_enabled, static_enabled, highlighted_enab
end end
function large_monster_UI.draw_dynamic(displayed_monsters, highlighted_monster) function large_monster_UI.draw_dynamic(displayed_monsters, highlighted_monster)
local cached_config = config.current_config.large_monster_UI.dynamic;
local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
local i = 0; local i = 0;
for _, monster in ipairs(displayed_monsters) do for _, monster in ipairs(displayed_monsters) do
if config.current_config.large_monster_UI.dynamic.settings.max_distance == 0 then if cached_config.settings.max_distance == 0 then
break; break;
end
if monster.dead_or_captured and config.current_config.large_monster_UI.dynamic.settings.hide_dead_or_captured then
goto continue;
end
if monster == highlighted_monster then
if not config.current_config.large_monster_UI.dynamic.settings.render_highlighted_monster then
goto continue;
end
else
if not config.current_config.large_monster_UI.dynamic.settings.render_not_highlighted_monsters then
goto continue;
end
end
local position_on_screen = {};
local world_offset = Vector3f.new(config.current_config.large_monster_UI.dynamic.world_offset.x, config.current_config.large_monster_UI.dynamic.world_offset.y, config.current_config.large_monster_UI.dynamic.world_offset.z);
position_on_screen = draw.world_to_screen(monster.position + world_offset);
if position_on_screen == nil then
goto continue;
end
position_on_screen.x = position_on_screen.x + config.current_config.large_monster_UI.dynamic.viewport_offset.x * config.current_config.global_settings.modifiers.global_scale_modifier;
position_on_screen.y = position_on_screen.y + config.current_config.large_monster_UI.dynamic.viewport_offset.y * config.current_config.global_settings.modifiers.global_scale_modifier;
local opacity_scale = 1;
if monster.distance > config.current_config.large_monster_UI.dynamic.settings.max_distance then
goto continue;
end
if config.current_config.large_monster_UI.dynamic.settings.opacity_falloff then
opacity_scale = 1 - (monster.distance / config.current_config.large_monster_UI.dynamic.settings.max_distance);
end
large_monster.draw_dynamic(monster, position_on_screen, opacity_scale);
i = i + 1;
::continue::
end end
if monster.dead_or_captured and cached_config.settings.hide_dead_or_captured then
goto continue;
end
if monster == highlighted_monster then
if not cached_config.settings.render_highlighted_monster then
goto continue;
end
else
if not cached_config.settings.render_not_highlighted_monsters then
goto continue;
end
end
local position_on_screen = {};
local world_offset = Vector3f.new(cached_config.world_offset.x, cached_config.world_offset.y, cached_config.world_offset.z);
position_on_screen = draw.world_to_screen(monster.position + world_offset);
if position_on_screen == nil then
goto continue;
end
position_on_screen.x = position_on_screen.x + cached_config.viewport_offset.x * global_scale_modifier;
position_on_screen.y = position_on_screen.y + cached_config.viewport_offset.y * global_scale_modifier;
local opacity_scale = 1;
if monster.distance > cached_config.settings.max_distance then
goto continue;
end
if cached_config.settings.opacity_falloff then
opacity_scale = 1 - (monster.distance / cached_config.settings.max_distance);
end
large_monster.draw_dynamic(monster, position_on_screen, opacity_scale);
i = i + 1;
::continue::
end
end end
function large_monster_UI.draw_static(displayed_monsters, highlighted_monster) function large_monster_UI.draw_static(displayed_monsters, highlighted_monster)
local cached_config = config.current_config.large_monster_UI.static;
local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
-- sort here -- sort here
if config.current_config.large_monster_UI.static.sorting.type == "Normal" and config.current_config.large_monster_UI.static.sorting.reversed_order then if cached_config.sorting.type == "Normal" and cached_config.sorting.reversed_order then
local reversed_monsters = {}; local reversed_monsters = {};
for i = #displayed_monsters, 1, -1 do for i = #displayed_monsters, 1, -1 do
table.insert(reversed_monsters, displayed_monsters[i]); table.insert(reversed_monsters, displayed_monsters[i]);
@@ -152,8 +158,8 @@ function large_monster_UI.draw_static(displayed_monsters, highlighted_monster)
displayed_monsters = reversed_monsters; displayed_monsters = reversed_monsters;
elseif config.current_config.large_monster_UI.static.sorting.type == "Health" then elseif cached_config.sorting.type == "Health" then
if config.current_config.large_monster_UI.static.sorting.reversed_order then if cached_config.sorting.reversed_order then
table.sort(displayed_monsters, function(left, right) table.sort(displayed_monsters, function(left, right)
return left.health > right.health; return left.health > right.health;
end); end);
@@ -162,8 +168,8 @@ function large_monster_UI.draw_static(displayed_monsters, highlighted_monster)
return left.health < right.health; return left.health < right.health;
end); end);
end end
elseif config.current_config.large_monster_UI.static.sorting.type == "Health Percentage" then elseif cached_config.sorting.type == "Health Percentage" then
if config.current_config.large_monster_UI.static.sorting.reversed_order then if cached_config.sorting.reversed_order then
table.sort(displayed_monsters, function(left, right) table.sort(displayed_monsters, function(left, right)
return left.health_percentage > right.health_percentage; return left.health_percentage > right.health_percentage;
end); end);
@@ -172,8 +178,8 @@ function large_monster_UI.draw_static(displayed_monsters, highlighted_monster)
return left.health_percentage < right.health_percentage; return left.health_percentage < right.health_percentage;
end); end);
end end
elseif config.current_config.large_monster_UI.static.sorting.type == "Distance" then elseif cached_config.sorting.type == "Distance" then
if config.current_config.large_monster_UI.static.sorting.reversed_order then if cached_config.sorting.reversed_order then
table.sort(displayed_monsters, function(left, right) table.sort(displayed_monsters, function(left, right)
return left.distance > right.distance; return left.distance > right.distance;
end); end);
@@ -184,20 +190,20 @@ function large_monster_UI.draw_static(displayed_monsters, highlighted_monster)
end end
end end
local position_on_screen = screen.calculate_absolute_coordinates(config.current_config.large_monster_UI.static.position); local position_on_screen = screen.calculate_absolute_coordinates(cached_config.position);
local i = 0; local i = 0;
for _, monster in ipairs(displayed_monsters) do for _, monster in ipairs(displayed_monsters) do
if monster.dead_or_captured and config.current_config.large_monster_UI.static.settings.hide_dead_or_captured then if monster.dead_or_captured and cached_config.settings.hide_dead_or_captured then
goto continue; goto continue;
end end
if monster == highlighted_monster then if monster == highlighted_monster then
if not config.current_config.large_monster_UI.static.settings.render_highlighted_monster then if not cached_config.settings.render_highlighted_monster then
goto continue; goto continue;
end end
else else
if not config.current_config.large_monster_UI.static.settings.render_not_highlighted_monsters then if not cached_config.settings.render_not_highlighted_monsters then
goto continue; goto continue;
end end
end end
@@ -207,10 +213,10 @@ function large_monster_UI.draw_static(displayed_monsters, highlighted_monster)
y = position_on_screen.y y = position_on_screen.y
} }
if config.current_config.large_monster_UI.static.settings.orientation == "Horizontal" then if cached_config.settings.orientation == "Horizontal" then
monster_position_on_screen.x = monster_position_on_screen.x + config.current_config.large_monster_UI.static.spacing.x * i * config.current_config.global_settings.modifiers.global_scale_modifier; monster_position_on_screen.x = monster_position_on_screen.x + cached_config.spacing.x * i * global_scale_modifier;
else else
monster_position_on_screen.y = monster_position_on_screen.y + config.current_config.large_monster_UI.static.spacing.y * i * config.current_config.global_settings.modifiers.global_scale_modifier; monster_position_on_screen.y = monster_position_on_screen.y + cached_config.spacing.y * i * global_scale_modifier;
end end
large_monster.draw_static(monster, monster_position_on_screen, 1); large_monster.draw_static(monster, monster_position_on_screen, 1);
@@ -221,13 +227,15 @@ function large_monster_UI.draw_static(displayed_monsters, highlighted_monster)
end end
function large_monster_UI.draw_highlighted(monster) function large_monster_UI.draw_highlighted(monster)
local cached_config = config.current_config.large_monster_UI.highlighted;
if monster == nil then if monster == nil then
return; return;
end end
local position_on_screen = screen.calculate_absolute_coordinates(config.current_config.large_monster_UI.highlighted.position); local position_on_screen = screen.calculate_absolute_coordinates(cached_config.position);
if monster.dead_or_captured and config.current_config.large_monster_UI.highlighted.settings.hide_dead_or_captured then if monster.dead_or_captured and cached_config.settings.hide_dead_or_captured then
return; return;
end end

View File

@@ -19,6 +19,8 @@ function small_monster_UI.draw()
return; return;
end end
local cached_config = config.current_config.small_monster_UI;
local displayed_monsters = {}; local displayed_monsters = {};
local enemy_count = get_zako_enemy_count_method:call(singletons.enemy_manager); local enemy_count = get_zako_enemy_count_method:call(singletons.enemy_manager);
@@ -40,7 +42,7 @@ function small_monster_UI.draw()
goto continue; goto continue;
end end
if monster.dead_or_captured and config.current_config.small_monster_UI.settings.hide_dead_or_captured then if monster.dead_or_captured and cached_config.settings.hide_dead_or_captured then
goto continue; goto continue;
end end
@@ -48,24 +50,24 @@ function small_monster_UI.draw()
::continue:: ::continue::
end end
if config.current_config.small_monster_UI.dynamic_positioning.enabled if cached_config.dynamic_positioning.enabled
or (not config.current_config.small_monster_UI.dynamic_positioning.enabled and config.current_config.small_monster_UI.static_sorting.type == "Distance") then or (not cached_config.dynamic_positioning.enabled and cached_config.static_sorting.type == "Distance") then
for _, monster in ipairs(displayed_monsters) do for _, monster in ipairs(displayed_monsters) do
monster.distance = (player.myself_position - monster.position):length(); monster.distance = (player.myself_position - monster.position):length();
end end
end end
if not config.current_config.small_monster_UI.dynamic_positioning.enabled then if not cached_config.dynamic_positioning.enabled then
-- sort here -- sort here
if config.current_config.small_monster_UI.static_sorting.type == "Normal" and config.current_config.small_monster_UI.static_sorting.reversed_order then if cached_config.static_sorting.type == "Normal" and cached_config.static_sorting.reversed_order then
local reversed_monsters = {}; local reversed_monsters = {};
for i = #displayed_monsters, 1, -1 do for i = #displayed_monsters, 1, -1 do
table.insert(reversed_monsters, displayed_monsters[i]); table.insert(reversed_monsters, displayed_monsters[i]);
end end
displayed_monsters = reversed_monsters; displayed_monsters = reversed_monsters;
elseif config.current_config.small_monster_UI.static_sorting.type == "Health" then elseif cached_config.static_sorting.type == "Health" then
if config.current_config.small_monster_UI.static_sorting.reversed_order then if cached_config.static_sorting.reversed_order then
table.sort(displayed_monsters, function(left, right) table.sort(displayed_monsters, function(left, right)
return left.health > right.health; return left.health > right.health;
end); end);
@@ -75,8 +77,8 @@ function small_monster_UI.draw()
end); end);
end end
elseif config.current_config.small_monster_UI.static_sorting.type == "Health Percentage" then elseif cached_config.static_sorting.type == "Health Percentage" then
if config.current_config.small_monster_UI.static_sorting.reversed_order then if cached_config.static_sorting.reversed_order then
table.sort(displayed_monsters, function(left, right) table.sort(displayed_monsters, function(left, right)
return left.health_percentage > right.health_percentage; return left.health_percentage > right.health_percentage;
end); end);
@@ -85,8 +87,8 @@ function small_monster_UI.draw()
return left.health_percentage < right.health_percentage; return left.health_percentage < right.health_percentage;
end); end);
end end
elseif config.current_config.small_monster_UI.static_sorting.type == "Distance" then elseif cached_config.static_sorting.type == "Distance" then
if config.current_config.small_monster_UI.static_sorting.reversed_order then if cached_config.static_sorting.reversed_order then
table.sort(displayed_monsters, function(left, right) table.sort(displayed_monsters, function(left, right)
return left.distance > right.distance; return left.distance > right.distance;
end); end);
@@ -102,8 +104,8 @@ function small_monster_UI.draw()
for _, monster in ipairs(displayed_monsters) do for _, monster in ipairs(displayed_monsters) do
local position_on_screen; local position_on_screen;
if config.current_config.small_monster_UI.dynamic_positioning.enabled then if cached_config.dynamic_positioning.enabled then
local world_offset = Vector3f.new(config.current_config.small_monster_UI.dynamic_positioning.world_offset.x, config.current_config.small_monster_UI.dynamic_positioning.world_offset.y, config.current_config.small_monster_UI.dynamic_positioning.world_offset.z); local world_offset = Vector3f.new(cached_config.dynamic_positioning.world_offset.x, cached_config.dynamic_positioning.world_offset.y, cached_config.dynamic_positioning.world_offset.z);
position_on_screen = draw.world_to_screen(monster.position + world_offset); position_on_screen = draw.world_to_screen(monster.position + world_offset);
@@ -111,31 +113,31 @@ function small_monster_UI.draw()
goto continue goto continue
end end
position_on_screen.x = position_on_screen.x + config.current_config.small_monster_UI.dynamic_positioning.viewport_offset.x; position_on_screen.x = position_on_screen.x + cached_config.dynamic_positioning.viewport_offset.x;
position_on_screen.y = position_on_screen.y + config.current_config.small_monster_UI.dynamic_positioning.viewport_offset.y; position_on_screen.y = position_on_screen.y + cached_config.dynamic_positioning.viewport_offset.y;
else else
position_on_screen = screen.calculate_absolute_coordinates(config.current_config.small_monster_UI.static_position); position_on_screen = screen.calculate_absolute_coordinates(cached_config.static_position);
if config.current_config.small_monster_UI.settings.orientation == "Horizontal" then if cached_config.settings.orientation == "Horizontal" then
position_on_screen.x = position_on_screen.x + config.current_config.small_monster_UI.static_spacing.x * i; position_on_screen.x = position_on_screen.x + cached_config.static_spacing.x * i;
else else
position_on_screen.y = position_on_screen.y + config.current_config.small_monster_UI.static_spacing.y * i; position_on_screen.y = position_on_screen.y + cached_config.static_spacing.y * i;
end end
end end
local opacity_scale = 1; local opacity_scale = 1;
if config.current_config.small_monster_UI.dynamic_positioning.enabled then if cached_config.dynamic_positioning.enabled then
if config.current_config.small_monster_UI.dynamic_positioning.max_distance == 0 then if cached_config.dynamic_positioning.max_distance == 0 then
return; return;
end end
if monster.distance > config.current_config.small_monster_UI.dynamic_positioning.max_distance then if monster.distance > cached_config.dynamic_positioning.max_distance then
goto continue; goto continue;
end end
if config.current_config.small_monster_UI.dynamic_positioning.opacity_falloff then if cached_config.dynamic_positioning.opacity_falloff then
opacity_scale = 1 - (monster.distance / config.current_config.small_monster_UI.dynamic_positioning.max_distance); opacity_scale = 1 - (monster.distance / cached_config.dynamic_positioning.max_distance);
end end
end end

View File

@@ -23,8 +23,10 @@ end
function time_UI.init_UI() function time_UI.init_UI()
time_UI.label = table_helpers.deep_copy(config.current_config.time_UI.time_label); time_UI.label = table_helpers.deep_copy(config.current_config.time_UI.time_label);
time_UI.label.offset.x = time_UI.label.offset.x * config.current_config.global_settings.modifiers.global_scale_modifier; local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
time_UI.label.offset.y = time_UI.label.offset.y * config.current_config.global_settings.modifiers.global_scale_modifier;
time_UI.label.offset.x = time_UI.label.offset.x * global_scale_modifier;
time_UI.label.offset.y = time_UI.label.offset.y * global_scale_modifier;
end end
function time_UI.init_module() function time_UI.init_module()

View File

@@ -7,6 +7,8 @@ local language;
function ailment_UI_entity.new(visibility, bar, name_label, text_label, value_label, percentage_label, timer_label) function ailment_UI_entity.new(visibility, bar, name_label, text_label, value_label, percentage_label, timer_label)
local entity = {}; local entity = {};
local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
entity.visibility = visibility; entity.visibility = visibility;
entity.bar = table_helpers.deep_copy(bar); entity.bar = table_helpers.deep_copy(bar);
entity.name_label = table_helpers.deep_copy(name_label); entity.name_label = table_helpers.deep_copy(name_label);
@@ -15,25 +17,25 @@ function ailment_UI_entity.new(visibility, bar, name_label, text_label, value_la
entity.percentage_label = table_helpers.deep_copy(percentage_label); entity.percentage_label = table_helpers.deep_copy(percentage_label);
entity.timer_label = table_helpers.deep_copy(timer_label); entity.timer_label = table_helpers.deep_copy(timer_label);
entity.bar.offset.x = entity.bar.offset.x * config.current_config.global_settings.modifiers.global_scale_modifier; entity.bar.offset.x = entity.bar.offset.x * global_scale_modifier;
entity.bar.offset.y = entity.bar.offset.y * config.current_config.global_settings.modifiers.global_scale_modifier; entity.bar.offset.y = entity.bar.offset.y * global_scale_modifier;
entity.bar.size.width = entity.bar.size.width * config.current_config.global_settings.modifiers.global_scale_modifier; entity.bar.size.width = entity.bar.size.width * global_scale_modifier;
entity.bar.size.height = entity.bar.size.height * config.current_config.global_settings.modifiers.global_scale_modifier; entity.bar.size.height = entity.bar.size.height * global_scale_modifier;
entity.name_label.offset.x = entity.name_label.offset.x * config.current_config.global_settings.modifiers.global_scale_modifier; entity.name_label.offset.x = entity.name_label.offset.x * global_scale_modifier;
entity.name_label.offset.y = entity.name_label.offset.y * config.current_config.global_settings.modifiers.global_scale_modifier; entity.name_label.offset.y = entity.name_label.offset.y * global_scale_modifier;
entity.text_label.offset.x = entity.text_label.offset.x * config.current_config.global_settings.modifiers.global_scale_modifier; entity.text_label.offset.x = entity.text_label.offset.x * global_scale_modifier;
entity.text_label.offset.y = entity.text_label.offset.y * config.current_config.global_settings.modifiers.global_scale_modifier; entity.text_label.offset.y = entity.text_label.offset.y * global_scale_modifier;
entity.value_label.offset.x = entity.value_label.offset.x * config.current_config.global_settings.modifiers.global_scale_modifier; entity.value_label.offset.x = entity.value_label.offset.x * global_scale_modifier;
entity.value_label.offset.y = entity.value_label.offset.y * config.current_config.global_settings.modifiers.global_scale_modifier; entity.value_label.offset.y = entity.value_label.offset.y * global_scale_modifier;
entity.percentage_label.offset.x = entity.percentage_label.offset.x * config.current_config.global_settings.modifiers.global_scale_modifier; entity.percentage_label.offset.x = entity.percentage_label.offset.x * global_scale_modifier;
entity.percentage_label.offset.y = entity.percentage_label.offset.y * config.current_config.global_settings.modifiers.global_scale_modifier; entity.percentage_label.offset.y = entity.percentage_label.offset.y * global_scale_modifier;
entity.timer_label.offset.x = entity.timer_label.offset.x * config.current_config.global_settings.modifiers.global_scale_modifier; entity.timer_label.offset.x = entity.timer_label.offset.x * global_scale_modifier;
entity.timer_label.offset.y = entity.timer_label.offset.y * config.current_config.global_settings.modifiers.global_scale_modifier; entity.timer_label.offset.y = entity.timer_label.offset.y * global_scale_modifier;
return entity; return entity;
end end
@@ -43,11 +45,13 @@ function ailment_UI_entity.draw_dynamic(ailment, ailment_UI, position_on_screen,
return; return;
end end
local cached_config = config.current_config.large_monster_UI.dynamic.ailments;
local ailment_name = ""; local ailment_name = "";
if config.current_config.large_monster_UI.dynamic.ailments.ailment_name_label.include.ailment_name then if cached_config.ailment_name_label.include.ailment_name then
ailment_name = ailment.name .. " "; ailment_name = ailment.name .. " ";
end end
if config.current_config.large_monster_UI.dynamic.ailments.ailment_name_label.include.activation_count and ailment.activate_count ~= 0 then if cached_config.ailment_name_label.include.activation_count and ailment.activate_count ~= 0 then
ailment_name = ailment_name .. "x" .. tostring(ailment.activate_count); ailment_name = ailment_name .. "x" .. tostring(ailment.activate_count);
end end
@@ -72,11 +76,13 @@ function ailment_UI_entity.draw_static(ailment, ailment_UI, position_on_screen,
return; return;
end end
local cached_config = config.current_config.large_monster_UI.static.ailments;
local ailment_name = ""; local ailment_name = "";
if config.current_config.large_monster_UI.static.ailments.ailment_name_label.include.ailment_name then if cached_config.ailment_name_label.include.ailment_name then
ailment_name = ailment.name .. " "; ailment_name = ailment.name .. " ";
end end
if config.current_config.large_monster_UI.static.ailments.ailment_name_label.include.activation_count and ailment.activate_count ~= 0 then if cached_config.ailment_name_label.include.activation_count and ailment.activate_count ~= 0 then
ailment_name = ailment_name .. "x" .. tostring(ailment.activate_count); ailment_name = ailment_name .. "x" .. tostring(ailment.activate_count);
end end
@@ -101,11 +107,13 @@ function ailment_UI_entity.draw_highlighted(ailment, ailment_UI, position_on_scr
return; return;
end end
local cached_config = config.current_config.large_monster_UI.highlighted.ailments;
local ailment_name = ""; local ailment_name = "";
if config.current_config.large_monster_UI.highlighted.ailments.ailment_name_label.include.ailment_name then if cached_config.ailment_name_label.include.ailment_name then
ailment_name = ailment.name .. " "; ailment_name = ailment.name .. " ";
end end
if config.current_config.large_monster_UI.highlighted.ailments.ailment_name_label.include.activation_count and ailment.activate_count ~= 0 then if cached_config.ailment_name_label.include.activation_count and ailment.activate_count ~= 0 then
ailment_name = ailment_name .. "x" .. tostring(ailment.activate_count); ailment_name = ailment_name .. "x" .. tostring(ailment.activate_count);
end end
@@ -130,11 +138,13 @@ function ailment_UI_entity.draw_small(ailment, ailment_UI, position_on_screen, o
return; return;
end end
local cached_config = config.current_config.small_monster_UI.ailments;
local ailment_name = ""; local ailment_name = "";
if config.current_config.small_monster_UI.ailments.ailment_name_label.include.ailment_name then if cached_config.ailment_name_label.include.ailment_name then
ailment_name = ailment.name .. " "; ailment_name = ailment.name .. " ";
end end
if config.current_config.small_monster_UI.ailments.ailment_name_label.include.activation_count and ailment.activate_count ~= 0 then if cached_config.ailment_name_label.include.activation_count and ailment.activate_count ~= 0 then
ailment_name = ailment_name .. "x" .. tostring(ailment.activate_count); ailment_name = ailment_name .. "x" .. tostring(ailment.activate_count);
end end

View File

@@ -8,6 +8,7 @@ local language;
function ailment_buildup_UI_entity.new(buildup_bar, highlighted_buildup_bar, ailment_name_label, player_name_label, buildup_value_label, buildup_percentage_label, total_buildup_label, total_buildup_value_label) function ailment_buildup_UI_entity.new(buildup_bar, highlighted_buildup_bar, ailment_name_label, player_name_label, buildup_value_label, buildup_percentage_label, total_buildup_label, total_buildup_value_label)
local entity = {}; local entity = {};
local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
--entity.visibility = visibility; --entity.visibility = visibility;
entity.buildup_bar = table_helpers.deep_copy(buildup_bar); entity.buildup_bar = table_helpers.deep_copy(buildup_bar);
@@ -19,38 +20,39 @@ function ailment_buildup_UI_entity.new(buildup_bar, highlighted_buildup_bar, ail
entity.total_buildup_label = table_helpers.deep_copy(total_buildup_label); entity.total_buildup_label = table_helpers.deep_copy(total_buildup_label);
entity.total_buildup_value_label = table_helpers.deep_copy(total_buildup_value_label); entity.total_buildup_value_label = table_helpers.deep_copy(total_buildup_value_label);
entity.buildup_bar.offset.x = entity.buildup_bar.offset.x * config.current_config.global_settings.modifiers.global_scale_modifier; entity.buildup_bar.offset.x = entity.buildup_bar.offset.x * global_scale_modifier;
entity.buildup_bar.offset.y = entity.buildup_bar.offset.y * config.current_config.global_settings.modifiers.global_scale_modifier; entity.buildup_bar.offset.y = entity.buildup_bar.offset.y * global_scale_modifier;
entity.buildup_bar.size.width = entity.buildup_bar.size.width * config.current_config.global_settings.modifiers.global_scale_modifier; entity.buildup_bar.size.width = entity.buildup_bar.size.width * global_scale_modifier;
entity.buildup_bar.size.height = entity.buildup_bar.size.height * config.current_config.global_settings.modifiers.global_scale_modifier; entity.buildup_bar.size.height = entity.buildup_bar.size.height * global_scale_modifier;
entity.highlighted_buildup_bar.offset.x = entity.highlighted_buildup_bar.offset.x * config.current_config.global_settings.modifiers.global_scale_modifier; entity.highlighted_buildup_bar.offset.x = entity.highlighted_buildup_bar.offset.x * global_scale_modifier;
entity.highlighted_buildup_bar.offset.y = entity.highlighted_buildup_bar.offset.y * config.current_config.global_settings.modifiers.global_scale_modifier; entity.highlighted_buildup_bar.offset.y = entity.highlighted_buildup_bar.offset.y * global_scale_modifier;
entity.highlighted_buildup_bar.size.width = entity.highlighted_buildup_bar.size.width * config.current_config.global_settings.modifiers.global_scale_modifier; entity.highlighted_buildup_bar.size.width = entity.highlighted_buildup_bar.size.width * global_scale_modifier;
entity.highlighted_buildup_bar.size.height = entity.highlighted_buildup_bar.size.height * config.current_config.global_settings.modifiers.global_scale_modifier; entity.highlighted_buildup_bar.size.height = entity.highlighted_buildup_bar.size.height * global_scale_modifier;
entity.player_name_label.offset.x = entity.player_name_label.offset.x * config.current_config.global_settings.modifiers.global_scale_modifier; entity.player_name_label.offset.x = entity.player_name_label.offset.x * global_scale_modifier;
entity.player_name_label.offset.y = entity.player_name_label.offset.y * config.current_config.global_settings.modifiers.global_scale_modifier; entity.player_name_label.offset.y = entity.player_name_label.offset.y * global_scale_modifier;
entity.buildup_value_label.offset.x = entity.buildup_value_label.offset.x * config.current_config.global_settings.modifiers.global_scale_modifier; entity.buildup_value_label.offset.x = entity.buildup_value_label.offset.x * global_scale_modifier;
entity.buildup_value_label.offset.y = entity.buildup_value_label.offset.y * config.current_config.global_settings.modifiers.global_scale_modifier; entity.buildup_value_label.offset.y = entity.buildup_value_label.offset.y * global_scale_modifier;
entity.buildup_percentage_label.offset.x = entity.buildup_percentage_label.offset.x * config.current_config.global_settings.modifiers.global_scale_modifier; entity.buildup_percentage_label.offset.x = entity.buildup_percentage_label.offset.x * global_scale_modifier
entity.buildup_percentage_label.offset.y = entity.buildup_percentage_label.offset.y * config.current_config.global_settings.modifiers.global_scale_modifier; entity.buildup_percentage_label.offset.y = entity.buildup_percentage_label.offset.y * global_scale_modifier;
entity.total_buildup_label.offset.x = entity.total_buildup_label.offset.x * config.current_config.global_settings.modifiers.global_scale_modifier; entity.total_buildup_label.offset.x = entity.total_buildup_label.offset.x * global_scale_modifier;
entity.total_buildup_label.offset.y = entity.total_buildup_label.offset.y * config.current_config.global_settings.modifiers.global_scale_modifier; entity.total_buildup_label.offset.y = entity.total_buildup_label.offset.y * global_scale_modifier;
entity.total_buildup_value_label.offset.x = entity.total_buildup_value_label.offset.x * config.current_config.global_settings.modifiers.global_scale_modifier; entity.total_buildup_value_label.offset.x = entity.total_buildup_value_label.offset.x * global_scale_modifier;
entity.total_buildup_value_label.offset.y = entity.total_buildup_value_label.offset.y * config.current_config.global_settings.modifiers.global_scale_modifier; entity.total_buildup_value_label.offset.y = entity.total_buildup_value_label.offset.y * global_scale_modifier;
return entity; return entity;
end end
function ailment_buildup_UI_entity.draw_dynamic(_player, ailment_buildup_UI, position_on_screen, opacity_scale, top_buildup) function ailment_buildup_UI_entity.draw_dynamic(_player, ailment_buildup_UI, position_on_screen, opacity_scale, top_buildup)
local cached_config = config.current_config.large_monster_UI.dynamic.ailment_buildups;
local player_buildup_bar_percentage = 0; local player_buildup_bar_percentage = 0;
if config.current_config.large_monster_UI.dynamic.ailment_buildups.settings.buildup_bar_relative_to == "Total Buildup" then if cached_config.settings.buildup_bar_relative_to == "Total Buildup" then
player_buildup_bar_percentage = _player.buildup_share; player_buildup_bar_percentage = _player.buildup_share;
else else
if top_buildup ~= 0 then if top_buildup ~= 0 then
@@ -58,9 +60,9 @@ function ailment_buildup_UI_entity.draw_dynamic(_player, ailment_buildup_UI, pos
end end
end end
if _player.id == player.myself.id and config.current_config.large_monster_UI.dynamic.ailment_buildups.settings.highlighted_bar == "Me" then if _player.id == player.myself.id and cached_config.settings.highlighted_bar == "Me" then
drawing.draw_bar(ailment_buildup_UI.highlighted_buildup_bar, position_on_screen, opacity_scale, player_buildup_bar_percentage); drawing.draw_bar(ailment_buildup_UI.highlighted_buildup_bar, position_on_screen, opacity_scale, player_buildup_bar_percentage);
elseif config.current_config.large_monster_UI.dynamic.ailment_buildups.settings.highlighted_bar == "Top Buildup" and _player.buildup == top_buildup then elseif cached_config.settings.highlighted_bar == "Top Buildup" and _player.buildup == top_buildup then
drawing.draw_bar(ailment_buildup_UI.highlighted_buildup_bar, position_on_screen, opacity_scale, player_buildup_bar_percentage); drawing.draw_bar(ailment_buildup_UI.highlighted_buildup_bar, position_on_screen, opacity_scale, player_buildup_bar_percentage);
else else
drawing.draw_bar(ailment_buildup_UI.buildup_bar, position_on_screen, opacity_scale, player_buildup_bar_percentage); drawing.draw_bar(ailment_buildup_UI.buildup_bar, position_on_screen, opacity_scale, player_buildup_bar_percentage);
@@ -72,9 +74,10 @@ function ailment_buildup_UI_entity.draw_dynamic(_player, ailment_buildup_UI, pos
end end
function ailment_buildup_UI_entity.draw_static(_player, ailment_buildup_UI, position_on_screen, opacity_scale, top_buildup) function ailment_buildup_UI_entity.draw_static(_player, ailment_buildup_UI, position_on_screen, opacity_scale, top_buildup)
local cached_config = config.current_config.large_monster_UI.static.ailment_buildups;
local player_buildup_bar_percentage = 0; local player_buildup_bar_percentage = 0;
if config.current_config.large_monster_UI.static.ailment_buildups.settings.buildup_bar_relative_to == "Total Buildup" then if cached_config.settings.buildup_bar_relative_to == "Total Buildup" then
player_buildup_bar_percentage = _player.buildup_share; player_buildup_bar_percentage = _player.buildup_share;
else else
if top_buildup ~= 0 then if top_buildup ~= 0 then
@@ -82,9 +85,9 @@ function ailment_buildup_UI_entity.draw_static(_player, ailment_buildup_UI, posi
end end
end end
if _player.id == player.myself.id and config.current_config.large_monster_UI.static.ailment_buildups.settings.highlighted_bar == "Me" then if _player.id == player.myself.id and cached_config.settings.highlighted_bar == "Me" then
drawing.draw_bar(ailment_buildup_UI.highlighted_buildup_bar, position_on_screen, opacity_scale, player_buildup_bar_percentage); drawing.draw_bar(ailment_buildup_UI.highlighted_buildup_bar, position_on_screen, opacity_scale, player_buildup_bar_percentage);
elseif config.current_config.large_monster_UI.static.ailment_buildups.settings.highlighted_bar == "Top Buildup" and _player.buildup == top_buildup then elseif cached_config.settings.highlighted_bar == "Top Buildup" and _player.buildup == top_buildup then
drawing.draw_bar(ailment_buildup_UI.highlighted_buildup_bar, position_on_screen, opacity_scale, player_buildup_bar_percentage); drawing.draw_bar(ailment_buildup_UI.highlighted_buildup_bar, position_on_screen, opacity_scale, player_buildup_bar_percentage);
else else
drawing.draw_bar(ailment_buildup_UI.buildup_bar, position_on_screen, opacity_scale, player_buildup_bar_percentage); drawing.draw_bar(ailment_buildup_UI.buildup_bar, position_on_screen, opacity_scale, player_buildup_bar_percentage);
@@ -96,9 +99,10 @@ function ailment_buildup_UI_entity.draw_static(_player, ailment_buildup_UI, posi
end end
function ailment_buildup_UI_entity.draw_highlighted(_player, ailment_buildup_UI, position_on_screen, opacity_scale, top_buildup) function ailment_buildup_UI_entity.draw_highlighted(_player, ailment_buildup_UI, position_on_screen, opacity_scale, top_buildup)
local cached_config = config.current_config.large_monster_UI.highlighted.ailment_buildups;
local player_buildup_bar_percentage = 0; local player_buildup_bar_percentage = 0;
if config.current_config.large_monster_UI.highlighted.ailment_buildups.settings.buildup_bar_relative_to == "Total Buildup" then if cached_config.settings.buildup_bar_relative_to == "Total Buildup" then
player_buildup_bar_percentage = _player.buildup_share; player_buildup_bar_percentage = _player.buildup_share;
else else
if top_buildup ~= 0 then if top_buildup ~= 0 then
@@ -106,9 +110,9 @@ function ailment_buildup_UI_entity.draw_highlighted(_player, ailment_buildup_UI,
end end
end end
if _player.id == player.myself.id and config.current_config.large_monster_UI.highlighted.ailment_buildups.settings.highlighted_bar == "Me" then if _player.id == player.myself.id and cached_config.settings.highlighted_bar == "Me" then
drawing.draw_bar(ailment_buildup_UI.highlighted_buildup_bar, position_on_screen, opacity_scale, player_buildup_bar_percentage); drawing.draw_bar(ailment_buildup_UI.highlighted_buildup_bar, position_on_screen, opacity_scale, player_buildup_bar_percentage);
elseif config.current_config.large_monster_UI.highlighted.ailment_buildups.settings.highlighted_bar == "Top Buildup" and _player.buildup == top_buildup then elseif cached_config.settings.highlighted_bar == "Top Buildup" and _player.buildup == top_buildup then
drawing.draw_bar(ailment_buildup_UI.highlighted_buildup_bar, position_on_screen, opacity_scale, player_buildup_bar_percentage); drawing.draw_bar(ailment_buildup_UI.highlighted_buildup_bar, position_on_screen, opacity_scale, player_buildup_bar_percentage);
else else
drawing.draw_bar(ailment_buildup_UI.buildup_bar, position_on_screen, opacity_scale, player_buildup_bar_percentage); drawing.draw_bar(ailment_buildup_UI.buildup_bar, position_on_screen, opacity_scale, player_buildup_bar_percentage);
@@ -120,9 +124,10 @@ function ailment_buildup_UI_entity.draw_highlighted(_player, ailment_buildup_UI,
end end
function ailment_buildup_UI_entity.draw_small(_player, ailment_buildup_UI, position_on_screen, opacity_scale, top_buildup) function ailment_buildup_UI_entity.draw_small(_player, ailment_buildup_UI, position_on_screen, opacity_scale, top_buildup)
local cached_config = config.current_config.small_monster_UI.ailment_buildups;
local player_buildup_bar_percentage = 0; local player_buildup_bar_percentage = 0;
if config.current_config.small_monster_UI.ailment_buildups.settings.buildup_bar_relative_to == "Total Buildup" then if cached_config.settings.buildup_bar_relative_to == "Total Buildup" then
player_buildup_bar_percentage = _player.buildup_share; player_buildup_bar_percentage = _player.buildup_share;
else else
if top_buildup ~= 0 then if top_buildup ~= 0 then
@@ -130,9 +135,9 @@ function ailment_buildup_UI_entity.draw_small(_player, ailment_buildup_UI, posit
end end
end end
if _player.id == player.myself.id and config.current_config.small_monster_UI.ailment_buildups.settings.highlighted_bar == "Me" then if _player.id == player.myself.id and cached_config.settings.highlighted_bar == "Me" then
drawing.draw_bar(ailment_buildup_UI.highlighted_buildup_bar, position_on_screen, opacity_scale, player_buildup_bar_percentage); drawing.draw_bar(ailment_buildup_UI.highlighted_buildup_bar, position_on_screen, opacity_scale, player_buildup_bar_percentage);
elseif config.current_config.small_monster_UI.ailment_buildups.settings.highlighted_bar == "Top Buildup" and _player.buildup == top_buildup then elseif cached_config.settings.highlighted_bar == "Top Buildup" and _player.buildup == top_buildup then
drawing.draw_bar(ailment_buildup_UI.highlighted_buildup_bar, position_on_screen, opacity_scale, player_buildup_bar_percentage); drawing.draw_bar(ailment_buildup_UI.highlighted_buildup_bar, position_on_screen, opacity_scale, player_buildup_bar_percentage);
else else
drawing.draw_bar(ailment_buildup_UI.buildup_bar, position_on_screen, opacity_scale, player_buildup_bar_percentage); drawing.draw_bar(ailment_buildup_UI.buildup_bar, position_on_screen, opacity_scale, player_buildup_bar_percentage);

View File

@@ -7,6 +7,9 @@ function body_part_UI_entity.new(part_visibility, part_name_label,
flinch_visibility, flinch_bar, flinch_text_label, flinch_value_label, flinch_percentage_label, flinch_visibility, flinch_bar, flinch_text_label, flinch_value_label, flinch_percentage_label,
break_visibility, break_bar, break_text_label, break_value_label, break_percentage_label, break_visibility, break_bar, break_text_label, break_value_label, break_percentage_label,
loss_visibility, loss_bar, loss_text_label, loss_value_label, loss_health_percentage_label) loss_visibility, loss_bar, loss_text_label, loss_value_label, loss_health_percentage_label)
local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
local entity = {}; local entity = {};
entity.part_visibility = part_visibility; entity.part_visibility = part_visibility;
@@ -16,91 +19,93 @@ function body_part_UI_entity.new(part_visibility, part_name_label,
entity.part_name_label = table_helpers.deep_copy(part_name_label); entity.part_name_label = table_helpers.deep_copy(part_name_label);
entity.part_name_label.offset.x = entity.part_name_label.offset.x * config.current_config.global_settings.modifiers.global_scale_modifier; entity.part_name_label.offset.x = entity.part_name_label.offset.x * global_scale_modifier;
entity.part_name_label.offset.y = entity.part_name_label.offset.y * config.current_config.global_settings.modifiers.global_scale_modifier; entity.part_name_label.offset.y = entity.part_name_label.offset.y * global_scale_modifier;
entity.flinch_bar = table_helpers.deep_copy(flinch_bar); entity.flinch_bar = table_helpers.deep_copy(flinch_bar);
entity.flinch_text_label = table_helpers.deep_copy(flinch_text_label); entity.flinch_text_label = table_helpers.deep_copy(flinch_text_label);
entity.flinch_value_label = table_helpers.deep_copy(flinch_value_label); entity.flinch_value_label = table_helpers.deep_copy(flinch_value_label);
entity.flinch_percentage_label = table_helpers.deep_copy(flinch_percentage_label); entity.flinch_percentage_label = table_helpers.deep_copy(flinch_percentage_label);
entity.flinch_bar.offset.x = entity.flinch_bar.offset.x * config.current_config.global_settings.modifiers.global_scale_modifier; entity.flinch_bar.offset.x = entity.flinch_bar.offset.x * global_scale_modifier;
entity.flinch_bar.offset.y = entity.flinch_bar.offset.y * config.current_config.global_settings.modifiers.global_scale_modifier; entity.flinch_bar.offset.y = entity.flinch_bar.offset.y * global_scale_modifier;
entity.flinch_bar.size.width = entity.flinch_bar.size.width * config.current_config.global_settings.modifiers.global_scale_modifier; entity.flinch_bar.size.width = entity.flinch_bar.size.width * global_scale_modifier;
entity.flinch_bar.size.height = entity.flinch_bar.size.height * config.current_config.global_settings.modifiers.global_scale_modifier; entity.flinch_bar.size.height = entity.flinch_bar.size.height * global_scale_modifier;
entity.flinch_text_label.offset.x = entity.flinch_text_label.offset.x * config.current_config.global_settings.modifiers.global_scale_modifier; entity.flinch_text_label.offset.x = entity.flinch_text_label.offset.x * global_scale_modifier;
entity.flinch_text_label.offset.y = entity.flinch_text_label.offset.y * config.current_config.global_settings.modifiers.global_scale_modifier; entity.flinch_text_label.offset.y = entity.flinch_text_label.offset.y * global_scale_modifier;
entity.flinch_value_label.offset.x = entity.flinch_value_label.offset.x * config.current_config.global_settings.modifiers.global_scale_modifier; entity.flinch_value_label.offset.x = entity.flinch_value_label.offset.x * global_scale_modifier;
entity.flinch_value_label.offset.y = entity.flinch_value_label.offset.y * config.current_config.global_settings.modifiers.global_scale_modifier; entity.flinch_value_label.offset.y = entity.flinch_value_label.offset.y * global_scale_modifier;
entity.flinch_percentage_label.offset.x = entity.flinch_percentage_label.offset.x * config.current_config.global_settings.modifiers.global_scale_modifier; entity.flinch_percentage_label.offset.x = entity.flinch_percentage_label.offset.x * global_scale_modifier;
entity.flinch_percentage_label.offset.y = entity.flinch_percentage_label.offset.y * config.current_config.global_settings.modifiers.global_scale_modifier; entity.flinch_percentage_label.offset.y = entity.flinch_percentage_label.offset.y * global_scale_modifier;
entity.break_bar = table_helpers.deep_copy(break_bar); entity.break_bar = table_helpers.deep_copy(break_bar);
entity.break_text_label = table_helpers.deep_copy(break_text_label); entity.break_text_label = table_helpers.deep_copy(break_text_label);
entity.break_value_label = table_helpers.deep_copy(break_value_label); entity.break_value_label = table_helpers.deep_copy(break_value_label);
entity.break_percentage_label = table_helpers.deep_copy(break_percentage_label); entity.break_percentage_label = table_helpers.deep_copy(break_percentage_label);
entity.break_bar.offset.x = entity.break_bar.offset.x * config.current_config.global_settings.modifiers.global_scale_modifier; entity.break_bar.offset.x = entity.break_bar.offset.x * global_scale_modifier;
entity.break_bar.offset.y = entity.break_bar.offset.y * config.current_config.global_settings.modifiers.global_scale_modifier; entity.break_bar.offset.y = entity.break_bar.offset.y * global_scale_modifier;
entity.break_bar.size.width = entity.break_bar.size.width * config.current_config.global_settings.modifiers.global_scale_modifier; entity.break_bar.size.width = entity.break_bar.size.width * global_scale_modifier;
entity.break_bar.size.height = entity.break_bar.size.height * config.current_config.global_settings.modifiers.global_scale_modifier; entity.break_bar.size.height = entity.break_bar.size.height * global_scale_modifier;
entity.break_text_label.offset.x = entity.break_text_label.offset.x * config.current_config.global_settings.modifiers.global_scale_modifier; entity.break_text_label.offset.x = entity.break_text_label.offset.x * global_scale_modifier;
entity.break_text_label.offset.y = entity.break_text_label.offset.y * config.current_config.global_settings.modifiers.global_scale_modifier; entity.break_text_label.offset.y = entity.break_text_label.offset.y * global_scale_modifier;
entity.break_value_label.offset.x = entity.break_value_label.offset.x * config.current_config.global_settings.modifiers.global_scale_modifier; entity.break_value_label.offset.x = entity.break_value_label.offset.x * global_scale_modifier;
entity.break_value_label.offset.y = entity.break_value_label.offset.y * config.current_config.global_settings.modifiers.global_scale_modifier; entity.break_value_label.offset.y = entity.break_value_label.offset.y * global_scale_modifier;
entity.break_percentage_label.offset.x = entity.break_percentage_label.offset.x * config.current_config.global_settings.modifiers.global_scale_modifier; entity.break_percentage_label.offset.x = entity.break_percentage_label.offset.x * global_scale_modifier;
entity.break_percentage_label.offset.y = entity.break_percentage_label.offset.y * config.current_config.global_settings.modifiers.global_scale_modifier; entity.break_percentage_label.offset.y = entity.break_percentage_label.offset.y * global_scale_modifier;
entity.loss_bar = table_helpers.deep_copy(loss_bar); entity.loss_bar = table_helpers.deep_copy(loss_bar);
entity.loss_text_label = table_helpers.deep_copy(loss_text_label); entity.loss_text_label = table_helpers.deep_copy(loss_text_label);
entity.loss_value_label = table_helpers.deep_copy(loss_value_label); entity.loss_value_label = table_helpers.deep_copy(loss_value_label);
entity.loss_health_percentage_label = table_helpers.deep_copy(loss_health_percentage_label); entity.loss_health_percentage_label = table_helpers.deep_copy(loss_health_percentage_label);
entity.loss_bar.offset.x = entity.loss_bar.offset.x * config.current_config.global_settings.modifiers.global_scale_modifier; entity.loss_bar.offset.x = entity.loss_bar.offset.x * global_scale_modifier;
entity.loss_bar.offset.y = entity.loss_bar.offset.y * config.current_config.global_settings.modifiers.global_scale_modifier; entity.loss_bar.offset.y = entity.loss_bar.offset.y * global_scale_modifier;
entity.loss_bar.size.width = entity.loss_bar.size.width * config.current_config.global_settings.modifiers.global_scale_modifier; entity.loss_bar.size.width = entity.loss_bar.size.width * global_scale_modifier;
entity.loss_bar.size.height = entity.loss_bar.size.height * config.current_config.global_settings.modifiers.global_scale_modifier; entity.loss_bar.size.height = entity.loss_bar.size.height * global_scale_modifier;
entity.loss_text_label.offset.x = entity.loss_text_label.offset.x * config.current_config.global_settings.modifiers.global_scale_modifier; entity.loss_text_label.offset.x = entity.loss_text_label.offset.x * global_scale_modifier;
entity.loss_text_label.offset.y = entity.loss_text_label.offset.y * config.current_config.global_settings.modifiers.global_scale_modifier; entity.loss_text_label.offset.y = entity.loss_text_label.offset.y * global_scale_modifier;
entity.loss_value_label.offset.x = entity.loss_value_label.offset.x * config.current_config.global_settings.modifiers.global_scale_modifier; entity.loss_value_label.offset.x = entity.loss_value_label.offset.x * global_scale_modifier;
entity.loss_value_label.offset.y = entity.loss_value_label.offset.y * config.current_config.global_settings.modifiers.global_scale_modifier; entity.loss_value_label.offset.y = entity.loss_value_label.offset.y * global_scale_modifier;
entity.loss_health_percentage_label.offset.x = entity.loss_health_percentage_label.offset.x * config.current_config.global_settings.modifiers.global_scale_modifier; entity.loss_health_percentage_label.offset.x = entity.loss_health_percentage_label.offset.x * global_scale_modifier;
entity.loss_health_percentage_label.offset.y = entity.loss_health_percentage_label.offset.y * config.current_config.global_settings.modifiers.global_scale_modifier; entity.loss_health_percentage_label.offset.y = entity.loss_health_percentage_label.offset.y * global_scale_modifier;
return entity; return entity;
end end
function body_part_UI_entity.draw_dynamic(part, position_on_screen, opacity_scale) function body_part_UI_entity.draw_dynamic(part, position_on_screen, opacity_scale)
local cached_config = config.current_config.large_monster_UI.dynamic.body_parts;
if not part.body_part_dynamic_UI.part_visibility then if not part.body_part_dynamic_UI.part_visibility then
return; return;
end end
local part_name = ""; local part_name = "";
if config.current_config.large_monster_UI.dynamic.body_parts.part_name_label.include.part_name then if cached_config.part_name_label.include.part_name then
part_name = part.name .. " "; part_name = part.name .. " ";
end end
if config.current_config.large_monster_UI.dynamic.body_parts.part_name_label.include.flinch_count and part.flinch_count ~= 0 then if cached_config.part_name_label.include.flinch_count and part.flinch_count ~= 0 then
part_name = part_name .. "x" .. tostring(part.flinch_count) .. " "; part_name = part_name .. "x" .. tostring(part.flinch_count) .. " ";
end end
if part.break_max_count ~= 0 then if part.break_max_count ~= 0 then
if config.current_config.large_monster_UI.dynamic.body_parts.part_name_label.include.break_count then if cached_config.part_name_label.include.break_count then
if config.current_config.large_monster_UI.dynamic.body_parts.part_name_label.include.break_max_count then if cached_config.part_name_label.include.break_max_count then
part_name = part_name .. tostring(part.break_count) .. "/" .. tostring(part.break_max_count); part_name = part_name .. tostring(part.break_count) .. "/" .. tostring(part.break_max_count);
elseif part.flinch_count ~= 0 then elseif part.flinch_count ~= 0 then
part_name = part_name .. "x" .. tostring(part.break_count); part_name = part_name .. "x" .. tostring(part.break_count);
end end
elseif config.current_config.large_monster_UI.dynamic.body_parts.part_name_label.include.break_max_count then elseif cached_config.part_name_label.include.break_max_count then
part_name = part_name .. "/" .. tostring(part.break_max_count); part_name = part_name .. "/" .. tostring(part.break_max_count);
end end
end end
@@ -110,20 +115,20 @@ function body_part_UI_entity.draw_dynamic(part, position_on_screen, opacity_scal
local loss_health_string = string.format("%.0f/%.0f", part.loss_health, part.loss_max_health); local loss_health_string = string.format("%.0f/%.0f", part.loss_health, part.loss_max_health);
local flinch_position_on_screen = { local flinch_position_on_screen = {
x = position_on_screen.x + config.current_config.large_monster_UI.dynamic.body_parts.part_health.offset.x, x = position_on_screen.x + cached_config.part_health.offset.x,
y = position_on_screen.y + config.current_config.large_monster_UI.dynamic.body_parts.part_health.offset.y, y = position_on_screen.y + cached_config.part_health.offset.y,
visibility = part.body_part_dynamic_UI.flinch_visibility visibility = part.body_part_dynamic_UI.flinch_visibility
}; };
local break_position_on_screen = { local break_position_on_screen = {
x = position_on_screen.x + config.current_config.large_monster_UI.dynamic.body_parts.part_break.offset.x, x = position_on_screen.x + cached_config.part_break.offset.x,
y = position_on_screen.y + config.current_config.large_monster_UI.dynamic.body_parts.part_break.offset.y, y = position_on_screen.y + cached_config.part_break.offset.y,
visibility = part.body_part_dynamic_UI.flinch_visibility visibility = part.body_part_dynamic_UI.flinch_visibility
}; };
local loss_position_on_screen = { local loss_position_on_screen = {
x = position_on_screen.x + config.current_config.large_monster_UI.dynamic.body_parts.part_loss.offset.x, x = position_on_screen.x + cached_config.part_loss.offset.x,
y = position_on_screen.y + config.current_config.large_monster_UI.dynamic.body_parts.part_loss.offset.y, y = position_on_screen.y + cached_config.part_loss.offset.y,
}; };
@@ -162,27 +167,29 @@ function body_part_UI_entity.draw_dynamic(part, position_on_screen, opacity_scal
end end
function body_part_UI_entity.draw_static(part, position_on_screen, opacity_scale) function body_part_UI_entity.draw_static(part, position_on_screen, opacity_scale)
local cached_config = config.current_config.large_monster_UI.static.body_parts;
if not part.body_part_static_UI.part_visibility then if not part.body_part_static_UI.part_visibility then
return; return;
end end
local part_name = ""; local part_name = "";
if config.current_config.large_monster_UI.static.body_parts.part_name_label.include.part_name then if cached_config.part_name_label.include.part_name then
part_name = part.name .. " "; part_name = part.name .. " ";
end end
if config.current_config.large_monster_UI.static.body_parts.part_name_label.include.flinch_count and part.flinch_count ~= 0 then if cached_config.part_name_label.include.flinch_count and part.flinch_count ~= 0 then
part_name = part_name .. "x" .. tostring(part.flinch_count) .. " "; part_name = part_name .. "x" .. tostring(part.flinch_count) .. " ";
end end
if part.break_max_count ~= 0 then if part.break_max_count ~= 0 then
if config.current_config.large_monster_UI.static.body_parts.part_name_label.include.break_count then if cached_config.part_name_label.include.break_count then
if config.current_config.large_monster_UI.static.body_parts.part_name_label.include.break_max_count then if cached_config.part_name_label.include.break_max_count then
part_name = part_name .. tostring(part.break_count) .. "/" .. tostring(part.break_max_count); part_name = part_name .. tostring(part.break_count) .. "/" .. tostring(part.break_max_count);
elseif part.flinch_count ~= 0 then elseif part.flinch_count ~= 0 then
part_name = part_name .. "x" .. tostring(part.break_count); part_name = part_name .. "x" .. tostring(part.break_count);
end end
elseif config.current_config.large_monster_UI.static.body_parts.part_name_label.include.break_max_count then elseif cached_config.part_name_label.include.break_max_count then
part_name = part_name .. "/" .. tostring(part.break_max_count); part_name = part_name .. "/" .. tostring(part.break_max_count);
end end
end end
@@ -192,20 +199,20 @@ function body_part_UI_entity.draw_static(part, position_on_screen, opacity_scale
local loss_health_string = string.format("%.0f/%.0f", part.loss_health, part.loss_max_health); local loss_health_string = string.format("%.0f/%.0f", part.loss_health, part.loss_max_health);
local flinch_position_on_screen = { local flinch_position_on_screen = {
x = position_on_screen.x + config.current_config.large_monster_UI.static.body_parts.part_health.offset.x, x = position_on_screen.x + cached_config.part_health.offset.x,
y = position_on_screen.y + config.current_config.large_monster_UI.static.body_parts.part_health.offset.y, y = position_on_screen.y + cached_config.part_health.offset.y,
visibility = part.body_part_static_UI.flinch_visibility visibility = part.body_part_static_UI.flinch_visibility
}; };
local break_position_on_screen = { local break_position_on_screen = {
x = position_on_screen.x + config.current_config.large_monster_UI.static.body_parts.part_break.offset.x, x = position_on_screen.x + cached_config.part_break.offset.x,
y = position_on_screen.y + config.current_config.large_monster_UI.static.body_parts.part_break.offset.y, y = position_on_screen.y + cached_config.part_break.offset.y,
visibility = part.body_part_static_UI.flinch_visibility visibility = part.body_part_static_UI.flinch_visibility
}; };
local loss_position_on_screen = { local loss_position_on_screen = {
x = position_on_screen.x + config.current_config.large_monster_UI.static.body_parts.part_loss.offset.x, x = position_on_screen.x + cached_config.part_loss.offset.x,
y = position_on_screen.y + config.current_config.large_monster_UI.static.body_parts.part_loss.offset.y, y = position_on_screen.y + cached_config.part_loss.offset.y,
}; };
@@ -244,27 +251,29 @@ function body_part_UI_entity.draw_static(part, position_on_screen, opacity_scale
end end
function body_part_UI_entity.draw_highlighted(part, position_on_screen, opacity_scale) function body_part_UI_entity.draw_highlighted(part, position_on_screen, opacity_scale)
local cached_config = config.current_config.large_monster_UI.highlighted.body_parts;
if not part.body_part_highlighted_UI.part_visibility then if not part.body_part_highlighted_UI.part_visibility then
return; return;
end end
local part_name = ""; local part_name = "";
if config.current_config.large_monster_UI.highlighted.body_parts.part_name_label.include.part_name then if cached_config.part_name_label.include.part_name then
part_name = part.name .. " "; part_name = part.name .. " ";
end end
if config.current_config.large_monster_UI.highlighted.body_parts.part_name_label.include.flinch_count and part.flinch_count ~= 0 then if cached_config.part_name_label.include.flinch_count and part.flinch_count ~= 0 then
part_name = part_name .. "x" .. tostring(part.flinch_count) .. " "; part_name = part_name .. "x" .. tostring(part.flinch_count) .. " ";
end end
if part.break_max_count ~= 0 then if part.break_max_count ~= 0 then
if config.current_config.large_monster_UI.highlighted.body_parts.part_name_label.include.break_count then if cached_config.part_name_label.include.break_count then
if config.current_config.large_monster_UI.highlighted.body_parts.part_name_label.include.break_max_count then if cached_config.part_name_label.include.break_max_count then
part_name = part_name .. tostring(part.break_count) .. "/" .. tostring(part.break_max_count); part_name = part_name .. tostring(part.break_count) .. "/" .. tostring(part.break_max_count);
elseif part.flinch_count ~= 0 then elseif part.flinch_count ~= 0 then
part_name = part_name .. "x" .. tostring(part.break_count); part_name = part_name .. "x" .. tostring(part.break_count);
end end
elseif config.current_config.large_monster_UI.highlighted.body_parts.part_name_label.include.break_max_count then elseif cached_config.part_name_label.include.break_max_count then
part_name = part_name .. "/" .. tostring(part.break_max_count); part_name = part_name .. "/" .. tostring(part.break_max_count);
end end
end end
@@ -274,51 +283,55 @@ function body_part_UI_entity.draw_highlighted(part, position_on_screen, opacity_
local loss_health_string = string.format("%.0f/%.0f", part.loss_health, part.loss_max_health); local loss_health_string = string.format("%.0f/%.0f", part.loss_health, part.loss_max_health);
local flinch_position_on_screen = { local flinch_position_on_screen = {
x = position_on_screen.x + config.current_config.large_monster_UI.highlighted.body_parts.part_health.offset.x, x = position_on_screen.x + cached_config.part_health.offset.x,
y = position_on_screen.y + config.current_config.large_monster_UI.highlighted.body_parts.part_health.offset.y, y = position_on_screen.y + cached_config.part_health.offset.y,
visibility = part.body_part_highlighted_UI.flinch_visibility visibility = part.body_part_highlighted_UI.flinch_visibility
}; };
local break_position_on_screen = { local break_position_on_screen = {
x = position_on_screen.x + config.current_config.large_monster_UI.highlighted.body_parts.part_break.offset.x, x = position_on_screen.x + cached_config.part_break.offset.x,
y = position_on_screen.y + config.current_config.large_monster_UI.highlighted.body_parts.part_break.offset.y, y = position_on_screen.y + cached_config.part_break.offset.y,
visibility = part.body_part_highlighted_UI.flinch_visibility visibility = part.body_part_highlighted_UI.flinch_visibility
}; };
local loss_position_on_screen = { local loss_position_on_screen = {
x = position_on_screen.x + config.current_config.large_monster_UI.highlighted.body_parts.part_loss.offset.x, x = position_on_screen.x + cached_config.part_loss.offset.x,
y = position_on_screen.y + config.current_config.large_monster_UI.highlighted.body_parts.part_loss.offset.y, y = position_on_screen.y + cached_config.part_loss.offset.y,
}; };
if part.body_part_highlighted_UI.flinch_visibility then local draw_health = part.body_part_highlighted_UI.flinch_visibility and part.max_health > 0;
local draw_break = part.body_part_highlighted_UI.break_visibility and part.break_max_health > 0 and part.break_count < part.break_max_count;
local draw_loss = part.body_part_highlighted_UI.loss_visibility and part.loss_max_health > 0 and not part.is_severed;
if draw_health then
drawing.draw_bar(part.body_part_highlighted_UI.flinch_bar, flinch_position_on_screen, opacity_scale, part.health_percentage); drawing.draw_bar(part.body_part_highlighted_UI.flinch_bar, flinch_position_on_screen, opacity_scale, part.health_percentage);
end end
if part.body_part_highlighted_UI.break_visibility and part.break_max_health ~= -1 and part.break_count < part.break_max_count then if draw_break then
drawing.draw_bar(part.body_part_highlighted_UI.break_bar, break_position_on_screen, opacity_scale, part.break_health_percentage); drawing.draw_bar(part.body_part_highlighted_UI.break_bar, break_position_on_screen, opacity_scale, part.break_health_percentage);
end end
if part.body_part_highlighted_UI.loss_visibility and part.loss_max_health ~= -1 and not part.is_severed then if draw_loss then
drawing.draw_bar(part.body_part_highlighted_UI.loss_bar, loss_position_on_screen, opacity_scale, part.loss_health_percentage); drawing.draw_bar(part.body_part_highlighted_UI.loss_bar, loss_position_on_screen, opacity_scale, part.loss_health_percentage);
end end
drawing.draw_label(part.body_part_highlighted_UI.part_name_label, position_on_screen, opacity_scale, part_name); drawing.draw_label(part.body_part_highlighted_UI.part_name_label, position_on_screen, opacity_scale, part_name);
if part.body_part_highlighted_UI.flinch_visibility then if draw_health then
drawing.draw_label(part.body_part_highlighted_UI.flinch_text_label, flinch_position_on_screen, opacity_scale); drawing.draw_label(part.body_part_highlighted_UI.flinch_text_label, flinch_position_on_screen, opacity_scale);
drawing.draw_label(part.body_part_highlighted_UI.flinch_value_label, flinch_position_on_screen, opacity_scale, health_string); drawing.draw_label(part.body_part_highlighted_UI.flinch_value_label, flinch_position_on_screen, opacity_scale, health_string);
drawing.draw_label(part.body_part_highlighted_UI.flinch_percentage_label, flinch_position_on_screen, opacity_scale, 100 * part.health_percentage); drawing.draw_label(part.body_part_highlighted_UI.flinch_percentage_label, flinch_position_on_screen, opacity_scale, 100 * part.health_percentage);
end end
if part.body_part_highlighted_UI.break_visibility and part.break_max_health ~= -1 and part.break_count < part.break_max_count then if draw_break then
drawing.draw_label(part.body_part_highlighted_UI.break_text_label, break_position_on_screen, opacity_scale); drawing.draw_label(part.body_part_highlighted_UI.break_text_label, break_position_on_screen, opacity_scale);
drawing.draw_label(part.body_part_highlighted_UI.break_value_label, break_position_on_screen, opacity_scale, break_health_string); drawing.draw_label(part.body_part_highlighted_UI.break_value_label, break_position_on_screen, opacity_scale, break_health_string);
drawing.draw_label(part.body_part_highlighted_UI.break_percentage_label, break_position_on_screen, opacity_scale, 100 * part.break_health_percentage); drawing.draw_label(part.body_part_highlighted_UI.break_percentage_label, break_position_on_screen, opacity_scale, 100 * part.break_health_percentage);
end end
if part.body_part_highlighted_UI.loss_visibility and part.loss_max_health ~= -1 and not part.is_severed then if draw_loss then
drawing.draw_label(part.body_part_highlighted_UI.loss_text_label, loss_position_on_screen, opacity_scale); drawing.draw_label(part.body_part_highlighted_UI.loss_text_label, loss_position_on_screen, opacity_scale);
drawing.draw_label(part.body_part_highlighted_UI.loss_value_label, loss_position_on_screen, opacity_scale, loss_health_string); drawing.draw_label(part.body_part_highlighted_UI.loss_value_label, loss_position_on_screen, opacity_scale, loss_health_string);
drawing.draw_label(part.body_part_highlighted_UI.loss_health_percentage_label, loss_position_on_screen, opacity_scale, 100 * part.loss_health_percentage); drawing.draw_label(part.body_part_highlighted_UI.loss_health_percentage_label, loss_position_on_screen, opacity_scale, 100 * part.loss_health_percentage);

View File

@@ -8,6 +8,8 @@ local language;
function damage_UI_entity.new(bar, highlighted_bar, player_name_label, dps_label, hunter_rank_label, value_label, percentage_label) function damage_UI_entity.new(bar, highlighted_bar, player_name_label, dps_label, hunter_rank_label, value_label, percentage_label)
local entity = {}; local entity = {};
local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
--entity.visibility = visibility; --entity.visibility = visibility;
entity.bar = table_helpers.deep_copy(bar); entity.bar = table_helpers.deep_copy(bar);
entity.highlighted_bar = table_helpers.deep_copy(highlighted_bar); entity.highlighted_bar = table_helpers.deep_copy(highlighted_bar);
@@ -17,39 +19,40 @@ function damage_UI_entity.new(bar, highlighted_bar, player_name_label, dps_label
entity.value_label = table_helpers.deep_copy(value_label); entity.value_label = table_helpers.deep_copy(value_label);
entity.percentage_label = table_helpers.deep_copy(percentage_label); entity.percentage_label = table_helpers.deep_copy(percentage_label);
entity.bar.offset.x = entity.bar.offset.x * config.current_config.global_settings.modifiers.global_scale_modifier; entity.bar.offset.x = entity.bar.offset.x * global_scale_modifier;
entity.bar.offset.y = entity.bar.offset.y * config.current_config.global_settings.modifiers.global_scale_modifier; entity.bar.offset.y = entity.bar.offset.y * global_scale_modifier;
entity.bar.size.width = entity.bar.size.width * config.current_config.global_settings.modifiers.global_scale_modifier; entity.bar.size.width = entity.bar.size.width * global_scale_modifier;
entity.bar.size.height = entity.bar.size.height * config.current_config.global_settings.modifiers.global_scale_modifier; entity.bar.size.height = entity.bar.size.height * global_scale_modifier;
entity.highlighted_bar.offset.x = entity.highlighted_bar.offset.x * config.current_config.global_settings.modifiers.global_scale_modifier; entity.highlighted_bar.offset.x = entity.highlighted_bar.offset.x * global_scale_modifier;
entity.highlighted_bar.offset.y = entity.highlighted_bar.offset.y * config.current_config.global_settings.modifiers.global_scale_modifier; entity.highlighted_bar.offset.y = entity.highlighted_bar.offset.y * global_scale_modifier;
entity.highlighted_bar.size.width = entity.highlighted_bar.size.width * config.current_config.global_settings.modifiers.global_scale_modifier; entity.highlighted_bar.size.width = entity.highlighted_bar.size.width * global_scale_modifier;
entity.highlighted_bar.size.height = entity.highlighted_bar.size.height * config.current_config.global_settings.modifiers.global_scale_modifier; entity.highlighted_bar.size.height = entity.highlighted_bar.size.height * global_scale_modifier;
entity.player_name_label.offset.x = entity.player_name_label.offset.x * config.current_config.global_settings.modifiers.global_scale_modifier; entity.player_name_label.offset.x = entity.player_name_label.offset.x * global_scale_modifier;
entity.player_name_label.offset.y = entity.player_name_label.offset.y * config.current_config.global_settings.modifiers.global_scale_modifier; entity.player_name_label.offset.y = entity.player_name_label.offset.y * global_scale_modifier;
entity.dps_label.offset.x = entity.dps_label.offset.x * config.current_config.global_settings.modifiers.global_scale_modifier; entity.dps_label.offset.x = entity.dps_label.offset.x * global_scale_modifier;
entity.dps_label.offset.y = entity.dps_label.offset.y * config.current_config.global_settings.modifiers.global_scale_modifier; entity.dps_label.offset.y = entity.dps_label.offset.y * global_scale_modifier;
entity.hunter_rank_label.offset.x = entity.hunter_rank_label.offset.x * config.current_config.global_settings.modifiers.global_scale_modifier; entity.hunter_rank_label.offset.x = entity.hunter_rank_label.offset.x * global_scale_modifier;
entity.hunter_rank_label.offset.y = entity.hunter_rank_label.offset.y * config.current_config.global_settings.modifiers.global_scale_modifier; entity.hunter_rank_label.offset.y = entity.hunter_rank_label.offset.y * global_scale_modifier;
entity.value_label.offset.x = entity.value_label.offset.x * config.current_config.global_settings.modifiers.global_scale_modifier; entity.value_label.offset.x = entity.value_label.offset.x * global_scale_modifier;
entity.value_label.offset.y = entity.value_label.offset.y * config.current_config.global_settings.modifiers.global_scale_modifier; entity.value_label.offset.y = entity.value_label.offset.y * global_scale_modifier;
entity.percentage_label.offset.x = entity.percentage_label.offset.x * config.current_config.global_settings.modifiers.global_scale_modifier; entity.percentage_label.offset.x = entity.percentage_label.offset.x * global_scale_modifier;
entity.percentage_label.offset.y = entity.percentage_label.offset.y * config.current_config.global_settings.modifiers.global_scale_modifier; entity.percentage_label.offset.y = entity.percentage_label.offset.y * global_scale_modifier;
return entity; return entity;
end end
function damage_UI_entity.draw(_player, position_on_screen, opacity_scale, top_damage, top_dps) function damage_UI_entity.draw(_player, position_on_screen, opacity_scale, top_damage, top_dps)
local cached_config = config.current_config.damage_meter_UI;
local player_include = config.current_config.damage_meter_UI.player_name_label.include.others; local player_include = cached_config.player_name_label.include.others;
if _player.id == player.myself.id then if _player.id == player.myself.id then
player_include = config.current_config.damage_meter_UI.player_name_label.include.myself; player_include = cached_config.player_name_label.include.myself;
end end
local player_name_text = ""; local player_name_text = "";
@@ -76,7 +79,7 @@ function damage_UI_entity.draw(_player, position_on_screen, opacity_scale, top_d
end end
local player_damage_bar_percentage = 0; local player_damage_bar_percentage = 0;
if config.current_config.damage_meter_UI.settings.damage_bar_relative_to == "Total Damage" then if cached_config.settings.damage_bar_relative_to == "Total Damage" then
if player.total.display.total_damage ~= 0 then if player.total.display.total_damage ~= 0 then
player_damage_bar_percentage = _player.display.total_damage / player.total.display.total_damage; player_damage_bar_percentage = _player.display.total_damage / player.total.display.total_damage;
end end
@@ -86,11 +89,11 @@ function damage_UI_entity.draw(_player, position_on_screen, opacity_scale, top_d
end end
end end
if _player.id == player.myself.id and config.current_config.damage_meter_UI.settings.highlighted_bar == "Me" then if _player.id == player.myself.id and cached_config.settings.highlighted_bar == "Me" then
drawing.draw_bar(_player.damage_UI.highlighted_bar, position_on_screen, opacity_scale, player_damage_bar_percentage); drawing.draw_bar(_player.damage_UI.highlighted_bar, position_on_screen, opacity_scale, player_damage_bar_percentage);
elseif config.current_config.damage_meter_UI.settings.highlighted_bar == "Top Damage" and _player.display.total_damage == top_damage then elseif cached_config.settings.highlighted_bar == "Top Damage" and _player.display.total_damage == top_damage then
drawing.draw_bar(_player.damage_UI.highlighted_bar, position_on_screen, opacity_scale, player_damage_bar_percentage); drawing.draw_bar(_player.damage_UI.highlighted_bar, position_on_screen, opacity_scale, player_damage_bar_percentage);
elseif config.current_config.damage_meter_UI.settings.highlighted_bar == "Top DPS" and _player.dps == top_dps then elseif cached_config.settings.highlighted_bar == "Top DPS" and _player.dps == top_dps then
drawing.draw_bar(_player.damage_UI.highlighted_bar, position_on_screen, opacity_scale, player_damage_bar_percentage); drawing.draw_bar(_player.damage_UI.highlighted_bar, position_on_screen, opacity_scale, player_damage_bar_percentage);
else else
drawing.draw_bar(_player.damage_UI.bar, position_on_screen, opacity_scale, player_damage_bar_percentage); drawing.draw_bar(_player.damage_UI.bar, position_on_screen, opacity_scale, player_damage_bar_percentage);

View File

@@ -7,25 +7,27 @@ local config;
function health_UI_entity.new(visibility, bar, text_label, value_label, percentage_label) function health_UI_entity.new(visibility, bar, text_label, value_label, percentage_label)
local entity = {}; local entity = {};
local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
entity.visibility = visibility; entity.visibility = visibility;
entity.bar = table_helpers.deep_copy(bar); entity.bar = table_helpers.deep_copy(bar);
entity.text_label = table_helpers.deep_copy(text_label); entity.text_label = table_helpers.deep_copy(text_label);
entity.value_label = table_helpers.deep_copy(value_label); entity.value_label = table_helpers.deep_copy(value_label);
entity.percentage_label = table_helpers.deep_copy(percentage_label); entity.percentage_label = table_helpers.deep_copy(percentage_label);
entity.bar.offset.x = entity.bar.offset.x * config.current_config.global_settings.modifiers.global_scale_modifier; entity.bar.offset.x = entity.bar.offset.x * global_scale_modifier;
entity.bar.offset.y = entity.bar.offset.y * config.current_config.global_settings.modifiers.global_scale_modifier; entity.bar.offset.y = entity.bar.offset.y * global_scale_modifier;
entity.bar.size.width = entity.bar.size.width * config.current_config.global_settings.modifiers.global_scale_modifier; entity.bar.size.width = entity.bar.size.width * global_scale_modifier;
entity.bar.size.height = entity.bar.size.height * config.current_config.global_settings.modifiers.global_scale_modifier; entity.bar.size.height = entity.bar.size.height * global_scale_modifier;
entity.text_label.offset.x = entity.text_label.offset.x * config.current_config.global_settings.modifiers.global_scale_modifier; entity.text_label.offset.x = entity.text_label.offset.x * global_scale_modifier;
entity.text_label.offset.y = entity.text_label.offset.y * config.current_config.global_settings.modifiers.global_scale_modifier; entity.text_label.offset.y = entity.text_label.offset.y * global_scale_modifier;
entity.value_label.offset.x = entity.value_label.offset.x * config.current_config.global_settings.modifiers.global_scale_modifier; entity.value_label.offset.x = entity.value_label.offset.x * global_scale_modifier;
entity.value_label.offset.y = entity.value_label.offset.y * config.current_config.global_settings.modifiers.global_scale_modifier; entity.value_label.offset.y = entity.value_label.offset.y * global_scale_modifier;
entity.percentage_label.offset.x = entity.percentage_label.offset.x * config.current_config.global_settings.modifiers.global_scale_modifier; entity.percentage_label.offset.x = entity.percentage_label.offset.x * global_scale_modifier;
entity.percentage_label.offset.y = entity.percentage_label.offset.y * config.current_config.global_settings.modifiers.global_scale_modifier; entity.percentage_label.offset.y = entity.percentage_label.offset.y * global_scale_modifier;
return entity; return entity;
end end

View File

@@ -7,6 +7,8 @@ local config;
function rage_UI_entity.new(visibility, bar, text_label, value_label, percentage_label, timer_label) function rage_UI_entity.new(visibility, bar, text_label, value_label, percentage_label, timer_label)
local entity = {}; local entity = {};
local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
entity.visibility = visibility; entity.visibility = visibility;
entity.bar = table_helpers.deep_copy(bar); entity.bar = table_helpers.deep_copy(bar);
entity.text_label = table_helpers.deep_copy(text_label); entity.text_label = table_helpers.deep_copy(text_label);
@@ -14,22 +16,22 @@ function rage_UI_entity.new(visibility, bar, text_label, value_label, percentage
entity.percentage_label = table_helpers.deep_copy(percentage_label); entity.percentage_label = table_helpers.deep_copy(percentage_label);
entity.timer_label = table_helpers.deep_copy(timer_label); entity.timer_label = table_helpers.deep_copy(timer_label);
entity.bar.offset.x = entity.bar.offset.x * config.current_config.global_settings.modifiers.global_scale_modifier; entity.bar.offset.x = entity.bar.offset.x * global_scale_modifier;
entity.bar.offset.y = entity.bar.offset.y * config.current_config.global_settings.modifiers.global_scale_modifier; entity.bar.offset.y = entity.bar.offset.y * global_scale_modifier;
entity.bar.size.width = entity.bar.size.width * config.current_config.global_settings.modifiers.global_scale_modifier; entity.bar.size.width = entity.bar.size.width * global_scale_modifier;
entity.bar.size.height = entity.bar.size.height * config.current_config.global_settings.modifiers.global_scale_modifier; entity.bar.size.height = entity.bar.size.height * global_scale_modifier;
entity.text_label.offset.x = entity.text_label.offset.x * config.current_config.global_settings.modifiers.global_scale_modifier; entity.text_label.offset.x = entity.text_label.offset.x * global_scale_modifier;
entity.text_label.offset.y = entity.text_label.offset.y * config.current_config.global_settings.modifiers.global_scale_modifier; entity.text_label.offset.y = entity.text_label.offset.y * global_scale_modifier;
entity.value_label.offset.x = entity.value_label.offset.x * config.current_config.global_settings.modifiers.global_scale_modifier; entity.value_label.offset.x = entity.value_label.offset.x * global_scale_modifier;
entity.value_label.offset.y = entity.value_label.offset.y * config.current_config.global_settings.modifiers.global_scale_modifier; entity.value_label.offset.y = entity.value_label.offset.y * global_scale_modifier;
entity.percentage_label.offset.x = entity.percentage_label.offset.x * config.current_config.global_settings.modifiers.global_scale_modifier; entity.percentage_label.offset.x = entity.percentage_label.offset.x * global_scale_modifier;
entity.percentage_label.offset.y = entity.percentage_label.offset.y * config.current_config.global_settings.modifiers.global_scale_modifier; entity.percentage_label.offset.y = entity.percentage_label.offset.y * global_scale_modifier;
entity.timer_label.offset.x = entity.timer_label.offset.x * config.current_config.global_settings.modifiers.global_scale_modifier; entity.timer_label.offset.x = entity.timer_label.offset.x * global_scale_modifier;
entity.timer_label.offset.y = entity.timer_label.offset.y * config.current_config.global_settings.modifiers.global_scale_modifier; entity.timer_label.offset.y = entity.timer_label.offset.y * global_scale_modifier;
return entity; return entity;
end end

View File

@@ -7,25 +7,27 @@ local config;
function stamina_UI_entity.new(visibility, bar, text_label, value_label, percentage_label) function stamina_UI_entity.new(visibility, bar, text_label, value_label, percentage_label)
local entity = {}; local entity = {};
local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
entity.visibility = visibility; entity.visibility = visibility;
entity.bar = table_helpers.deep_copy(bar); entity.bar = table_helpers.deep_copy(bar);
entity.text_label = table_helpers.deep_copy(text_label); entity.text_label = table_helpers.deep_copy(text_label);
entity.value_label = table_helpers.deep_copy(value_label); entity.value_label = table_helpers.deep_copy(value_label);
entity.percentage_label = table_helpers.deep_copy(percentage_label); entity.percentage_label = table_helpers.deep_copy(percentage_label);
entity.bar.offset.x = entity.bar.offset.x * config.current_config.global_settings.modifiers.global_scale_modifier; entity.bar.offset.x = entity.bar.offset.x * global_scale_modifier;
entity.bar.offset.y = entity.bar.offset.y * config.current_config.global_settings.modifiers.global_scale_modifier; entity.bar.offset.y = entity.bar.offset.y * global_scale_modifier;
entity.bar.size.width = entity.bar.size.width * config.current_config.global_settings.modifiers.global_scale_modifier; entity.bar.size.width = entity.bar.size.width * global_scale_modifier;
entity.bar.size.height = entity.bar.size.height * config.current_config.global_settings.modifiers.global_scale_modifier; entity.bar.size.height = entity.bar.size.height * global_scale_modifier;
entity.text_label.offset.x = entity.text_label.offset.x * config.current_config.global_settings.modifiers.global_scale_modifier; entity.text_label.offset.x = entity.text_label.offset.x * global_scale_modifier;
entity.text_label.offset.y = entity.text_label.offset.y * config.current_config.global_settings.modifiers.global_scale_modifier; entity.text_label.offset.y = entity.text_label.offset.y * global_scale_modifier;
entity.value_label.offset.x = entity.value_label.offset.x * config.current_config.global_settings.modifiers.global_scale_modifier; entity.value_label.offset.x = entity.value_label.offset.x * global_scale_modifier;
entity.value_label.offset.y = entity.value_label.offset.y * config.current_config.global_settings.modifiers.global_scale_modifier; entity.value_label.offset.y = entity.value_label.offset.y * global_scale_modifier;
entity.percentage_label.offset.x = entity.percentage_label.offset.x * config.current_config.global_settings.modifiers.global_scale_modifier; entity.percentage_label.offset.x = entity.percentage_label.offset.x * global_scale_modifier;
entity.percentage_label.offset.y = entity.percentage_label.offset.y * config.current_config.global_settings.modifiers.global_scale_modifier; entity.percentage_label.offset.y = entity.percentage_label.offset.y * global_scale_modifier;
return entity; return entity;
end end

File diff suppressed because it is too large Load Diff

View File

@@ -4,7 +4,8 @@ local config;
drawing.font = nil; drawing.font = nil;
function drawing.init_font() function drawing.init_font()
drawing.font = d2d.Font.new(config.current_config.global_settings.UI_font.family, config.current_config.global_settings.UI_font.size, config.current_config.global_settings.UI_font.bold, config.current_config.global_settings.UI_font.italic); local cached_config = config.current_config.global_settings.UI_font;
drawing.font = d2d.Font.new(cached_config.family, cached_config.size, cached_config.bold, cached_config.italic);
end end
function drawing.argb_color_to_abgr_color(argb_color) function drawing.argb_color_to_abgr_color(argb_color)