Refactoring

This commit is contained in:
GreenComfyTea
2022-07-26 19:27:37 +03:00
parent a20c458629
commit 2f9a8ac6a3
41 changed files with 5939 additions and 18587 deletions

View File

@@ -44,6 +44,9 @@ local ailment_UI_entity = require("MHR_Overlay.UI.UI_Entities.ailment_UI_entity"
local ailment_buildup_UI_entity = require("MHR_Overlay.UI.UI_Entities.ailment_buildup_UI_entity");
local customization_menu = require("MHR_Overlay.UI.customization_menu");
local label_customization = require("MHR_Overlay.UI.Customizations.label_customization");
local bar_customization = require("MHR_Overlay.UI.Customizations.bar_customization");
local line_customization = require("MHR_Overlay.UI.Customizations.line_customization");
local drawing = require("MHR_Overlay.UI.drawing");
------------------------INIT MODULES-------------------------
@@ -82,9 +85,12 @@ ailment_hook.init_module();
ailment_buildup.init_module();
customization_menu.init_module();
label_customization.init_module();
bar_customization.init_module();
line_customization.init_module();
drawing.init_module();
damage_meter_UI.init_module();
drawing.init_module();
large_monster_UI.init_module();
small_monster_UI.init_module();
time_UI.init_module();
@@ -102,97 +108,25 @@ log.info("[MHR Overlay] loaded");
-- #region
local function main_loop()
customization_menu.status = "OK";
singletons.init();
screen.update_window_size();
player.update_myself_position();
quest_status.update_is_online();
quest_status.update_is_result_screen();
quest_status.update_is_host();
time.tick();
player.update_player_list(quest_status.index >= 2);
if quest_status.index < 2 then
quest_status.update_is_training_area();
if quest_status.is_training_area then
local dynamic_enabled = config.current_config.large_monster_UI.dynamic.enabled and config.current_config.global_settings.module_visibility.training_area.large_monster_dynamic_UI;
local static_enabled = config.current_config.large_monster_UI.static.enabled and config.current_config.global_settings.module_visibility.training_area.large_monster_static_UI;
local highlighted_enabled = config.current_config.large_monster_UI.highlighted.enabled and config.current_config.global_settings.module_visibility.training_area.large_monster_highlighted_UI;
if dynamic_enabled or static_enabled or highlighted_enabled then
local success = pcall(large_monster_UI.draw, dynamic_enabled, static_enabled, highlighted_enabled);
if not success then
customization_menu.status = "Large monster drawing function threw an exception";
end
end
if config.current_config.damage_meter_UI.enabled and config.current_config.global_settings.module_visibility.training_area.damage_meter_UI then
local success = pcall(damage_meter_UI.draw);
if not success then
customization_menu.status = "Damage meter drawing function threw an exception";
end
end
if config.current_config.endemic_life_UI.enabled and config.current_config.global_settings.module_visibility.training_area.endemic_life_UI then
local success = pcall(env_creature_UI.draw);
if not success then
customization_menu.status = "Endemic life drawing function threw an exception";
end
end
end
elseif quest_status.is_result_screen then
if config.current_config.small_monster_UI.enabled and config.current_config.global_settings.module_visibility.quest_result_screen.small_monster_UI then
local success = pcall(small_monster_UI.draw);
if not success then
customization_menu.status = "Small monster drawing function threw an exception";
end
end
local dynamic_enabled = config.current_config.large_monster_UI.dynamic.enabled and config.current_config.global_settings.module_visibility.quest_result_screen.large_monster_dynamic_UI;
local static_enabled = config.current_config.large_monster_UI.static.enabled and config.current_config.global_settings.module_visibility.quest_result_screen.large_monster_static_UI;
local highlighted_enabled = config.current_config.large_monster_UI.highlighted.enabled and config.current_config.global_settings.module_visibility.quest_result_screen.large_monster_highlighted_UI;
if dynamic_enabled or static_enabled or highlighted_enabled then
local success = pcall(large_monster_UI.draw, dynamic_enabled, static_enabled, highlighted_enabled);
if not success then
customization_menu.status = "Large monster drawing function threw an exception";
end
end
if config.current_config.time_UI.enabled and config.current_config.global_settings.module_visibility.quest_result_screen.time_UI then
local success = pcall(time_UI.draw);
if not success then
customization_menu.status = "Time drawing function threw an exception";
end
end
if config.current_config.damage_meter_UI.enabled and config.current_config.global_settings.module_visibility.quest_result_screen.damage_meter_UI then
local success = pcall(damage_meter_UI.draw);
if not success then
customization_menu.status = "Damage meter drawing function threw an exception";
end
end
if config.current_config.endemic_life_UI.enabled and config.current_config.global_settings.module_visibility.quest_result_screen.endemic_life_UI then
local success = pcall(env_creature_UI.draw);
if not success then
customization_menu.status = "Endemic life drawing function threw an exception";
end
end
elseif quest_status.index == 2 then
if config.current_config.small_monster_UI.enabled and config.current_config.global_settings.module_visibility.during_quest.small_monster_UI then
local success = pcall(small_monster_UI.draw);
if not success then
customization_menu.status = "Small monster drawing function threw an exception";
end
end
local dynamic_enabled = config.current_config.large_monster_UI.dynamic.enabled and config.current_config.global_settings.module_visibility.during_quest.large_monster_dynamic_UI;
local static_enabled = config.current_config.large_monster_UI.static.enabled and config.current_config.global_settings.module_visibility.during_quest.large_monster_static_UI;
local highlighted_enabled = config.current_config.large_monster_UI.highlighted.enabled and config.current_config.global_settings.module_visibility.during_quest.large_monster_highlighted_UI;
singletons.init();
screen.update_window_size();
player.update_myself_position();
quest_status.update_is_online();
quest_status.update_is_result_screen();
quest_status.update_is_host();
time.tick();
player.update_player_list(quest_status.index >= 2);
if quest_status.index < 2 then
quest_status.update_is_training_area();
if quest_status.is_training_area then
local dynamic_enabled = config.current_config.large_monster_UI.dynamic.enabled and
config.current_config.global_settings.module_visibility.training_area.large_monster_dynamic_UI;
local static_enabled = config.current_config.large_monster_UI.static.enabled and
config.current_config.global_settings.module_visibility.training_area.large_monster_static_UI;
local highlighted_enabled = config.current_config.large_monster_UI.highlighted.enabled and
config.current_config.global_settings.module_visibility.training_area.large_monster_highlighted_UI;
if dynamic_enabled or static_enabled or highlighted_enabled then
local success = pcall(large_monster_UI.draw, dynamic_enabled, static_enabled, highlighted_enabled);
@@ -201,67 +135,158 @@ local function main_loop()
end
end
if config.current_config.time_UI.enabled and config.current_config.global_settings.module_visibility.during_quest.time_UI then
local success = pcall(time_UI.draw);
if not success then
customization_menu.status = "Time drawing function threw an exception";
end
end
if config.current_config.damage_meter_UI.enabled and config.current_config.global_settings.module_visibility.during_quest.damage_meter_UI then
if config.current_config.damage_meter_UI.enabled and
config.current_config.global_settings.module_visibility.training_area.damage_meter_UI then
local success = pcall(damage_meter_UI.draw);
if not success then
customization_menu.status = "Damage meter drawing function threw an exception";
end
end
if config.current_config.endemic_life_UI.enabled and config.current_config.global_settings.module_visibility.during_quest.endemic_life_UI then
if config.current_config.endemic_life_UI.enabled and
config.current_config.global_settings.module_visibility.training_area.endemic_life_UI then
local success = pcall(env_creature_UI.draw);
if not success then
customization_menu.status = "Endemic life drawing function threw an exception";
end
end
end
elseif quest_status.is_result_screen then
if config.current_config.small_monster_UI.enabled and
config.current_config.global_settings.module_visibility.quest_result_screen.small_monster_UI then
local success = pcall(small_monster_UI.draw);
if not success then
customization_menu.status = "Small monster drawing function threw an exception";
end
end
--snow.player.PlayerManager ->
-- <PlayerData>k_BackingField -> [0]
local dynamic_enabled = config.current_config.large_monster_UI.dynamic.enabled and
config.current_config.global_settings.module_visibility.quest_result_screen.large_monster_dynamic_UI;
local static_enabled = config.current_config.large_monster_UI.static.enabled and
config.current_config.global_settings.module_visibility.quest_result_screen.large_monster_static_UI;
local highlighted_enabled = config.current_config.large_monster_UI.highlighted.enabled and
config.current_config.global_settings.module_visibility.quest_result_screen.large_monster_highlighted_UI;
--Demondrug _AtkUpAlive = 5 1
--Mega Demondrug _AtkUpAlive = 7 1
--Armorskin _DefUpAlive = 15 1
--Mega Armorskin _DefUpAlive = 25 1
--Might Seed _AtkUpBuffSecond and _AtkUpBuffSecondTimer 1
--Demon Powder _AtkUpItemSecond and _AtkUpItemSecondTimer 1
--Adamant Seed _DefUpBuffSecond and _DefUpBuffSecondTimer 1
--Hardshell Powder _DefUpItemSecond and _DefUpItemSecondTimer 1
--Dash Juice _StaminaUpBuffSecondTimer 1
--Immunizer _VitalizerTimer 1
if dynamic_enabled or static_enabled or highlighted_enabled then
local success = pcall(large_monster_UI.draw, dynamic_enabled, static_enabled, highlighted_enabled);
if not success then
customization_menu.status = "Large monster drawing function threw an exception";
end
end
-- Attack Up
-- Defense Up
-- Affinity Up _AtkUpEcSecond and _AtkUpEcSecondTimer
-- Sharpness Loss Reduced
-- Elemental Attack Boost
-- Divine Protection
-- Health Regeneration
-- Natural Healing Up
-- Blight Negated
-- Immunity
-- Stamina Recovery Up
-- Stamina Use Reduced
-- Knockbacks Negated _DefUpEcSecond and _DefUpEcSecondTimer
-- Sonic Barrier
-- Earplugs (S)
-- Earplugs (L)
-- Tremor Negated
-- Enviroment Damage Negated
-- Stun Negated
-- Wind Pressure Negated
-- Gourmet Fish Effect
-- Self Improvement
-- Infernal Melody
if config.current_config.time_UI.enabled and
config.current_config.global_settings.module_visibility.quest_result_screen.time_UI then
local success = pcall(time_UI.draw);
if not success then
customization_menu.status = "Time drawing function threw an exception";
end
end
--[[
if config.current_config.damage_meter_UI.enabled and
config.current_config.global_settings.module_visibility.quest_result_screen.damage_meter_UI then
local success = pcall(damage_meter_UI.draw);
if not success then
customization_menu.status = "Damage meter drawing function threw an exception";
end
end
if config.current_config.endemic_life_UI.enabled and
config.current_config.global_settings.module_visibility.quest_result_screen.endemic_life_UI then
local success = pcall(env_creature_UI.draw);
if not success then
customization_menu.status = "Endemic life drawing function threw an exception";
end
end
elseif quest_status.index == 2 then
if config.current_config.small_monster_UI.enabled and
config.current_config.global_settings.module_visibility.during_quest.small_monster_UI then
local success = pcall(small_monster_UI.draw);
if not success then
customization_menu.status = "Small monster drawing function threw an exception";
end
end
local dynamic_enabled = config.current_config.large_monster_UI.dynamic.enabled and
config.current_config.global_settings.module_visibility.during_quest.large_monster_dynamic_UI;
local static_enabled = config.current_config.large_monster_UI.static.enabled and
config.current_config.global_settings.module_visibility.during_quest.large_monster_static_UI;
local highlighted_enabled = config.current_config.large_monster_UI.highlighted.enabled and
config.current_config.global_settings.module_visibility.during_quest.large_monster_highlighted_UI;
if dynamic_enabled or static_enabled or highlighted_enabled then
local success = pcall(large_monster_UI.draw, dynamic_enabled, static_enabled, highlighted_enabled);
if not success then
customization_menu.status = "Large monster drawing function threw an exception";
end
end
if config.current_config.time_UI.enabled and
config.current_config.global_settings.module_visibility.during_quest.time_UI then
local success = pcall(time_UI.draw);
if not success then
customization_menu.status = "Time drawing function threw an exception";
end
end
if config.current_config.damage_meter_UI.enabled and
config.current_config.global_settings.module_visibility.during_quest.damage_meter_UI then
local success = pcall(damage_meter_UI.draw);
if not success then
customization_menu.status = "Damage meter drawing function threw an exception";
end
end
if config.current_config.endemic_life_UI.enabled and
config.current_config.global_settings.module_visibility.during_quest.endemic_life_UI then
local success = pcall(env_creature_UI.draw);
if not success then
customization_menu.status = "Endemic life drawing function threw an exception";
end
end
end
--snow.player.PlayerManager ->
-- <PlayerData>k_BackingField -> [0]
--Demondrug _AtkUpAlive = 5 1
--Mega Demondrug _AtkUpAlive = 7 1
--Armorskin _DefUpAlive = 15 1
--Mega Armorskin _DefUpAlive = 25 1
--Might Seed _AtkUpBuffSecond and _AtkUpBuffSecondTimer 1
--Demon Powder _AtkUpItemSecond and _AtkUpItemSecondTimer 1
--Adamant Seed _DefUpBuffSecond and _DefUpBuffSecondTimer 1
--Hardshell Powder _DefUpItemSecond and _DefUpItemSecondTimer 1
--Dash Juice _StaminaUpBuffSecondTimer 1
--Immunizer _VitalizerTimer 1
-- Attack Up
-- Defense Up
-- Affinity Up _AtkUpEcSecond and _AtkUpEcSecondTimer
-- Sharpness Loss Reduced
-- Elemental Attack Boost
-- Divine Protection
-- Health Regeneration
-- Natural Healing Up
-- Blight Negated
-- Immunity
-- Stamina Recovery Up
-- Stamina Use Reduced
-- Knockbacks Negated _DefUpEcSecond and _DefUpEcSecondTimer
-- Sonic Barrier
-- Earplugs (S)
-- Earplugs (L)
-- Tremor Negated
-- Enviroment Damage Negated
-- Stun Negated
-- Wind Pressure Negated
-- Gourmet Fish Effect
-- Self Improvement
-- Infernal Melody
--[[
local player_data_array = singletons.player_manager:get_field("<PlayerData>k__BackingField");
local player_data = player_data_array:get_element(0);
@@ -438,6 +463,7 @@ local function main_loop()
xy = xy .. "\n_WyvernBlastReloadTimer: " .. tostring(_WyvernBlastReloadTimer);
--]]
end
-- #endregion
----------------------------LOOP-----------------------------
@@ -494,4 +520,4 @@ if debug.enabled then
end
end);
end
end
end

View File

@@ -12,7 +12,7 @@ local enemy_character_base_after_calc_damage_damage_side_method = enemy_characte
local is_boss_enemy_method = enemy_character_base_type_def:get_method("get_isBossEnemy");
local check_die_method = enemy_character_base_type_def:get_method("checkDie");
local enemy_calc_damage_info_type_def = sdk.find_type_definition("snow.hit.EnemyCalcDamageInfo.AfterCalcInfo_DamageSide");
local enemy_calc_damage_info_type_def = sdk.find_type_definition("snow.hit.EnemyCalcDamageInfo.AfterCalcInfo_DamageSide");
local get_attacker_id_method = enemy_calc_damage_info_type_def:get_method("get_AttackerID");
local get_damage_attacker_type_method = enemy_calc_damage_info_type_def:get_method("get_DamageAttackerType");
local is_marionette_attack_method = enemy_calc_damage_info_type_def:get_method("get_IsMarionetteAttack");
@@ -28,7 +28,7 @@ local get_condition_type2_method = enemy_calc_damage_info_type_def:get_method("g
local get_condition_damage3_method = enemy_calc_damage_info_type_def:get_method("get_ConditionDamage3");
local get_condition_type3_method = enemy_calc_damage_info_type_def:get_method("get_ConditionDamageType3");
local stock_mystery_core_break_damage_type_def = sdk.find_type_definition("snow.enemy.EnemyCharacterBase.stockMysteryCoreBreakDamage");
local stock_mystery_core_break_damage_type_def = sdk.find_type_definition("snow.enemy.EnemyCharacterBase.stockMysteryCoreBreakDamage");
local quest_manager_type_def = sdk.find_type_definition("snow.QuestManager");
@@ -43,7 +43,8 @@ local is_from_host_field = packet_quest_forfeit_type_def:get_field("_IsFromQuest
function damage_hook.get_damage_source_type(damage_source_type_id, is_marionette_attack)
if is_marionette_attack then
return "wyvern riding";
elseif damage_source_type_id == 0 or damage_source_type_id == 7 or damage_source_type_id == 11 or damage_source_type_id == 13 then
elseif damage_source_type_id == 0 or damage_source_type_id == 7 or damage_source_type_id == 11 or
damage_source_type_id == 13 then
return "player";
elseif damage_source_type_id == 1 or damage_source_type_id == 8 then
return "bomb";
@@ -82,7 +83,7 @@ function damage_hook.update_damage(enemy, enemy_calc_damage_info)
local attacker_id = get_attacker_id_method:call(enemy_calc_damage_info);
local attacker_type = get_damage_attacker_type_method:call(enemy_calc_damage_info);
local is_marionette_attack = is_marionette_attack_method:call(enemy_calc_damage_info)
-- 4 is virtual player in singleplayer that "owns" 2nd otomo
if not quest_status.is_online and attacker_id == 4 then
attacker_id = player.myself.player_id;
@@ -93,7 +94,7 @@ function damage_hook.update_damage(enemy, enemy_calc_damage_info)
for enemy, monster in pairs(large_monster.list) do
if monster.unique_id == attacker_id then
attacker_id = monster.rider_id;
break;
break
end
end
end
@@ -161,7 +162,8 @@ function damage_hook.update_damage(enemy, enemy_calc_damage_info)
-- xy = "";
--end
local damage_source_type = damage_hook.get_damage_source_type(attacker_type, is_marionette_attack);
local damage_source_type = damage_hook.get_damage_source_type(attacker_type,
is_marionette_attack);
local attacking_player = player.get_player(attacker_id);
@@ -217,10 +219,10 @@ end
--function damage_hook.on_get_finish_shoot_wall_hit_damage_rate(enemy, rate, is_part_damage)
--xy = string.format("enemy: %s\nrate: %s\nis_part_damage: %s", tostring(enemy), tostring(rate), tostring(is_part_damage));
--xy = string.format("enemy: %s\nrate: %s\nis_part_damage: %s", tostring(enemy), tostring(rate), tostring(is_part_damage));
--end
local get_finish_shoot_wall_hit_damage_rate_method = enemy_character_base_type_def:get_method("stockFinishShootHitDamage");
function damage_hook.init_module()
@@ -268,4 +270,4 @@ function damage_hook.init_module()
--end);
end
return damage_hook;
return damage_hook;

View File

@@ -226,19 +226,19 @@ function player.update_display(_player)
if cached_config.tracked_damage_types.player_damage then
player.merge_damage(_player.display, _player.small_monsters);
end
if cached_config.tracked_damage_types.bomb_damage then
player.merge_damage(_player.display, _player.small_monsters.bombs);
end
if cached_config.tracked_damage_types.kunai_damage then
player.merge_damage(_player.display, _player.small_monsters.kunai);
end
if cached_config.tracked_damage_types.installation_damage then
player.merge_damage(_player.display, _player.small_monsters.installations);
end
if cached_config.tracked_damage_types.otomo_damage then
player.merge_damage(_player.display, _player.small_monsters.otomo);
end
@@ -268,19 +268,19 @@ function player.update_display(_player)
if cached_config.tracked_damage_types.player_damage then
player.merge_damage(_player.display, _player.large_monsters);
end
if cached_config.tracked_damage_types.bomb_damage then
player.merge_damage(_player.display, _player.large_monsters.bombs);
end
if cached_config.tracked_damage_types.kunai_damage then
player.merge_damage(_player.display, _player.large_monsters.kunai);
end
if cached_config.tracked_damage_types.installation_damage then
player.merge_damage(_player.display, _player.large_monsters.installations);
end
if cached_config.tracked_damage_types.otomo_damage then
player.merge_damage(_player.display, _player.large_monsters.otomo);
end
@@ -324,7 +324,7 @@ local get_transform_method = sdk.find_type_definition("via.GameObject"):get_meth
local get_position_method = sdk.find_type_definition("via.Transform"):get_method("get_Position");
function player.update_myself_position()
if singletons.player_manager == nil then
if singletons.player_manager == nil then
customization_menu.status = "No player manager";
return;
end
@@ -340,7 +340,7 @@ function player.update_myself_position()
customization_menu.status = "No master player game object";
return;
end
local master_player_transform = get_transform_method:call(master_player_game_object);
if not master_player_transform then
customization_menu.status = "No master player transform";
@@ -401,7 +401,7 @@ function player.update_player_list_(hunter_info_field_)
if singletons.lobby_manager == nil then
return;
end
if singletons.progress_manager == nil then
return;
end
@@ -424,9 +424,9 @@ function player.update_player_list_(hunter_info_field_)
local myself_id = get_master_player_id_method:call(singletons.player_manager) or -1;
--if quest_status.is_online then
--myself_id = get_master_player_id_method:call(singletons.player_manager) or -1;
--myself_id = get_master_player_id_method:call(singletons.player_manager) or -1;
--else
--myself_id = myself_quest_index_field:call(singletons.lobby_manager) or -1;
--myself_id = myself_quest_index_field:call(singletons.lobby_manager) or -1;
--end
if myself_id == nil then
@@ -447,11 +447,12 @@ function player.update_player_list_(hunter_info_field_)
--end
if myself_id ~= player.myself.id then
player.list[player.myself.id] = nil;
player.myself = player.new(myself_id, myself_guid, myself_player_name, myself_master_rank, myself_hunter_rank);
player.list[myself_id] = player.myself;
player.list[player.myself.id] = nil;
player.myself = player.new(myself_id, myself_guid, myself_player_name, myself_master_rank,
myself_hunter_rank);
player.list[myself_id] = player.myself;
end
-- other players
local player_info_list = hunter_info_field_:get_data(singletons.lobby_manager);
if player_info_list == nil then
@@ -468,13 +469,13 @@ function player.update_player_list_(hunter_info_field_)
for i = 0, count - 1 do
local player_info = get_item_method:call(player_info_list, i);
if player_info == nil then
goto continue;
goto continue
end
local player_id = member_index_field:get_data(player_info);
if player_id == nil then
goto continue;
goto continue
end
local player_guid = hunter_unique_id_field:get_data(player_info);
@@ -494,17 +495,18 @@ function player.update_player_list_(hunter_info_field_)
local player_name = name_field:get_data(player_info);
if player_name == nil then
goto continue;
goto continue
end
if player.list[player_id] == nil or
not guid_equals_method:call(player.list[player_id].guid, player_guid)
not guid_equals_method:call(player.list[player_id].guid, player_guid)
--player.list[player_id].guid ~= player_guid
then
local _player = player.new(player_id, player_guid, player_name, player_master_rank, player_hunter_rank);
player.list[player_id] = _player;
if player_name == player.myself.name and player_hunter_rank == player.myself.hunter_rank and player_master_rank == player.myself.master_rank then
if player_name == player.myself.name and player_hunter_rank == player.myself.hunter_rank and
player_master_rank == player.myself.master_rank then
player.myself = _player;
end
end
@@ -541,8 +543,10 @@ function player.init_total_UI(_player)
_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 * 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 * 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 *
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 * global_scale_modifier;
@@ -553,8 +557,10 @@ function player.draw(_player, position_on_screen, opacity_scale, top_damage, top
end
function player.draw_total(position_on_screen, opacity_scale)
drawing.draw_label(player.total.damage_UI.total_damage_label, position_on_screen, opacity_scale, language.current_language.UI.total_damage);
drawing.draw_label(player.total.damage_UI.total_damage_value_label, position_on_screen, opacity_scale, player.total.display.total_damage);
drawing.draw_label(player.total.damage_UI.total_damage_label, position_on_screen, opacity_scale,
language.current_language.UI.total_damage);
drawing.draw_label(player.total.damage_UI.total_damage_value_label, position_on_screen, opacity_scale,
player.total.display.total_damage);
drawing.draw_label(player.total.damage_UI.total_dps_label, position_on_screen, opacity_scale, player.total.dps);
end
@@ -572,4 +578,4 @@ function player.init_module()
player.init();
end
return player;
return player;

View File

@@ -51,7 +51,8 @@ function env_creature.init(creature, REcreature)
return;
end
local creature_name = get_env_creature_name_message_method:call(singletons.message_manager, creature_type);
local creature_name = get_env_creature_name_message_method:call(singletons.message_manager,
creature_type);
if creature_name ~= nil then
creature.name = creature_name;
end
@@ -74,7 +75,7 @@ function env_creature.update_position(REcreature, creature)
if creature == nil then
creature = env_creature.get_creature(REcreature);
end
local position = get_pos_method:call(REcreature);
if position ~= nil then
creature.position = position;
@@ -122,4 +123,4 @@ function env_creature.init_module()
--ailment_UI_entity = require("MHR_Overlay.UI.UI_Entities.ailment_UI_entity");
end
return env_creature;
return env_creature;

View File

@@ -24,4 +24,4 @@ function env_creature_hook.init_module()
end);
end
return env_creature_hook;
return env_creature_hook;

View File

@@ -335,7 +335,7 @@ function keyboard.check_modifiers(hard_keyboard)
if is_ctrl_down ~= nil then
keyboard.hotkey_modifiers_down.ctrl = is_ctrl_down;
end
local is_shift_down = get_down_method:call(hard_keyboard, 16);
if is_shift_down ~= nil then
keyboard.hotkey_modifiers_down.shift = is_shift_down;
@@ -458,16 +458,16 @@ function keyboard.check_hotkeys(hard_keyboard)
local cached_config = config.current_config.global_settings.hotkeys_with_modifiers;
if not (cached_config.all_UI.ctrl and not keyboard.hotkey_modifiers_down.ctrl)
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
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
or config.current_config.small_monster_UI.enabled
or config.current_config.large_monster_UI.dynamic.enabled
or config.current_config.large_monster_UI.static.enabled
or config.current_config.large_monster_UI.highlighted.enabled
or config.current_config.damage_meter_UI.enabled;
or config.current_config.small_monster_UI.enabled
or config.current_config.large_monster_UI.dynamic.enabled
or config.current_config.large_monster_UI.static.enabled
or config.current_config.large_monster_UI.highlighted.enabled
or config.current_config.damage_meter_UI.enabled;
config.current_config.time_UI.enabled = not is_any_enabled;
config.current_config.small_monster_UI.enabled = not is_any_enabled;
@@ -479,16 +479,16 @@ function keyboard.check_hotkeys(hard_keyboard)
end
if not (cached_config.small_monster_UI.ctrl and not keyboard.hotkey_modifiers_down.ctrl)
and not (cached_config.small_monster_UI.shift and not keyboard.hotkey_modifiers_down.shift)
and not (cached_config.small_monster_UI.alt and not keyboard.hotkey_modifiers_down.alt) then
and not (cached_config.small_monster_UI.shift and not keyboard.hotkey_modifiers_down.shift)
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(cached_config.small_monster_UI.key)) then
config.current_config.small_monster_UI.enabled = not config.current_config.small_monster_UI.enabled;
end
end
if not (cached_config.large_monster_UI.ctrl and not keyboard.hotkey_modifiers_down.ctrl)
and not (cached_config.large_monster_UI.shift and not keyboard.hotkey_modifiers_down.shift)
and not (cached_config.large_monster_UI.alt and not keyboard.hotkey_modifiers_down.alt) then
and not (cached_config.large_monster_UI.shift and not keyboard.hotkey_modifiers_down.shift)
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(cached_config.large_monster_UI.key)) then
local is_any_enabled = config.current_config.large_monster_UI.dynamic.enabled
or config.current_config.large_monster_UI.static.enabled
@@ -501,48 +501,52 @@ function keyboard.check_hotkeys(hard_keyboard)
end
if not (cached_config.large_monster_dynamic_UI.ctrl and not keyboard.hotkey_modifiers_down.ctrl)
and not (cached_config.large_monster_dynamic_UI.shift and not keyboard.hotkey_modifiers_down.shift)
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(cached_config.large_monster_dynamic_UI.key)) then
and not (cached_config.large_monster_dynamic_UI.shift and not keyboard.hotkey_modifiers_down.shift)
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(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;
end
end
if not (cached_config.large_monster_static_UI.ctrl and not keyboard.hotkey_modifiers_down.ctrl)
and not (cached_config.large_monster_static_UI.shift and not keyboard.hotkey_modifiers_down.shift)
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(cached_config.large_monster_static_UI.key)) then
and not (cached_config.large_monster_static_UI.shift and not keyboard.hotkey_modifiers_down.shift)
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(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;
end
end
if not (cached_config.large_monster_highlighted_UI.ctrl and not keyboard.hotkey_modifiers_down.ctrl)
and not (cached_config.large_monster_highlighted_UI.shift and not keyboard.hotkey_modifiers_down.shift)
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(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;
and not (cached_config.large_monster_highlighted_UI.shift and not keyboard.hotkey_modifiers_down.shift)
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(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;
end
end
if not (cached_config.time_UI.ctrl and not keyboard.hotkey_modifiers_down.ctrl)
and not (cached_config.time_UI.shift and not keyboard.hotkey_modifiers_down.shift)
and not (cached_config.time_UI.alt and not keyboard.hotkey_modifiers_down.alt) then
and not (cached_config.time_UI.shift and not keyboard.hotkey_modifiers_down.shift)
and not (cached_config.time_UI.alt and not keyboard.hotkey_modifiers_down.alt) 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;
end
end
if not (cached_config.damage_meter_UI.ctrl and not keyboard.hotkey_modifiers_down.ctrl)
and not (cached_config.damage_meter_UI.shift and not keyboard.hotkey_modifiers_down.shift)
and not (cached_config.damage_meter_UI.alt and not keyboard.hotkey_modifiers_down.alt) then
and not (cached_config.damage_meter_UI.shift and not keyboard.hotkey_modifiers_down.shift)
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(cached_config.damage_meter_UI.key)) then
config.current_config.damage_meter_UI.enabled = not config.current_config.damage_meter_UI.enabled;
end
end
if not (cached_config.endemic_life_UI.ctrl and not keyboard.hotkey_modifiers_down.ctrl)
and not (cached_config.endemic_life_UI.shift and not keyboard.hotkey_modifiers_down.shift)
and not (cached_config.endemic_life_UI.alt and not keyboard.hotkey_modifiers_down.alt) then
and not (cached_config.endemic_life_UI.shift and not keyboard.hotkey_modifiers_down.shift)
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(cached_config.endemic_life_UI.key)) then
config.current_config.endemic_life_UI.enabled = not config.current_config.endemic_life_UI.enabled;
end
@@ -577,4 +581,4 @@ function keyboard.init_module()
time = require("MHR_Overlay.Game_Handler.time");
end
return keyboard;
return keyboard;

View File

@@ -1,4 +1,3 @@
local quest_status = {};
local singletons;
local customization_menu;
@@ -36,7 +35,7 @@ local is_quest_host_method = lobby_manager_type_definition:get_method("isQuestHo
function quest_status.on_changed_game_status(new_quest_status)
if (quest_status.index < 2 and new_quest_status == 2)
or new_quest_status < 2 then
or new_quest_status < 2 then
player.init();
small_monster.init_list();
@@ -145,7 +144,7 @@ function quest_status.init_module()
env_creature = require("MHR_Overlay.Endemic_Life.env_creature");
quest_status.init();
sdk.hook(on_changed_game_status, function(args)
quest_status.on_changed_game_status(sdk.to_int64(args[3]));
end, function(retval) return retval; end);
@@ -163,4 +162,4 @@ function quest_status.init_module()
end, function(retval) return retval; end);
end
return quest_status;
return quest_status;

View File

@@ -15,7 +15,7 @@ function screen.update_window_size()
else
width, height = screen.get_game_window_size();
end
if width ~= nil then
screen.width = width;
end
@@ -35,7 +35,9 @@ local height_field = size_type:get_field("h");
function screen.get_game_window_size()
if scene_view == nil then
scene_view = sdk.call_native_func(singletons.scene_manager, sdk.find_type_definition("via.SceneManager"), "get_MainView");
scene_view = sdk.call_native_func(singletons.scene_manager,
sdk.find_type_definition("via.SceneManager")
, "get_MainView");
if scene_view == nil then
--log.error("[MHR_Overlay.lua] No scene view");
@@ -56,7 +58,7 @@ function screen.get_game_window_size()
end
local screen_height = height_field:get_data(size);
if screen_height == nil then
if screen_height == nil then
--log.error("[MHR_Overlay.lua] No screen height");
return;
end
@@ -71,32 +73,32 @@ function screen.calculate_absolute_coordinates(position)
x = position.x * global_position_modifier;
y = position.y * global_position_modifier;
}
-- top left
if position.anchor == "Top-Left" then
return {x = _position.x, y = _position.y};
return { x = _position.x, y = _position.y };
end
-- top right
if position.anchor == "Top-Right" then
local screen_x = screen.width - _position.x;
return {x = screen_x, y = _position.y};
return { x = screen_x, y = _position.y };
end
-- bottom left
if position.anchor == "Bottom-Left" then
local screen_y = screen.height - _position.y;
return {x = _position.x, y = screen_y};
return { x = _position.x, y = screen_y };
end
-- bottom right
if position.anchor == "Bottom-Right" then
local screen_x = screen.width - _position.x;
local screen_y = screen.height - _position.y;
return {x = screen_x, y = screen_y};
return { x = screen_x, y = screen_y };
end
return {x = _position.x, y = _position.y};
return { x = _position.x, y = _position.y };
end
function screen.init_module()

