Utilize this keyword everywhere

This commit is contained in:
GreenComfyTea
2023-04-21 10:19:12 +03:00
parent 94e9e5d18b
commit 9b1ff5b264
49 changed files with 1398 additions and 1403 deletions

View File

@@ -1,4 +1,4 @@
local ailment_buildups_customization = {};
local this = {};
local utils;
local config;
@@ -47,7 +47,7 @@ local os = os;
local ValueType = ValueType;
local package = package;
function ailment_buildups_customization.draw(cached_config)
function this.draw(cached_config)
local changed = false;
local config_changed = false;
local index = 1;
@@ -200,7 +200,7 @@ function ailment_buildups_customization.draw(cached_config)
return config_changed;
end
function ailment_buildups_customization.init_module()
function this.init_module()
utils = require("MHR_Overlay.Misc.utils");
language = require("MHR_Overlay.Misc.language");
config = require("MHR_Overlay.Misc.config");
@@ -218,4 +218,4 @@ function ailment_buildups_customization.init_module()
bar_customization = require("MHR_Overlay.UI.Customizations.bar_customization");
end
return ailment_buildups_customization;
return this;

View File

@@ -1,4 +1,4 @@
local ailments_customization = {};
local this = {};
local utils;
local config;
@@ -47,7 +47,7 @@ local os = os;
local ValueType = ValueType;
local package = package;
function ailments_customization.draw(cached_config)
function this.draw(cached_config)
local changed = false;
local config_changed = false;
local index = 0;
@@ -365,7 +365,7 @@ function ailments_customization.draw(cached_config)
return config_changed;
end
function ailments_customization.init_module()
function this.init_module()
utils = require("MHR_Overlay.Misc.utils");
language = require("MHR_Overlay.Misc.language");
config = require("MHR_Overlay.Misc.config");
@@ -382,4 +382,4 @@ function ailments_customization.init_module()
bar_customization = require("MHR_Overlay.UI.Customizations.bar_customization");
end
return ailments_customization;
return this;

View File

@@ -1,4 +1,4 @@
local bar_customization = {};
local this = {};
local utils;
local config;
@@ -46,7 +46,7 @@ local os = os;
local ValueType = ValueType;
local package = package;
function bar_customization.draw(bar_name, bar)
function this.draw(bar_name, bar)
if bar == nil then
return false;
end
@@ -191,7 +191,7 @@ function bar_customization.draw(bar_name, bar)
return bar_changed;
end
function bar_customization.init_module()
function this.init_module()
utils = require("MHR_Overlay.Misc.utils");
language = require("MHR_Overlay.Misc.language");
config = require("MHR_Overlay.Misc.config");
@@ -207,4 +207,4 @@ function bar_customization.init_module()
line_customization = require("MHR_Overlay.UI.Customizations.line_customization");
end
return bar_customization;
return this;

View File

@@ -1,4 +1,4 @@
local body_parts_customization = {};
local this = {};
local utils;
local config;
@@ -47,7 +47,7 @@ local os = os;
local ValueType = ValueType;
local package = package;
function body_parts_customization.draw(cached_config)
function this.draw(cached_config)
local changed = false;
local config_changed = false;
local index = 0;
@@ -368,7 +368,7 @@ function body_parts_customization.draw(cached_config)
return config_changed;
end
function body_parts_customization.init_module()
function this.init_module()
utils = require("MHR_Overlay.Misc.utils");
language = require("MHR_Overlay.Misc.language");
config = require("MHR_Overlay.Misc.config");
@@ -385,4 +385,4 @@ function body_parts_customization.init_module()
bar_customization = require("MHR_Overlay.UI.Customizations.bar_customization");
end
return body_parts_customization;
return this;

View File

@@ -1,4 +1,4 @@
local large_monster_UI_customization = {};
local this = {};
local config;
local screen;
@@ -46,7 +46,7 @@ local os = os;
local ValueType = ValueType;
local package = package;
function large_monster_UI_customization.draw(cached_config)
function this.draw(cached_config)
local changed = false;
local config_changed = false;
@@ -88,7 +88,7 @@ function large_monster_UI_customization.draw(cached_config)
return config_changed;
end
function large_monster_UI_customization.init_module()
function this.init_module()
language = require("MHR_Overlay.Misc.language");
config = require("MHR_Overlay.Misc.config");
screen = require("MHR_Overlay.Game_Handler.screen");
@@ -104,4 +104,4 @@ function large_monster_UI_customization.init_module()
bar_customization = require("MHR_Overlay.UI.Customizations.bar_customization");
end
return large_monster_UI_customization;
return this;

View File

@@ -1,4 +1,4 @@
local label_customization = {};
local this = {};
local config;
local screen;
@@ -44,7 +44,7 @@ local os = os;
local ValueType = ValueType;
local package = package;
function label_customization.draw(label_name, label)
function this.draw(label_name, label)
local label_changed = false;
local changed = false;
@@ -115,7 +115,7 @@ function label_customization.draw(label_name, label)
return label_changed;
end
function label_customization.init_module()
function this.init_module()
language = require("MHR_Overlay.Misc.language");
config = require("MHR_Overlay.Misc.config");
screen = require("MHR_Overlay.Game_Handler.screen");
@@ -129,4 +129,4 @@ function label_customization.init_module()
customization_menu = require("MHR_Overlay.UI.customization_menu");
end
return label_customization;
return this;

View File

@@ -1,4 +1,4 @@
local large_monster_UI_customization = {};
local this = {};
local config;
local screen;
@@ -53,7 +53,7 @@ local os = os;
local ValueType = ValueType;
local package = package;
function large_monster_UI_customization.draw(cached_config)
function this.draw(cached_config)
local changed = false;
local config_changed = false;
@@ -81,7 +81,7 @@ function large_monster_UI_customization.draw(cached_config)
return config_changed;
end
function large_monster_UI_customization.init_module()
function this.init_module()
language = require("MHR_Overlay.Misc.language");
config = require("MHR_Overlay.Misc.config");
screen = require("MHR_Overlay.Game_Handler.screen");
@@ -104,4 +104,4 @@ function large_monster_UI_customization.init_module()
ailment_buildups_customization = require("MHR_Overlay.UI.Customizations.ailment_buildups_customization");
end
return large_monster_UI_customization;
return this;

View File

@@ -1,4 +1,4 @@
local line_customization = {};
local this = {};
local config;
local screen;
@@ -44,7 +44,7 @@ local os = os;
local ValueType = ValueType;
local package = package;
function line_customization.draw(line_name, line)
function this.draw(line_name, line)
if line == nil then
return;
end
@@ -95,7 +95,7 @@ function line_customization.draw(line_name, line)
return line_changed;
end
function line_customization.init_module()
function this.init_module()
language = require("MHR_Overlay.Misc.language");
config = require("MHR_Overlay.Misc.config");
screen = require("MHR_Overlay.Game_Handler.screen");
@@ -109,4 +109,4 @@ function line_customization.init_module()
customization_menu = require("MHR_Overlay.UI.customization_menu");
end
return line_customization;
return this;

View File

@@ -1,4 +1,4 @@
local module_visibility_customization = {};
local this = {};
local config;
local screen;
@@ -46,7 +46,7 @@ local os = os;
local ValueType = ValueType;
local package = package;
function module_visibility_customization.draw(cached_config)
function this.draw(cached_config)
local changed = false;
local config_changed = false;
@@ -101,7 +101,7 @@ function module_visibility_customization.draw(cached_config)
return config_changed;
end
function module_visibility_customization.init_module()
function this.init_module()
language = require("MHR_Overlay.Misc.language");
config = require("MHR_Overlay.Misc.config");
screen = require("MHR_Overlay.Game_Handler.screen");
@@ -115,4 +115,4 @@ function module_visibility_customization.init_module()
customization_menu = require("MHR_Overlay.UI.customization_menu");
end
return module_visibility_customization;
return this;

View File

@@ -1,4 +1,4 @@
local rage_customization = {};
local this = {};
local config;
local screen;
@@ -46,7 +46,7 @@ local os = os;
local ValueType = ValueType;
local package = package;
function rage_customization.draw(cached_config)
function this.draw(cached_config)
local changed = false;
local config_changed = false;
@@ -91,7 +91,7 @@ function rage_customization.draw(cached_config)
return config_changed;
end
function rage_customization.init_module()
function this.init_module()
language = require("MHR_Overlay.Misc.language");
config = require("MHR_Overlay.Misc.config");
screen = require("MHR_Overlay.Game_Handler.screen");
@@ -107,4 +107,4 @@ function rage_customization.init_module()
bar_customization = require("MHR_Overlay.UI.Customizations.bar_customization");
end
return rage_customization;
return this;

View File