View File

@@ -160,4 +160,4 @@ function singletons.init_module()
singletons.init();
end
return singletons;
return singletons;

View File

@@ -44,7 +44,7 @@ function time.tick()
time.total_elapsed_seconds = quest_time_total_elapsed_seconds;
time.elapsed_seconds = quest_time_total_elapsed_seconds - quest_time_elapsed_minutes * 60;
if time.total_elapsed_script_seconds - time.last_elapsed_script_seconds > 1 then
time.last_elapsed_script_seconds = time.total_elapsed_script_seconds;
time.update_players_dps();
@@ -53,7 +53,7 @@ end
function time.update_players_dps()
local cached_config = config.current_config.damage_meter_UI.settings;
if cached_config.freeze_dps_on_quest_clear and quest_status.is_quest_clear then
return;
end
@@ -93,4 +93,4 @@ function time.init_module()
quest_status = require("MHR_Overlay.Game_Handler.quest_status");
end
return time;
return time;

File diff suppressed because it is too large Load Diff

View File

@@ -47,7 +47,7 @@ language.default_language = {
left_leg_mud = "Leg L (Mud)",
right_leg_mud = "Leg R (Mud)",
tail_mud = "Tail (Mud)",
tail_windsac = "Tail (Windsac)",
chest_windsac = "Chest (Windsac)",
back_windsac = "Back (Windsac)",
@@ -96,7 +96,7 @@ language.default_language = {
flash = "Flash",
poison = "Poison",
blast = "Blast",
exhaust ="Exhaust",
exhaust = "Exhaust",
ride = "Wyvern Riding",
waterblight = "Waterblight",
fireblight = "Fireblight",
@@ -207,7 +207,7 @@ language.default_language = {
text_label = "Text Label",
value_label = "Value Label",
percentage_label = "Percentage Label",
bar = "Bar",
bar = "Bar",
width = "Width",
height = "Height",
@@ -279,7 +279,7 @@ language.default_language = {
my_damage_bar_location = "My Damage Bar Location",
first = "First",
last = "Last",
small_monsters = "Small Monsters",
large_monsters = "Large Monsters",
@@ -293,7 +293,7 @@ language.default_language = {
blast_damage = "Blast Damage",
damage = "Damage",
other_players = "Other Players",
hunter_rank = "Hunter Rank",
word_player = "Word \"Player\"";
@@ -385,21 +385,28 @@ language.default_language = {
freeze_dps_on_quest_clear = "Freeze DPS when Quest is cleared",
health_break_severe_filter = "Health + Break + Severe",
health_break_filter = "Health + Break",
health_severe_filter = "Health + Severe",
health_filter = "Health",
break_severe_filter = "Break + Severe",
break_filter = "Break",
severe_filter = "Severe"
severe_filter = "Severe",
outline = "Outline",
thickness = "Thickness",
style = "Style",
inside = "Inside",
outside = "Outside",
center = "Center"
}
};
language.current_language = {};
language.language_names = {"default"};
language.languages = {language.default_language};
language.language_names = { "default" };
language.languages = { language.default_language };
function language.load()
local language_files = fs.glob([[MHR Overlay\\languages\\.*json]]);
@@ -409,7 +416,9 @@ function language.load()
end
for i, language_file_name in ipairs(language_files) do
local language_name = language_file_name:gsub(language.language_folder, ""):gsub(".json", "");
local language_name = language_file_name:gsub(language.language_folder, ""):gsub(".json"
,
"");
local loaded_language = json.load_file(language_file_name);
if loaded_language ~= nil then
@@ -436,11 +445,10 @@ function language.save(file_name, language_table)
end
end
function language.save_default();
function language.save_default()
language.save(language.language_folder .. "en-us.json", language.default_language)
end
function language.update(index)
language.current_language = table_helpers.deep_copy(language.languages[index]);
end
@@ -452,4 +460,4 @@ function language.init_module()
language.current_language = table_helpers.deep_copy(language.default_language);
end
return language;
return language;

File diff suppressed because it is too large Load Diff

View File

@@ -11,9 +11,13 @@ function table_helpers.deep_copy(original, copies)
copy = {};
copies[original] = copy;
for original_key, original_value in next, original, nil do
copy[table_helpers.deep_copy(original_key, copies)] = table_helpers.deep_copy(original_value, copies);
copy[table_helpers.deep_copy(original_key, copies)] = table_helpers.deep_copy(original_value
,
copies);
end
setmetatable(copy, table_helpers.deep_copy(getmetatable(original), copies));
setmetatable(copy,
table_helpers.deep_copy(getmetatable(original)
, copies));
end
else -- number, string, boolean, etc
copy = original;
@@ -36,7 +40,7 @@ function table_helpers.find_index(table, value, nullable)
end
function table_helpers.merge(...)
local tables_to_merge = {...};
local tables_to_merge = { ... };
assert(#tables_to_merge > 1, "There should be at least two tables to merge them");
for key, table in ipairs(tables_to_merge) do
@@ -64,11 +68,11 @@ end
function table_helpers.tostring(table)
if type(table) == "table" then
local s = "{ \n";
for k,v in pairs(table) do
for k, v in pairs(table) do
if type(k) ~= "number" then
k = "\"" .. k .. "\"";
end
s = s .. "\t[" .. k .."] = " .. table_helpers.tostring(v) .. ",\n";
s = s .. "\t[" .. k .. "] = " .. table_helpers.tostring(v) .. ",\n";
end
return s .. "} \n";
else
@@ -79,4 +83,4 @@ end
function table_helpers.init_module()
end
return table_helpers;
return table_helpers;

View File

@@ -19,7 +19,7 @@ local unicode_helpers = {};
-- 1110xxxx 10xxxxxx 10xxxxxx | FFFF (65535)
-- 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx | 10FFFF (1114111)
local pattern = '[%z\1-\127\194-\244][\128-\191]*';
local pattern = "[%z\1-\127\194-\244][\128-\191]*";
-- helper function
function unicode_helpers.relative_position(position, length)
@@ -36,13 +36,13 @@ function unicode_helpers.map(s, f, no_subs)
local i = 0;
if no_subs then
for b, e in s:gmatch('()' .. pattern .. '()') do
for b, e in s:gmatch("()" .. pattern .. "()") do
i = i + 1;
local c = e - b;
f(i, c, b)
end
else
for b, c in s:gmatch('()(' .. pattern .. ')') do
for b, c in s:gmatch("()(" .. pattern .. ")") do
i = i + 1;
f(i, c, b);
end
@@ -53,7 +53,7 @@ end
-- generator for the above -- to iterate over all utf8 chars
function unicode_helpers.chars(s, no_subs)
return coroutine.wrap(function ()
return coroutine.wrap(function()
return unicode_helpers.map(s, coroutine.yield, no_subs);
end);
end
@@ -61,52 +61,51 @@ end
-- like string.sub() but i, j are utf8 strings
-- a utf8-safe string.sub()
function unicode_helpers.sub(string, i, j)
local l = utf8.len(string);
local l = utf8.len(string);
i = unicode_helpers.relative_position(i, l);
j = j and unicode_helpers.relative_position(j, l) or l;
i = unicode_helpers.relative_position(i, l);
j = j and unicode_helpers.relative_position(j, l) or l;
if i < 1 then
i = 1;
end
if j > l then
j = l;
end
if i > j then
return '';
end
local diff = j - i;
local iterator = unicode_helpers.chars(string, true);
-- advance up to i
for _ = 1, i - 1 do
iterator();
end
local c, b = select(2, iterator());
-- i and j are the same, single-charaacter sub
if diff == 0 then
return string.sub(string, b, b + c - 1);
end
i = b;
-- advance up to j
for _ = 1, diff - 1 do
iterator();
end
c, b = select(2, iterator());
return string.sub(string, i, b + c - 1);
if i < 1 then
i = 1;
end
if j > l then
j = l;
end
if i > j then
return "";
end
local diff = j - i;
local iterator = unicode_helpers.chars(string, true);
-- advance up to i
for _ = 1, i - 1 do
iterator();
end
local c, b = select(2, iterator());
-- i and j are the same, single-charaacter sub
if diff == 0 then
return string.sub(string, b, b + c - 1);
end
i = b;
-- advance up to j
for _ = 1, diff - 1 do
iterator();
end
c, b = select(2, iterator());
return string.sub(string, i, b + c - 1);
end
function unicode_helpers.init_module()
end
return unicode_helpers;
return unicode_helpers;

View File

@@ -21,23 +21,24 @@ function ailment_buildup.draw_dynamic(monster, ailment_buildups_position_on_scre
for id, ailment in pairs(monster.ailments) do
if id == ailments.stun_id then
if not cached_config.filter.stun then
goto continue;
goto continue
end
elseif id == ailments.poison_id then
if not cached_config.filter.poison then
goto continue;
goto continue
end
elseif id == ailments.blast_id then
if not cached_config.filter.blast then
goto continue;
goto continue
end
else
goto continue;
goto continue
end
if cached_config.settings.time_limit ~= 0 and time.total_elapsed_script_seconds - ailment.last_change_time > cached_config.settings.time_limit then
goto continue;
if cached_config.settings.time_limit ~= 0 and
time.total_elapsed_script_seconds - ailment.last_change_time > cached_config.settings.time_limit then
goto continue
end
local total_buildup = 0;
@@ -52,7 +53,7 @@ function ailment_buildup.draw_dynamic(monster, ailment_buildups_position_on_scre
end
table.insert(displayed_players,
{
{
["buildup"] = player_buildup,
["buildup_share"] = ailment.buildup_share[player_id],
["id"] = player_id
@@ -61,7 +62,7 @@ function ailment_buildup.draw_dynamic(monster, ailment_buildups_position_on_scre
end
if total_buildup == 0 then
goto continue;
goto continue
end
if cached_config.sorting.type == "Normal" then
@@ -103,8 +104,9 @@ function ailment_buildup.draw_dynamic(monster, ailment_buildups_position_on_scre
if cached_config.ailment_name_label.include.activation_count and ailment.activate_count ~= 0 then
ailment_name = ailment_name .. "x" .. tostring(ailment.activate_count);
end
drawing.draw_label(monster.ailments[ailments.stun_id].ailment_buildup_dynamic_UI.ailment_name_label, ailment_buildups_position_on_screen, opacity_scale, ailment_name);
drawing.draw_label(monster.ailments[ailments.stun_id].ailment_buildup_dynamic_UI.ailment_name_label,
ailment_buildups_position_on_screen, opacity_scale, ailment_name);
local last_j = 0;
@@ -114,21 +116,24 @@ function ailment_buildup.draw_dynamic(monster, ailment_buildups_position_on_scre
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);
last_j = j;
end
local total_buildup_position_on_screen = {
x = ailment_buildups_position_on_screen.x + cached_config.player_spacing.x * last_j * 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);
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 = {
x = total_buildup_position_on_screen.x + cached_config.ailment_spacing.x * global_scale_modifier,
@@ -138,7 +143,7 @@ function ailment_buildup.draw_dynamic(monster, ailment_buildups_position_on_scre
::continue::
end
end
function ailment_buildup.draw_static(monster, ailment_buildups_position_on_screen, opacity_scale)
@@ -152,23 +157,24 @@ function ailment_buildup.draw_static(monster, ailment_buildups_position_on_scree
for id, ailment in pairs(monster.ailments) do
if id == ailments.stun_id then
if not cached_config.filter.stun then
goto continue;
goto continue
end
elseif id == ailments.poison_id then
if not cached_config.filter.poison then
goto continue;
goto continue
end
elseif id == ailments.blast_id then
if not cached_config.filter.blast then
goto continue;
goto continue
end
else
goto continue;
goto continue
end
if cached_config.settings.time_limit ~= 0 and time.total_elapsed_script_seconds - ailment.last_change_time > cached_config.settings.time_limit then
goto continue;
if cached_config.settings.time_limit ~= 0 and
time.total_elapsed_script_seconds - ailment.last_change_time > cached_config.settings.time_limit then
goto continue
end
local total_buildup = 0;
@@ -183,7 +189,7 @@ function ailment_buildup.draw_static(monster, ailment_buildups_position_on_scree
end
table.insert(displayed_players,
{
{
["buildup"] = player_buildup,
["buildup_share"] = ailment.buildup_share[player_id],
["id"] = player_id
@@ -192,7 +198,7 @@ function ailment_buildup.draw_static(monster, ailment_buildups_position_on_scree
end
if total_buildup == 0 then
goto continue;
goto continue
end
if cached_config.sorting.type == "Normal" then
@@ -235,7 +241,8 @@ function ailment_buildup.draw_static(monster, ailment_buildups_position_on_scree
ailment_name = ailment_name .. "x" .. tostring(ailment.activate_count);
end
drawing.draw_label(monster.ailments[ailments.stun_id].ailment_buildup_static_UI.ailment_name_label, ailment_buildups_position_on_screen, opacity_scale, ailment_name);
drawing.draw_label(monster.ailments[ailments.stun_id].ailment_buildup_static_UI.ailment_name_label,
ailment_buildups_position_on_screen, opacity_scale, ailment_name);
local last_j = 0;
for j, _player in ipairs(displayed_players) do
@@ -244,7 +251,8 @@ function ailment_buildup.draw_static(monster, ailment_buildups_position_on_scree
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);
last_j = j;
end
@@ -254,9 +262,11 @@ function ailment_buildup.draw_static(monster, ailment_buildups_position_on_scree
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);
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 = {
x = total_buildup_position_on_screen.x + cached_config.ailment_spacing.x * global_scale_modifier,
@@ -266,7 +276,7 @@ function ailment_buildup.draw_static(monster, ailment_buildups_position_on_scree
::continue::
end
end
function ailment_buildup.draw_highlighted(monster, ailment_buildups_position_on_screen, opacity_scale)
@@ -280,23 +290,24 @@ function ailment_buildup.draw_highlighted(monster, ailment_buildups_position_on_
for id, ailment in pairs(monster.ailments) do
if id == ailments.stun_id then
if not cached_config.filter.stun then
goto continue;
goto continue
end
elseif id == ailments.poison_id then
if not cached_config.filter.poison then
goto continue;
goto continue
end
elseif id == ailments.blast_id then
if not cached_config.filter.blast then
goto continue;
goto continue
end
else
goto continue;
goto continue
end
if cached_config.settings.time_limit ~= 0 and time.total_elapsed_script_seconds - ailment.last_change_time > cached_config.settings.time_limit then
goto continue;
if cached_config.settings.time_limit ~= 0 and
time.total_elapsed_script_seconds - ailment.last_change_time > cached_config.settings.time_limit then
goto continue
end
local total_buildup = 0;
@@ -311,7 +322,7 @@ function ailment_buildup.draw_highlighted(monster, ailment_buildups_position_on_
end
table.insert(displayed_players,
{
{
["buildup"] = player_buildup,
["buildup_share"] = ailment.buildup_share[player_id],
["id"] = player_id
@@ -320,7 +331,7 @@ function ailment_buildup.draw_highlighted(monster, ailment_buildups_position_on_
end
if total_buildup == 0 then
goto continue;
goto continue
end
if cached_config.sorting.type == "Normal" then
@@ -363,7 +374,8 @@ function ailment_buildup.draw_highlighted(monster, ailment_buildups_position_on_
ailment_name = ailment_name .. "x" .. tostring(ailment.activate_count);
end
drawing.draw_label(monster.ailments[ailments.stun_id].ailment_buildup_highlighted_UI.ailment_name_label, ailment_buildups_position_on_screen, opacity_scale, ailment_name);
drawing.draw_label(monster.ailments[ailments.stun_id].ailment_buildup_highlighted_UI.ailment_name_label,
ailment_buildups_position_on_screen, opacity_scale, ailment_name);
local last_j = 0;
for j, _player in ipairs(displayed_players) do
@@ -372,7 +384,8 @@ function ailment_buildup.draw_highlighted(monster, ailment_buildups_position_on_
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);
last_j = j;
end
@@ -382,9 +395,11 @@ function ailment_buildup.draw_highlighted(monster, ailment_buildups_position_on_
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);
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 = {
x = total_buildup_position_on_screen.x + cached_config.ailment_spacing.x * global_scale_modifier,
@@ -394,7 +409,7 @@ function ailment_buildup.draw_highlighted(monster, ailment_buildups_position_on_
::continue::
end
end
function ailment_buildup.draw_small(monster, ailment_buildups_position_on_screen, opacity_scale)
@@ -408,23 +423,24 @@ function ailment_buildup.draw_small(monster, ailment_buildups_position_on_screen
for id, ailment in pairs(monster.ailments) do
if id == ailments.stun_id then
if not cached_config.filter.stun then
goto continue;
goto continue
end
elseif id == ailments.poison_id then
if not cached_config.filter.poison then
goto continue;
goto continue
end
elseif id == ailments.blast_id then
if not cached_config.filter.blast then
goto continue;
goto continue
end
else
goto continue;
goto continue
end
if cached_config.settings.time_limit ~= 0 and time.total_elapsed_script_seconds - ailment.last_change_time > cached_config.settings.time_limit then
goto continue;
if cached_config.settings.time_limit ~= 0 and
time.total_elapsed_script_seconds - ailment.last_change_time > cached_config.settings.time_limit then
goto continue
end
local total_buildup = 0;
@@ -439,7 +455,7 @@ function ailment_buildup.draw_small(monster, ailment_buildups_position_on_screen
end
table.insert(displayed_players,
{
{
["buildup"] = player_buildup,
["buildup_share"] = ailment.buildup_share[player_id],
["id"] = player_id
@@ -448,7 +464,7 @@ function ailment_buildup.draw_small(monster, ailment_buildups_position_on_screen
end
if total_buildup == 0 then
goto continue;
goto continue
end
if cached_config.sorting.type == "Normal" then
@@ -491,7 +507,8 @@ function ailment_buildup.draw_small(monster, ailment_buildups_position_on_screen
ailment_name = ailment_name .. "x" .. tostring(ailment.activate_count);
end
drawing.draw_label(monster.ailments[ailments.stun_id].ailment_buildup_small_UI.ailment_name_label, ailment_buildups_position_on_screen, opacity_scale, ailment_name);
drawing.draw_label(monster.ailments[ailments.stun_id].ailment_buildup_small_UI.ailment_name_label,
ailment_buildups_position_on_screen, opacity_scale, ailment_name);
local last_j = 0;
for j, _player in ipairs(displayed_players) do
@@ -500,7 +517,8 @@ function ailment_buildup.draw_small(monster, ailment_buildups_position_on_screen
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);
last_j = j;
end
@@ -510,9 +528,11 @@ function ailment_buildup.draw_small(monster, ailment_buildups_position_on_screen
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);
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 = {
x = total_buildup_position_on_screen.x + cached_config.ailment_spacing.x * global_scale_modifier,
@@ -522,7 +542,7 @@ function ailment_buildup.draw_small(monster, ailment_buildups_position_on_screen
::continue::
end
end
function ailment_buildup.init_module()
@@ -538,4 +558,4 @@ function ailment_buildup.init_module()
drawing = require("MHR_Overlay.UI.drawing");
end
return ailment_buildup;
return ailment_buildup;

View File

@@ -50,11 +50,11 @@ function ailment_hook.poison_proc(poison_param)
monster = small_monster.get_monster(enemy);
end
monster.ailments[ailments.poison_id].cached_buildup_share = table_helpers.deep_copy(monster.ailments[ailments.poison_id].buildup_share);
monster.ailments[ailments.poison_id].cached_buildup_share = table_helpers.deep_copy(monster.ailments[ailments
.poison_id].buildup_share);
ailments.clear_ailment_contribution(monster, ailments.poison_id);
end
function ailment_hook.blast_proc(blast_param)
if blast_param == nil then
return;
@@ -79,7 +79,7 @@ function ailment_hook.blast_proc(blast_param)
local blast_damage = blast_damage_method:call(blast_param);
local blast_adjust_rate = blast_adjust_rate_method:call(blast_param);
ailments.apply_ailment_damage(monster, ailments.blast_id, blast_damage * blast_adjust_rate);
ailments.clear_ailment_contribution(monster, ailments.blast_id);
@@ -89,7 +89,7 @@ function ailment_hook.stock_damage()
for enemy, monster in pairs(large_monster.list) do
local damage_param = damage_param_field:get_data(enemy);
if damage_param == nil then
goto continue;
goto continue
end
local poison_param = poison_param_field:get_data(damage_param);
@@ -101,7 +101,7 @@ function ailment_hook.stock_damage()
for enemy, monster in pairs(small_monster.list) do
local damage_param = damage_param_field:get_data(enemy);
if damage_param == nil then
goto continue;
goto continue
end
local poison_param = poison_param_field:get_data(damage_param);
@@ -123,7 +123,7 @@ function ailment_hook.init_module()
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)
@@ -137,4 +137,4 @@ function ailment_hook.init_module()
end);
end
return ailment_hook;
return ailment_hook;

View File

@@ -42,7 +42,7 @@ ailments.thunder_id = 11;
ailments.fall_trap_id = 12;
ailments.shock_trap_id = 13;
ailments.capture_id = 14 --tranq bomb
ailments.koyashi_id = 15; --dung bomb
ailments.koyashi_id = 15; --dung bomb
ailments.steel_fang_id = 16;
ailments.fall_quick_sand_id = 17;
ailments.fall_otomo_trap_id = 18;
@@ -258,14 +258,14 @@ function ailments.update_ailments(enemy, monster)
end
ailments.update_stun_poison_blast_ailments(monster, damage_param);
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.highlighted.ailments.visibility
and not config.current_config.small_monster_UI.ailments.visibility
and not config.current_config.large_monster_UI.dynamic.ailment_buildups.visibility
and not config.current_config.large_monster_UI.static.ailment_buildups.visibility
and not config.current_config.small_monster_UI.ailment_buildups.visibility then
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.small_monster_UI.ailments.visibility
and not config.current_config.large_monster_UI.dynamic.ailment_buildups.visibility
and not config.current_config.large_monster_UI.static.ailment_buildups.visibility
and not config.current_config.small_monster_UI.ailment_buildups.visibility then
return;
end
@@ -285,7 +285,7 @@ function ailments.update_ailments(enemy, monster)
for index, ailment_param in ipairs(condition_param_table) do
local id = index - 1;
if id == ailments.stun_id or id == ailments.poison_id or id == ailments.blast_id then
goto continue;
goto continue
end
ailments.update_ailment(monster, ailment_param, id);
@@ -312,100 +312,100 @@ function ailments.update_stun_poison_blast_ailments(monster, damage_param)
end
function ailments.update_ailment(monster, ailment_param, id)
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") or 0;
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 timer = get_active_timer_method:call(ailment_param);
local duration = get_active_time_method:call(ailment_param);
local is_active = get_is_active_method:call(ailment_param);
if is_enable == nil then
is_enable = true;
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") or 0;
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 timer = get_active_timer_method:call(ailment_param);
local duration = get_active_time_method:call(ailment_param);
local is_active = get_is_active_method:call(ailment_param);
if is_enable == nil then
is_enable = true;
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 ~= monster.ailments[id].activate_count then
ailments.update_last_change_time(monster, id);
if id == ailments.stun_id then
ailments.clear_ailment_contribution(monster, ailments.stun_id);
end
end
monster.ailments[id].activate_count = activate_count;
end
if is_enable ~= monster.ailments[id].is_enable then
if buildup ~= nil then
if buildup ~= monster.ailments[id].total_buildup then
ailments.update_last_change_time(monster, id);
end
monster.ailments[id].is_enable = is_enable;
monster.ailments[id].total_buildup = buildup;
end
if activate_count ~= nil then
if activate_count ~= monster.ailments[id].activate_count then
ailments.update_last_change_time(monster, id);
if id == ailments.stun_id then
ailments.clear_ailment_contribution(monster, ailments.stun_id);
end
end
monster.ailments[id].activate_count = activate_count;
if buildup_limit ~= nil then
if buildup_limit ~= monster.ailments[id].buildup_limit then
ailments.update_last_change_time(monster, id);
end
if buildup ~= nil then
if buildup ~= monster.ailments[id].total_buildup then
ailments.update_last_change_time(monster, id);
end
monster.ailments[id].buildup_limit = buildup_limit;
end
monster.ailments[id].total_buildup = buildup;
if buildup ~= nil and buildup_limit ~= nil and buildup_limit ~= 0 then
monster.ailments[id].buildup_percentage = buildup / buildup_limit;
end
if timer ~= nil then
if timer ~= monster.ailments[id].timer then
ailments.update_last_change_time(monster, id);
end
if buildup_limit ~= nil then
if buildup_limit ~= monster.ailments[id].buildup_limit then
ailments.update_last_change_time(monster, id);
end
monster.ailments[id].timer = timer;
end
monster.ailments[id].buildup_limit = buildup_limit;
if is_active ~= nil then
if is_active ~= monster.ailments[id].is_active then
ailments.update_last_change_time(monster, id);
end
if buildup ~= nil and buildup_limit ~= nil and buildup_limit ~= 0 then
monster.ailments[id].buildup_percentage = buildup / buildup_limit;
monster.ailments[id].is_active = is_active;
end
if duration ~= nil and not monster.ailments[id].is_active then
if duration ~= monster.ailments[id].duration then
ailments.update_last_change_time(monster, id);
end
if timer ~= nil then
if timer ~= monster.ailments[id].timer then
ailments.update_last_change_time(monster, id);
end
monster.ailments[id].duration = duration;
end
monster.ailments[id].timer = timer;
if duration ~= 0 and duration ~= nil then
monster.ailments[id].timer_percentage = timer / monster.ailments[id].duration;
end
if is_active then
if timer < 0 then
timer = 0;
end
if is_active ~= nil then
if is_active ~= monster.ailments[id].is_active then
ailments.update_last_change_time(monster, id);
end
local minutes_left = math.floor(timer / 60);
local seconds_left = timer - 60 * minutes_left;
monster.ailments[id].is_active = is_active;
end
if duration ~= nil and not monster.ailments[id].is_active then
if duration ~= monster.ailments[id].duration then
ailments.update_last_change_time(monster, id);
end
monster.ailments[id].duration = duration;
end
if duration ~= 0 and duration ~= nil then
if duration ~= 0 then
monster.ailments[id].timer_percentage = timer / monster.ailments[id].duration;
end
if is_active then
if timer < 0 then
timer = 0;
end
local minutes_left = math.floor(timer / 60);
local seconds_left = timer - 60 * minutes_left;
if duration ~= 0 then
monster.ailments[id].timer_percentage = timer / monster.ailments[id].duration;
end
monster.ailments[id].minutes_left = minutes_left;
monster.ailments[id].seconds_left = seconds_left;
end
monster.ailments[id].minutes_left = minutes_left;
monster.ailments[id].seconds_left = seconds_left;
end
end
function ailments.update_last_change_time(monster, id)
@@ -423,7 +423,7 @@ function ailments.update_poison(monster, poison_param)
local is_damage = poison_get_is_damage_method:call(poison_param);
if is_damage then
local poison_damage = poison_damage_field:get_data(poison_param);
ailments.apply_ailment_damage(monster, ailments.poison_id, poison_damage);
end
end
@@ -438,116 +438,121 @@ function ailments.draw_dynamic(monster, ailments_position_on_screen, opacity_sca
for id, ailment in pairs(monster.ailments) do
if id == ailments.paralyze_id then
if not cached_config.filter.paralysis then
goto continue;
goto continue
end
elseif id == ailments.sleep_id then
if not cached_config.filter.sleep then
goto continue;
goto continue
end
elseif id == ailments.stun_id then
if not cached_config.filter.stun then
goto continue;
goto continue
end
elseif id == ailments.flash_id then
if not cached_config.filter.flash then
goto continue;
goto continue
end
elseif id == ailments.poison_id then
if not cached_config.filter.poison then
goto continue;
goto continue
end
elseif id == ailments.blast_id then
if not cached_config.filter.blast then
goto continue;
goto continue
end
elseif id == ailments.exhaust_id then
if not cached_config.filter.exhaust then
goto continue;
goto continue
end
elseif id == ailments.ride_id then
if not cached_config.filter.ride then
goto continue;
goto continue
end
elseif id == ailments.water_id then
if not cached_config.filter.waterblight then
goto continue;
goto continue
end
elseif id == ailments.fire_id then
if not cached_config.filter.fireblight then
goto continue;
goto continue
end
elseif id == ailments.ice_id then
if not cached_config.filter.iceblight then
goto continue;
goto continue
end
elseif id == ailments.thunder_id then
if not cached_config.filter.thunderblight then
goto continue;
goto continue
end
elseif id == ailments.fall_trap_id then
if not cached_config.filter.fall_trap then
goto continue;
goto continue
end
elseif id == ailments.shock_trap_id then
if not cached_config.filter.shock_trap then
goto continue;
goto continue
end
elseif id == ailments.capture_id then
if not cached_config.filter.tranq_bomb then
goto continue;
goto continue
end
elseif id == ailments.koyashi_id then
if not cached_config.filter.dung_bomb then
goto continue;
goto continue
end
elseif id == ailments.steel_fang_id then
if not cached_config.filter.steel_fang then
goto continue;
goto continue
end
elseif id == ailments.fall_quick_sand_id then
if not cached_config.filter.quick_sand then
goto continue;
goto continue
end
elseif id == ailments.fall_otomo_trap_id then
if not cached_config.filter.fall_otomo_trap then
goto continue;
goto continue
end
elseif id == ailments.shock_otomo_trap_id then
if not cached_config.filter.shock_otomo_trap then
goto continue;
goto continue
end
else
goto continue;
goto continue
end
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;
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
end
if cached_config.settings.hide_inactive_ailments_with_no_buildup_support and ailment.buildup_limit == 0 and not ailment.is_active then
goto continue;
if cached_config.settings.hide_inactive_ailments_with_no_buildup_support and ailment.buildup_limit == 0 and
not ailment.is_active then
goto continue
end
if cached_config.settings.hide_all_inactive_ailments and not ailment.is_active then
goto continue;
goto continue
end
if cached_config.settings.hide_all_active_ailments and ailment.is_active then
goto continue;
goto continue
end
if cached_config.settings.hide_disabled_ailments and not ailment.is_enable then
goto continue;
goto continue
end
if cached_config.settings.time_limit ~= 0 and time.total_elapsed_script_seconds - ailment.last_change_time > cached_config.settings.time_limit and not ailment.is_active then
goto continue;
if cached_config.settings.time_limit ~= 0 and
time.total_elapsed_script_seconds - ailment.last_change_time > cached_config.settings.time_limit and
not ailment.is_active then
goto continue
end
table.insert(displayed_ailments, ailment);
::continue::
end
if cached_config.sorting.type == "Normal" then
if cached_config.sorting.reversed_order then
@@ -601,116 +606,121 @@ function ailments.draw_static(monster, ailments_position_on_screen, opacity_scal
for id, ailment in pairs(monster.ailments) do
if id == ailments.paralyze_id then
if not cached_config.filter.paralysis then
goto continue;
goto continue
end
elseif id == ailments.sleep_id then
if not cached_config.filter.sleep then
goto continue;
goto continue
end
elseif id == ailments.stun_id then
if not cached_config.filter.stun then
goto continue;
goto continue
end
elseif id == ailments.flash_id then
if not cached_config.filter.flash then
goto continue;
goto continue
end
elseif id == ailments.poison_id then
if not cached_config.filter.poison then
goto continue;
goto continue
end
elseif id == ailments.blast_id then
if not cached_config.filter.blast then
goto continue;
goto continue
end
elseif id == ailments.exhaust_id then
if not cached_config.filter.exhaust then
goto continue;
goto continue
end
elseif id == ailments.ride_id then
if not cached_config.filter.ride then
goto continue;
goto continue
end
elseif id == ailments.water_id then
if not cached_config.filter.waterblight then
goto continue;
goto continue
end
elseif id == ailments.fire_id then
if not cached_config.filter.fireblight then
goto continue;
goto continue
end
elseif id == ailments.ice_id then
if not cached_config.filter.iceblight then
goto continue;
goto continue
end
elseif id == ailments.thunder_id then
if not cached_config.filter.thunderblight then
goto continue;
goto continue
end
elseif id == ailments.fall_trap_id then
if not cached_config.filter.fall_trap then
goto continue;
goto continue
end
elseif id == ailments.shock_trap_id then
if not cached_config.filter.shock_trap then
goto continue;
goto continue
end
elseif id == ailments.capture_id then
if not cached_config.filter.tranq_bomb then
goto continue;
goto continue
end
elseif id == ailments.koyashi_id then
if not cached_config.filter.dung_bomb then
goto continue;
goto continue
end
elseif id == ailments.steel_fang_id then
if not cached_config.filter.steel_fang then
goto continue;
goto continue
end
elseif id == ailments.fall_quick_sand_id then
if not cached_config.filter.quick_sand then
goto continue;
goto continue
end
elseif id == ailments.fall_otomo_trap_id then
if not cached_config.filter.fall_otomo_trap then
goto continue;
goto continue
end
elseif id == ailments.shock_otomo_trap_id then
if not cached_config.filter.shock_otomo_trap then
goto continue;
goto continue
end
else
goto continue;
goto continue
end
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;
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
end
if cached_config.settings.hide_inactive_ailments_with_no_buildup_support and ailment.buildup_limit == 0 and not ailment.is_active then
goto continue;
if cached_config.settings.hide_inactive_ailments_with_no_buildup_support and ailment.buildup_limit == 0 and
not ailment.is_active then
goto continue
end
if cached_config.settings.hide_all_inactive_ailments and not ailment.is_active then
goto continue;
goto continue
end
if cached_config.settings.hide_all_active_ailments and ailment.is_active then
goto continue;
goto continue
end
if cached_config.settings.hide_disabled_ailments and not ailment.is_enable then
goto continue;
goto continue
end
if cached_config.settings.time_limit ~= 0 and time.total_elapsed_script_seconds - ailment.last_change_time > cached_config.settings.time_limit and not ailment.is_active then
goto continue;
if cached_config.settings.time_limit ~= 0 and
time.total_elapsed_script_seconds - ailment.last_change_time > cached_config.settings.time_limit and
not ailment.is_active then
goto continue
end
table.insert(displayed_ailments, ailment);
::continue::
end
if cached_config.sorting.type == "Normal" then
if cached_config.sorting.reversed_order then
@@ -749,7 +759,7 @@ function ailments.draw_static(monster, ailments_position_on_screen, opacity_scal
x = ailments_position_on_screen.x + cached_config.spacing.x * (j - 1) * 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);
end
end
@@ -763,116 +773,121 @@ function ailments.draw_highlighted(monster, ailments_position_on_screen, opacity
for id, ailment in pairs(monster.ailments) do
if id == ailments.paralyze_id then
if not cached_config.filter.paralysis then
goto continue;
goto continue
end
elseif id == ailments.sleep_id then
if not cached_config.filter.sleep then
goto continue;
goto continue
end
elseif id == ailments.stun_id then
if not cached_config.filter.stun then
goto continue;
goto continue
end
elseif id == ailments.flash_id then
if not cached_config.filter.flash then
goto continue;
goto continue
end
elseif id == ailments.poison_id then
if not cached_config.filter.poison then
goto continue;
goto continue
end
elseif id == ailments.blast_id then
if not cached_config.filter.blast then
goto continue;
goto continue
end
elseif id == ailments.exhaust_id then
if not cached_config.filter.exhaust then
goto continue;
goto continue
end
elseif id == ailments.ride_id then
if not cached_config.filter.ride then
goto continue;
goto continue
end
elseif id == ailments.water_id then
if not cached_config.filter.waterblight then
goto continue;
goto continue
end
elseif id == ailments.fire_id then
if not cached_config.filter.fireblight then
goto continue;
goto continue
end
elseif id == ailments.ice_id then
if not cached_config.filter.iceblight then
goto continue;
goto continue
end
elseif id == ailments.thunder_id then
if not cached_config.filter.thunderblight then
goto continue;
goto continue
end
elseif id == ailments.fall_trap_id then
if not cached_config.filter.fall_trap then
goto continue;
goto continue
end
elseif id == ailments.shock_trap_id then
if not cached_config.filter.shock_trap then
goto continue;
goto continue
end
elseif id == ailments.capture_id then
if not cached_config.filter.tranq_bomb then
goto continue;
goto continue
end
elseif id == ailments.koyashi_id then
if not cached_config.filter.dung_bomb then
goto continue;
goto continue
end
elseif id == ailments.steel_fang_id then
if not cached_config.filter.steel_fang then
goto continue;
goto continue
end
elseif id == ailments.fall_quick_sand_id then
if not cached_config.filter.quick_sand then
goto continue;
goto continue
end
elseif id == ailments.fall_otomo_trap_id then
if not cached_config.filter.fall_otomo_trap then
goto continue;
goto continue
end
elseif id == ailments.shock_otomo_trap_id then
if not cached_config.filter.shock_otomo_trap then
goto continue;
goto continue
end
else
goto continue;
goto continue
end
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;
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
end
if cached_config.settings.hide_inactive_ailments_with_no_buildup_support and ailment.buildup_limit == 0 and not ailment.is_active then
goto continue;
if cached_config.settings.hide_inactive_ailments_with_no_buildup_support and ailment.buildup_limit == 0 and
not ailment.is_active then
goto continue
end
if cached_config.settings.hide_all_inactive_ailments and not ailment.is_active then
goto continue;
goto continue
end
if cached_config.settings.hide_all_active_ailments and ailment.is_active then
goto continue;
goto continue
end
if cached_config.settings.hide_disabled_ailments and not ailment.is_enable then
goto continue;
goto continue
end
if cached_config.settings.time_limit ~= 0 and time.total_elapsed_script_seconds - ailment.last_change_time > cached_config.settings.time_limit and not ailment.is_active then
goto continue;
if cached_config.settings.time_limit ~= 0 and
time.total_elapsed_script_seconds - ailment.last_change_time > cached_config.settings.time_limit and
not ailment.is_active then
goto continue
end
table.insert(displayed_ailments, ailment);
::continue::
end
if cached_config.sorting.type == "Normal" then
if cached_config.sorting.reversed_order then
table.sort(displayed_ailments, function(left, right)
@@ -910,7 +925,7 @@ function ailments.draw_highlighted(monster, ailments_position_on_screen, opacity
x = ailments_position_on_screen.x + cached_config.spacing.x * (j - 1) * 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);
end
end
@@ -924,116 +939,121 @@ function ailments.draw_small(monster, ailments_position_on_screen, opacity_scale
for id, ailment in pairs(monster.ailments) do
if id == ailments.paralyze_id then
if not cached_config.filter.paralysis then
goto continue;
goto continue
end
elseif id == ailments.sleep_id then
if not cached_config.filter.sleep then
goto continue;
goto continue
end
elseif id == ailments.stun_id then
if not cached_config.filter.stun then
goto continue;
goto continue
end
elseif id == ailments.flash_id then
if not cached_config.filter.flash then
goto continue;
goto continue
end
elseif id == ailments.poison_id then
if not cached_config.filter.poison then
goto continue;
goto continue
end
elseif id == ailments.blast_id then
if not cached_config.filter.blast then
goto continue;
goto continue
end
elseif id == ailments.exhaust_id then
if not cached_config.filter.exhaust then
goto continue;
goto continue
end
elseif id == ailments.ride_id then
if not cached_config.filter.ride then
goto continue;
goto continue
end
elseif id == ailments.water_id then
if not cached_config.filter.waterblight then
goto continue;
goto continue
end
elseif id == ailments.fire_id then
if not cached_config.filter.fireblight then
goto continue;
goto continue
end
elseif id == ailments.ice_id then
if not cached_config.filter.iceblight then
goto continue;
goto continue
end
elseif id == ailments.thunder_id then
if not cached_config.filter.thunderblight then
goto continue;
goto continue
end
elseif id == ailments.fall_trap_id then
if not cached_config.filter.fall_trap then
goto continue;
goto continue
end
elseif id == ailments.shock_trap_id then
if not cached_config.filter.shock_trap then
goto continue;
goto continue
end
elseif id == ailments.capture_id then
if not cached_config.filter.tranq_bomb then
goto continue;
goto continue
end
elseif id == ailments.koyashi_id then
if not cached_config.filter.dung_bomb then
goto continue;
goto continue
end
elseif id == ailments.steel_fang_id then
if not cached_config.filter.steel_fang then
goto continue;
goto continue
end
elseif id == ailments.fall_quick_sand_id then
if not cached_config.filter.quick_sand then
goto continue;
goto continue
end
elseif id == ailments.fall_otomo_trap_id then
if not cached_config.filter.fall_otomo_trap then
goto continue;
goto continue
end
elseif id == ailments.shock_otomo_trap_id then
if not cached_config.filter.shock_otomo_trap then
goto continue;
goto continue
end
else
goto continue;
goto continue
end
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;
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
end
if cached_config.settings.hide_inactive_ailments_with_no_buildup_support and ailment.buildup_limit == 0 and not ailment.is_active then
goto continue;
if cached_config.settings.hide_inactive_ailments_with_no_buildup_support and ailment.buildup_limit == 0 and
not ailment.is_active then
goto continue
end
if cached_config.settings.hide_all_inactive_ailments and not ailment.is_active then
goto continue;
goto continue
end
if cached_config.settings.hide_all_active_ailments and ailment.is_active then
goto continue;
goto continue
end
if cached_config.settings.hide_disabled_ailments and not ailment.is_enable then
goto continue;
goto continue
end
if cached_config.settings.time_limit ~= 0 and time.total_elapsed_script_seconds - ailment.last_change_time > cached_config.settings.time_limit and not ailment.is_active then
goto continue;
if cached_config.settings.time_limit ~= 0 and
time.total_elapsed_script_seconds - ailment.last_change_time > cached_config.settings.time_limit and
not ailment.is_active then
goto continue
end
table.insert(displayed_ailments, ailment);
::continue::
end
if cached_config.sorting.type == "Normal" then
if cached_config.sorting.reversed_order then
@@ -1087,7 +1107,8 @@ end
function ailments.apply_ailment_buildup(monster, attacker_id, ailment_type, ailment_buildup)
if monster == nil or player == nil or (ailment_type ~= ailments.poison_id and ailment_type ~= ailments.blast_id and ailment_type ~= ailments.stun_id) then
if monster == nil or player == nil or
(ailment_type ~= ailments.poison_id and ailment_type ~= ailments.blast_id and ailment_type ~= ailments.stun_id) then
return;
end
@@ -1095,9 +1116,10 @@ function ailments.apply_ailment_buildup(monster, attacker_id, ailment_type, ailm
if monster.ailments[ailment_type].buildup == nil then
monster.ailments[ailment_type].buildup = {};
end
-- accumulate this buildup for this attacker
monster.ailments[ailment_type].buildup[attacker_id] = (monster.ailments[ailment_type].buildup[attacker_id] or 0) + ailment_buildup;
monster.ailments[ailment_type].buildup[attacker_id] = (monster.ailments[ailment_type].buildup[attacker_id] or 0) +
ailment_buildup;
ailments.calculate_ailment_contribution(monster, ailment_type);
end
@@ -1150,9 +1172,9 @@ function ailments.apply_ailment_damage(monster, ailment_type, ailment_damage)
damage_object.physical_damage = 0;
damage_object.elemental_damage = 0;
damage_object.ailment_damage = damage_portion;
local attacking_player = player.get_player(attacker_id);
if attacking_player ~= nil then
player.update_damage(attacking_player, damage_source_type, true, damage_object);
end
@@ -1179,4 +1201,4 @@ function ailments.init_module()
table_helpers = require("MHR_Overlay.Misc.table_helpers");
end
return ailments;
return ailments;

View File

@@ -44,7 +44,6 @@ function body_part.new(id, name)
return part;
end
function body_part.init_dynamic_UI(part)
local cached_config = config.current_config.large_monster_UI.dynamic.body_parts;
@@ -155,7 +154,7 @@ function body_part.update_break(part, part_break_current, part_break_max, part_b
if part.break_max_count ~= part_break_max_count then
part.last_change_time = time.total_elapsed_script_seconds;
end
part.break_health = part_break_current;
part.break_max_health = part_break_max;
@@ -205,21 +204,21 @@ function body_part.draw_dynamic(monster, parts_position_on_screen, opacity_scale
if break_supported then
if severe_supported then
if not cached_config.filter.health_break_severe then
goto continue;
goto continue
end
else
if not cached_config.filter.health_break then
goto continue;
goto continue
end
end
else
if severe_supported then
if not cached_config.filter.health_severe then
goto continue;
goto continue
end
else
if not cached_config.filter.health then
goto continue;
goto continue
end
end
end
@@ -227,39 +226,42 @@ function body_part.draw_dynamic(monster, parts_position_on_screen, opacity_scale
if break_supported then
if severe_supported then
if not cached_config.filter.break_severe then
goto continue;
goto continue
end
else
if not cached_config.filter.break_ then
goto continue;
goto continue
end
end
else
if severe_supported then
if not cached_config.filter.severe then
goto continue;
goto continue
end
else
goto continue;
goto continue
end
end
end
if cached_config.settings.hide_undamaged_parts
and ((part.health == part.max_health and part.flinch_count == 0) or not health_supported)
and ((part.break_health == part.break_max_health and part.break_count == 0) or not break_supported)
and ((part.loss_health == part.loss_max_health and not part.is_severed) or not severe_supported) then
goto continue;
and ((part.health == part.max_health and part.flinch_count == 0) or not health_supported)
and ((part.break_health == part.break_max_health and part.break_count == 0) or not break_supported)
and ((part.loss_health == part.loss_max_health and not part.is_severed) or not severe_supported) then
goto continue
end
if (not part.body_part_dynamic_UI.flinch_visibility or not health_supported)
and (not part.body_part_dynamic_UI.break_visibility or not break_supported or part.break_count >= part.break_max_count)
and (not part.body_part_dynamic_UI.loss_visibility or not severe_supported or part.is_severed) then
goto continue;
and
(not part.body_part_dynamic_UI.break_visibility or not break_supported or part.break_count >= part.break_max_count
)
and (not part.body_part_dynamic_UI.loss_visibility or not severe_supported or part.is_severed) then
goto continue
end
if cached_config.settings.time_limit ~= 0 and time.total_elapsed_script_seconds - part.last_change_time > cached_config.settings.time_limit then
goto continue;
if cached_config.settings.time_limit ~= 0 and
time.total_elapsed_script_seconds - part.last_change_time > cached_config.settings.time_limit then
goto continue
end
table.insert(displayed_parts, part);
@@ -387,21 +389,21 @@ function body_part.draw_static(monster, parts_position_on_screen, opacity_scale)
if break_supported then
if severe_supported then
if not cached_config.filter.health_break_severe then
goto continue;
goto continue
end
else
if not cached_config.filter.health_break then
goto continue;
goto continue
end
end
else
if severe_supported then
if not cached_config.filter.health_severe then
goto continue;
goto continue
end
else
if not cached_config.filter.health then
goto continue;
goto continue
end
end
end
@@ -409,39 +411,42 @@ function body_part.draw_static(monster, parts_position_on_screen, opacity_scale)
if break_supported then
if severe_supported then
if not cached_config.filter.break_severe then
goto continue;
goto continue
end
else
if not cached_config.filter.break_ then
goto continue;
goto continue
end
end
else
if severe_supported then
if not cached_config.filter.severe then
goto continue;
goto continue
end
else
goto continue;
goto continue
end
end
end
if cached_config.settings.hide_undamaged_parts
and ((part.health == part.max_health and part.flinch_count == 0) or not health_supported)
and ((part.break_health == part.break_max_health and part.break_count == 0) or not break_supported)
and ((part.loss_health == part.loss_max_health and not part.is_severed) or not severe_supported) then
goto continue;
and ((part.health == part.max_health and part.flinch_count == 0) or not health_supported)
and ((part.break_health == part.break_max_health and part.break_count == 0) or not break_supported)
and ((part.loss_health == part.loss_max_health and not part.is_severed) or not severe_supported) then
goto continue
end
if (not part.body_part_static_UI.flinch_visibility or not health_supported)
and (not part.body_part_static_UI.break_visibility or not break_supported or part.break_count >= part.break_max_count)
and (not part.body_part_static_UI.loss_visibility or not severe_supported or part.is_severed) then
goto continue;
and
(not part.body_part_static_UI.break_visibility or not break_supported or part.break_count >= part.break_max_count
)
and (not part.body_part_static_UI.loss_visibility or not severe_supported or part.is_severed) then
goto continue
end
if cached_config.settings.time_limit ~= 0 and time.total_elapsed_script_seconds - part.last_change_time > cached_config.settings.time_limit then
goto continue;
if cached_config.settings.time_limit ~= 0 and
time.total_elapsed_script_seconds - part.last_change_time > cached_config.settings.time_limit then
goto continue
end
@@ -570,21 +575,21 @@ function body_part.draw_highlighted(monster, parts_position_on_screen, opacity_s
if break_supported then
if severe_supported then
if not cached_config.filter.health_break_severe then
goto continue;
goto continue
end
else
if not cached_config.filter.health_break then
goto continue;
goto continue
end
end
else
if severe_supported then
if not cached_config.filter.health_severe then
goto continue;
goto continue
end
else
if not cached_config.filter.health then
goto continue;
goto continue
end
end
end
@@ -592,39 +597,42 @@ function body_part.draw_highlighted(monster, parts_position_on_screen, opacity_s
if break_supported then
if severe_supported then
if not cached_config.filter.break_severe then
goto continue;
goto continue
end
else
if not cached_config.filter.break_ then
goto continue;
goto continue
end
end
else
if severe_supported then
if not cached_config.filter.severe then
goto continue;
goto continue
end
else
goto continue;
goto continue
end
end
end
if cached_config.settings.hide_undamaged_parts
and ((part.health == part.max_health and part.flinch_count == 0) or not health_supported)
and ((part.break_health == part.break_max_health and part.break_count == 0) or not break_supported)
and ((part.loss_health == part.loss_max_health and not part.is_severed) or not severe_supported) then
goto continue;
and ((part.health == part.max_health and part.flinch_count == 0) or not health_supported)
and ((part.break_health == part.break_max_health and part.break_count == 0) or not break_supported)
and ((part.loss_health == part.loss_max_health and not part.is_severed) or not severe_supported) then
goto continue
end
if (not part.body_part_highlighted_UI.flinch_visibility or not health_supported)
and (not part.body_part_highlighted_UI.break_visibility or not break_supported or part.break_count >= part.break_max_count)
and (not part.body_part_highlighted_UI.loss_visibility or not severe_supported or part.is_severed) then
goto continue;
and (
not part.body_part_highlighted_UI.break_visibility or not break_supported or part.break_count >= part.break_max_count
)
and (not part.body_part_highlighted_UI.loss_visibility or not severe_supported or part.is_severed) then
goto continue
end
if cached_config.settings.time_limit ~= 0 and time.total_elapsed_script_seconds - part.last_change_time > cached_config.settings.time_limit then
goto continue;
if cached_config.settings.time_limit ~= 0 and
time.total_elapsed_script_seconds - part.last_change_time > cached_config.settings.time_limit then
goto continue
end
table.insert(displayed_parts, part);
@@ -753,4 +761,4 @@ function body_part.init_module()
time = require("MHR_Overlay.Game_Handler.time");
end
return body_part;
return body_part;

View File

@@ -147,7 +147,7 @@ function large_monster.init(monster, enemy)
if enemy_name ~= nil then
monster.name = enemy_name;
end
local set_info = get_set_info_method:call(enemy);
if set_info ~= nil then
local unique_id = get_unique_id_method:call(set_info);
@@ -204,10 +204,14 @@ function large_monster.init_dynamic_UI(monster)
cached_config.health.percentage_label
);
monster.health_dynamic_UI.bar.capture_line.offset.x = monster.health_dynamic_UI.bar.capture_line.offset.x * global_scale_modifier;
monster.health_dynamic_UI.bar.capture_line.offset.y = monster.health_dynamic_UI.bar.capture_line.offset.y * global_scale_modifier;
monster.health_dynamic_UI.bar.capture_line.size.width = monster.health_dynamic_UI.bar.capture_line.size.width * global_scale_modifier;
monster.health_dynamic_UI.bar.capture_line.size.height = monster.health_dynamic_UI.bar.capture_line.size.height * global_scale_modifier;
monster.health_dynamic_UI.bar.capture_line.offset.x = monster.health_dynamic_UI.bar.capture_line.offset.x *
global_scale_modifier;
monster.health_dynamic_UI.bar.capture_line.offset.y = monster.health_dynamic_UI.bar.capture_line.offset.y *
global_scale_modifier;
monster.health_dynamic_UI.bar.capture_line.size.width = monster.health_dynamic_UI.bar.capture_line.size.width *
global_scale_modifier;
monster.health_dynamic_UI.bar.capture_line.size.height = monster.health_dynamic_UI.bar.capture_line.size.height *
global_scale_modifier;
monster.health_dynamic_UI.bar.colors = cached_config.health.bar.normal_colors;
@@ -251,7 +255,7 @@ function large_monster.init_static_UI(monster)
local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
monster.static_name_label = table_helpers.deep_copy(cached_config.monster_name_label);
monster.static_name_label.offset.x = monster.static_name_label.offset.x * global_scale_modifier;
monster.static_name_label.offset.y = monster.static_name_label.offset.y * global_scale_modifier;
@@ -263,10 +267,14 @@ function large_monster.init_static_UI(monster)
cached_config.health.percentage_label
);
monster.health_static_UI.bar.capture_line.offset.x = monster.health_static_UI.bar.capture_line.offset.x * global_scale_modifier;
monster.health_static_UI.bar.capture_line.offset.y = monster.health_static_UI.bar.capture_line.offset.y * global_scale_modifier;
monster.health_static_UI.bar.capture_line.size.width = monster.health_static_UI.bar.capture_line.size.width * global_scale_modifier;
monster.health_static_UI.bar.capture_line.size.height = monster.health_static_UI.bar.capture_line.size.height * global_scale_modifier;
monster.health_static_UI.bar.capture_line.offset.x = monster.health_static_UI.bar.capture_line.offset.x *
global_scale_modifier;
monster.health_static_UI.bar.capture_line.offset.y = monster.health_static_UI.bar.capture_line.offset.y *
global_scale_modifier;
monster.health_static_UI.bar.capture_line.size.width = monster.health_static_UI.bar.capture_line.size.width *
global_scale_modifier;
monster.health_static_UI.bar.capture_line.size.height = monster.health_static_UI.bar.capture_line.size.height *
global_scale_modifier;
monster.health_static_UI.bar.colors = cached_config.health.bar.normal_colors;
@@ -278,7 +286,7 @@ function large_monster.init_static_UI(monster)
cached_config.stamina.percentage_label,
cached_config.stamina.timer_label
);
monster.rage_static_UI = rage_UI_entity.new(
cached_config.rage.visibility,
cached_config.rage.bar,
@@ -287,7 +295,7 @@ function large_monster.init_static_UI(monster)
cached_config.rage.percentage_label,
cached_config.rage.timer_label
);
for REpart, part in pairs(monster.parts) do
body_part.init_static_UI(part);
end
@@ -319,10 +327,14 @@ function large_monster.init_highlighted_UI(monster)
cached_config.health.percentage_label
);
monster.health_highlighted_UI.bar.capture_line.offset.x = monster.health_highlighted_UI.bar.capture_line.offset.x * global_scale_modifier;
monster.health_highlighted_UI.bar.capture_line.offset.y = monster.health_highlighted_UI.bar.capture_line.offset.y * global_scale_modifier;
monster.health_highlighted_UI.bar.capture_line.size.width = monster.health_highlighted_UI.bar.capture_line.size.width * global_scale_modifier;
monster.health_highlighted_UI.bar.capture_line.size.height = monster.health_highlighted_UI.bar.capture_line.size.height * global_scale_modifier;
monster.health_highlighted_UI.bar.capture_line.offset.x = monster.health_highlighted_UI.bar.capture_line.offset.x *
global_scale_modifier;
monster.health_highlighted_UI.bar.capture_line.offset.y = monster.health_highlighted_UI.bar.capture_line.offset.y *
global_scale_modifier;
monster.health_highlighted_UI.bar.capture_line.size.width = monster.health_highlighted_UI.bar.capture_line.size.width *
global_scale_modifier;
monster.health_highlighted_UI.bar.capture_line.size.height = monster.health_highlighted_UI.bar.capture_line.size.height
* global_scale_modifier;
monster.health_highlighted_UI.bar.colors = cached_config.health.bar.normal_colors;
@@ -334,7 +346,7 @@ function large_monster.init_highlighted_UI(monster)
cached_config.stamina.percentage_label,
cached_config.stamina.timer_label
);
monster.rage_highlighted_UI = rage_UI_entity.new(
cached_config.rage.visibility,
cached_config.rage.bar,
@@ -343,7 +355,7 @@ function large_monster.init_highlighted_UI(monster)
cached_config.rage.percentage_label,
cached_config.rage.timer_label
);
for REpart, part in pairs(monster.parts) do
body_part.init_highlighted_UI(part);
end
@@ -402,7 +414,8 @@ local get_mario_player_index_method = mario_param_type:get_method("get_MarioPlay
local get_pos_field = enemy_character_base_type_def:get_method("get_Pos");
function large_monster.update_position(enemy, monster)
if not config.current_config.large_monster_UI.dynamic.enabled and config.current_config.large_monster_UI.static.sorting.type ~= "Distance" then
if not config.current_config.large_monster_UI.dynamic.enabled and
config.current_config.large_monster_UI.static.sorting.type ~= "Distance" then
return;
end
@@ -427,15 +440,15 @@ function large_monster.update_all_riders()
end
end
end
end
function large_monster.update(enemy, monster)
local cached_config = config.current_config.large_monster_UI;
if not cached_config.dynamic.enabled
and not cached_config.static.enabled
and not cached_config.highlighted.enabled then
and not cached_config.static.enabled
and not cached_config.highlighted.enabled then
return;
end
@@ -445,21 +458,21 @@ function large_monster.update(enemy, monster)
monster.is_disp_icon_mini_map = (is_disp_icon_mini_map == nil and false) or is_disp_icon_mini_map;
ailments.update_ailments(enemy, monster);
end
function large_monster.update_health(enemy, monster)
local cached_config = config.current_config.large_monster_UI;
if not cached_config.dynamic.enabled
and not cached_config.static.enabled
and not cached_config.highlighted.enabled then
and not cached_config.static.enabled
and not cached_config.highlighted.enabled then
return;
end
if not cached_config.dynamic.health.visibility
and not cached_config.static.health.visibility
and not cached_config.highlighted.health.visibility then
and not cached_config.static.health.visibility
and not cached_config.highlighted.health.visibility then
return nil;
end
@@ -492,14 +505,14 @@ function large_monster.update_stamina(enemy, monster, stamina_param)
local cached_config = config.current_config.large_monster_UI;
if not cached_config.dynamic.enabled
and not cached_config.static.enabled
and not cached_config.highlighted.enabled then
and not cached_config.static.enabled
and not cached_config.highlighted.enabled then
return;
end
if not cached_config.dynamic.stamina.visibility
and not cached_config.static.stamina.visibility
and not cached_config.highlighted.stamina.visibility then
and not cached_config.static.stamina.visibility
and not cached_config.highlighted.stamina.visibility then
return;
end
@@ -516,11 +529,11 @@ function large_monster.update_stamina(enemy, monster, stamina_param)
monster.is_tired = is_tired;
end
monster.stamina = get_stamina_method:call(stamina_param) or monster.stamina;
monster.max_stamina = get_max_stamina_method:call(stamina_param) or monster.max_stamina;
monster.stamina = get_stamina_method:call(stamina_param) or monster.stamina;
monster.max_stamina = get_max_stamina_method:call(stamina_param) or monster.max_stamina;
monster.missing_stamina = monster.max_stamina - monster.stamina;
if monster.max_stamina ~= 0 then
if monster.max_stamina ~= 0 then
monster.stamina_percentage = monster.stamina / monster.max_stamina;
end
end
@@ -529,14 +542,14 @@ function large_monster.update_stamina_timer(enemy, monster, stamina_param)
local cached_config = config.current_config.large_monster_UI;
if not cached_config.dynamic.enabled
and not cached_config.static.enabled
and not cached_config.highlighted.enabled then
and not cached_config.static.enabled
and not cached_config.highlighted.enabled then
return;
end
if not cached_config.dynamic.stamina.visibility
and not cached_config.static.stamina.visibility
and not cached_config.highlighted.stamina.visibility then
and not cached_config.static.stamina.visibility
and not cached_config.highlighted.stamina.visibility then
return;
end
@@ -576,14 +589,14 @@ function large_monster.update_rage(enemy, monster, anger_param)
local cached_config = config.current_config.large_monster_UI;
if not cached_config.dynamic.enabled
and not cached_config.static.enabled
and not cached_config.highlighted.enabled then
and not cached_config.static.enabled
and not cached_config.highlighted.enabled then
return;
end
if not cached_config.dynamic.rage.visibility
and not cached_config.static.rage.visibility
and not cached_config.highlighted.rage.visibility then
and not cached_config.static.rage.visibility
and not cached_config.highlighted.rage.visibility then
return;
end
@@ -597,8 +610,8 @@ function large_monster.update_rage(enemy, monster, anger_param)
monster.rage_point = get_anger_point_method:call(anger_param) or monster.rage_point;
monster.rage_limit = get_limit_anger_method:call(anger_param)or monster.rage_limit;
monster.rage_limit = get_limit_anger_method:call(anger_param) or monster.rage_limit;
if monster.rage_limit ~= 0 then
monster.rage_percentage = monster.rage_point / monster.rage_limit;
end
@@ -608,14 +621,14 @@ function large_monster.update_rage_timer(enemy, monster, anger_param)
local cached_config = config.current_config.large_monster_UI;
if not cached_config.dynamic.enabled
and not cached_config.static.enabled
and not cached_config.highlighted.enabled then
and not cached_config.static.enabled
and not cached_config.highlighted.enabled then
return;
end
if not cached_config.dynamic.rage.visibility
and not cached_config.static.rage.visibility
and not cached_config.highlighted.rage.visibility then
and not cached_config.static.rage.visibility
and not cached_config.highlighted.rage.visibility then
return;
end
@@ -631,7 +644,7 @@ function large_monster.update_rage_timer(enemy, monster, anger_param)
if is_in_rage ~= nil then
monster.is_in_rage = is_in_rage;
end
monster.rage_timer = get_remaining_anger_time_method:call(anger_param) or monster.rage_timer;
monster.rage_duration = get_total_anger_time_method:call(anger_param) or monster.rage_duration;
@@ -654,26 +667,26 @@ function large_monster.update_parts(enemy, monster, physical_param)
local cached_config = config.current_config.large_monster_UI;
if not cached_config.dynamic.enabled
and not cached_config.static.enabled
and not cached_config.highlighted.enabled then
and not cached_config.static.enabled
and not cached_config.highlighted.enabled then
return;
end
if not cached_config.dynamic.body_parts.visibility
and not cached_config.static.body_parts.visibility
and not cached_config.highlighted.body_parts.visibility then
and not cached_config.static.body_parts.visibility
and not cached_config.highlighted.body_parts.visibility then
return;
end
if not cached_config.dynamic.body_parts.part_health.visibility
and not cached_config.dynamic.body_parts.part_break.visibility
and not cached_config.dynamic.body_parts.part_loss.visibility
and not cached_config.static.body_parts.part_health.visibility
and not cached_config.static.body_parts.part_break.visibility
and not cached_config.static.body_parts.part_loss.visibility
and not cached_config.highlighted.body_parts.part_health.visibility
and not cached_config.highlighted.body_parts.part_break.visibility
and not cached_config.highlighted.body_parts.part_loss.visibility then
and not cached_config.dynamic.body_parts.part_break.visibility
and not cached_config.dynamic.body_parts.part_loss.visibility
and not cached_config.static.body_parts.part_health.visibility
and not cached_config.static.body_parts.part_break.visibility
and not cached_config.static.body_parts.part_loss.visibility
and not cached_config.highlighted.body_parts.part_health.visibility
and not cached_config.highlighted.body_parts.part_break.visibility
and not cached_config.highlighted.body_parts.part_loss.visibility then
return;
end
@@ -708,34 +721,34 @@ function large_monster.update_parts(enemy, monster, physical_param)
local part_id = 1;
for i = 0, enemy_parts_info_array_size - 1 do
local enemy_parts_info = enemy_parts_info_array[i];
local part = monster.parts[part_id];
if part == nil then
local part_name = part_names.get_part_name(monster.id, part_id);
if part_name == nil then
goto continue;
goto continue
else
part = body_part.new(part_id, part_name);
monster.parts[part_id] = part;
end
end
if cached_config.dynamic.body_parts.part_health.visibility
or cached_config.static.body_parts.part_health.visibility
or cached_config.highlighted.body_parts.part_health.visibility then
or cached_config.static.body_parts.part_health.visibility
or cached_config.highlighted.body_parts.part_health.visibility then
local part_vital = physical_param:call("getVital", 1, i);
if part_vital ~= nil then
local part_current = part_vital:call("get_Current") or -1;
local part_max = part_vital:call("get_Max") or -1;
body_part.update_flinch(part, part_current, part_max);
end
end
if cached_config.dynamic.body_parts.part_break.visibility
or cached_config.static.body_parts.part_break.visibility
or cached_config.highlighted.body_parts.part_break.visibility then
or cached_config.static.body_parts.part_break.visibility
or cached_config.highlighted.body_parts.part_break.visibility then
local part_break_vital = physical_param:call("getVital", 2, i);
if part_break_vital ~= nil then
local part_break_current = part_break_vital:call("get_Current") or -1;
@@ -747,14 +760,14 @@ function large_monster.update_parts(enemy, monster, physical_param)
part_break_count = enemy_parts_info:call("get_PartsBreakDamageLevel") or part_break_count;
part_break_max_count = enemy_parts_info:call("get_PartsBreakDamageMaxLevel") or part_break_max_count;
end
body_part.update_break(part, part_break_current, part_break_max, part_break_count, part_break_max_count)
end
end
if cached_config.dynamic.body_parts.part_loss.visibility
or cached_config.static.body_parts.part_loss.visibility
or cached_config.highlighted.body_parts.part_loss.visibility then
or cached_config.static.body_parts.part_loss.visibility
or cached_config.highlighted.body_parts.part_loss.visibility then
local part_loss_vital = physical_param:call("getVital", 3, i);
if part_loss_vital ~= nil then
local part_loss_current = part_loss_vital:call("get_Current") or -1;
@@ -767,11 +780,11 @@ function large_monster.update_parts(enemy, monster, physical_param)
is_severed = _is_severed;
end
end
body_part.update_loss(part, part_loss_current, part_loss_max, is_severed)
end
end
part_id = part_id + 1;
::continue::
end
@@ -799,7 +812,7 @@ function large_monster.draw_dynamic(monster, position_on_screen, opacity_scale)
if cached_config.monster_name_label.include.scrown_thresholds then
monster_name_text = monster_name_text .. string.format("<=%.0f >=%.0f >=%.0f", 100 * monster.small_border,
100 * monster.big_border, 100 * monster.king_border);
100 * monster.big_border, 100 * monster.king_border);
end
if monster.health < monster.capture_health then
@@ -839,21 +852,26 @@ function large_monster.draw_dynamic(monster, position_on_screen, opacity_scale)
x = position_on_screen.x + cached_config.ailment_buildups.offset.x * global_scale_modifier,
y = position_on_screen.y + cached_config.ailment_buildups.offset.y * global_scale_modifier
};
health_UI_entity.draw(monster, monster.health_dynamic_UI, health_position_on_screen, opacity_scale);
drawing.draw_capture_line(monster.health_dynamic_UI, health_position_on_screen, opacity_scale, monster.capture_percentage);
drawing.draw_capture_line(monster.health_dynamic_UI, health_position_on_screen, opacity_scale,
monster.capture_percentage);
stamina_UI_entity.draw(monster, monster.stamina_dynamic_UI, stamina_position_on_screen, opacity_scale);
rage_UI_entity.draw(monster, monster.rage_dynamic_UI, rage_position_on_screen, opacity_scale);
local last_part_position_on_screen = body_part.draw_dynamic(monster, parts_position_on_screen, opacity_scale);
local last_part_position_on_screen = body_part.draw_dynamic(monster,
parts_position_on_screen
, opacity_scale);
if cached_config.ailments.settings.offset_is_relative_to_parts then
if last_part_position_on_screen ~= nil then
ailments_position_on_screen = {
x = last_part_position_on_screen.x + config.current_config.large_monster_UI.highlighted.ailments.relative_offset.x * global_scale_modifier,
y = last_part_position_on_screen.y + config.current_config.large_monster_UI.highlighted.ailments.relative_offset.y * global_scale_modifier
x = last_part_position_on_screen.x +
config.current_config.large_monster_UI.highlighted.ailments.relative_offset.x * global_scale_modifier,
y = last_part_position_on_screen.y +
config.current_config.large_monster_UI.highlighted.ailments.relative_offset.y * global_scale_modifier
};
end
end
@@ -884,7 +902,7 @@ function large_monster.draw_static(monster, position_on_screen, opacity_scale)
if cached_config.monster_name_label.include.scrown_thresholds then
monster_name_text = monster_name_text .. string.format("<=%.0f >=%.0f >=%.0f", 100 * monster.small_border,
100 * monster.big_border, 100 * monster.king_border);
100 * monster.big_border, 100 * monster.king_border);
end
if monster.health < monster.capture_health then
@@ -932,7 +950,9 @@ function large_monster.draw_static(monster, position_on_screen, opacity_scale)
stamina_UI_entity.draw(monster, monster.stamina_static_UI, stamina_position_on_screen, opacity_scale);
rage_UI_entity.draw(monster, monster.rage_static_UI, rage_position_on_screen, opacity_scale);
local last_part_position_on_screen = body_part.draw_static(monster, parts_position_on_screen, opacity_scale);
local last_part_position_on_screen = body_part.draw_static(monster,
parts_position_on_screen
, opacity_scale);
if cached_config.ailments.settings.offset_is_relative_to_parts then
if last_part_position_on_screen ~= nil then
@@ -969,7 +989,7 @@ function large_monster.draw_highlighted(monster, position_on_screen, opacity_sca
if cached_config.monster_name_label.include.scrown_thresholds then
monster_name_text = monster_name_text .. string.format("<=%.0f >=%.0f >=%.0f", 100 * monster.small_border,
100 * monster.big_border, 100 * monster.king_border);
100 * monster.big_border, 100 * monster.king_border);
end
if monster.health < monster.capture_health then
@@ -1011,12 +1031,15 @@ function large_monster.draw_highlighted(monster, position_on_screen, opacity_sca
};
health_UI_entity.draw(monster, monster.health_highlighted_UI, health_position_on_screen, opacity_scale);
drawing.draw_capture_line(monster.health_highlighted_UI, health_position_on_screen, opacity_scale, monster.capture_percentage);
drawing.draw_capture_line(monster.health_highlighted_UI, health_position_on_screen, opacity_scale,
monster.capture_percentage);
stamina_UI_entity.draw(monster, monster.stamina_highlighted_UI, stamina_position_on_screen, opacity_scale);
rage_UI_entity.draw(monster, monster.rage_highlighted_UI, rage_position_on_screen, opacity_scale);
local last_part_position_on_screen = body_part.draw_highlighted(monster, parts_position_on_screen, opacity_scale);
local last_part_position_on_screen = body_part.draw_highlighted(monster,
parts_position_on_screen
, opacity_scale);
if cached_config.ailments.settings.offset_is_relative_to_parts then
if last_part_position_on_screen ~= nil then
@@ -1031,7 +1054,7 @@ function large_monster.draw_highlighted(monster, position_on_screen, opacity_sca
ailment_buildup.draw_highlighted(monster, ailment_buildups_position_on_screen, opacity_scale);
end
function large_monster.init_list()
function large_monster.init_list()
large_monster.list = {};
end
@@ -1056,4 +1079,4 @@ function large_monster.init_module()
ailment_buildup = require("MHR_Overlay.Monsters.ailment_buildup");
end
return large_monster;
return large_monster;

View File

@@ -37,19 +37,19 @@ local updates_this_tick = 0;
-- the reason for this is that the hooks on all the monsters' update functions
-- causes a HUGE performance hit (adds ~3+ ms to UpdateBehavior and frame time)
re.on_pre_application_entry("UpdateBehavior", function()
tick_count = tick_count + 1;
tick_count = tick_count + 1;
updates_this_tick = 0;
if num_known_monsters ~= 0 and num_updated_monsters >= num_known_monsters or tick_count >= num_known_monsters * 2 then
recorded_monsters = {};
updated_monsters = {};
if num_known_monsters ~= 0 and num_updated_monsters >= num_known_monsters or tick_count >= num_known_monsters * 2 then
recorded_monsters = {};
updated_monsters = {};
known_big_monsters = {};
last_update_tick = 0;
tick_count = 0;
num_known_monsters = 0;
num_updated_monsters = 0;
last_update_tick = 0;
tick_count = 0;
num_known_monsters = 0;
num_updated_monsters = 0;
updates_this_tick = 0;
end
end
end)
function monster_hook.update_monster(enemy)
@@ -57,10 +57,10 @@ function monster_hook.update_monster(enemy)
return;
end
if not recorded_monsters[enemy] then
num_known_monsters = num_known_monsters + 1;
recorded_monsters[enemy] = true;
end
if not recorded_monsters[enemy] then
num_known_monsters = num_known_monsters + 1;
recorded_monsters[enemy] = true;
end
-- saves on a method call.
if not known_big_monsters[enemy] then
@@ -83,8 +83,8 @@ function monster_hook.update_large_monster(enemy)
local cached_config = config.current_config.large_monster_UI;
if not cached_config.dynamic.enabled and
not cached_config.static.enabled and
not cached_config.highlighted.enabled then
not cached_config.static.enabled and
not cached_config.highlighted.enabled then
return;
end
@@ -101,7 +101,8 @@ function monster_hook.update_large_monster(enemy)
-- is it old tick?
-- is update limit reached?
if tick_count == last_update_tick and updates_this_tick >= config.current_config.global_settings.performance.max_monster_updates_per_tick then
if tick_count == last_update_tick and
updates_this_tick >= config.current_config.global_settings.performance.max_monster_updates_per_tick then
return;
end
@@ -142,7 +143,8 @@ function monster_hook.update_small_monster(enemy)
-- is it old tick?
-- is update limit reached?
if tick_count == last_update_tick and updates_this_tick >= config.current_config.global_settings.performance.max_monster_updates_per_tick then
if tick_count == last_update_tick and
updates_this_tick >= config.current_config.global_settings.performance.max_monster_updates_per_tick then
return;
end
@@ -171,10 +173,10 @@ function monster_hook.update_health(enemy_damage_stock_param)
if is_large == nil then
return;
end
if is_large then
local monster = large_monster.get_monster(enemy);
local physical_param = large_monster.update_health(enemy, monster);
large_monster.update_parts(enemy, monster, physical_param);
@@ -244,10 +246,11 @@ function monster_hook.init_module()
end);
sdk.hook(anger_add_method, function(args)
pcall(monster_hook.update_rage, sdk.to_managed_object(args[2]), sdk.to_float(args[3]), sdk.to_managed_object(args[4]));
pcall(monster_hook.update_rage, sdk.to_managed_object(args[2]), sdk.to_float(args[3]),
sdk.to_managed_object(args[4]));
end, function(retval)
return retval;
end);
end
return monster_hook;
return monster_hook;

View File

@@ -29,7 +29,7 @@ function small_monster.new(enemy)
monster.name = "Small Monster";
monster.ailments = ailments.init_ailments();
small_monster.init(monster, enemy);
small_monster.init_UI(monster);
@@ -118,7 +118,7 @@ local get_pos_field = enemy_character_base_type_def:get_method("get_Pos");
function small_monster.update_position(enemy, monster)
local cached_config = config.current_config.small_monster_UI;
if not cached_config.enabled then
return;
end
@@ -197,7 +197,7 @@ function small_monster.draw(monster, position_on_screen, opacity_scale)
ailment_buildup.draw_small(monster, ailment_buildups_position_on_screen, opacity_scale);
end
function small_monster.init_list()
function small_monster.init_list()
small_monster.list = {};
end
@@ -215,4 +215,4 @@ function small_monster.init_module()
ailment_buildup = require("MHR_Overlay.Monsters.ailment_buildup");
end
return small_monster;
return small_monster;

View File

@@ -34,7 +34,7 @@ function damage_meter_UI.get_players(player_info_list)
local quest_players = {};
local count = get_count_method:call(player_info_list);
if count == nil then
customization_menu.status = "No player info list count";
return {};
@@ -44,18 +44,18 @@ function damage_meter_UI.get_players(player_info_list)
local player_info = get_item_method:call(player_info_list, i);
if player_info == nil then
goto continue;
goto continue
end
local player_id = member_index_field:get_data(player_info);
if player_id == nil then
goto continue;
goto continue
end
local _player = player.get_player(player_id);
if _player ~= nil then
if _player == player.myself and cached_config.settings.my_damage_bar_location ~= "Normal" then
goto continue;
goto continue
end
table.insert(quest_players, _player);
end
@@ -128,7 +128,7 @@ function damage_meter_UI.draw()
end
damage_meter_UI.last_displayed_players = quest_players;
end
local top_damage = 0;
local top_dps = 0;
for _, _player in ipairs(quest_players) do
@@ -140,20 +140,20 @@ function damage_meter_UI.draw()
top_dps = _player.dps;
end
end
-- draw
local position_on_screen = screen.calculate_absolute_coordinates(cached_config.position);
for _, _player in ipairs(quest_players) do
if _player.display.total_damage == 0 and cached_config.settings.hide_player_if_player_damage_is_zero then
goto continue;
goto continue
end
if _player == player.myself then
if cached_config.settings.hide_myself then
goto continue;
goto continue
end
elseif cached_config.settings.hide_other_players then
goto continue;
goto continue
end
player.draw(_player, position_on_screen, 1, top_damage, top_dps);
@@ -195,4 +195,4 @@ function damage_meter_UI.init_module()
language = require("MHR_Overlay.Misc.language");
end
return damage_meter_UI;
return damage_meter_UI;

View File

@@ -23,35 +23,36 @@ function env_creature_UI.draw()
local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
for REcreature, creature in pairs(env_creature.list) do
if cached_config.settings.max_distance == 0 then
break;
break
end
if cached_config.settings.hide_inactive_creatures and creature.is_inactive then
goto continue;
goto continue
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);
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);
if position_on_screen == nil then
goto continue;
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;
creature.distance = (player.myself_position - creature.position):length();
local opacity_scale = 1;
if creature.distance > cached_config.settings.max_distance then
goto continue;
goto continue
end
if cached_config.settings.opacity_falloff then
opacity_scale = 1 - (creature.distance / cached_config.settings.max_distance);
end
@@ -61,7 +62,6 @@ function env_creature_UI.draw()
end
end
function env_creature_UI.init_module()
singletons = require("MHR_Overlay.Game_Handler.singletons");
config = require("MHR_Overlay.Misc.config");
@@ -77,4 +77,4 @@ function env_creature_UI.init_module()
env_creature = require("MHR_Overlay.Endemic_Life.env_creature");
end
return env_creature_UI;
return env_creature_UI;

View File

@@ -25,7 +25,7 @@ function large_monster_UI.draw(dynamic_enabled, static_enabled, highlighted_enab
if singletons.enemy_manager == nil then
return;
end
local displayed_monsters = {};
local highlighted_id = -1;
@@ -43,7 +43,7 @@ function large_monster_UI.draw(dynamic_enabled, static_enabled, highlighted_enab
end
end
local enemy_count = get_boss_enemy_count_method:call(singletons.enemy_manager);
if enemy_count == nil then
return;
@@ -53,13 +53,13 @@ function large_monster_UI.draw(dynamic_enabled, static_enabled, highlighted_enab
local enemy = get_boss_enemy_method:call(singletons.enemy_manager, i);
if enemy == nil then
customization_menu.status = "No enemy";
goto continue;
goto continue
end
local monster = large_monster.list[enemy];
if monster == nil then
customization_menu.status = "No monster hp entry";
goto continue;
goto continue
end
if monster.dead_or_captured or not monster.is_disp_icon_mini_map then
@@ -79,7 +79,7 @@ function large_monster_UI.draw(dynamic_enabled, static_enabled, highlighted_enab
end
if dynamic_enabled then
large_monster_UI.draw_dynamic(displayed_monsters, highlighted_monster);
--large_monster_UI.draw_dynamic(displayed_monsters, highlighted_monster);
end
if highlighted_enabled then
@@ -87,7 +87,7 @@ function large_monster_UI.draw(dynamic_enabled, static_enabled, highlighted_enab
end
if static_enabled then
large_monster_UI.draw_static(displayed_monsters, highlighted_monster);
--large_monster_UI.draw_static(displayed_monsters, highlighted_monster);
end
end
@@ -98,45 +98,46 @@ function large_monster_UI.draw_dynamic(displayed_monsters, highlighted_monster)
local i = 0;
for _, monster in ipairs(displayed_monsters) do
if cached_config.settings.max_distance == 0 then
break;
break
end
if monster.dead_or_captured and cached_config.settings.hide_dead_or_captured then
goto continue;
goto continue
end
if monster == highlighted_monster then
if not cached_config.settings.render_highlighted_monster then
goto continue;
goto continue
end
else
if not cached_config.settings.render_not_highlighted_monsters then
goto continue;
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);
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;
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;
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;
@@ -147,14 +148,14 @@ end
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
if cached_config.sorting.type == "Normal" and cached_config.sorting.reversed_order then
local reversed_monsters = {};
for i = #displayed_monsters, 1, -1 do
table.insert(reversed_monsters, displayed_monsters[i]);
end
displayed_monsters = reversed_monsters;
elseif cached_config.sorting.type == "Health" then
@@ -194,16 +195,16 @@ function large_monster_UI.draw_static(displayed_monsters, highlighted_monster)
local i = 0;
for _, monster in ipairs(displayed_monsters) do
if monster.dead_or_captured and cached_config.settings.hide_dead_or_captured then
goto continue;
goto continue
end
if monster == highlighted_monster then
if not cached_config.settings.render_highlighted_monster then
goto continue;
goto continue
end
else
if not cached_config.settings.render_not_highlighted_monsters then
goto continue;
goto continue
end
end
@@ -211,11 +212,11 @@ function large_monster_UI.draw_static(displayed_monsters, highlighted_monster)
x = position_on_screen.x,
y = position_on_screen.y
}
if cached_config.settings.orientation == "Horizontal" then
monster_position_on_screen.x = monster_position_on_screen.x + cached_config.spacing.x * i * global_scale_modifier;
else
monster_position_on_screen.y = monster_position_on_screen.y + cached_config.spacing.y * i * global_scale_modifier;
monster_position_on_screen.y = monster_position_on_screen.y + cached_config.spacing.y * i * global_scale_modifier;
end
large_monster.draw_static(monster, monster_position_on_screen, 1);
@@ -231,13 +232,13 @@ function large_monster_UI.draw_highlighted(monster)
if monster == nil then
return;
end
local position_on_screen = screen.calculate_absolute_coordinates(cached_config.position);
if monster.dead_or_captured and cached_config.settings.hide_dead_or_captured then
return;
end
large_monster.draw_highlighted(monster, position_on_screen, 1);
end
@@ -255,4 +256,4 @@ function large_monster_UI.init_module()
rage_UI_entity = require("MHR_Overlay.UI.UI_Entities.rage_UI_entity");
end
return large_monster_UI;
return large_monster_UI;

View File

@@ -33,17 +33,17 @@ function small_monster_UI.draw()
local enemy = get_zako_enemy_method:call(singletons.enemy_manager, i);
if enemy == nil then
customization_menu.status = "No enemy";
goto continue;
goto continue
end
local monster = small_monster.list[enemy];
if monster == nil then
customization_menu.status = "No monster hp entry";
goto continue;
goto continue
end
if monster.dead_or_captured and cached_config.settings.hide_dead_or_captured then
goto continue;
goto continue
end
table.insert(displayed_monsters, monster);
@@ -51,7 +51,7 @@ function small_monster_UI.draw()
end
if cached_config.dynamic_positioning.enabled
or (not cached_config.dynamic_positioning.enabled and cached_config.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
monster.distance = (player.myself_position - monster.position):length();
end
@@ -99,13 +99,15 @@ function small_monster_UI.draw()
end
end
end
local i = 0;
for _, monster in ipairs(displayed_monsters) do
local position_on_screen;
if cached_config.dynamic_positioning.enabled then
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);
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);
@@ -125,9 +127,9 @@ function small_monster_UI.draw()
end
end
local opacity_scale = 1;
if cached_config.dynamic_positioning.enabled then
if cached_config.dynamic_positioning.max_distance == 0 then
@@ -135,9 +137,9 @@ function small_monster_UI.draw()
end
if monster.distance > cached_config.dynamic_positioning.max_distance then
goto continue;
goto continue
end
if cached_config.dynamic_positioning.opacity_falloff then
opacity_scale = 1 - (monster.distance / cached_config.dynamic_positioning.max_distance);
end
@@ -146,7 +148,7 @@ function small_monster_UI.draw()
small_monster.draw(monster, position_on_screen, opacity_scale);
i = i + 1;
::continue::
end
@@ -165,4 +167,4 @@ function small_monster_UI.init_module()
stamina_UI_entity = require("MHR_Overlay.UI.UI_Entities.stamina_UI_entity");
end
return small_monster_UI;
return small_monster_UI;

View File

@@ -16,8 +16,8 @@ function time_UI.draw()
end
local position_on_screen = screen.calculate_absolute_coordinates(config.current_config.time_UI.position);
drawing.draw_label(time_UI.label , position_on_screen, 1, elapsed_minutes, elapsed_seconds);
drawing.draw_label(time_UI.label, position_on_screen, 1, elapsed_minutes, elapsed_seconds);
end
function time_UI.init_UI()
@@ -39,4 +39,4 @@ function time_UI.init_module()
time_UI.init_UI()
end
return time_UI;
return time_UI;

View File

@@ -21,6 +21,8 @@ function ailment_UI_entity.new(visibility, bar, name_label, text_label, value_la
entity.bar.offset.y = entity.bar.offset.y * global_scale_modifier;
entity.bar.size.width = entity.bar.size.width * global_scale_modifier;
entity.bar.size.height = entity.bar.size.height * global_scale_modifier;
entity.bar.outline.thickness = entity.bar.outline.thickness * global_scale_modifier;
entity.bar.outline.offset = entity.bar.outline.offset * 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 * global_scale_modifier;
@@ -57,16 +59,18 @@ function ailment_UI_entity.draw_dynamic(ailment, ailment_UI, position_on_screen,
if ailment.is_active then
drawing.draw_bar(ailment_UI.bar, position_on_screen, opacity_scale, ailment.timer_percentage);
drawing.draw_label(ailment_UI.name_label, position_on_screen, opacity_scale, ailment_name);
drawing.draw_label(ailment_UI.text_label, position_on_screen, opacity_scale, language.current_language.UI.buildup);
drawing.draw_label(ailment_UI.timer_label, position_on_screen, opacity_scale, ailment.minutes_left, ailment.seconds_left);
drawing.draw_label(ailment_UI.timer_label, position_on_screen, opacity_scale, ailment.minutes_left,
ailment.seconds_left);
else
drawing.draw_bar(ailment_UI.bar, position_on_screen, opacity_scale, ailment.buildup_percentage);
drawing.draw_label(ailment_UI.name_label, position_on_screen, opacity_scale, ailment_name);
drawing.draw_label(ailment_UI.text_label, position_on_screen, opacity_scale, language.current_language.UI.buildup);
drawing.draw_label(ailment_UI.value_label, position_on_screen, opacity_scale, ailment.total_buildup, ailment.buildup_limit);
drawing.draw_label(ailment_UI.value_label, position_on_screen, opacity_scale, ailment.total_buildup,
ailment.buildup_limit);
drawing.draw_label(ailment_UI.percentage_label, position_on_screen, opacity_scale, 100 * ailment.buildup_percentage);
end
end
@@ -88,16 +92,18 @@ function ailment_UI_entity.draw_static(ailment, ailment_UI, position_on_screen,
if ailment.is_active then
drawing.draw_bar(ailment_UI.bar, position_on_screen, opacity_scale, ailment.timer_percentage);
drawing.draw_label(ailment_UI.name_label, position_on_screen, opacity_scale, ailment_name);
drawing.draw_label(ailment_UI.text_label, position_on_screen, opacity_scale, language.current_language.UI.buildup);
drawing.draw_label(ailment_UI.timer_label, position_on_screen, opacity_scale, ailment.minutes_left, ailment.seconds_left);
drawing.draw_label(ailment_UI.timer_label, position_on_screen, opacity_scale, ailment.minutes_left,
ailment.seconds_left);
else
drawing.draw_bar(ailment_UI.bar, position_on_screen, opacity_scale, ailment.buildup_percentage);
drawing.draw_label(ailment_UI.name_label, position_on_screen, opacity_scale, ailment_name);
drawing.draw_label(ailment_UI.text_label, position_on_screen, opacity_scale, language.current_language.UI.buildup);
drawing.draw_label(ailment_UI.value_label, position_on_screen, opacity_scale, ailment.total_buildup, ailment.buildup_limit);
drawing.draw_label(ailment_UI.value_label, position_on_screen, opacity_scale, ailment.total_buildup,
ailment.buildup_limit);
drawing.draw_label(ailment_UI.percentage_label, position_on_screen, opacity_scale, 100 * ailment.buildup_percentage);
end
end
@@ -119,16 +125,18 @@ function ailment_UI_entity.draw_highlighted(ailment, ailment_UI, position_on_scr
if ailment.is_active then
drawing.draw_bar(ailment_UI.bar, position_on_screen, opacity_scale, ailment.timer_percentage);
drawing.draw_label(ailment_UI.name_label, position_on_screen, opacity_scale, ailment_name);
drawing.draw_label(ailment_UI.text_label, position_on_screen, opacity_scale, language.current_language.UI.buildup);
drawing.draw_label(ailment_UI.timer_label, position_on_screen, opacity_scale, ailment.minutes_left, ailment.seconds_left);
drawing.draw_label(ailment_UI.timer_label, position_on_screen, opacity_scale, ailment.minutes_left,
ailment.seconds_left);
else
drawing.draw_bar(ailment_UI.bar, position_on_screen, opacity_scale, ailment.buildup_percentage);
drawing.draw_label(ailment_UI.name_label, position_on_screen, opacity_scale, ailment_name);
drawing.draw_label(ailment_UI.text_label, position_on_screen, opacity_scale, language.current_language.UI.buildup);
drawing.draw_label(ailment_UI.value_label, position_on_screen, opacity_scale, ailment.total_buildup, ailment.buildup_limit);
drawing.draw_label(ailment_UI.value_label, position_on_screen, opacity_scale, ailment.total_buildup,
ailment.buildup_limit);
drawing.draw_label(ailment_UI.percentage_label, position_on_screen, opacity_scale, 100 * ailment.buildup_percentage);
end
end
@@ -150,16 +158,18 @@ function ailment_UI_entity.draw_small(ailment, ailment_UI, position_on_screen, o
if ailment.is_active then
drawing.draw_bar(ailment_UI.bar, position_on_screen, opacity_scale, ailment.timer_percentage);
drawing.draw_label(ailment_UI.name_label, position_on_screen, opacity_scale, ailment_name);
drawing.draw_label(ailment_UI.text_label, position_on_screen, opacity_scale, language.current_language.UI.buildup);
drawing.draw_label(ailment_UI.timer_label, position_on_screen, opacity_scale, ailment.minutes_left, ailment.seconds_left);
drawing.draw_label(ailment_UI.timer_label, position_on_screen, opacity_scale, ailment.minutes_left,
ailment.seconds_left);
else
drawing.draw_bar(ailment_UI.bar, position_on_screen, opacity_scale, ailment.buildup_percentage);
drawing.draw_label(ailment_UI.name_label, position_on_screen, opacity_scale, ailment_name);
drawing.draw_label(ailment_UI.text_label, position_on_screen, opacity_scale, language.current_language.UI.buildup);
drawing.draw_label(ailment_UI.value_label, position_on_screen, opacity_scale, ailment.total_buildup, ailment.buildup_limit);
drawing.draw_label(ailment_UI.value_label, position_on_screen, opacity_scale, ailment.total_buildup,
ailment.buildup_limit);
drawing.draw_label(ailment_UI.percentage_label, position_on_screen, opacity_scale, 100 * ailment.buildup_percentage);
end
end
@@ -171,4 +181,4 @@ function ailment_UI_entity.init_module()
language = require("MHR_Overlay.Misc.language");
end
return ailment_UI_entity;
return ailment_UI_entity;

View File

@@ -5,7 +5,9 @@ local config;
local player;
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 global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
@@ -24,11 +26,16 @@ function ailment_buildup_UI_entity.new(buildup_bar, highlighted_buildup_bar, ail
entity.buildup_bar.offset.y = entity.buildup_bar.offset.y * 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 * global_scale_modifier;
entity.buildup_bar.outline.thickness = entity.buildup_bar.outline.thickness * global_scale_modifier;
entity.buildup_bar.outline.offset = entity.buildup_bar.outline.offset * 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 * 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 * global_scale_modifier;
entity.highlighted_buildup_bar.outline.thickness = entity.highlighted_buildup_bar.outline.thickness *
global_scale_modifier;
entity.highlighted_buildup_bar.outline.offset = entity.highlighted_buildup_bar.outline.offset * 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 * global_scale_modifier;
@@ -48,12 +55,13 @@ function ailment_buildup_UI_entity.new(buildup_bar, highlighted_buildup_bar, ail
return entity;
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;
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
if top_buildup ~= 0 then
player_buildup_bar_percentage = _player.buildup / top_buildup;
@@ -61,24 +69,29 @@ function ailment_buildup_UI_entity.draw_dynamic(_player, ailment_buildup_UI, pos
end
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 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
drawing.draw_bar(ailment_buildup_UI.buildup_bar, position_on_screen, opacity_scale, player_buildup_bar_percentage);
end
drawing.draw_label(ailment_buildup_UI.player_name_label, position_on_screen, opacity_scale, player.get_player(_player.id).name);
drawing.draw_label(ailment_buildup_UI.player_name_label, position_on_screen, opacity_scale,
player.get_player(_player.id).name);
drawing.draw_label(ailment_buildup_UI.buildup_value_label, position_on_screen, opacity_scale, _player.buildup);
drawing.draw_label(ailment_buildup_UI.buildup_percentage_label, position_on_screen, opacity_scale, 100 * _player.buildup_share);
drawing.draw_label(ailment_buildup_UI.buildup_percentage_label, position_on_screen, opacity_scale,
100 * _player.buildup_share);
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;
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
if top_buildup ~= 0 then
player_buildup_bar_percentage = _player.buildup / top_buildup;
@@ -86,24 +99,29 @@ function ailment_buildup_UI_entity.draw_static(_player, ailment_buildup_UI, posi
end
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 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
drawing.draw_bar(ailment_buildup_UI.buildup_bar, position_on_screen, opacity_scale, player_buildup_bar_percentage);
end
drawing.draw_label(ailment_buildup_UI.player_name_label, position_on_screen, opacity_scale, player.get_player(_player.id).name);
drawing.draw_label(ailment_buildup_UI.player_name_label, position_on_screen, opacity_scale,
player.get_player(_player.id).name);
drawing.draw_label(ailment_buildup_UI.buildup_value_label, position_on_screen, opacity_scale, _player.buildup);
drawing.draw_label(ailment_buildup_UI.buildup_percentage_label, position_on_screen, opacity_scale, 100 * _player.buildup_share);
drawing.draw_label(ailment_buildup_UI.buildup_percentage_label, position_on_screen, opacity_scale,
100 * _player.buildup_share);
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;
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
if top_buildup ~= 0 then
player_buildup_bar_percentage = _player.buildup / top_buildup;
@@ -111,24 +129,28 @@ function ailment_buildup_UI_entity.draw_highlighted(_player, ailment_buildup_UI,
end
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 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
drawing.draw_bar(ailment_buildup_UI.buildup_bar, position_on_screen, opacity_scale, player_buildup_bar_percentage);
end
drawing.draw_label(ailment_buildup_UI.player_name_label, position_on_screen, opacity_scale, player.get_player(_player.id).name);
drawing.draw_label(ailment_buildup_UI.player_name_label, position_on_screen, opacity_scale,
player.get_player(_player.id).name);
drawing.draw_label(ailment_buildup_UI.buildup_value_label, position_on_screen, opacity_scale, _player.buildup);
drawing.draw_label(ailment_buildup_UI.buildup_percentage_label, position_on_screen, opacity_scale, 100 * _player.buildup_share);
drawing.draw_label(ailment_buildup_UI.buildup_percentage_label, position_on_screen, opacity_scale,
100 * _player.buildup_share);
end
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;
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
if top_buildup ~= 0 then
player_buildup_bar_percentage = _player.buildup / top_buildup;
@@ -136,16 +158,20 @@ function ailment_buildup_UI_entity.draw_small(_player, ailment_buildup_UI, posit
end
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 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
drawing.draw_bar(ailment_buildup_UI.buildup_bar, position_on_screen, opacity_scale, player_buildup_bar_percentage);
end
drawing.draw_label(ailment_buildup_UI.player_name_label, position_on_screen, opacity_scale, player.get_player(_player.id).name);
drawing.draw_label(ailment_buildup_UI.player_name_label, position_on_screen, opacity_scale,
player.get_player(_player.id).name);
drawing.draw_label(ailment_buildup_UI.buildup_value_label, position_on_screen, opacity_scale, _player.buildup);
drawing.draw_label(ailment_buildup_UI.buildup_percentage_label, position_on_screen, opacity_scale, 100 * _player.buildup_share);
drawing.draw_label(ailment_buildup_UI.buildup_percentage_label, position_on_screen, opacity_scale,
100 * _player.buildup_share);
end
function ailment_buildup_UI_entity.init_module()
@@ -156,4 +182,4 @@ function ailment_buildup_UI_entity.init_module()
language = require("MHR_Overlay.Misc.language");
end
return ailment_buildup_UI_entity;
return ailment_buildup_UI_entity;

View File

@@ -4,9 +4,12 @@ local table_helpers;
local drawing;
function body_part_UI_entity.new(part_visibility, part_name_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,
loss_visibility, loss_bar, loss_text_label, loss_value_label, loss_health_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
,
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;
@@ -31,6 +34,8 @@ function body_part_UI_entity.new(part_visibility, part_name_label,
entity.flinch_bar.offset.y = entity.flinch_bar.offset.y * 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 * global_scale_modifier;
entity.flinch_bar.outline.thickness = entity.flinch_bar.outline.thickness * global_scale_modifier;
entity.flinch_bar.outline.offset = entity.flinch_bar.outline.offset * 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 * global_scale_modifier;
@@ -50,6 +55,8 @@ function body_part_UI_entity.new(part_visibility, part_name_label,
entity.break_bar.offset.y = entity.break_bar.offset.y * 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 * global_scale_modifier;
entity.break_bar.outline.thickness = entity.break_bar.outline.thickness * global_scale_modifier;
entity.break_bar.outline.offset = entity.break_bar.outline.offset * 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 * global_scale_modifier;
@@ -69,6 +76,8 @@ function body_part_UI_entity.new(part_visibility, part_name_label,
entity.loss_bar.offset.y = entity.loss_bar.offset.y * 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 * global_scale_modifier;
entity.loss_bar.outline.thickness = entity.loss_bar.outline.thickness * global_scale_modifier;
entity.loss_bar.outline.offset = entity.loss_bar.outline.offset * 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 * global_scale_modifier;
@@ -88,7 +97,7 @@ function body_part_UI_entity.draw_dynamic(part, position_on_screen, opacity_scal
if not part.body_part_dynamic_UI.part_visibility then
return;
end
local part_name = "";
if cached_config.part_name_label.include.part_name then
part_name = part.name .. " ";
@@ -101,19 +110,20 @@ function body_part_UI_entity.draw_dynamic(part, position_on_screen, opacity_scal
if cached_config.part_name_label.include.break_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);
elseif part.flinch_count ~= 0 then
part_name = part_name .. "x" .. tostring(part.break_count);
end
elseif cached_config.part_name_label.include.break_max_count then
part_name = part_name .. "/" .. tostring(part.break_max_count);
end
end
end
local health_string = string.format("%.0f/%.0f", part.health, part.max_health);
local break_health_string = string.format("%.0f/%.0f", part.break_health, part.break_max_health);
local break_health_string = string.format("%.0f/%.0f", part.break_health,
part.break_max_health);
local loss_health_string = string.format("%.0f/%.0f", part.loss_health, part.loss_max_health);
local flinch_position_on_screen = {
x = position_on_screen.x + cached_config.part_health.offset.x,
y = position_on_screen.y + cached_config.part_health.offset.y,
@@ -127,9 +137,9 @@ function body_part_UI_entity.draw_dynamic(part, position_on_screen, opacity_scal
};
local loss_position_on_screen = {
x = position_on_screen.x + cached_config.part_loss.offset.x,
x = position_on_screen.x + cached_config.part_loss.offset.x,
y = position_on_screen.y + cached_config.part_loss.offset.y,
};
@@ -137,32 +147,42 @@ function body_part_UI_entity.draw_dynamic(part, position_on_screen, opacity_scal
drawing.draw_bar(part.body_part_dynamic_UI.flinch_bar, flinch_position_on_screen, opacity_scale, part.health_percentage);
end
if part.body_part_dynamic_UI.break_visibility and part.break_max_health ~= -1 and part.break_count < part.break_max_count then
drawing.draw_bar(part.body_part_dynamic_UI.break_bar, break_position_on_screen, opacity_scale, part.break_health_percentage);
if part.body_part_dynamic_UI.break_visibility and part.break_max_health ~= -1 and
part.break_count < part.break_max_count then
drawing.draw_bar(part.body_part_dynamic_UI.break_bar, break_position_on_screen, opacity_scale,
part.break_health_percentage);
end
if part.body_part_dynamic_UI.loss_visibility and part.loss_max_health ~= -1 and not part.is_severed then
drawing.draw_bar(part.body_part_dynamic_UI.loss_bar, loss_position_on_screen, opacity_scale, part.loss_health_percentage);
drawing.draw_bar(part.body_part_dynamic_UI.loss_bar, loss_position_on_screen, opacity_scale,
part.loss_health_percentage);
end
drawing.draw_label(part.body_part_dynamic_UI.part_name_label, position_on_screen, opacity_scale, part_name);
if part.body_part_dynamic_UI.flinch_visibility then
drawing.draw_label(part.body_part_dynamic_UI.flinch_text_label, flinch_position_on_screen, opacity_scale);
drawing.draw_label(part.body_part_dynamic_UI.flinch_value_label, flinch_position_on_screen, opacity_scale, health_string);
drawing.draw_label(part.body_part_dynamic_UI.flinch_percentage_label, flinch_position_on_screen, opacity_scale, 100 * part.health_percentage);
drawing.draw_label(part.body_part_dynamic_UI.flinch_value_label, flinch_position_on_screen, opacity_scale,
health_string);
drawing.draw_label(part.body_part_dynamic_UI.flinch_percentage_label, flinch_position_on_screen, opacity_scale,
100 * part.health_percentage);
end
if part.body_part_dynamic_UI.break_visibility and part.break_max_health ~= -1 and part.break_count < part.break_max_count then
if part.body_part_dynamic_UI.break_visibility and part.break_max_health ~= -1 and
part.break_count < part.break_max_count then
drawing.draw_label(part.body_part_dynamic_UI.break_text_label, break_position_on_screen, opacity_scale);
drawing.draw_label(part.body_part_dynamic_UI.break_value_label, break_position_on_screen, opacity_scale, break_health_string);
drawing.draw_label(part.body_part_dynamic_UI.break_percentage_label, break_position_on_screen, opacity_scale, 100 * part.break_health_percentage);
drawing.draw_label(part.body_part_dynamic_UI.break_value_label, break_position_on_screen, opacity_scale,
break_health_string);
drawing.draw_label(part.body_part_dynamic_UI.break_percentage_label, break_position_on_screen, opacity_scale,
100 * part.break_health_percentage);
end
if part.body_part_dynamic_UI.loss_visibility and part.loss_max_health ~= -1 and not part.is_severed then
drawing.draw_label(part.body_part_dynamic_UI.loss_text_label, loss_position_on_screen, opacity_scale);
drawing.draw_label(part.body_part_dynamic_UI.loss_value_label, loss_position_on_screen, opacity_scale, loss_health_string);
drawing.draw_label(part.body_part_dynamic_UI.loss_health_percentage_label, loss_position_on_screen, opacity_scale, 100 * part.loss_health_percentage);
drawing.draw_label(part.body_part_dynamic_UI.loss_value_label, loss_position_on_screen, opacity_scale,
loss_health_string);
drawing.draw_label(part.body_part_dynamic_UI.loss_health_percentage_label, loss_position_on_screen, opacity_scale,
100 * part.loss_health_percentage);
end
end
@@ -172,7 +192,7 @@ function body_part_UI_entity.draw_static(part, position_on_screen, opacity_scale
if not part.body_part_static_UI.part_visibility then
return;
end
local part_name = "";
if cached_config.part_name_label.include.part_name then
part_name = part.name .. " ";
@@ -185,19 +205,20 @@ function body_part_UI_entity.draw_static(part, position_on_screen, opacity_scale
if cached_config.part_name_label.include.break_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);
elseif part.flinch_count ~= 0 then
part_name = part_name .. "x" .. tostring(part.break_count);
end
elseif cached_config.part_name_label.include.break_max_count then
part_name = part_name .. "/" .. tostring(part.break_max_count);
end
end
end
local health_string = string.format("%.0f/%.0f", part.health, part.max_health);
local break_health_string = string.format("%.0f/%.0f", part.break_health, part.break_max_health);
local break_health_string = string.format("%.0f/%.0f", part.break_health,
part.break_max_health);
local loss_health_string = string.format("%.0f/%.0f", part.loss_health, part.loss_max_health);
local flinch_position_on_screen = {
x = position_on_screen.x + cached_config.part_health.offset.x,
y = position_on_screen.y + cached_config.part_health.offset.y,
@@ -211,9 +232,9 @@ function body_part_UI_entity.draw_static(part, position_on_screen, opacity_scale
};
local loss_position_on_screen = {
x = position_on_screen.x + cached_config.part_loss.offset.x,
x = position_on_screen.x + cached_config.part_loss.offset.x,
y = position_on_screen.y + cached_config.part_loss.offset.y,
};
@@ -222,7 +243,8 @@ function body_part_UI_entity.draw_static(part, position_on_screen, opacity_scale
end
if part.body_part_static_UI.break_visibility and part.break_max_health ~= -1 and part.break_count < part.break_max_count then
drawing.draw_bar(part.body_part_static_UI.break_bar, break_position_on_screen, opacity_scale, part.break_health_percentage);
drawing.draw_bar(part.body_part_static_UI.break_bar, break_position_on_screen, opacity_scale,
part.break_health_percentage);
end
if part.body_part_static_UI.loss_visibility and part.loss_max_health ~= -1 and not part.is_severed then
@@ -234,19 +256,24 @@ function body_part_UI_entity.draw_static(part, position_on_screen, opacity_scale
if part.body_part_static_UI.flinch_visibility then
drawing.draw_label(part.body_part_static_UI.flinch_text_label, flinch_position_on_screen, opacity_scale);
drawing.draw_label(part.body_part_static_UI.flinch_value_label, flinch_position_on_screen, opacity_scale, health_string);
drawing.draw_label(part.body_part_static_UI.flinch_percentage_label, flinch_position_on_screen, opacity_scale, 100 * part.health_percentage);
drawing.draw_label(part.body_part_static_UI.flinch_percentage_label, flinch_position_on_screen, opacity_scale,
100 * part.health_percentage);
end
if part.body_part_static_UI.break_visibility and part.break_max_health ~= -1 and part.break_count < part.break_max_count then
drawing.draw_label(part.body_part_static_UI.break_text_label, break_position_on_screen, opacity_scale);
drawing.draw_label(part.body_part_static_UI.break_value_label, break_position_on_screen, opacity_scale, break_health_string);
drawing.draw_label(part.body_part_static_UI.break_percentage_label, break_position_on_screen, opacity_scale, 100 * part.break_health_percentage);
drawing.draw_label(part.body_part_static_UI.break_value_label, break_position_on_screen, opacity_scale,
break_health_string);
drawing.draw_label(part.body_part_static_UI.break_percentage_label, break_position_on_screen, opacity_scale,
100 * part.break_health_percentage);
end
if part.body_part_static_UI.loss_visibility and part.loss_max_health ~= -1 and not part.is_severed then
drawing.draw_label(part.body_part_static_UI.loss_text_label, loss_position_on_screen, opacity_scale);
drawing.draw_label(part.body_part_static_UI.loss_value_label, loss_position_on_screen, opacity_scale, loss_health_string);
drawing.draw_label(part.body_part_static_UI.loss_health_percentage_label, loss_position_on_screen, opacity_scale, 100 * part.loss_health_percentage);
drawing.draw_label(part.body_part_static_UI.loss_value_label, loss_position_on_screen, opacity_scale,
loss_health_string);
drawing.draw_label(part.body_part_static_UI.loss_health_percentage_label, loss_position_on_screen, opacity_scale,
100 * part.loss_health_percentage);
end
end
@@ -256,7 +283,7 @@ function body_part_UI_entity.draw_highlighted(part, position_on_screen, opacity_
if not part.body_part_highlighted_UI.part_visibility then
return;
end
local part_name = "";
if cached_config.part_name_label.include.part_name then
part_name = part.name .. " ";
@@ -269,19 +296,20 @@ function body_part_UI_entity.draw_highlighted(part, position_on_screen, opacity_
if cached_config.part_name_label.include.break_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);
elseif part.flinch_count ~= 0 then
part_name = part_name .. "x" .. tostring(part.break_count);
end
elseif cached_config.part_name_label.include.break_max_count then
part_name = part_name .. "/" .. tostring(part.break_max_count);
end
end
end
local health_string = string.format("%.0f/%.0f", part.health, part.max_health);
local break_health_string = string.format("%.0f/%.0f", part.break_health, part.break_max_health);
local break_health_string = string.format("%.0f/%.0f", part.break_health,
part.break_max_health);
local loss_health_string = string.format("%.0f/%.0f", part.loss_health, part.loss_max_health);
local flinch_position_on_screen = {
x = position_on_screen.x + cached_config.part_health.offset.x,
y = position_on_screen.y + cached_config.part_health.offset.y,
@@ -295,46 +323,56 @@ function body_part_UI_entity.draw_highlighted(part, position_on_screen, opacity_
};
local loss_position_on_screen = {
x = position_on_screen.x + cached_config.part_loss.offset.x,
x = position_on_screen.x + cached_config.part_loss.offset.x,
y = position_on_screen.y + cached_config.part_loss.offset.y,
};
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_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
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
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
drawing.draw_label(part.body_part_highlighted_UI.part_name_label, position_on_screen, opacity_scale, part_name);
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_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_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);
end
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_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_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);
end
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_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_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);
end
end
@@ -344,4 +382,4 @@ function body_part_UI_entity.init_module()
config = require("MHR_Overlay.Misc.config");
end
return body_part_UI_entity;
return body_part_UI_entity;

View File

@@ -5,7 +5,8 @@ local config;
local player;
local language;
function damage_UI_entity.new(bar, highlighted_bar, player_name_label, dps_label, hunter_rank_label, value_label, percentage_label, cart_count_label)
function damage_UI_entity.new(bar, highlighted_bar, player_name_label, dps_label, hunter_rank_label, value_label,
percentage_label, cart_count_label)
local entity = {};
local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
@@ -24,16 +25,21 @@ function damage_UI_entity.new(bar, highlighted_bar, player_name_label, dps_label
entity.bar.offset.y = entity.bar.offset.y * global_scale_modifier;
entity.bar.size.width = entity.bar.size.width * global_scale_modifier;
entity.bar.size.height = entity.bar.size.height * global_scale_modifier;
entity.bar.outline.thickness = entity.bar.outline.thickness * global_scale_modifier;
entity.bar.outline.offset = entity.bar.outline.offset * 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 * 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 * global_scale_modifier;
entity.highlighted_bar.outline.thickness = entity.highlighted_bar.outline.thickness * global_scale_modifier;
entity.highlighted_bar.outline.offset = entity.highlighted_bar.outline.offset * 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 * global_scale_modifier;
entity.player_name_size_limit = config.current_config.damage_meter_UI.settings.player_name_size_limit * global_scale_modifier;
entity.player_name_size_limit = config.current_config.damage_meter_UI.settings.player_name_size_limit *
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 * global_scale_modifier;
@@ -60,7 +66,7 @@ function damage_UI_entity.draw(_player, position_on_screen, opacity_scale, top_d
if _player.id == player.myself.id then
player_include = cached_config.player_name_label.include.myself;
end
local player_name_text = "";
if player_include.master_rank and player_include.hunter_rank then
@@ -117,20 +123,28 @@ function damage_UI_entity.draw(_player, position_on_screen, opacity_scale, top_d
end
if _player.id == player.myself.id then
if _player.damage_UI.hunter_rank_label.include.myself.master_rank and _player.damage_UI.hunter_rank_label.include.myself.hunter_rank then
drawing.draw_label(_player.damage_UI.hunter_rank_label, position_on_screen, opacity_scale, string.format("%d:%d", _player.master_rank, _player.hunter_rank));
if _player.damage_UI.hunter_rank_label.include.myself.master_rank and
_player.damage_UI.hunter_rank_label.include.myself.hunter_rank then
drawing.draw_label(_player.damage_UI.hunter_rank_label, position_on_screen, opacity_scale,
string.format("%d:%d", _player.master_rank, _player.hunter_rank));
elseif _player.damage_UI.hunter_rank_label.include.myself.master_rank then
drawing.draw_label(_player.damage_UI.hunter_rank_label, position_on_screen, opacity_scale, string.format("%d", _player.master_rank));
drawing.draw_label(_player.damage_UI.hunter_rank_label, position_on_screen, opacity_scale,
string.format("%d", _player.master_rank));
elseif _player.damage_UI.hunter_rank_label.include.myself.hunter_rank then
drawing.draw_label(_player.damage_UI.hunter_rank_label, position_on_screen, opacity_scale, string.format("%d", _player.hunter_rank));
drawing.draw_label(_player.damage_UI.hunter_rank_label, position_on_screen, opacity_scale,
string.format("%d", _player.hunter_rank));
end
else
if _player.damage_UI.hunter_rank_label.include.others.master_rank and _player.damage_UI.hunter_rank_label.include.others.hunter_rank then
drawing.draw_label(_player.damage_UI.hunter_rank_label, position_on_screen, opacity_scale, string.format("%d:%d", _player.master_rank, _player.hunter_rank));
if _player.damage_UI.hunter_rank_label.include.others.master_rank and
_player.damage_UI.hunter_rank_label.include.others.hunter_rank then
drawing.draw_label(_player.damage_UI.hunter_rank_label, position_on_screen, opacity_scale,
string.format("%d:%d", _player.master_rank, _player.hunter_rank));
elseif _player.damage_UI.hunter_rank_label.include.others.master_rank then
drawing.draw_label(_player.damage_UI.hunter_rank_label, position_on_screen, opacity_scale, string.format("%d", _player.master_rank));
drawing.draw_label(_player.damage_UI.hunter_rank_label, position_on_screen, opacity_scale,
string.format("%d", _player.master_rank));
elseif _player.damage_UI.hunter_rank_label.include.others.hunter_rank then
drawing.draw_label(_player.damage_UI.hunter_rank_label, position_on_screen, opacity_scale, string.format("%d", _player.hunter_rank));
drawing.draw_label(_player.damage_UI.hunter_rank_label, position_on_screen, opacity_scale,
string.format("%d", _player.hunter_rank));
end
end
@@ -152,4 +166,4 @@ function damage_UI_entity.init_module()
language = require("MHR_Overlay.Misc.language");
end
return damage_UI_entity;
return damage_UI_entity;

View File

@@ -19,6 +19,8 @@ function health_UI_entity.new(visibility, bar, text_label, value_label, percenta
entity.bar.offset.y = entity.bar.offset.y * global_scale_modifier;
entity.bar.size.width = entity.bar.size.width * global_scale_modifier;
entity.bar.size.height = entity.bar.size.height * global_scale_modifier;
entity.bar.outline.thickness = entity.bar.outline.thickness * global_scale_modifier;
entity.bar.outline.offset = entity.bar.outline.offset * 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 * global_scale_modifier;
@@ -51,4 +53,4 @@ function health_UI_entity.init_module()
config = require("MHR_Overlay.Misc.config");
end
return health_UI_entity;
return health_UI_entity;

View File

@@ -20,6 +20,8 @@ function rage_UI_entity.new(visibility, bar, text_label, value_label, percentage
entity.bar.offset.y = entity.bar.offset.y * global_scale_modifier;
entity.bar.size.width = entity.bar.size.width * global_scale_modifier;
entity.bar.size.height = entity.bar.size.height * global_scale_modifier;
entity.bar.outline.thickness = entity.bar.outline.thickness * global_scale_modifier;
entity.bar.outline.offset = entity.bar.outline.offset * 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 * global_scale_modifier;
@@ -43,9 +45,10 @@ function rage_UI_entity.draw(monster, rage_UI, position_on_screen, opacity_scale
if monster.is_in_rage then
drawing.draw_bar(rage_UI.bar, position_on_screen, opacity_scale, monster.rage_timer_percentage);
drawing.draw_label(rage_UI.text_label, position_on_screen, opacity_scale, language.current_language.UI.rage);
drawing.draw_label(rage_UI.timer_label, position_on_screen, opacity_scale, monster.rage_minutes_left, monster.rage_seconds_left);
drawing.draw_label(rage_UI.timer_label, position_on_screen, opacity_scale, monster.rage_minutes_left,
monster.rage_seconds_left);
else
drawing.draw_bar(rage_UI.bar, position_on_screen, opacity_scale, monster.rage_percentage);
@@ -62,4 +65,4 @@ function rage_UI_entity.init_module()
config = require("MHR_Overlay.Misc.config");
end
return rage_UI_entity;
return rage_UI_entity;

View File

@@ -45,8 +45,9 @@ function stamina_UI_entity.draw(monster, stamina_UI, position_on_screen, opacity
if monster.is_tired then
drawing.draw_bar(stamina_UI.bar, position_on_screen, opacity_scale, monster.tired_timer_percentage);
drawing.draw_label(stamina_UI.timer_label, position_on_screen, opacity_scale, monster.tired_minutes_left, monster.tired_seconds_left);
drawing.draw_label(stamina_UI.timer_label, position_on_screen, opacity_scale, monster.tired_minutes_left,
monster.tired_seconds_left);
else
drawing.draw_bar(stamina_UI.bar, position_on_screen, opacity_scale, monster.stamina_percentage);
@@ -62,4 +63,4 @@ function stamina_UI_entity.init_module()
config = require("MHR_Overlay.Misc.config");
end
return stamina_UI_entity;
return stamina_UI_entity;

File diff suppressed because it is too large Load Diff

View File

@@ -7,7 +7,8 @@ drawing.font = nil;
function drawing.init_font()
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);
drawing.font = d2d.Font.new(cached_config.family, cached_config.size, cached_config.bold,
cached_config.italic);
end
function drawing.argb_color_to_abgr_color(argb_color)
@@ -31,7 +32,7 @@ function drawing.color_to_argb(color)
end
function drawing.argb_to_color(alpha, red, green, blue)
return 0x1000000 * alpha + 0x10000 * red + 0x100 * green + blue;
return 0x1000000 * alpha + 0x10000 * red + 0x100 * green + blue;
end
function drawing.limit_text_size(text, size_limit)
@@ -44,7 +45,7 @@ function drawing.limit_text_size(text, size_limit)
local text_width, text_height = drawing.font:measure(limited_text);
if text_width < size_limit then
break;
break
else
limited_text = unicode_helpers.sub(limited_text, 1, -5) .. "...";
end
@@ -54,7 +55,7 @@ function drawing.limit_text_size(text, size_limit)
end
function drawing.scale_color_opacity(color, scale)
local alpha, red, green, blue = drawing.color_to_argb(color);
local alpha, red, green, blue = drawing.color_to_argb(color);
local new_alpha = math.floor(alpha * scale);
if new_alpha < 0 then new_alpha = 0; end
if new_alpha > 255 then new_alpha = 255; end
@@ -64,19 +65,19 @@ end
function drawing.scale_bar_opacity(bar, scale)
if bar == nil
or scale == nil
or not bar.visibility then
or scale == nil
or not bar.visibility then
return;
end
bar.colors.foreground = drawing.scale_color_opacity(bar.colors.foreground, scale);
bar.colors.background = drawing.scale_color_opacity(bar.colors.background, scale);
end
function drawing.scale_label_opacity(label, scale)
if label == nil
or scale == nil
or not label.visibility then
or scale == nil
or not label.visibility then
return;
end
@@ -86,17 +87,17 @@ end
function drawing.draw_label(label, position, opacity_scale, ...)
if label == nil
or not label.visibility then
or not label.visibility then
return;
end
local text = string.format(label.text, table.unpack({...}));
local text = string.format(label.text, table.unpack({ ... }));
local position_x = position.x + label.offset.x;
local position_y = position.y + label.offset.y;
if label.shadow.visibility then
local new_shadow_color = label.shadow.color;
if opacity_scale < 1 then
new_shadow_color = drawing.scale_color_opacity(new_shadow_color, opacity_scale);
end
@@ -120,12 +121,13 @@ function drawing.draw_label(label, position, opacity_scale, ...)
new_color = drawing.argb_color_to_abgr_color(new_color);
draw.text(text, position_x, position_y, new_color);
end
end
function drawing.draw_bar(bar, position, opacity_scale, percentage)
if bar == nil
or not bar.visibility then
or not bar.visibility then
return;
end
@@ -137,63 +139,160 @@ function drawing.draw_bar(bar, position, opacity_scale, percentage)
percentage = 0;
end
local position_x = position.x + bar.offset.x;
local position_y = position.y + bar.offset.y;
local foreground_width = bar.size.width * percentage;
local background_width = bar.size.width - foreground_width;
local outline_visibility = bar.outline.visibility;
local style = bar.outline.style; -- Inside/Center/Outside
local new_foreground_color = bar.colors.foreground;
local new_background_color = bar.colors.background;
local outline_thickness = bar.outline.thickness;
if not outline_visibility then
outline_thickness = 0;
end
local half_outline_thickness = outline_thickness / 2;
local outline_offset = bar.outline.offset;
if outline_thickness == 0 then
outline_offset = 0;
end
local half_outline_offset = outline_offset / 2;
local outline_position_x = 0;
local outline_position_y = 0;
local outline_width = 0;
local outline_height = 0;
local position_x = 0;
local position_y = 0;
local foreground_width = 0;
local background_width = 0;
local height = 0;
if style == "Inside" then
outline_position_x = position.x + bar.offset.x + half_outline_thickness;
outline_position_y = position.y + bar.offset.y + half_outline_thickness;
outline_width = bar.size.width - outline_thickness;
outline_height = bar.size.height - outline_thickness;
position_x = outline_position_x + half_outline_thickness + outline_offset;
position_y = outline_position_y + half_outline_thickness + outline_offset;
local width = outline_width - outline_thickness - outline_offset - outline_offset;
foreground_width = width * percentage;
background_width = width - foreground_width;
height = outline_height - outline_thickness - outline_offset - outline_offset;
elseif style == "Center" then
outline_position_x = position.x + bar.offset.x - half_outline_offset;
outline_position_y = position.y + bar.offset.y - half_outline_offset;
outline_width = bar.size.width + outline_offset;
outline_height = bar.size.height + outline_offset;
position_x = outline_position_x + half_outline_thickness + outline_offset;
position_y = outline_position_y + half_outline_thickness + outline_offset;
local width = outline_width - outline_thickness - outline_offset - outline_offset;
foreground_width = width * percentage;
background_width = width - foreground_width;
height = outline_height - outline_thickness - outline_offset - outline_offset;
else
position_x = position.x + bar.offset.x;
position_y = position.y + bar.offset.y;
local width = bar.size.width;
height = bar.size.height;
foreground_width = width * percentage;
background_width = width - foreground_width;
outline_position_x = position_x - half_outline_thickness - outline_offset;
outline_position_y = position_y - half_outline_thickness - outline_offset;
outline_width = width + outline_thickness + outline_offset + outline_offset;
outline_height = height + outline_thickness + outline_offset + outline_offset;
end
local foreground_color = bar.colors.foreground;
local background_color = bar.colors.background;
local outline_color = bar.colors.outline;
if opacity_scale < 1 then
new_foreground_color = drawing.scale_color_opacity(new_foreground_color, opacity_scale);
new_background_color = drawing.scale_color_opacity(new_background_color, opacity_scale);
foreground_color = drawing.scale_color_opacity(foreground_color, opacity_scale);
background_color = drawing.scale_color_opacity(background_color, opacity_scale);
outline_color = drawing.scale_color_opacity(outline_color, opacity_scale);
end
local use_d2d = d2d ~= nil;
-- outline
if outline_thickness ~= 0 then
if use_d2d then
d2d.outline_rect(outline_position_x, outline_position_y, outline_width, outline_height, outline_thickness,
outline_color);
else
outline_color = drawing.argb_color_to_abgr_color(outline_color);
draw.outline_rect(outline_position_x, outline_position_y, outline_width, outline_height, outline_color);
end
end
-- foreground
if d2d ~= nil then
d2d.fill_rect(position_x, position_y, foreground_width, bar.size.height, new_foreground_color);
else
new_foreground_color = drawing.argb_color_to_abgr_color(new_foreground_color);
draw.filled_rect(position_x, position_y, foreground_width, bar.size.height, new_foreground_color)
if foreground_width ~= 0 then
if use_d2d then
d2d.fill_rect(position_x, position_y, foreground_width, height, foreground_color);
else
foreground_color = drawing.argb_color_to_abgr_color(foreground_color);
draw.filled_rect(position_x, position_y, foreground_width, height, foreground_color)
end
end
-- background
if d2d ~= nil then
d2d.fill_rect(position_x + foreground_width, position_y, background_width, bar.size.height, new_background_color);
else
new_background_color = drawing.argb_color_to_abgr_color(new_background_color);
draw.filled_rect(position_x + foreground_width, position_y, background_width, bar.size.height, new_background_color)
if background_width ~= 0 then
if use_d2d then
d2d.fill_rect(position_x + foreground_width, position_y, background_width, height, background_color);
else
background_color = drawing.argb_color_to_abgr_color(background_color);
draw.filled_rect(position_x + foreground_width, position_y, background_width, height, background_color)
end
end
end
function drawing.draw_capture_line(health_UI, position, opacity_scale, percentage)
if health_UI == nil
or not health_UI.visibility
or health_UI.bar == nil
or not health_UI.bar.visibility
or health_UI.bar.capture_line == nil
or not health_UI.bar.capture_line.visibility
or percentage >= 1
or percentage <= 0 then
or not health_UI.visibility
or health_UI.bar == nil
or not health_UI.bar.visibility
or health_UI.bar.capture_line == nil
or not health_UI.bar.capture_line.visibility
or percentage >= 1
or percentage <= 0 then
return;
end
local position_x = position.x + health_UI.bar.offset.x + health_UI.bar.capture_line.offset.x + health_UI.bar.size.width * percentage;
local position_x = position.x + health_UI.bar.offset.x + health_UI.bar.capture_line.offset.x +
health_UI.bar.size.width * percentage;
local position_y = position.y + health_UI.bar.offset.y + health_UI.bar.capture_line.offset.y;
local color = health_UI.bar.capture_line.color;
if opacity_scale < 1 then
color = drawing.scale_color_opacity(color, opacity_scale);
color = drawing.scale_color_opacity(color, opacity_scale);
end
if d2d ~= nil then
d2d.fill_rect(position_x, position_y, health_UI.bar.capture_line.size.width, health_UI.bar.capture_line.size.height, color);
d2d.fill_rect(position_x, position_y, health_UI.bar.capture_line.size.width, health_UI.bar.capture_line.size.height,
color);
else
color = drawing.argb_color_to_abgr_color(color);
draw.filled_rect(position_x, position_y, health_UI.bar.capture_line.size.width, health_UI.bar.capture_line.size.height, color)
draw.filled_rect(position_x, position_y, health_UI.bar.capture_line.size.width, health_UI.bar.capture_line.size.height
, color)
end
end
@@ -203,4 +302,4 @@ function drawing.init_module()
unicode_helpers = require("MHR_Overlay.Misc.unicode_helpers");
end
return drawing;
return drawing;

View File

@@ -71,6 +71,7 @@
"capture_line": "Capture Line",
"cart_count": "Cart Count",
"cart_count_label": "Cart Count Label",
"center": "Center",
"color": "Color",
"colors": "Colors",
"creature_name_label": "Creature Name Label",
@@ -134,6 +135,7 @@
"hunter_rank": "Hunter Rank",
"hunter_rank_label": "Hunter Rank Label",
"include": "Include",
"inside": "Inside",
"installation_damage": "Installation Damage",
"italic": "Italic",
"join_time": "Join Time",
@@ -172,6 +174,8 @@
"other_damage": "Other Damage",
"other_players": "Other Players",
"otomo_damage": "Buddy Damage",
"outline": "Outline",
"outside": "Outside",
"part_health": "Part Health",
"part_name": "Part Name",
"part_name_label": "Part Name Label",
@@ -209,7 +213,9 @@
"static_spacing": "Static Spacing",
"statically_positioned": "Statically Positioned",
"status": "Status",
"style": "Style",
"text_label": "Text Label",
"thickness": "Thickness",
"time_UI": "Time UI",
"time_label": "Time Label",
"time_limit": "Time Limit (seconds)",

View File

@@ -71,6 +71,7 @@
"capture_line": "포획 표시선",
"cart_count": "수레 횟수",
"cart_count_label": "수레 횟수 정보",
"center": "Center",
"color": "색상",
"colors": "색상",
"creature_name_label": "환경생물 이름 정보",
@@ -134,6 +135,7 @@
"hunter_rank": "헌터 랭크",
"hunter_rank_label": "헌터 랭크 정보",
"include": "포함",
"inside": "Inside",
"installation_damage": "설비 대미지",
"italic": "기울임",
"join_time": "참가 시간",
@@ -172,6 +174,8 @@
"other_damage": "기타 대미지",
"other_players": "다른 헌터",
"otomo_damage": "동반자 대미지",
"outline": "Outline",
"outside": "Outside",
"part_health": "부위 수치",
"part_name": "부위",
"part_name_label": "부위 정보",
@@ -209,7 +213,9 @@
"static_spacing": "고정 간격",
"statically_positioned": "고정 위치 UI",
"status": "상태",
"style": "Style",
"text_label": "텍스트 정보",
"thickness": "Thickness",
"time_UI": "시간 UI",
"time_label": "시간 정보",
"time_limit": "시간 제한 (단위: 초)",

View File

@@ -71,6 +71,7 @@
"capture_line": "Линия здоровья захвата",
"cart_count": "Кол-во потерь сознания",
"cart_count_label": "Метка кол-ва потерь сознания",
"center": "Центр",
"color": "Цвет",
"colors": "Цвета",
"creature_name_label": "Метка имени существа",
@@ -134,6 +135,7 @@
"hunter_rank": "Ранг охотника",
"hunter_rank_label": "Метка ранга охотника",
"include": "Элементы",
"inside": "Внутри",
"installation_damage": "Урон от установок",
"italic": "Курсив",
"join_time": "Время присоединения",
@@ -172,6 +174,8 @@
"other_damage": "Другой урон",
"other_players": "Другие игроки",
"otomo_damage": "Урон от отомо",
"outline": "Обводка",
"outside": "Снаружи",
"part_health": "Здоровье части",
"part_name": "Имя части тела",
"part_name_label": "Метка имени части тела",
@@ -209,7 +213,9 @@
"static_spacing": "Статичное расстояние между элементами",
"statically_positioned": "Рассположенный статично",
"status": "Статус",
"style": "Стиль",
"text_label": "Текстовая метка",
"thickness": "Thickness",
"time_UI": "Интерфейс времени",
"time_label": "Метка времени",
"time_limit": "Ограничение по времени",

View File

@@ -71,6 +71,7 @@
"capture_line": "可捕捉线",
"cart_count": "Cart Count",
"cart_count_label": "Cart Count Label",
"center": "Center",
"color": "颜色",
"colors": "颜色",
"creature_name_label": "生物名标签",
@@ -134,6 +135,7 @@
"hunter_rank": "猎人等級",
"hunter_rank_label": "猎人等级标签",
"include": "包含",
"inside": "Inside",
"installation_damage": "设备伤害",
"italic": "斜体",
"join_time": "加入时间",
@@ -172,6 +174,8 @@
"other_damage": "Other Damage",
"other_players": "其他玩家",
"otomo_damage": "随从伤害",
"outline": "Outline",
"outside": "Outside",
"part_health": "Part Health",
"part_name": "部位名",
"part_name_label": "部位名标签",
@@ -209,7 +213,9 @@
"static_spacing": "固定间距",
"statically_positioned": "固定位置",
"status": "状态",
"style": "Style",
"text_label": "文字标签",
"thickness": "Thickness",
"time_UI": "时间UI",
"time_label": "时间标签",
"time_limit": "时间限制(秒)",

View File

@@ -71,6 +71,7 @@
"capture_line": "可捕捉標記線",
"cart_count": "Cart Count",
"cart_count_label": "Cart Count Label",
"center": "Center",
"color": "調色盤",
"colors": "調色盤",
"creature_name_label": "環境生物名稱",
@@ -134,6 +135,7 @@
"hunter_rank": "獵人等級",
"hunter_rank_label": "獵人等級",
"include": "細部資訊調整",
"inside": "Inside",
"installation_damage": "設備傷害",
"italic": "斜體",
"join_time": "加入時間",
@@ -172,6 +174,8 @@
"other_damage": "Other Damage",
"other_players": "其他玩家",
"otomo_damage": "隨從傷害",
"outline": "Outline",
"outside": "Outside",
"part_health": "Part Health",
"part_name": "部位名稱",
"part_name_label": "部位名稱",
@@ -209,7 +213,9 @@
"static_spacing": "固定魔物資訊的間距",
"statically_positioned": "固定的魔物資訊",
"status": "狀態",
"style": "Style",
"text_label": "文字",
"thickness": "Thickness",
"time_UI": "時間 UI",
"time_label": "時間",
"time_limit": "時限 (秒)",