@@ -1,4 +1,4 @@
local stamina_customization = {};
local this = {};
local config;
local screen;
@@ -46,7 +46,7 @@ local os = os;
local ValueType = ValueType;
local package = package;
function stamina_customization.draw(cached_config)
function this.draw(cached_config)
local changed = false;
local config_changed = false;
@@ -91,7 +91,7 @@ function stamina_customization.draw(cached_config)
return config_changed;
end
function stamina_customization.init_module()
function this.init_module()
language = require("MHR_Overlay.Misc.language");
config = require("MHR_Overlay.Misc.config");
screen = require("MHR_Overlay.Game_Handler.screen");
@@ -107,4 +107,4 @@ function stamina_customization.init_module()
bar_customization = require("MHR_Overlay.UI.Customizations.bar_customization");
end
return stamina_customization;
return this;

View File

@@ -1,4 +1,4 @@
local buff_UI = {};
local this = {};
local buff_UI_entity;
local config;
@@ -37,7 +37,7 @@ local os = os;
local ValueType = ValueType;
local package = package;
function buff_UI.draw()
function this.draw()
local cached_config = config.current_config.buff_UI;
local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
@@ -110,7 +110,7 @@ function buff_UI.draw()
end
end
function buff_UI.init_module()
function this.init_module()
config = require("MHR_Overlay.Misc.config");
buff_UI_entity = require("MHR_Overlay.UI.UI_Entities.buff_UI_entity");
buffs = require("MHR_Overlay.Buffs.buffs");
@@ -124,4 +124,4 @@ function buff_UI.init_module()
--drawing = require("MHR_Overlay.UI.drawing");
end
return buff_UI;
return this;

View File

@@ -1,4 +1,4 @@
local damage_meter_UI = {};
local this = {};
local singletons;
local config;
@@ -43,8 +43,8 @@ local os = os;
local ValueType = ValueType;
local package = package;
damage_meter_UI.last_displayed_players = {};
damage_meter_UI.freeze_displayed_players = false;
this.last_displayed_players = {};
this.freeze_displayed_players = false;
local lobby_manager_type_def = sdk.find_type_definition("snow.LobbyManager");
local quest_hunter_info_field = lobby_manager_type_def:get_field("_questHunterInfo");
@@ -57,7 +57,7 @@ local get_item_method = quest_hunter_info_type_def:get_method("get_Item");
local hunter_info_type_def = sdk.find_type_definition("snow.LobbyManager.HunterInfo");
local member_index_field = hunter_info_type_def:get_field("_memberIndex");
function damage_meter_UI.draw()
function this.draw()
local cached_config = config.current_config.damage_meter_UI;
local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
@@ -67,13 +67,13 @@ function damage_meter_UI.draw()
local quest_players = {};
if damage_meter_UI.freeze_displayed_players and not utils.table.is_empty(damage_meter_UI.last_displayed_players) then
quest_players = damage_meter_UI.last_displayed_players;
if this.freeze_displayed_players and not utils.table.is_empty(this.last_displayed_players) then
quest_players = this.last_displayed_players;
else
quest_players = players.display_list;
end
damage_meter_UI.last_displayed_players = quest_players;
this.last_displayed_players = quest_players;
local top_damage = 0;
local top_dps = 0;
@@ -175,7 +175,7 @@ function damage_meter_UI.draw()
end
end
function damage_meter_UI.init_module()
function this.init_module()
singletons = require("MHR_Overlay.Game_Handler.singletons");
config = require("MHR_Overlay.Misc.config");
customization_menu = require("MHR_Overlay.UI.customization_menu");
@@ -188,4 +188,4 @@ function damage_meter_UI.init_module()
utils = require("MHR_Overlay.Misc.utils");
end
return damage_meter_UI;
return this;

View File

@@ -1,4 +1,4 @@
local env_creature_UI = {};
local this = {};
local singletons;
local config;
@@ -46,7 +46,7 @@ local package = package;
local enemy_manager_type_def = sdk.find_type_definition("snow.enemy.EnemyManager");
function env_creature_UI.draw()
function this.draw()
if singletons.enemy_manager == nil then
return;
end
@@ -94,7 +94,7 @@ function env_creature_UI.draw()
end
end
function env_creature_UI.init_module()
function this.init_module()
singletons = require("MHR_Overlay.Game_Handler.singletons");
config = require("MHR_Overlay.Misc.config");
customization_menu = require("MHR_Overlay.UI.customization_menu");
@@ -108,4 +108,4 @@ function env_creature_UI.init_module()
env_creature = require("MHR_Overlay.Endemic_Life.env_creature");
end
return env_creature_UI;
return this;

View File

@@ -1,4 +1,4 @@
local large_monster_UI = {};
local this = {};
local singletons;
local config;
@@ -53,7 +53,7 @@ local get_tg_camera_method = gui_manager_type_def:get_method("get_refGuiHud_TgCa
local tg_camera_type_def = get_tg_camera_method:get_return_type();
local get_targeting_enemy_index_field = tg_camera_type_def:get_field("OldTargetingEmIndex");
function large_monster_UI.draw(dynamic_enabled, static_enabled, highlighted_enabled)
function this.draw(dynamic_enabled, static_enabled, highlighted_enabled)
local cached_config = config.current_config.large_monster_UI;
if singletons.enemy_manager == nil then
@@ -153,27 +153,27 @@ function large_monster_UI.draw(dynamic_enabled, static_enabled, highlighted_enab
end
if dynamic_enabled then
local success = pcall(large_monster_UI.draw_dynamic, displayed_monsters, highlighted_monster, cached_config);
local success = pcall(this.draw_dynamic, displayed_monsters, highlighted_monster, cached_config);
if not success then
customization_menu.status = string.format("[%s] Dynamic Large Monster drawing function threw an exception");
end
end
if highlighted_enabled then
local success = pcall(large_monster_UI.draw_highlighted, highlighted_monster, cached_config);
local success = pcall(this.draw_highlighted, highlighted_monster, cached_config);
if not success then
customization_menu.status = string.format("[%s] Highlighted Large Monster drawing function threw an exception");
end
end
if static_enabled then
local success = pcall(large_monster_UI.draw_static, displayed_monsters, highlighted_monster, cached_config);
local success = pcall(this.draw_static, displayed_monsters, highlighted_monster, cached_config);
if not success then
customization_menu.status = string.format("[%s] Static Large Monster drawing function threw an exception");
end
end
end
function large_monster_UI.draw_dynamic(displayed_monsters, highlighted_monster, cached_config)
function this.draw_dynamic(displayed_monsters, highlighted_monster, cached_config)
cached_config = cached_config.dynamic;
local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
@@ -230,7 +230,7 @@ function large_monster_UI.draw_dynamic(displayed_monsters, highlighted_monster,
end
end
function large_monster_UI.draw_static(displayed_monsters, highlighted_monster, cached_config)
function this.draw_static(displayed_monsters, highlighted_monster, cached_config)
cached_config = cached_config.static;
local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
@@ -311,7 +311,7 @@ function large_monster_UI.draw_static(displayed_monsters, highlighted_monster, c
end
end
function large_monster_UI.draw_highlighted(monster, cached_config)
function this.draw_highlighted(monster, cached_config)
cached_config = cached_config.highlighted;
if monster == nil then
@@ -327,7 +327,7 @@ function large_monster_UI.draw_highlighted(monster, cached_config)
large_monster.draw(monster, "highlighted", cached_config, position_on_screen, 1);
end
function large_monster_UI.init_module()
function this.init_module()
singletons = require("MHR_Overlay.Game_Handler.singletons");
config = require("MHR_Overlay.Misc.config");
customization_menu = require("MHR_Overlay.UI.customization_menu");
@@ -340,4 +340,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 this;

View File

@@ -1,4 +1,4 @@
local small_monster_UI = {};
local this = {};
local singletons;
local config;
@@ -46,7 +46,7 @@ local enemy_manager_type_def = sdk.find_type_definition("snow.enemy.EnemyManager
local get_zako_enemy_count_method = enemy_manager_type_def:get_method("getZakoEnemyCount");
local get_zako_enemy_method = enemy_manager_type_def:get_method("getZakoEnemy");
function small_monster_UI.draw()
function this.draw()
if singletons.enemy_manager == nil then
return;
end
@@ -186,7 +186,7 @@ function small_monster_UI.draw()
end
end
function small_monster_UI.init_module()
function this.init_module()
singletons = require("MHR_Overlay.Game_Handler.singletons");
config = require("MHR_Overlay.Misc.config");
customization_menu = require("MHR_Overlay.UI.customization_menu");
@@ -198,4 +198,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 this;

View File

@@ -1,4 +1,4 @@
local time_UI = {};
local this = {};
local time;
local screen;
@@ -38,9 +38,9 @@ local os = os;
local ValueType = ValueType;
local package = package;
time_UI.label = nil;
this.label = nil;
function time_UI.draw()
function this.draw()
local elapsed_minutes = time.elapsed_minutes;
local elapsed_seconds = time.elapsed_seconds;
@@ -50,26 +50,26 @@ function time_UI.draw()
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(this.label, position_on_screen, 1, elapsed_minutes, elapsed_seconds);
end
function time_UI.init_UI()
time_UI.label = utils.table.deep_copy(config.current_config.time_UI.time_label);
function this.init_UI()
this.label = utils.table.deep_copy(config.current_config.time_UI.time_label);
local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
time_UI.label.offset.x = time_UI.label.offset.x * global_scale_modifier;
time_UI.label.offset.y = time_UI.label.offset.y * global_scale_modifier;
this.label.offset.x = this.label.offset.x * global_scale_modifier;
this.label.offset.y = this.label.offset.y * global_scale_modifier;
end
function time_UI.init_module()
function this.init_module()
time = require("MHR_Overlay.Game_Handler.time");
screen = require("MHR_Overlay.Game_Handler.screen");
config = require("MHR_Overlay.Misc.config");
drawing = require("MHR_Overlay.UI.drawing");
utils = require("MHR_Overlay.Misc.utils");
time_UI.init_UI()
this.init_UI()
end
return time_UI;
return this;

View File

@@ -1,4 +1,4 @@
local ailment_UI_entity = {};
local this = {};
local config;
local utils;
@@ -37,7 +37,7 @@ local os = os;
local ValueType = ValueType;
local package = package;
function ailment_UI_entity.new(visibility, bar, name_label, text_label, value_label, percentage_label, timer_label)
function this.new(visibility, bar, name_label, text_label, value_label, percentage_label, timer_label)
local entity = {};
local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
@@ -75,7 +75,7 @@ function ailment_UI_entity.new(visibility, bar, name_label, text_label, value_la
return entity;
end
function ailment_UI_entity.draw(ailment, ailment_UI, cached_config, position_on_screen, opacity_scale)
function this.draw(ailment, ailment_UI, cached_config, position_on_screen, opacity_scale)
if not ailment_UI.visibility then
return;
end
@@ -118,11 +118,11 @@ function ailment_UI_entity.draw(ailment, ailment_UI, cached_config, position_on_
end
end
function ailment_UI_entity.init_module()
function this.init_module()
utils = require("MHR_Overlay.Misc.utils");
drawing = require("MHR_Overlay.UI.drawing");
config = require("MHR_Overlay.Misc.config");
language = require("MHR_Overlay.Misc.language");
end
return ailment_UI_entity;
return this;

View File

@@ -1,4 +1,4 @@
local ailment_buildup_UI_entity = {};
local this = {};
local utils;
local drawing;
@@ -38,7 +38,7 @@ local os = os;
local ValueType = ValueType;
local package = package;
function ailment_buildup_UI_entity.new(buildup_bar, highlighted_buildup_bar, ailment_name_label, player_name_label,
function this.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 = {};
@@ -88,7 +88,7 @@ function ailment_buildup_UI_entity.new(buildup_bar, highlighted_buildup_bar, ail
return entity;
end
function ailment_buildup_UI_entity.draw(player, player_buildup, ailment_buildup_UI, cached_config, position_on_screen, opacity_scale, top_buildup)
function this.draw(player, player_buildup, ailment_buildup_UI, cached_config, position_on_screen, opacity_scale, top_buildup)
local player_buildup_bar_percentage = 0;
if cached_config.settings.buildup_bar_relative_to == "Total Buildup" then
@@ -117,7 +117,7 @@ function ailment_buildup_UI_entity.draw(player, player_buildup, ailment_buildup_
drawing.draw_label(ailment_buildup_UI.buildup_percentage_label, position_on_screen, opacity_scale, 100 * player_buildup.buildup_share);
end
function ailment_buildup_UI_entity.init_module()
function this.init_module()
utils = require("MHR_Overlay.Misc.utils");
drawing = require("MHR_Overlay.UI.drawing");
config = require("MHR_Overlay.Misc.config");
@@ -125,4 +125,4 @@ function ailment_buildup_UI_entity.init_module()
language = require("MHR_Overlay.Misc.language");
end
return ailment_buildup_UI_entity;
return this;

View File

@@ -1,4 +1,4 @@
local body_part_UI_entity = {};
local this = {};
local config;
local utils;
@@ -36,7 +36,7 @@ local os = os;
local ValueType = ValueType;
local package = package;
function body_part_UI_entity.new(part_visibility, part_name_label, flinch_visibility, flinch_bar, flinch_text_label,
function this.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)
@@ -120,7 +120,7 @@ function body_part_UI_entity.new(part_visibility, part_name_label, flinch_visibi
return entity;
end
function body_part_UI_entity.draw(part, part_UI, cached_config, position_on_screen, opacity_scale)
function this.draw(part, part_UI, cached_config, position_on_screen, opacity_scale)
if not part_UI.part_visibility then
return;
end
@@ -250,10 +250,10 @@ function body_part_UI_entity.draw(part, part_UI, cached_config, position_on_scre
end
end
function body_part_UI_entity.init_module()
function this.init_module()
utils = require("MHR_Overlay.Misc.utils");
drawing = require("MHR_Overlay.UI.drawing");
config = require("MHR_Overlay.Misc.config");
end
return body_part_UI_entity;
return this;

View File

@@ -1,4 +1,4 @@
local buff_UI_entity = {};
local this = {};
local config;
local utils;
@@ -37,7 +37,7 @@ local os = os;
local ValueType = ValueType;
local package = package;
function buff_UI_entity.new(bar, name_label, timer_label)
function this.new(bar, name_label, timer_label)
local entity = {};
local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
@@ -63,7 +63,7 @@ function buff_UI_entity.new(bar, name_label, timer_label)
return entity;
end
function buff_UI_entity.draw(buff, buff_UI, position_on_screen, opacity_scale)
function this.draw(buff, buff_UI, position_on_screen, opacity_scale)
local cached_config = config.current_config.buff_UI;
if not buff.is_infinite then
@@ -81,11 +81,11 @@ function buff_UI_entity.draw(buff, buff_UI, position_on_screen, opacity_scale)
end
end
function buff_UI_entity.init_module()
function this.init_module()
utils = require("MHR_Overlay.Misc.utils");
drawing = require("MHR_Overlay.UI.drawing");
config = require("MHR_Overlay.Misc.config");
language = require("MHR_Overlay.Misc.language");
end
return buff_UI_entity;
return this;

View File

@@ -1,4 +1,4 @@
local damage_UI_entity = {};
local this = {};
local utils;
local drawing;
@@ -40,7 +40,7 @@ local os = os;
local ValueType = ValueType;
local package = package;
function damage_UI_entity.new(damage_meter_UI_elements, type)
function this.new(damage_meter_UI_elements, type)
local entity = {};
local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
@@ -111,7 +111,7 @@ function damage_UI_entity.new(damage_meter_UI_elements, type)
return entity;
end
function damage_UI_entity.draw(player, position_on_screen, opacity_scale, top_damage, top_dps)
function this.draw(player, position_on_screen, opacity_scale, top_damage, top_dps)
local cached_config = config.current_config.damage_meter_UI;
local name_include = nil;
@@ -233,7 +233,7 @@ function damage_UI_entity.draw(player, position_on_screen, opacity_scale, top_da
end
end
function damage_UI_entity.init_module()
function this.init_module()
utils = require("MHR_Overlay.Misc.utils");
drawing = require("MHR_Overlay.UI.drawing");
config = require("MHR_Overlay.Misc.config");
@@ -243,4 +243,4 @@ function damage_UI_entity.init_module()
non_players = require("MHR_Overlay.Damage_Meter.non_players");
end
return damage_UI_entity;
return this;

View File

@@ -1,4 +1,4 @@
local health_UI_entity = {};
local this = {};
local utils;
local drawing;
@@ -37,7 +37,7 @@ local os = os;
local ValueType = ValueType;
local package = package;
function health_UI_entity.new(visibility, bar, text_label, value_label, percentage_label)
function this.new(visibility, bar, text_label, value_label, percentage_label)
local entity = {};
local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
@@ -67,7 +67,7 @@ function health_UI_entity.new(visibility, bar, text_label, value_label, percenta
return entity;
end
function health_UI_entity.draw(monster, health_UI, position_on_screen, opacity_scale)
function this.draw(monster, health_UI, position_on_screen, opacity_scale)
if not health_UI.visibility then
return;
end
@@ -91,11 +91,11 @@ function health_UI_entity.draw(monster, health_UI, position_on_screen, opacity_s
drawing.draw_label(health_UI.percentage_label, position_on_screen, opacity_scale, 100 * monster.health_percentage);
end
function health_UI_entity.init_module()
function this.init_module()
utils = require("MHR_Overlay.Misc.utils");
drawing = require("MHR_Overlay.UI.drawing");
language = require("MHR_Overlay.Misc.language");
config = require("MHR_Overlay.Misc.config");
end
return health_UI_entity;
return this;

View File

@@ -1,4 +1,4 @@
local rage_UI_entity = {};
local this = {};
local utils;
local drawing;
@@ -37,7 +37,7 @@ local os = os;
local ValueType = ValueType;
local package = package;
function rage_UI_entity.new(visibility, bar, text_label, value_label, percentage_label, timer_label)
function this.new(visibility, bar, text_label, value_label, percentage_label, timer_label)
local entity = {};
local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
@@ -71,7 +71,7 @@ function rage_UI_entity.new(visibility, bar, text_label, value_label, percentage
return entity;
end
function rage_UI_entity.draw(monster, rage_UI, position_on_screen, opacity_scale)
function this.draw(monster, rage_UI, position_on_screen, opacity_scale)
if not rage_UI.visibility then
return;
end
@@ -105,11 +105,11 @@ function rage_UI_entity.draw(monster, rage_UI, position_on_screen, opacity_scale
end
end
function rage_UI_entity.init_module()
function this.init_module()
utils = require("MHR_Overlay.Misc.utils");
drawing = require("MHR_Overlay.UI.drawing");
language = require("MHR_Overlay.Misc.language");
config = require("MHR_Overlay.Misc.config");
end
return rage_UI_entity;
return this;

View File

@@ -1,4 +1,4 @@
local stamina_UI_entity = {};
local this = {};
local utils;
local drawing;
@@ -37,7 +37,7 @@ local os = os;
local ValueType = ValueType;
local package = package;
function stamina_UI_entity.new(visibility, bar, text_label, value_label, percentage_label, timer_label)
function this.new(visibility, bar, text_label, value_label, percentage_label, timer_label)
local entity = {};
local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
@@ -69,7 +69,7 @@ function stamina_UI_entity.new(visibility, bar, text_label, value_label, percent
return entity;
end
function stamina_UI_entity.draw(monster, stamina_UI, position_on_screen, opacity_scale)
function this.draw(monster, stamina_UI, position_on_screen, opacity_scale)
if not stamina_UI.visibility then
return;
end
@@ -102,11 +102,11 @@ function stamina_UI_entity.draw(monster, stamina_UI, position_on_screen, opacity
end
end
function stamina_UI_entity.init_module()
function this.init_module()
utils = require("MHR_Overlay.Misc.utils");
drawing = require("MHR_Overlay.UI.drawing");
language = require("MHR_Overlay.Misc.language");
config = require("MHR_Overlay.Misc.config");
end
return stamina_UI_entity;
return this;

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,4 @@
local drawing = {};
local this = {};
local config;
local utils;
@@ -35,14 +35,14 @@ local os = os;
local ValueType = ValueType;
local package = package;
drawing.font = nil;
this.font = nil;
function drawing.init_font()
function this.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);
this.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)
function this.argb_color_to_abgr_color(argb_color)
local alpha = (argb_color >> 24) & 0xFF;
local red = (argb_color >> 16) & 0xFF;
local green = (argb_color >> 8) & 0xFF;
@@ -53,7 +53,7 @@ function drawing.argb_color_to_abgr_color(argb_color)
return abgr_color;
end
function drawing.color_to_argb(color)
function this.color_to_argb(color)
local alpha = (color >> 24) & 0xFF;
local red = (color >> 16) & 0xFF;
local green = (color >> 8) & 0xFF;
@@ -62,18 +62,18 @@ function drawing.color_to_argb(color)
return alpha, red, green, blue;
end
function drawing.argb_to_color(alpha, red, green, blue)
function this.argb_to_color(alpha, red, green, blue)
return 0x1000000 * alpha + 0x10000 * red + 0x100 * green + blue;
end
function drawing.limit_text_size(text, size_limit)
function this.limit_text_size(text, size_limit)
if d2d == nil or not config.current_config.global_settings.renderer.use_d2d_if_available or size_limit <= 0 then
return text;
end
local limited_text = text;
while limited_text ~= "..." do
local text_width, text_height = drawing.font:measure(limited_text);
local text_width, text_height = this.font:measure(limited_text);
if text_width < size_limit then
break
@@ -90,8 +90,8 @@ function drawing.limit_text_size(text, size_limit)
return limited_text;
end
function drawing.scale_color_opacity(color, scale)
local alpha, red, green, blue = drawing.color_to_argb(color);
function this.scale_color_opacity(color, scale)
local alpha, red, green, blue = this.color_to_argb(color);
local new_alpha = math.floor(alpha * scale);
if new_alpha < 0 then
new_alpha = 0;
@@ -100,28 +100,28 @@ function drawing.scale_color_opacity(color, scale)
new_alpha = 255;
end
return drawing.argb_to_color(new_alpha, red, green, blue);
return this.argb_to_color(new_alpha, red, green, blue);
end
function drawing.scale_bar_opacity(bar, scale)
function this.scale_bar_opacity(bar, scale)
if bar == nil 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);
bar.colors.foreground = this.scale_color_opacity(bar.colors.foreground, scale);
bar.colors.background = this.scale_color_opacity(bar.colors.background, scale);
end
function drawing.scale_label_opacity(label, scale)
function this.scale_label_opacity(label, scale)
if label == nil or scale == nil or not label.visibility then
return;
end
label.color = drawing.scale_color_opacity(label.color, scale);
label.shadow.color = drawing.scale_color_opacity(label.shadow.color, scale);
label.color = this.scale_color_opacity(label.color, scale);
label.shadow.color = this.scale_color_opacity(label.shadow.color, scale);
end
function drawing.draw_label(label, position, opacity_scale, ...)
function this.draw_label(label, position, opacity_scale, ...)
if label == nil or not label.visibility then
return;
end
@@ -141,32 +141,32 @@ function drawing.draw_label(label, position, opacity_scale, ...)
local new_shadow_color = label.shadow.color;
if opacity_scale < 1 then
new_shadow_color = drawing.scale_color_opacity(new_shadow_color, opacity_scale);
new_shadow_color = this.scale_color_opacity(new_shadow_color, opacity_scale);
end
if use_d2d then
d2d.text(drawing.font, text, position_x + label.shadow.offset.x, position_y + label.shadow.offset.y, new_shadow_color);
d2d.text(this.font, text, position_x + label.shadow.offset.x, position_y + label.shadow.offset.y, new_shadow_color);
else
new_shadow_color = drawing.argb_color_to_abgr_color(new_shadow_color);
new_shadow_color = this.argb_color_to_abgr_color(new_shadow_color);
draw.text(text, position_x + label.shadow.offset.x, position_y + label.shadow.offset.y, new_shadow_color);
end
end
local new_color = label.color;
if opacity_scale < 1 then
new_color = drawing.scale_color_opacity(new_color, opacity_scale);
new_color = this.scale_color_opacity(new_color, opacity_scale);
end
if use_d2d then
d2d.text(drawing.font, text, position_x, position_y, new_color);
d2d.text(this.font, text, position_x, position_y, new_color);
else
new_color = drawing.argb_color_to_abgr_color(new_color);
new_color = this.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)
function this.draw_bar(bar, position, opacity_scale, percentage)
if bar == nil or not bar.visibility then
return;
@@ -264,9 +264,9 @@ function drawing.draw_bar(bar, position, opacity_scale, percentage)
local outline_color = bar.colors.outline;
if opacity_scale < 1 then
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);
foreground_color = this.scale_color_opacity(foreground_color, opacity_scale);
background_color = this.scale_color_opacity(background_color, opacity_scale);
outline_color = this.scale_color_opacity(outline_color, opacity_scale);
end
local use_d2d = d2d ~= nil and config.current_config.global_settings.renderer.use_d2d_if_available;
@@ -277,7 +277,7 @@ function drawing.draw_bar(bar, position, opacity_scale, percentage)
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);
outline_color = this.argb_color_to_abgr_color(outline_color);
draw.outline_rect(outline_position_x, outline_position_y, outline_width, outline_height, outline_color);
end
end
@@ -288,7 +288,7 @@ function drawing.draw_bar(bar, position, opacity_scale, percentage)
d2d.fill_rect(position_x, position_y, foreground_width, height, foreground_color);
else
foreground_color = drawing.argb_color_to_abgr_color(foreground_color);
foreground_color = this.argb_color_to_abgr_color(foreground_color);
draw.filled_rect(position_x, position_y, foreground_width, height, foreground_color)
end
end
@@ -298,13 +298,13 @@ function drawing.draw_bar(bar, position, opacity_scale, percentage)
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);
background_color = this.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)
function this.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
return;
@@ -317,7 +317,7 @@ function drawing.draw_capture_line(health_UI, position, opacity_scale, percentag
local color = health_UI.bar.capture_line.color;
if opacity_scale < 1 then
color = drawing.scale_color_opacity(color, opacity_scale);
color = this.scale_color_opacity(color, opacity_scale);
end
local use_d2d = d2d ~= nil and config.current_config.global_settings.renderer.use_d2d_if_available;
@@ -326,15 +326,15 @@ function drawing.draw_capture_line(health_UI, position, opacity_scale, percentag
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);
color = this.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)
end
end
function drawing.init_module()
function this.init_module()
config = require("MHR_Overlay.Misc.config");
utils = require("MHR_Overlay.Misc.utils");
end
return drawing;
return this;