From f627a0b19b94037326ec27a46b805c76c941e122 Mon Sep 17 00:00:00 2001 From: GreenComfyTea Date: Fri, 21 Apr 2023 10:08:07 +0300 Subject: [PATCH] Merge table_helpers and unicode_helpers into utils --- reframework/autorun/MHR_Overlay.lua | 7 +- .../autorun/MHR_Overlay/Buffs/buffs.lua | 3 + .../MHR_Overlay/Damage_Meter/damage_hook.lua | 30 +- .../MHR_Overlay/Damage_Meter/non_players.lua | 9 +- .../MHR_Overlay/Damage_Meter/players.lua | 5 +- .../MHR_Overlay/Endemic_Life/env_creature.lua | 9 +- .../Endemic_Life/env_creature_hook.lua | 3 + .../MHR_Overlay/Game_Handler/keyboard.lua | 3 + .../MHR_Overlay/Game_Handler/quest_status.lua | 3 + .../MHR_Overlay/Game_Handler/screen.lua | 3 + .../MHR_Overlay/Game_Handler/singletons.lua | 3 + .../autorun/MHR_Overlay/Game_Handler/time.lua | 3 + .../autorun/MHR_Overlay/Misc/config.lua | 23 +- .../autorun/MHR_Overlay/Misc/language.lua | 9 +- .../autorun/MHR_Overlay/Misc/part_names.lua | 5 +- .../MHR_Overlay/Misc/table_helpers.lua | 194 --------- .../MHR_Overlay/Misc/unicode_helpers.lua | 172 -------- .../autorun/MHR_Overlay/Misc/utils.lua | 390 +++++++++++++++++- .../MHR_Overlay/Monsters/ailment_buildup.lua | 5 +- .../MHR_Overlay/Monsters/ailment_hook.lua | 5 +- .../autorun/MHR_Overlay/Monsters/ailments.lua | 5 +- .../MHR_Overlay/Monsters/body_part.lua | 5 +- .../MHR_Overlay/Monsters/large_monster.lua | 9 +- .../MHR_Overlay/Monsters/monster_hook.lua | 3 + .../MHR_Overlay/Monsters/small_monster.lua | 9 +- .../ailment_buildups_customization.lua | 13 +- .../Customizations/ailments_customization.lua | 9 +- .../UI/Customizations/bar_customization.lua | 9 +- .../body_parts_customization.lua | 11 +- .../Customizations/health_customization.lua | 5 +- .../UI/Customizations/label_customization.lua | 5 +- .../large_monster_UI_customization.lua | 5 +- .../UI/Customizations/line_customization.lua | 5 +- .../module_visibility_customization.lua | 5 +- .../UI/Customizations/rage_customization.lua | 5 +- .../Customizations/stamina_customization.lua | 5 +- .../MHR_Overlay/UI/Modules/buff_UI.lua | 5 +- .../UI/Modules/damage_meter_UI.lua | 9 +- .../UI/Modules/env_creature_UI.lua | 5 +- .../UI/Modules/large_monster_UI.lua | 5 +- .../UI/Modules/small_monster_UI.lua | 5 +- .../MHR_Overlay/UI/Modules/time_UI.lua | 9 +- .../UI/UI_Entities/ailment_UI_entity.lua | 19 +- .../UI_Entities/ailment_buildup_UI_entity.lua | 23 +- .../UI/UI_Entities/body_part_UI_entity.lua | 33 +- .../UI/UI_Entities/buff_UI_entity.lua | 13 +- .../UI/UI_Entities/damage_UI_entity.lua | 21 +- .../UI/UI_Entities/health_UI_entity.lua | 15 +- .../UI/UI_Entities/rage_UI_entity.lua | 17 +- .../UI/UI_Entities/stamina_UI_entity.lua | 17 +- .../MHR_Overlay/UI/customization_menu.lua | 63 +-- .../autorun/MHR_Overlay/UI/drawing.lua | 11 +- 52 files changed, 677 insertions(+), 585 deletions(-) delete mode 100644 reframework/autorun/MHR_Overlay/Misc/table_helpers.lua delete mode 100644 reframework/autorun/MHR_Overlay/Misc/unicode_helpers.lua diff --git a/reframework/autorun/MHR_Overlay.lua b/reframework/autorun/MHR_Overlay.lua index 49b8516..b765d3c 100644 --- a/reframework/autorun/MHR_Overlay.lua +++ b/reframework/autorun/MHR_Overlay.lua @@ -28,6 +28,9 @@ local imgui = imgui; local draw = draw; local Vector2f = Vector2f; local reframework = reframework; +local os = os; +local ValueType = ValueType; +local package = package; local debug = require("MHR_Overlay.Misc.debug"); @@ -39,8 +42,6 @@ local time = require("MHR_Overlay.Game_Handler.time"); local config = require("MHR_Overlay.Misc.config"); local language = require("MHR_Overlay.Misc.language"); -local table_helpers = require("MHR_Overlay.Misc.table_helpers"); -local unicode_helpers = require("MHR_Overlay.Misc.unicode_helpers"); local part_names = require("MHR_Overlay.Misc.part_names"); local utils = require("MHR_Overlay.Misc.utils"); @@ -98,8 +99,6 @@ local drawing = require("MHR_Overlay.UI.drawing"); -- #region screen.init_module(); singletons.init_module(); -table_helpers.init_module(); -unicode_helpers.init_module(); utils.init_module(); time.init_module(); diff --git a/reframework/autorun/MHR_Overlay/Buffs/buffs.lua b/reframework/autorun/MHR_Overlay/Buffs/buffs.lua index 318bb41..e185398 100644 --- a/reframework/autorun/MHR_Overlay/Buffs/buffs.lua +++ b/reframework/autorun/MHR_Overlay/Buffs/buffs.lua @@ -31,6 +31,9 @@ local imgui = imgui; local draw = draw; local Vector2f = Vector2f; local reframework = reframework; +local os = os; +local ValueType = ValueType; +local package = package; buffs.list = {}; diff --git a/reframework/autorun/MHR_Overlay/Damage_Meter/damage_hook.lua b/reframework/autorun/MHR_Overlay/Damage_Meter/damage_hook.lua index a858e39..f53860f 100644 --- a/reframework/autorun/MHR_Overlay/Damage_Meter/damage_hook.lua +++ b/reframework/autorun/MHR_Overlay/Damage_Meter/damage_hook.lua @@ -5,7 +5,6 @@ local players; local small_monster; local large_monster; local ailments; -local table_helpers; local singletons; local non_players; local utils; @@ -38,6 +37,9 @@ local imgui = imgui; local draw = draw; local Vector2f = Vector2f; local reframework = reframework; +local os = os; +local ValueType = ValueType; +local package = package; local wall_hit_damage_queue = {}; @@ -80,8 +82,7 @@ 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"; @@ -93,11 +94,9 @@ function damage_hook.get_damage_source_type(damage_source_type_id, is_marionette return "otomo"; elseif damage_source_type_id >= 25 and damage_source_type_id <= 32 then return "endemic life"; - elseif damage_source_type_id == 34 then - return "other"; end - return tostring(damage_source_type_id); + return "other"; end -- snow.hit.EnemyCalcDamageInfo.AfterCalcInfo_DamageSide @@ -129,7 +128,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 @@ -227,20 +226,6 @@ function damage_hook.update_damage(enemy, enemy_calc_damage_info) players.update_damage(players.total, damage_source_type, is_large_monster, damage_object); players.update_damage(player, damage_source_type, is_large_monster, damage_object); - - --xy = xy .. "\nPlayer: " .. tostring(player.id) .. - -- " " .. tostring(player.name) .. - -- " Damage: " .. tostring(damage_object.total_damage); - - --if is_otomo_attack then - --xy = xy .. "\nOtomo: " .. tostring(otomo.id) .. - -- " " .. tostring(otomo.name) .. - -- " Damage: " .. tostring(damage_object.total_damage); - --end - - --if string.len(xy) > 2000 then - -- xy = ""; - --end end --function damage_hook.on_mystery_core_break(enemy) @@ -263,7 +248,7 @@ end function damage_hook.on_stock_direct_marionette_finish_shoot_hit_parts_damage(enemy, damage_rate, is_endure, is_ignore_multi_rate, category, no) local monster = large_monster.get_monster(enemy); - local damage = utils.round(monster.max_health * damage_rate); + local damage = utils.math.round(monster.max_health * damage_rate); large_monster.update_all_riders(); local attacker_id = monster.rider_id; @@ -330,7 +315,6 @@ function damage_hook.init_module() small_monster = require("MHR_Overlay.Monsters.small_monster"); large_monster = require("MHR_Overlay.Monsters.large_monster"); ailments = require("MHR_Overlay.Monsters.ailments"); - table_helpers = require("MHR_Overlay.Misc.table_helpers"); singletons = require("MHR_Overlay.Game_Handler.singletons"); non_players = require("MHR_Overlay.Damage_Meter.non_players"); utils = require("MHR_Overlay.Misc.utils"); diff --git a/reframework/autorun/MHR_Overlay/Damage_Meter/non_players.lua b/reframework/autorun/MHR_Overlay/Damage_Meter/non_players.lua index 03ed3ec..6284319 100644 --- a/reframework/autorun/MHR_Overlay/Damage_Meter/non_players.lua +++ b/reframework/autorun/MHR_Overlay/Damage_Meter/non_players.lua @@ -1,7 +1,6 @@ local non_players = {}; local config; -local table_helpers; local singletons; local customization_menu; local damage_UI_entity; @@ -9,7 +8,6 @@ local time; local quest_status; local drawing; local language; -local unicode_helpers; local players; local sdk = sdk; @@ -40,6 +38,9 @@ local imgui = imgui; local draw = draw; local Vector2f = Vector2f; local reframework = reframework; +local os = os; +local ValueType = ValueType; +local package = package; non_players.servant_list = {}; non_players.otomo_list = {}; @@ -277,8 +278,6 @@ function non_players.update_servant_otomos() goto continue; end - --name = unicode_helpers.sub(name, 13); - if non_players.otomo_list[member_id] == nil then non_players.otomo_list[member_id] = non_players.new(member_id, name, level, players.types.servant_otomo); end @@ -380,7 +379,6 @@ end function non_players.init_module() config = require("MHR_Overlay.Misc.config"); - table_helpers = require("MHR_Overlay.Misc.table_helpers"); singletons = require("MHR_Overlay.Game_Handler.singletons"); customization_menu = require("MHR_Overlay.UI.customization_menu"); damage_UI_entity = require("MHR_Overlay.UI.UI_Entities.damage_UI_entity"); @@ -389,7 +387,6 @@ function non_players.init_module() drawing = require("MHR_Overlay.UI.drawing"); language = require("MHR_Overlay.Misc.language"); players = require("MHR_Overlay.Damage_Meter.players"); - unicode_helpers = require("MHR_Overlay.Misc.unicode_helpers"); non_players.init(); end diff --git a/reframework/autorun/MHR_Overlay/Damage_Meter/players.lua b/reframework/autorun/MHR_Overlay/Damage_Meter/players.lua index eda26a9..1862fa6 100644 --- a/reframework/autorun/MHR_Overlay/Damage_Meter/players.lua +++ b/reframework/autorun/MHR_Overlay/Damage_Meter/players.lua @@ -1,7 +1,6 @@ local players = {}; local config; -local table_helpers; local singletons; local customization_menu; local damage_UI_entity; @@ -39,6 +38,9 @@ local imgui = imgui; local draw = draw; local Vector2f = Vector2f; local reframework = reframework; +local os = os; +local ValueType = ValueType; +local package = package; players.list = {}; players.myself = nil; @@ -692,7 +694,6 @@ end function players.init_module() config = require("MHR_Overlay.Misc.config"); - table_helpers = require("MHR_Overlay.Misc.table_helpers"); singletons = require("MHR_Overlay.Game_Handler.singletons"); customization_menu = require("MHR_Overlay.UI.customization_menu"); damage_UI_entity = require("MHR_Overlay.UI.UI_Entities.damage_UI_entity"); diff --git a/reframework/autorun/MHR_Overlay/Endemic_Life/env_creature.lua b/reframework/autorun/MHR_Overlay/Endemic_Life/env_creature.lua index acbd48e..bd9daa4 100644 --- a/reframework/autorun/MHR_Overlay/Endemic_Life/env_creature.lua +++ b/reframework/autorun/MHR_Overlay/Endemic_Life/env_creature.lua @@ -4,7 +4,7 @@ local drawing; local customization_menu; local singletons; local config; -local table_helpers; +local utils; local sdk = sdk; local tostring = tostring; @@ -34,6 +34,9 @@ local imgui = imgui; local draw = draw; local Vector2f = Vector2f; local reframework = reframework; +local os = os; +local ValueType = ValueType; +local package = package; env_creature.list = {}; @@ -89,7 +92,7 @@ function env_creature.init(creature, REcreature) end function env_creature.init_UI(creature) - creature.name_label = table_helpers.deep_copy(config.current_config.endemic_life_UI.creature_name_label); + creature.name_label = utils.table.deep_copy(config.current_config.endemic_life_UI.creature_name_label); local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier; @@ -144,7 +147,7 @@ function env_creature.init_module() singletons = require("MHR_Overlay.Game_Handler.singletons"); customization_menu = require("MHR_Overlay.UI.customization_menu"); config = require("MHR_Overlay.Misc.config"); - table_helpers = require("MHR_Overlay.Misc.table_helpers"); + utils = require("MHR_Overlay.Misc.utils"); --health_UI_entity = require("MHR_Overlay.UI.UI_Entities.health_UI_entity"); --stamina_UI_entity = require("MHR_Overlay.UI.UI_Entities.stamina_UI_entity"); --screen = require("MHR_Overlay.Game_Handler.screen"); diff --git a/reframework/autorun/MHR_Overlay/Endemic_Life/env_creature_hook.lua b/reframework/autorun/MHR_Overlay/Endemic_Life/env_creature_hook.lua index d20c75c..b38c6f5 100644 --- a/reframework/autorun/MHR_Overlay/Endemic_Life/env_creature_hook.lua +++ b/reframework/autorun/MHR_Overlay/Endemic_Life/env_creature_hook.lua @@ -32,6 +32,9 @@ local imgui = imgui; local draw = draw; local Vector2f = Vector2f; local reframework = reframework; +local os = os; +local ValueType = ValueType; +local package = package; local environment_creature_base_type_def = sdk.find_type_definition("snow.envCreature.EnvironmentCreatureBase"); local update_method = environment_creature_base_type_def:get_method("update"); diff --git a/reframework/autorun/MHR_Overlay/Game_Handler/keyboard.lua b/reframework/autorun/MHR_Overlay/Game_Handler/keyboard.lua index 8f7b67c..eaee324 100644 --- a/reframework/autorun/MHR_Overlay/Game_Handler/keyboard.lua +++ b/reframework/autorun/MHR_Overlay/Game_Handler/keyboard.lua @@ -37,6 +37,9 @@ local imgui = imgui; local draw = draw; local Vector2f = Vector2f; local reframework = reframework; +local os = os; +local ValueType = ValueType; +local package = package; local game_keyboard_type_def = sdk.find_type_definition("snow.GameKeyboard"); local hard_keyboard_field = game_keyboard_type_def:get_field("hardKeyboard"); diff --git a/reframework/autorun/MHR_Overlay/Game_Handler/quest_status.lua b/reframework/autorun/MHR_Overlay/Game_Handler/quest_status.lua index 7eb5b8d..8721d42 100644 --- a/reframework/autorun/MHR_Overlay/Game_Handler/quest_status.lua +++ b/reframework/autorun/MHR_Overlay/Game_Handler/quest_status.lua @@ -38,6 +38,9 @@ local imgui = imgui; local draw = draw; local Vector2f = Vector2f; local reframework = reframework; +local os = os; +local ValueType = ValueType; +local package = package; quest_status.flow_states = { NONE = 0, diff --git a/reframework/autorun/MHR_Overlay/Game_Handler/screen.lua b/reframework/autorun/MHR_Overlay/Game_Handler/screen.lua index 7bb32ff..fd845fd 100644 --- a/reframework/autorun/MHR_Overlay/Game_Handler/screen.lua +++ b/reframework/autorun/MHR_Overlay/Game_Handler/screen.lua @@ -31,6 +31,9 @@ local imgui = imgui; local draw = draw; local Vector2f = Vector2f; local reframework = reframework; +local os = os; +local ValueType = ValueType; +local package = package; screen.width = 1920; screen.height = 1080; diff --git a/reframework/autorun/MHR_Overlay/Game_Handler/singletons.lua b/reframework/autorun/MHR_Overlay/Game_Handler/singletons.lua index 83f1b8c..9aa0693 100644 --- a/reframework/autorun/MHR_Overlay/Game_Handler/singletons.lua +++ b/reframework/autorun/MHR_Overlay/Game_Handler/singletons.lua @@ -28,6 +28,9 @@ local imgui = imgui; local draw = draw; local Vector2f = Vector2f; local reframework = reframework; +local os = os; +local ValueType = ValueType; +local package = package; singletons.message_manager = nil; singletons.enemy_manager = nil; diff --git a/reframework/autorun/MHR_Overlay/Game_Handler/time.lua b/reframework/autorun/MHR_Overlay/Game_Handler/time.lua index 2d84cbd..13e739d 100644 --- a/reframework/autorun/MHR_Overlay/Game_Handler/time.lua +++ b/reframework/autorun/MHR_Overlay/Game_Handler/time.lua @@ -36,6 +36,9 @@ local imgui = imgui; local draw = draw; local Vector2f = Vector2f; local reframework = reframework; +local os = os; +local ValueType = ValueType; +local package = package; local quest_manager_type_def = sdk.find_type_definition("snow.QuestManager"); local get_quest_elapsed_time_min_method = quest_manager_type_def:get_method("getQuestElapsedTimeMin"); diff --git a/reframework/autorun/MHR_Overlay/Misc/config.lua b/reframework/autorun/MHR_Overlay/Misc/config.lua index f2fa1be..83511d3 100644 --- a/reframework/autorun/MHR_Overlay/Misc/config.lua +++ b/reframework/autorun/MHR_Overlay/Misc/config.lua @@ -1,6 +1,6 @@ local config = {}; -local table_helpers; +local utils; local language; local sdk = sdk; @@ -31,6 +31,9 @@ local imgui = imgui; local draw = draw; local Vector2f = Vector2f; local reframework = reframework; +local os = os; +local ValueType = ValueType; +local package = package; config.version = "2.4.1"; @@ -5674,7 +5677,7 @@ function config.load_current_config_value() }; config.current_config_name = "old_config"; - config.current_config = table_helpers.merge(config.default_config, loaded_config); + config.current_config = utils.table.merge(config.default_config, loaded_config); config.current_config.version = config.version; config.save(config.config_folder .. "old_config.json", config.current_config); @@ -5713,7 +5716,7 @@ function config.load_configs() log.info("[MHR Overlay] " .. config_name .. ".json loaded successfully"); - local merged_config = table_helpers.merge(config.default_config, loaded_config); + local merged_config = utils.table.merge(config.default_config, loaded_config); merged_config.version = config.version; table.insert(config.config_names, config_name); @@ -5737,7 +5740,7 @@ function config.load_configs() config.current_config = config.configs[1]; else config.current_config_name = "default"; - config.current_config = table_helpers.deep_copy(config.default_config); + config.current_config = utils.table.deep_copy(config.default_config); table.insert(config.config_names, config.current_config_name); table.insert(config.configs, config.current_config); @@ -5784,7 +5787,7 @@ function config.new(config_name) return; end - local new_config = table_helpers.deep_copy(config.default_config); + local new_config = utils.table.deep_copy(config.default_config); config.create_new(config_name, new_config); end @@ -5794,15 +5797,15 @@ function config.duplicate(config_name) return; end - local new_config = table_helpers.deep_copy(config.current_config); + local new_config = utils.table.deep_copy(config.current_config); config.create_new(config_name, new_config); end function config.reset() - config.current_config = table_helpers.deep_copy(config.default_config); + config.current_config = utils.table.deep_copy(config.default_config); - local index = table_helpers.find_index(config.config_names, config.current_config_name); + local index = utils.table.find_index(config.config_names, config.current_config_name); config.configs[index] = config.current_config; end @@ -5812,14 +5815,14 @@ function config.update(index) end function config.init_module() - table_helpers = require("MHR_Overlay.Misc.table_helpers"); + utils = require("MHR_Overlay.Misc.utils"); language = require("MHR_Overlay.Misc.language"); config.init_default(); config.load_current_config_value(); config.load_configs(); - language.update(table_helpers.find_index(language.language_names, config.current_config.global_settings.language, false)); + language.update(utils.table.find_index(language.language_names, config.current_config.global_settings.language, false)); end return config; \ No newline at end of file diff --git a/reframework/autorun/MHR_Overlay/Misc/language.lua b/reframework/autorun/MHR_Overlay/Misc/language.lua index ae3ae8c..46e1728 100644 --- a/reframework/autorun/MHR_Overlay/Misc/language.lua +++ b/reframework/autorun/MHR_Overlay/Misc/language.lua @@ -1,6 +1,6 @@ local language = {}; -local table_helpers; +local utils; local sdk = sdk; local tostring = tostring; @@ -30,6 +30,9 @@ local imgui = imgui; local draw = draw; local Vector2f = Vector2f; local reframework = reframework; +local os = os; +local ValueType = ValueType; +local package = package; language.language_folder = "MHR Overlay\\languages\\"; @@ -523,7 +526,7 @@ function language.load() log.info("[MHR Overlay] " .. language_file_name .. ".json loaded successfully"); table.insert(language.language_names, language_name); - local merged_language = table_helpers.merge(language.default_language, loaded_language); + local merged_language = utils.table.merge(language.default_language, loaded_language); table.insert(language.languages, merged_language); language.save(language_file_name, merged_language); @@ -553,7 +556,7 @@ function language.update(index) end function language.init_module() - table_helpers = require("MHR_Overlay.Misc.table_helpers"); + utils = require("MHR_Overlay.Misc.utils"); language.save_default(); language.load(); diff --git a/reframework/autorun/MHR_Overlay/Misc/part_names.lua b/reframework/autorun/MHR_Overlay/Misc/part_names.lua index d8e9a26..81bc139 100644 --- a/reframework/autorun/MHR_Overlay/Misc/part_names.lua +++ b/reframework/autorun/MHR_Overlay/Misc/part_names.lua @@ -1,7 +1,6 @@ local part_names = {}; local language; -local table_helpers; local sdk = sdk; local tostring = tostring; @@ -31,6 +30,9 @@ local imgui = imgui; local draw = draw; local Vector2f = Vector2f; local reframework = reframework; +local os = os; +local ValueType = ValueType; +local package = package; part_names.list = {}; @@ -898,7 +900,6 @@ end function part_names.init_module() language = require("MHR_Overlay.Misc.language"); - table_helpers = require("MHR_Overlay.Misc.table_helpers"); part_names.init(); end diff --git a/reframework/autorun/MHR_Overlay/Misc/table_helpers.lua b/reframework/autorun/MHR_Overlay/Misc/table_helpers.lua deleted file mode 100644 index 10aab81..0000000 --- a/reframework/autorun/MHR_Overlay/Misc/table_helpers.lua +++ /dev/null @@ -1,194 +0,0 @@ -local table_helpers = {}; - -local sdk = sdk; -local tostring = tostring; -local pairs = pairs; -local ipairs = ipairs; -local tonumber = tonumber; -local require = require; -local pcall = pcall; -local table = table; -local string = string; -local Vector3f = Vector3f; -local d2d = d2d; -local math = math; -local json = json; -local log = log; -local fs = fs; -local next = next; -local type = type; -local setmetatable = setmetatable; -local getmetatable = getmetatable; -local assert = assert; -local select = select; -local coroutine = coroutine; -local utf8 = utf8; -local re = re; -local imgui = imgui; -local draw = draw; -local Vector2f = Vector2f; -local reframework = reframework; - -function table_helpers.deep_copy(original, copies) - copies = copies or {}; - local original_type = type(original); - local copy; - if original_type == "table" then - if copies[original] then - copy = copies[original]; - else - 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); - end - setmetatable(copy, table_helpers.deep_copy(getmetatable(original), copies)); - end - else -- number, string, boolean, etc - copy = original; - end - return copy; -end - -function table_helpers.find_index(table_, value, nullable) - for i = 1, #table_ do - if table_[i] == value then - return i; - end - end - - if not nullable then - return 1; - end - - return nil; -end - -function table_helpers.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 - assert(type(table_) == "table", string.format("Expected a table as function parameter %d", key)); - end - - local result = table_helpers.deep_copy(tables_to_merge[1]); - - for i = 2, #tables_to_merge do - local from = tables_to_merge[i]; - for key, value in pairs(from) do - if type(value) == "table" then - result[key] = result[key] or {}; - assert(type(result[key]) == "table", string.format("Expected a table: '%s'", key)); - result[key] = table_helpers.merge(result[key], value); - else - result[key] = value; - end - end - end - - return result; -end - -function table_helpers.tostring(table_) - if type(table_) == "number" or type(table_) == "boolean" or type(table_) == "string" then - return tostring(table_); - end - - if table_helpers.is_empty(table_) then - return "{}"; - end - - local cache = {}; - local stack = {}; - local output = {}; - local depth = 1; - local output_str = "{\n"; - - while true do - local size = 0; - for k,v in pairs(table_) do - size = size + 1; - end - - local cur_index = 1; - for k,v in pairs(table_) do - if cache[table_] == nil or cur_index >= cache[table_] then - - if string.find(output_str, "}", output_str:len()) then - output_str = output_str .. ",\n"; - elseif not string.find(output_str, "\n", output_str:len()) then - output_str = output_str .. "\n"; - end - - -- This is necessary for working with HUGE tables otherwise we run out of memory using concat on huge strings - table.insert(output,output_str); - output_str = ""; - - local key; - if type(k) == "number" or type(k) == "boolean" then - key = "[" .. tostring(k) .. "]"; - else - key = "['" .. tostring(k) .. "']"; - end - - if type(v) == "number" or type(v) == "boolean" then - output_str = output_str .. string.rep('\t', depth) .. key .. " = "..tostring(v); - elseif type(v) == "table" then - output_str = output_str .. string.rep('\t', depth) .. key .. " = {\n"; - table.insert(stack, table_); - table.insert(stack, v); - cache[table_] = cur_index + 1; - break; - else - output_str = output_str .. string.rep('\t', depth) .. key .. " = '" .. tostring(v) .. "'"; - end - - if cur_index == size then - output_str = output_str .. "\n" .. string.rep('\t', depth - 1) .. "}"; - else - output_str = output_str .. ","; - end - else - -- close the table - if cur_index == size then - output_str = output_str .. "\n" .. string.rep('\t', depth - 1) .. "}"; - end - end - - cur_index = cur_index + 1; - end - - if size == 0 then - output_str = output_str .. "\n" .. string.rep('\t', depth - 1) .. "}"; - end - - if #stack > 0 then - table_ = stack[#stack]; - stack[#stack] = nil; - depth = cache[table_] == nil and depth + 1 or depth - 1; - else - break - end - end - - -- This is necessary for working with HUGE tables otherwise we run out of memory using concat on huge strings - table.insert(output, output_str); - output_str = table.concat(output); - - return output_str; -end - -function table_helpers.tostringln(table_) - return "\n" .. table_helpers.tostring(table_); -end - -function table_helpers.is_empty(table_) - return next(table_) == nil; -end - -function table_helpers.init_module() - -end - -return table_helpers; diff --git a/reframework/autorun/MHR_Overlay/Misc/unicode_helpers.lua b/reframework/autorun/MHR_Overlay/Misc/unicode_helpers.lua deleted file mode 100644 index 21ddb28..0000000 --- a/reframework/autorun/MHR_Overlay/Misc/unicode_helpers.lua +++ /dev/null @@ -1,172 +0,0 @@ -local unicode_helpers = {}; - -local sdk = sdk; -local tostring = tostring; -local pairs = pairs; -local ipairs = ipairs; -local tonumber = tonumber; -local require = require; -local pcall = pcall; -local table = table; -local string = string; -local Vector3f = Vector3f; -local d2d = d2d; -local math = math; -local json = json; -local log = log; -local fs = fs; -local next = next; -local type = type; -local setmetatable = setmetatable; -local getmetatable = getmetatable; -local assert = assert; -local select = select; -local coroutine = coroutine; -local utf8 = utf8; -local re = re; -local imgui = imgui; -local draw = draw; -local Vector2f = Vector2f; -local reframework = reframework; - --- https://github.com/blitmap/lua-utf8-simple/blob/master/utf8_simple.lua - --- ABNF from RFC 3629 --- --- UTF8-octets = *( UTF8-char ) --- UTF8-char = UTF8-1 / UTF8-2 / UTF8-3 / UTF8-4 --- UTF8-1 = %x00-7F --- UTF8-2 = %xC2-DF UTF8-tail --- UTF8-3 = %xE0 %xA0-BF UTF8-tail / %xE1-EC 2( UTF8-tail ) / --- %xED %x80-9F UTF8-tail / %xEE-EF 2( UTF8-tail ) --- UTF8-4 = %xF0 %x90-BF 2( UTF8-tail ) / %xF1-F3 3( UTF8-tail ) / --- %xF4 %x80-8F 2( UTF8-tail ) --- UTF8-tail = %x80-BF - --- 0xxxxxxx | 007F (127) --- 110xxxxx 10xxxxxx | 07FF (2047) --- 1110xxxx 10xxxxxx 10xxxxxx | FFFF (65535) --- 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx | 10FFFF (1114111) - -local pattern = "[%z\1-\127\194-\244][\128-\191]*"; - --- helper function -function unicode_helpers.relative_position(position, length) - if position < 0 then - position = length + position + 1; - end - return position; -end - --- THE MEAT - --- maps f over s's utf8 characters f can accept args: (visual_index, utf8_character, byte_index) -function unicode_helpers.map(s, f, no_subs) - local i = 0; - - if no_subs then - 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 - i = i + 1; - f(i, c, b); - end - end -end - --- THE REST - --- returns the number of characters in a UTF-8 string -function unicode_helpers.len(s) - -- count the number of non-continuing bytes - return select(2, s:gsub('[^\128-\193]', '')); -end - --- replace all utf8 chars with mapping -function unicode_helpers.replace(s, map) - return s:gsub(pattern, map); -end - --- reverse a utf8 string -function unicode_helpers.reverse(s) - -- reverse the individual greater-than-single-byte characters - s = s:gsub(pattern,function (c) - return #c > 1 and c:reverse() - end); - - return s:reverse(); -end - --- strip non-ascii characters from a utf8 string -function unicode_helpers.strip(s) - return s:gsub(pattern, function(c) - return #c > 1 and ''; - end); -end - --- generator for the above -- to iterate over all utf8 chars -function unicode_helpers.chars(s, no_subs) - return coroutine.wrap(function() - return unicode_helpers.map(s, coroutine.yield, no_subs); - end); -end - --- like string.sub() but i, j are utf8 strings --- a utf8-safe string.sub() -function unicode_helpers.sub(str, i, j) - if coroutine == nil then - return str; - end - - local l = utf8.len(str); - - 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(str, 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(str, 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(str, i, b + c - 1); -end - -function unicode_helpers.init_module() -end - -return unicode_helpers; diff --git a/reframework/autorun/MHR_Overlay/Misc/utils.lua b/reframework/autorun/MHR_Overlay/Misc/utils.lua index 01d28bf..fbbfac2 100644 --- a/reframework/autorun/MHR_Overlay/Misc/utils.lua +++ b/reframework/autorun/MHR_Overlay/Misc/utils.lua @@ -1,4 +1,4 @@ -local utils = {}; +local this = {}; local sdk = sdk; local tostring = tostring; @@ -28,16 +28,392 @@ local imgui = imgui; local draw = draw; local Vector2f = Vector2f; local reframework = reframework; +local os = os; +local ValueType = ValueType; +local package = package; -function utils.sign(v) - return (v >= 0 and 1) or -1; +local table_tostring; +local deep_copy; +local merge; +local is_empty; +local unicode_map; +local unicode_relative_position; +local unicode_chars; + +this.table = {}; +this.number = {}; +this.string = {}; +this.vec2 = {}; +this.vec3 = {}; +this.vec4 = {}; +this.math = {}; +this.unicode = {}; + +function this.table.tostring(table_) + if type(table_) == "number" or type(table_) == "boolean" or type(table_) == "string" then + return tostring(table_); + end + + if is_empty(table_) then + return "{}"; + end + + local cache = {}; + local stack = {}; + local output = {}; + local depth = 1; + local output_str = "{\n"; + + while true do + local size = 0; + for k,v in pairs(table_) do + size = size + 1; + end + + local cur_index = 1; + for k,v in pairs(table_) do + if cache[table_] == nil or cur_index >= cache[table_] then + + if string.find(output_str, "}", output_str:len()) then + output_str = output_str .. ",\n"; + elseif not string.find(output_str, "\n", output_str:len()) then + output_str = output_str .. "\n"; + end + + -- This is necessary for working with HUGE tables otherwise we run out of memory using concat on huge strings + table.insert(output,output_str); + output_str = ""; + + local key; + if type(k) == "number" or type(k) == "boolean" then + key = "[" .. tostring(k) .. "]"; + else + key = "['" .. tostring(k) .. "']"; + end + + if type(v) == "number" or type(v) == "boolean" then + output_str = output_str .. string.rep('\t', depth) .. key .. " = "..tostring(v); + elseif type(v) == "table" then + output_str = output_str .. string.rep('\t', depth) .. key .. " = {\n"; + table.insert(stack, table_); + table.insert(stack, v); + cache[table_] = cur_index + 1; + break; + else + output_str = output_str .. string.rep('\t', depth) .. key .. " = '" .. tostring(v) .. "'"; + end + + if cur_index == size then + output_str = output_str .. "\n" .. string.rep('\t', depth - 1) .. "}"; + else + output_str = output_str .. ","; + end + else + -- close the table + if cur_index == size then + output_str = output_str .. "\n" .. string.rep('\t', depth - 1) .. "}"; + end + end + + cur_index = cur_index + 1; + end + + if size == 0 then + output_str = output_str .. "\n" .. string.rep('\t', depth - 1) .. "}"; + end + + if #stack > 0 then + table_ = stack[#stack]; + stack[#stack] = nil; + depth = cache[table_] == nil and depth + 1 or depth - 1; + else + break; + end + end + + -- This is necessary for working with HUGE tables otherwise we run out of memory using concat on huge strings + table.insert(output, output_str); + output_str = table.concat(output); + + return output_str; end -function utils.round(value, bracket) + +function this.table.tostringln(table_) + return "\n" .. table_tostring(table_); +end + +function this.table.is_empty(table_) + return next(table_) == nil; +end + +function this.table.deep_copy(original, copies) + copies = copies or {}; + local original_type = type(original); + local copy; + if original_type == "table" then + if copies[original] then + copy = copies[original]; + else + copy = {}; + copies[original] = copy; + for original_key, original_value in next, original, nil do + copy[deep_copy(original_key, copies)] = deep_copy(original_value,copies); + end + setmetatable(copy, deep_copy(getmetatable(original), copies)); + end + else -- number, string, boolean, etc + copy = original; + end + return copy; +end + +function this.table.find_index(table_, value, nullable) + for i = 1, #table_ do + if table_[i] == value then + return i; + end + end + + if not nullable then + return 1; + end + + return nil; +end + +function this.table.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 + assert(type(table_) == "table", string.format("Expected a table as function parameter %d", key)); + end + + local result = deep_copy(tables_to_merge[1]); + + for i = 2, #tables_to_merge do + local from = tables_to_merge[i]; + for key, value in pairs(from) do + if type(value) == "table" then + result[key] = result[key] or {}; + assert(type(result[key]) == "table", string.format("Expected a table: '%s'", key)); + result[key] = merge(result[key], value); + else + result[key] = value; + end + end + end + + return result; +end + +function this.number.is_NaN(value) + return tostring(value) == tostring(0/0); +end + +function this.number.round(value) + return math.floor(value + 0.5); +end + +function this.string.trim(str) + return str:match("^%s*(.-)%s*$"); +end + +function this.string.starts_with(str, pattern) + return str:find("^" .. pattern) ~= nil; +end + +function this.vec2.tostring(vector2f) + return string.format("<%f, %f>", vector2f.x, vector2f.y); +end + +function this.vec2.random(distance) + distance = distance or 1; + local radians = math.random() * math.pi * 2; + return Vector2f.new( + distance * math.cos(radians), + distance * math.sin(radians) + ); +end + +function this.vec3.tostring(vector3f) + return string.format("<%f, %f, %f>", vector3f.x, vector3f.y, vector3f.z); +end + +function this.vec4.tostring(vector4f) + return string.format("<%f, %f, %f, %f>", vector4f.x, vector4f.y, vector4f.z, vector4f.w); +end + +--- When called without arguments, returns a pseudo-random float with uniform distribution in the range [0,1). When called with two floats min and max, math.random returns a pseudo-random float with uniform distribution in the range [min, max). The call .random(max) is equivalent to .random(1, max) +---@param min number +---@param max number +---@return number +function this.math.random(min, max) + if min == nil and max == nil then + return math.random(); + end + + if max == nil then + return max * math.random(); + end + + return min + (max - min) * math.random(); +end + +function this.math.sign(value) + return (value >= 0 and 1) or -1; +end +function this.math.round(value, bracket) bracket = bracket or 1; - return math.floor(value / bracket + utils.sign(value) * 0.5) * bracket; + return math.floor(value / bracket + this.math.sign(value) * 0.5) * bracket; end -function utils.init_module() +-- https://github.com/blitmap/lua-utf8-simple/blob/master/utf8_simple.lua + +-- ABNF from RFC 3629 +-- +-- UTF8-octets = *( UTF8-char ) +-- UTF8-char = UTF8-1 / UTF8-2 / UTF8-3 / UTF8-4 +-- UTF8-1 = %x00-7F +-- UTF8-2 = %xC2-DF UTF8-tail +-- UTF8-3 = %xE0 %xA0-BF UTF8-tail / %xE1-EC 2( UTF8-tail ) / +-- %xED %x80-9F UTF8-tail / %xEE-EF 2( UTF8-tail ) +-- UTF8-4 = %xF0 %x90-BF 2( UTF8-tail ) / %xF1-F3 3( UTF8-tail ) / +-- %xF4 %x80-8F 2( UTF8-tail ) +-- UTF8-tail = %x80-BF + +-- 0xxxxxxx | 007F (127) +-- 110xxxxx 10xxxxxx | 07FF (2047) +-- 1110xxxx 10xxxxxx 10xxxxxx | FFFF (65535) +-- 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx | 10FFFF (1114111) + +local pattern = "[%z\1-\127\194-\244][\128-\191]*"; + +-- helper function +function this.unicode.relative_position(position, length) + if position < 0 then + position = length + position + 1; + end + return position; end -return utils; \ No newline at end of file +-- THE MEAT + +-- maps f over s's utf8 characters f can accept args: (visual_index, utf8_character, byte_index) +function this.unicode.map(s, f, no_subs) + local i = 0; + + if no_subs then + 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 + i = i + 1; + f(i, c, b); + end + end +end + +-- THE REST + +-- returns the number of characters in a UTF-8 string +function this.unicode.len(s) + -- count the number of non-continuing bytes + return select(2, s:gsub('[^\128-\193]', '')); +end + +-- replace all utf8 chars with mapping +function this.unicode.replace(s, map) + return s:gsub(pattern, map); +end + +-- reverse a utf8 string +function this.unicode.reverse(s) + -- reverse the individual greater-than-single-byte characters + s = s:gsub(pattern, function (c) + return #c > 1 and c:reverse() + end); + + return s:reverse(); +end + +-- strip non-ascii characters from a utf8 string +function this.unicode.strip(s) + return s:gsub(pattern, function(c) + return #c > 1 and ''; + end); +end + +-- generator for the above -- to iterate over all utf8 chars +function this.unicode.chars(s, no_subs) + return coroutine.wrap(function() + return unicode_map(s, coroutine.yield, no_subs); + end); +end + +-- like string.sub() but i, j are utf8 strings +-- a utf8-safe string.sub() +function this.unicode.sub(str, i, j) + if coroutine == nil then + return str; + end + + local l = utf8.len(str); + + i = unicode_relative_position(i, l); + j = j and unicode_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_chars(str, 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(str, 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(str, i, b + c - 1); +end + +function this.init_module() +end + +table_tostring = this.table.tostring; +deep_copy = this.table.deep_copy; +merge = this.table.merge; +is_empty = this.table.is_empty; +unicode_map = this.unicode.map; +unicode_relative_position = this.unicode.relative_position; +unicode_chars = this.unicode.chars; + +return this; \ No newline at end of file diff --git a/reframework/autorun/MHR_Overlay/Monsters/ailment_buildup.lua b/reframework/autorun/MHR_Overlay/Monsters/ailment_buildup.lua index 59b6ba4..7146136 100644 --- a/reframework/autorun/MHR_Overlay/Monsters/ailment_buildup.lua +++ b/reframework/autorun/MHR_Overlay/Monsters/ailment_buildup.lua @@ -8,7 +8,6 @@ local ailment_buildup_UI_entity; local time; local small_monster; local large_monster; -local table_helpers; local drawing; local sdk = sdk; @@ -39,6 +38,9 @@ local imgui = imgui; local draw = draw; local Vector2f = Vector2f; local reframework = reframework; +local os = os; +local ValueType = ValueType; +local package = package; function ailment_buildup.draw(monster, ailment_buildup_UI, cached_config, ailment_buildups_position_on_screen, opacity_scale) @@ -238,7 +240,6 @@ function ailment_buildup.init_module() time = require("MHR_Overlay.Game_Handler.time"); small_monster = require("MHR_Overlay.Monsters.small_monster"); large_monster = require("MHR_Overlay.Monsters.large_monster"); - table_helpers = require("MHR_Overlay.Misc.table_helpers"); drawing = require("MHR_Overlay.UI.drawing"); end diff --git a/reframework/autorun/MHR_Overlay/Monsters/ailment_hook.lua b/reframework/autorun/MHR_Overlay/Monsters/ailment_hook.lua index 5260092..d86432d 100644 --- a/reframework/autorun/MHR_Overlay/Monsters/ailment_hook.lua +++ b/reframework/autorun/MHR_Overlay/Monsters/ailment_hook.lua @@ -4,7 +4,6 @@ local small_monster; local large_monster; local config; local ailments; -local table_helpers; local sdk = sdk; local tostring = tostring; @@ -34,6 +33,9 @@ local imgui = imgui; local draw = draw; local Vector2f = Vector2f; local reframework = reframework; +local os = os; +local ValueType = ValueType; +local package = package; local enemy_poison_damage_param_type_def = sdk.find_type_definition("snow.enemy.EnemyPoisonDamageParam"); local on_poison_activate_proc_method = enemy_poison_damage_param_type_def:get_method("onActivateProc"); @@ -147,7 +149,6 @@ function ailment_hook.init_module() large_monster = require("MHR_Overlay.Monsters.large_monster"); config = require("MHR_Overlay.Misc.config"); ailments = require("MHR_Overlay.Monsters.ailments"); - table_helpers = require("MHR_Overlay.Misc.table_helpers"); sdk.hook(stock_damage_method, function(args) pcall(ailment_hook.stock_damage, sdk.to_managed_object(args[2])); diff --git a/reframework/autorun/MHR_Overlay/Monsters/ailments.lua b/reframework/autorun/MHR_Overlay/Monsters/ailments.lua index c6804d7..ba85d47 100644 --- a/reframework/autorun/MHR_Overlay/Monsters/ailments.lua +++ b/reframework/autorun/MHR_Overlay/Monsters/ailments.lua @@ -8,7 +8,6 @@ local ailment_buildup_UI_entity; local time; local small_monster; local large_monster; -local table_helpers; local non_players; local sdk = sdk; @@ -39,6 +38,9 @@ local imgui = imgui; local draw = draw; local Vector2f = Vector2f; local reframework = reframework; +local os = os; +local ValueType = ValueType; +local package = package; --0 Paralyze --1 Sleep @@ -821,7 +823,6 @@ function ailments.init_module() time = require("MHR_Overlay.Game_Handler.time"); small_monster = require("MHR_Overlay.Monsters.small_monster"); large_monster = require("MHR_Overlay.Monsters.large_monster"); - table_helpers = require("MHR_Overlay.Misc.table_helpers"); end return ailments; diff --git a/reframework/autorun/MHR_Overlay/Monsters/body_part.lua b/reframework/autorun/MHR_Overlay/Monsters/body_part.lua index ab441a4..822c7af 100644 --- a/reframework/autorun/MHR_Overlay/Monsters/body_part.lua +++ b/reframework/autorun/MHR_Overlay/Monsters/body_part.lua @@ -3,7 +3,6 @@ local body_part = {}; local singletons; local customization_menu; local config; -local table_helpers; local health_UI_entity; local stamina_UI_entity; local rage_UI_entity; @@ -41,6 +40,9 @@ local imgui = imgui; local draw = draw; local Vector2f = Vector2f; local reframework = reframework; +local os = os; +local ValueType = ValueType; +local package = package; body_part.list = {}; @@ -342,7 +344,6 @@ function body_part.init_module() singletons = require("MHR_Overlay.Game_Handler.singletons"); customization_menu = require("MHR_Overlay.UI.customization_menu"); config = require("MHR_Overlay.Misc.config"); - table_helpers = require("MHR_Overlay.Misc.table_helpers"); health_UI_entity = require("MHR_Overlay.UI.UI_Entities.health_UI_entity"); stamina_UI_entity = require("MHR_Overlay.UI.UI_Entities.stamina_UI_entity"); rage_UI_entity = require("MHR_Overlay.UI.UI_Entities.rage_UI_entity"); diff --git a/reframework/autorun/MHR_Overlay/Monsters/large_monster.lua b/reframework/autorun/MHR_Overlay/Monsters/large_monster.lua index 93ebfea..3b6dce3 100644 --- a/reframework/autorun/MHR_Overlay/Monsters/large_monster.lua +++ b/reframework/autorun/MHR_Overlay/Monsters/large_monster.lua @@ -4,7 +4,7 @@ local singletons; local customization_menu; local config; local language; -local table_helpers; +local utils; local health_UI_entity; local stamina_UI_entity; local rage_UI_entity; @@ -48,6 +48,9 @@ local imgui = imgui; local draw = draw; local Vector2f = Vector2f; local reframework = reframework; +local os = os; +local ValueType = ValueType; +local package = package; large_monster.list = {}; @@ -257,7 +260,7 @@ end function large_monster.init_UI(monster, monster_UI, cached_config) local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier; - monster_UI.monster_name_label = table_helpers.deep_copy(cached_config.monster_name_label); + monster_UI.monster_name_label = utils.table.deep_copy(cached_config.monster_name_label); monster_UI.health_UI = health_UI_entity.new( cached_config.health.visibility, @@ -910,7 +913,7 @@ function large_monster.init_module() customization_menu = require("MHR_Overlay.UI.customization_menu"); language = require("MHR_Overlay.Misc.language"); config = require("MHR_Overlay.Misc.config"); - table_helpers = require("MHR_Overlay.Misc.table_helpers"); + utils = require("MHR_Overlay.Misc.utils"); body_part = require("MHR_Overlay.Monsters.body_part"); health_UI_entity = require("MHR_Overlay.UI.UI_Entities.health_UI_entity"); stamina_UI_entity = require("MHR_Overlay.UI.UI_Entities.stamina_UI_entity"); diff --git a/reframework/autorun/MHR_Overlay/Monsters/monster_hook.lua b/reframework/autorun/MHR_Overlay/Monsters/monster_hook.lua index 1c57754..c558ec1 100644 --- a/reframework/autorun/MHR_Overlay/Monsters/monster_hook.lua +++ b/reframework/autorun/MHR_Overlay/Monsters/monster_hook.lua @@ -35,6 +35,9 @@ local imgui = imgui; local draw = draw; local Vector2f = Vector2f; local reframework = reframework; +local os = os; +local ValueType = ValueType; +local package = package; local enemy_character_base_type_def = sdk.find_type_definition("snow.enemy.EnemyCharacterBase"); local enemy_character_base_update_method = enemy_character_base_type_def:get_method("update"); diff --git a/reframework/autorun/MHR_Overlay/Monsters/small_monster.lua b/reframework/autorun/MHR_Overlay/Monsters/small_monster.lua index ce2d5ef..d3e584e 100644 --- a/reframework/autorun/MHR_Overlay/Monsters/small_monster.lua +++ b/reframework/autorun/MHR_Overlay/Monsters/small_monster.lua @@ -3,7 +3,7 @@ local small_monster = {}; local singletons; local customization_menu; local config; -local table_helpers; +local utils; local health_UI_entity; local stamina_UI_entity; local screen; @@ -41,6 +41,9 @@ local imgui = imgui; local draw = draw; local Vector2f = Vector2f; local reframework = reframework; +local os = os; +local ValueType = ValueType; +local package = package; small_monster.list = {}; @@ -113,7 +116,7 @@ function small_monster.init_UI(monster) local monster_UI = monster.UI; - monster_UI.name_label = table_helpers.deep_copy(cached_config.monster_name_label); + monster_UI.name_label = utils.table.deep_copy(cached_config.monster_name_label); monster_UI.name_label.offset.x = monster_UI.name_label.offset.x * global_scale_modifier; monster_UI.name_label.offset.y = monster_UI.name_label.offset.y * global_scale_modifier; @@ -250,7 +253,7 @@ function small_monster.init_module() singletons = require("MHR_Overlay.Game_Handler.singletons"); customization_menu = require("MHR_Overlay.UI.customization_menu"); config = require("MHR_Overlay.Misc.config"); - table_helpers = require("MHR_Overlay.Misc.table_helpers"); + utils = require("MHR_Overlay.Misc.utils"); health_UI_entity = require("MHR_Overlay.UI.UI_Entities.health_UI_entity"); stamina_UI_entity = require("MHR_Overlay.UI.UI_Entities.stamina_UI_entity"); screen = require("MHR_Overlay.Game_Handler.screen"); diff --git a/reframework/autorun/MHR_Overlay/UI/Customizations/ailment_buildups_customization.lua b/reframework/autorun/MHR_Overlay/UI/Customizations/ailment_buildups_customization.lua index 24bb278..67097c0 100644 --- a/reframework/autorun/MHR_Overlay/UI/Customizations/ailment_buildups_customization.lua +++ b/reframework/autorun/MHR_Overlay/UI/Customizations/ailment_buildups_customization.lua @@ -1,6 +1,6 @@ local ailment_buildups_customization = {}; -local table_helpers; +local utils; local config; local screen; local players; @@ -43,6 +43,9 @@ local imgui = imgui; local draw = draw; local Vector2f = Vector2f; local reframework = reframework; +local os = os; +local ValueType = ValueType; +local package = package; function ailment_buildups_customization.draw(cached_config) local changed = false; @@ -100,7 +103,7 @@ function ailment_buildups_customization.draw(cached_config) if imgui.tree_node(language.current_language.customization_menu.settings) then changed, index = imgui.combo( language.current_language.customization_menu.highlighted_bar, - table_helpers.find_index(customization_menu.highlighted_buildup_bar_types, cached_config.settings.highlighted_bar), + utils.table.find_index(customization_menu.highlighted_buildup_bar_types, cached_config.settings.highlighted_bar), customization_menu.displayed_highlighted_buildup_bar_types); config_changed = config_changed or changed; @@ -111,7 +114,7 @@ function ailment_buildups_customization.draw(cached_config) changed, index = imgui.combo( language.current_language.customization_menu.buildup_bars_are_relative_to, - table_helpers.find_index(customization_menu.displayed_buildup_bar_relative_types, cached_config.settings.buildup_bar_relative_to), + utils.table.find_index(customization_menu.displayed_buildup_bar_relative_types, cached_config.settings.buildup_bar_relative_to), customization_menu.displayed_buildup_bar_relative_types); config_changed = config_changed or changed; @@ -131,7 +134,7 @@ function ailment_buildups_customization.draw(cached_config) if imgui.tree_node(language.current_language.customization_menu.sorting) then changed, index = imgui.combo( language.current_language.customization_menu.type, - table_helpers.find_index(customization_menu.ailment_buildups_sorting_types, cached_config.sorting.type), + utils.table.find_index(customization_menu.ailment_buildups_sorting_types, cached_config.sorting.type), customization_menu.displayed_ailment_buildups_sorting_types); config_changed = config_changed or changed; @@ -198,7 +201,7 @@ function ailment_buildups_customization.draw(cached_config) end function ailment_buildups_customization.init_module() - table_helpers = require("MHR_Overlay.Misc.table_helpers"); + utils = require("MHR_Overlay.Misc.utils"); language = require("MHR_Overlay.Misc.language"); config = require("MHR_Overlay.Misc.config"); screen = require("MHR_Overlay.Game_Handler.screen"); diff --git a/reframework/autorun/MHR_Overlay/UI/Customizations/ailments_customization.lua b/reframework/autorun/MHR_Overlay/UI/Customizations/ailments_customization.lua index bc5d8e6..6e940a0 100644 --- a/reframework/autorun/MHR_Overlay/UI/Customizations/ailments_customization.lua +++ b/reframework/autorun/MHR_Overlay/UI/Customizations/ailments_customization.lua @@ -1,6 +1,6 @@ local ailments_customization = {}; -local table_helpers; +local utils; local config; local screen; local players; @@ -43,6 +43,9 @@ local imgui = imgui; local draw = draw; local Vector2f = Vector2f; local reframework = reframework; +local os = os; +local ValueType = ValueType; +local package = package; function ailments_customization.draw(cached_config) local changed = false; @@ -140,7 +143,7 @@ function ailments_customization.draw(cached_config) if imgui.tree_node(language.current_language.customization_menu.sorting) then changed, index = imgui.combo( language.current_language.customization_menu.type, - table_helpers.find_index(customization_menu.ailments_sorting_types, cached_config.sorting.type), + utils.table.find_index(customization_menu.ailments_sorting_types, cached_config.sorting.type), customization_menu.displayed_ailments_sorting_types); config_changed = config_changed or changed; @@ -363,7 +366,7 @@ function ailments_customization.draw(cached_config) end function ailments_customization.init_module() - table_helpers = require("MHR_Overlay.Misc.table_helpers"); + utils = require("MHR_Overlay.Misc.utils"); language = require("MHR_Overlay.Misc.language"); config = require("MHR_Overlay.Misc.config"); screen = require("MHR_Overlay.Game_Handler.screen"); diff --git a/reframework/autorun/MHR_Overlay/UI/Customizations/bar_customization.lua b/reframework/autorun/MHR_Overlay/UI/Customizations/bar_customization.lua index 9f656cc..5e73cc8 100644 --- a/reframework/autorun/MHR_Overlay/UI/Customizations/bar_customization.lua +++ b/reframework/autorun/MHR_Overlay/UI/Customizations/bar_customization.lua @@ -1,6 +1,6 @@ local bar_customization = {}; -local table_helpers; +local utils; local config; local screen; local players; @@ -42,6 +42,9 @@ local imgui = imgui; local draw = draw; local Vector2f = Vector2f; local reframework = reframework; +local os = os; +local ValueType = ValueType; +local package = package; function bar_customization.draw(bar_name, bar) if bar == nil then @@ -96,7 +99,7 @@ function bar_customization.draw(bar_name, bar) changed, index = imgui.combo(language.current_language.customization_menu.style, - table_helpers.find_index(customization_menu.outline_styles, + utils.table.find_index(customization_menu.outline_styles, bar.outline.style), customization_menu.displayed_outline_styles); bar_changed = bar_changed or changed; @@ -189,7 +192,7 @@ function bar_customization.draw(bar_name, bar) end function bar_customization.init_module() - table_helpers = require("MHR_Overlay.Misc.table_helpers"); + utils = require("MHR_Overlay.Misc.utils"); language = require("MHR_Overlay.Misc.language"); config = require("MHR_Overlay.Misc.config"); screen = require("MHR_Overlay.Game_Handler.screen"); diff --git a/reframework/autorun/MHR_Overlay/UI/Customizations/body_parts_customization.lua b/reframework/autorun/MHR_Overlay/UI/Customizations/body_parts_customization.lua index 4df6479..91ac6dc 100644 --- a/reframework/autorun/MHR_Overlay/UI/Customizations/body_parts_customization.lua +++ b/reframework/autorun/MHR_Overlay/UI/Customizations/body_parts_customization.lua @@ -1,6 +1,6 @@ local body_parts_customization = {}; -local table_helpers; +local utils; local config; local screen; local players; @@ -43,6 +43,9 @@ local imgui = imgui; local draw = draw; local Vector2f = Vector2f; local reframework = reframework; +local os = os; +local ValueType = ValueType; +local package = package; function body_parts_customization.draw(cached_config) local changed = false; @@ -88,7 +91,7 @@ function body_parts_customization.draw(cached_config) config_changed = config_changed or changed; changed, index = imgui.combo(language.current_language.customization_menu.filter_mode, - table_helpers.find_index(customization_menu.large_monster_UI_parts_filter_types, cached_config.settings.filter_mode), + utils.table.find_index(customization_menu.large_monster_UI_parts_filter_types, cached_config.settings.filter_mode), customization_menu.displayed_large_monster_UI_parts_filter_types); config_changed = config_changed or changed; @@ -108,7 +111,7 @@ function body_parts_customization.draw(cached_config) if imgui.tree_node(language.current_language.customization_menu.sorting) then changed, index = imgui.combo( language.current_language.customization_menu.type, - table_helpers.find_index(customization_menu.large_monster_UI_parts_sorting_types, cached_config.sorting.type), + utils.table.find_index(customization_menu.large_monster_UI_parts_sorting_types, cached_config.sorting.type), customization_menu.displayed_large_monster_UI_parts_sorting_types); config_changed = config_changed or changed; @@ -366,7 +369,7 @@ function body_parts_customization.draw(cached_config) end function body_parts_customization.init_module() - table_helpers = require("MHR_Overlay.Misc.table_helpers"); + utils = require("MHR_Overlay.Misc.utils"); language = require("MHR_Overlay.Misc.language"); config = require("MHR_Overlay.Misc.config"); screen = require("MHR_Overlay.Game_Handler.screen"); diff --git a/reframework/autorun/MHR_Overlay/UI/Customizations/health_customization.lua b/reframework/autorun/MHR_Overlay/UI/Customizations/health_customization.lua index 160f2f5..5d55a73 100644 --- a/reframework/autorun/MHR_Overlay/UI/Customizations/health_customization.lua +++ b/reframework/autorun/MHR_Overlay/UI/Customizations/health_customization.lua @@ -1,6 +1,5 @@ local large_monster_UI_customization = {}; -local table_helpers; local config; local screen; local players; @@ -43,6 +42,9 @@ local imgui = imgui; local draw = draw; local Vector2f = Vector2f; local reframework = reframework; +local os = os; +local ValueType = ValueType; +local package = package; function large_monster_UI_customization.draw(cached_config) local changed = false; @@ -87,7 +89,6 @@ function large_monster_UI_customization.draw(cached_config) end function large_monster_UI_customization.init_module() - table_helpers = require("MHR_Overlay.Misc.table_helpers"); language = require("MHR_Overlay.Misc.language"); config = require("MHR_Overlay.Misc.config"); screen = require("MHR_Overlay.Game_Handler.screen"); diff --git a/reframework/autorun/MHR_Overlay/UI/Customizations/label_customization.lua b/reframework/autorun/MHR_Overlay/UI/Customizations/label_customization.lua index ea0c8bb..fbb9ec7 100644 --- a/reframework/autorun/MHR_Overlay/UI/Customizations/label_customization.lua +++ b/reframework/autorun/MHR_Overlay/UI/Customizations/label_customization.lua @@ -1,6 +1,5 @@ local label_customization = {}; -local table_helpers; local config; local screen; local players; @@ -41,6 +40,9 @@ local imgui = imgui; local draw = draw; local Vector2f = Vector2f; local reframework = reframework; +local os = os; +local ValueType = ValueType; +local package = package; function label_customization.draw(label_name, label) local label_changed = false; @@ -114,7 +116,6 @@ function label_customization.draw(label_name, label) end function label_customization.init_module() - table_helpers = require("MHR_Overlay.Misc.table_helpers"); language = require("MHR_Overlay.Misc.language"); config = require("MHR_Overlay.Misc.config"); screen = require("MHR_Overlay.Game_Handler.screen"); diff --git a/reframework/autorun/MHR_Overlay/UI/Customizations/large_monster_UI_customization.lua b/reframework/autorun/MHR_Overlay/UI/Customizations/large_monster_UI_customization.lua index 8f37acd..9aef7d8 100644 --- a/reframework/autorun/MHR_Overlay/UI/Customizations/large_monster_UI_customization.lua +++ b/reframework/autorun/MHR_Overlay/UI/Customizations/large_monster_UI_customization.lua @@ -1,6 +1,5 @@ local large_monster_UI_customization = {}; -local table_helpers; local config; local screen; local players; @@ -50,6 +49,9 @@ local imgui = imgui; local draw = draw; local Vector2f = Vector2f; local reframework = reframework; +local os = os; +local ValueType = ValueType; +local package = package; function large_monster_UI_customization.draw(cached_config) local changed = false; @@ -80,7 +82,6 @@ function large_monster_UI_customization.draw(cached_config) end function large_monster_UI_customization.init_module() - table_helpers = require("MHR_Overlay.Misc.table_helpers"); language = require("MHR_Overlay.Misc.language"); config = require("MHR_Overlay.Misc.config"); screen = require("MHR_Overlay.Game_Handler.screen"); diff --git a/reframework/autorun/MHR_Overlay/UI/Customizations/line_customization.lua b/reframework/autorun/MHR_Overlay/UI/Customizations/line_customization.lua index 99d2166..a332a33 100644 --- a/reframework/autorun/MHR_Overlay/UI/Customizations/line_customization.lua +++ b/reframework/autorun/MHR_Overlay/UI/Customizations/line_customization.lua @@ -1,6 +1,5 @@ local line_customization = {}; -local table_helpers; local config; local screen; local players; @@ -41,6 +40,9 @@ local imgui = imgui; local draw = draw; local Vector2f = Vector2f; local reframework = reframework; +local os = os; +local ValueType = ValueType; +local package = package; function line_customization.draw(line_name, line) if line == nil then @@ -94,7 +96,6 @@ function line_customization.draw(line_name, line) end function line_customization.init_module() - table_helpers = require("MHR_Overlay.Misc.table_helpers"); language = require("MHR_Overlay.Misc.language"); config = require("MHR_Overlay.Misc.config"); screen = require("MHR_Overlay.Game_Handler.screen"); diff --git a/reframework/autorun/MHR_Overlay/UI/Customizations/module_visibility_customization.lua b/reframework/autorun/MHR_Overlay/UI/Customizations/module_visibility_customization.lua index 8a0a405..d59216e 100644 --- a/reframework/autorun/MHR_Overlay/UI/Customizations/module_visibility_customization.lua +++ b/reframework/autorun/MHR_Overlay/UI/Customizations/module_visibility_customization.lua @@ -1,6 +1,5 @@ local module_visibility_customization = {}; -local table_helpers; local config; local screen; local players; @@ -43,6 +42,9 @@ local imgui = imgui; local draw = draw; local Vector2f = Vector2f; local reframework = reframework; +local os = os; +local ValueType = ValueType; +local package = package; function module_visibility_customization.draw(cached_config) local changed = false; @@ -100,7 +102,6 @@ function module_visibility_customization.draw(cached_config) end function module_visibility_customization.init_module() - table_helpers = require("MHR_Overlay.Misc.table_helpers"); language = require("MHR_Overlay.Misc.language"); config = require("MHR_Overlay.Misc.config"); screen = require("MHR_Overlay.Game_Handler.screen"); diff --git a/reframework/autorun/MHR_Overlay/UI/Customizations/rage_customization.lua b/reframework/autorun/MHR_Overlay/UI/Customizations/rage_customization.lua index a361e44..5c121e2 100644 --- a/reframework/autorun/MHR_Overlay/UI/Customizations/rage_customization.lua +++ b/reframework/autorun/MHR_Overlay/UI/Customizations/rage_customization.lua @@ -1,6 +1,5 @@ local rage_customization = {}; -local table_helpers; local config; local screen; local players; @@ -43,6 +42,9 @@ local imgui = imgui; local draw = draw; local Vector2f = Vector2f; local reframework = reframework; +local os = os; +local ValueType = ValueType; +local package = package; function rage_customization.draw(cached_config) local changed = false; @@ -90,7 +92,6 @@ function rage_customization.draw(cached_config) end function rage_customization.init_module() - table_helpers = require("MHR_Overlay.Misc.table_helpers"); language = require("MHR_Overlay.Misc.language"); config = require("MHR_Overlay.Misc.config"); screen = require("MHR_Overlay.Game_Handler.screen"); diff --git a/reframework/autorun/MHR_Overlay/UI/Customizations/stamina_customization.lua b/reframework/autorun/MHR_Overlay/UI/Customizations/stamina_customization.lua index 288d9b2..9da0a3b 100644 --- a/reframework/autorun/MHR_Overlay/UI/Customizations/stamina_customization.lua +++ b/reframework/autorun/MHR_Overlay/UI/Customizations/stamina_customization.lua @@ -1,6 +1,5 @@ local stamina_customization = {}; -local table_helpers; local config; local screen; local players; @@ -43,6 +42,9 @@ local imgui = imgui; local draw = draw; local Vector2f = Vector2f; local reframework = reframework; +local os = os; +local ValueType = ValueType; +local package = package; function stamina_customization.draw(cached_config) local changed = false; @@ -90,7 +92,6 @@ function stamina_customization.draw(cached_config) end function stamina_customization.init_module() - table_helpers = require("MHR_Overlay.Misc.table_helpers"); language = require("MHR_Overlay.Misc.language"); config = require("MHR_Overlay.Misc.config"); screen = require("MHR_Overlay.Game_Handler.screen"); diff --git a/reframework/autorun/MHR_Overlay/UI/Modules/buff_UI.lua b/reframework/autorun/MHR_Overlay/UI/Modules/buff_UI.lua index 308e2e3..fa9c7c6 100644 --- a/reframework/autorun/MHR_Overlay/UI/Modules/buff_UI.lua +++ b/reframework/autorun/MHR_Overlay/UI/Modules/buff_UI.lua @@ -4,7 +4,6 @@ local buff_UI_entity; local config; local buffs; local screen; -local table_helpers; local sdk = sdk; local tostring = tostring; @@ -34,6 +33,9 @@ local imgui = imgui; local draw = draw; local Vector2f = Vector2f; local reframework = reframework; +local os = os; +local ValueType = ValueType; +local package = package; function buff_UI.draw() local cached_config = config.current_config.buff_UI; @@ -113,7 +115,6 @@ function buff_UI.init_module() buff_UI_entity = require("MHR_Overlay.UI.UI_Entities.buff_UI_entity"); buffs = require("MHR_Overlay.Buffs.buffs"); --singletons = require("MHR_Overlay.Game_Handler.singletons"); - table_helpers = require("MHR_Overlay.Misc.table_helpers"); config = require("MHR_Overlay.Misc.config"); --customization_menu = require("MHR_Overlay.UI.customization_menu"); --players = require("MHR_Overlay.Damage_Meter.players"); diff --git a/reframework/autorun/MHR_Overlay/UI/Modules/damage_meter_UI.lua b/reframework/autorun/MHR_Overlay/UI/Modules/damage_meter_UI.lua index 295fba4..8835526 100644 --- a/reframework/autorun/MHR_Overlay/UI/Modules/damage_meter_UI.lua +++ b/reframework/autorun/MHR_Overlay/UI/Modules/damage_meter_UI.lua @@ -9,7 +9,7 @@ local quest_status; local screen; local drawing; local language; -local table_helpers; +local utils; local sdk = sdk; local tostring = tostring; @@ -39,6 +39,9 @@ local imgui = imgui; local draw = draw; local Vector2f = Vector2f; local reframework = reframework; +local os = os; +local ValueType = ValueType; +local package = package; damage_meter_UI.last_displayed_players = {}; damage_meter_UI.freeze_displayed_players = false; @@ -64,7 +67,7 @@ function damage_meter_UI.draw() local quest_players = {}; - if damage_meter_UI.freeze_displayed_players and not table_helpers.is_empty(damage_meter_UI.last_displayed_players) then + 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; else quest_players = players.display_list; @@ -182,7 +185,7 @@ function damage_meter_UI.init_module() screen = require("MHR_Overlay.Game_Handler.screen"); drawing = require("MHR_Overlay.UI.drawing"); language = require("MHR_Overlay.Misc.language"); - table_helpers = require("MHR_Overlay.Misc.table_helpers"); + utils = require("MHR_Overlay.Misc.utils"); end return damage_meter_UI; diff --git a/reframework/autorun/MHR_Overlay/UI/Modules/env_creature_UI.lua b/reframework/autorun/MHR_Overlay/UI/Modules/env_creature_UI.lua index f397b2b..e596fca 100644 --- a/reframework/autorun/MHR_Overlay/UI/Modules/env_creature_UI.lua +++ b/reframework/autorun/MHR_Overlay/UI/Modules/env_creature_UI.lua @@ -7,7 +7,6 @@ local large_monster; local screen; local players; local drawing; -local table_helpers; local health_UI_entity; local stamina_UI_entity; local rage_UI_entity; @@ -41,6 +40,9 @@ local imgui = imgui; local draw = draw; local Vector2f = Vector2f; local reframework = reframework; +local os = os; +local ValueType = ValueType; +local package = package; local enemy_manager_type_def = sdk.find_type_definition("snow.enemy.EnemyManager"); @@ -100,7 +102,6 @@ function env_creature_UI.init_module() screen = require("MHR_Overlay.Game_Handler.screen"); players = require("MHR_Overlay.Damage_Meter.players"); drawing = require("MHR_Overlay.UI.drawing"); - table_helpers = require("MHR_Overlay.Misc.table_helpers"); health_UI_entity = require("MHR_Overlay.UI.UI_Entities.health_UI_entity"); stamina_UI_entity = require("MHR_Overlay.UI.UI_Entities.stamina_UI_entity"); rage_UI_entity = require("MHR_Overlay.UI.UI_Entities.rage_UI_entity"); diff --git a/reframework/autorun/MHR_Overlay/UI/Modules/large_monster_UI.lua b/reframework/autorun/MHR_Overlay/UI/Modules/large_monster_UI.lua index fe7f2c2..6fd993c 100644 --- a/reframework/autorun/MHR_Overlay/UI/Modules/large_monster_UI.lua +++ b/reframework/autorun/MHR_Overlay/UI/Modules/large_monster_UI.lua @@ -7,7 +7,6 @@ local large_monster; local screen; local players; local drawing; -local table_helpers; local health_UI_entity; local stamina_UI_entity; local rage_UI_entity; @@ -40,6 +39,9 @@ local imgui = imgui; local draw = draw; local Vector2f = Vector2f; local reframework = reframework; +local os = os; +local ValueType = ValueType; +local package = package; local enemy_manager_type_def = sdk.find_type_definition("snow.enemy.EnemyManager"); local get_boss_enemy_count_method = enemy_manager_type_def:get_method("getBossEnemyCount"); @@ -333,7 +335,6 @@ function large_monster_UI.init_module() screen = require("MHR_Overlay.Game_Handler.screen"); players = require("MHR_Overlay.Damage_Meter.players"); drawing = require("MHR_Overlay.UI.drawing"); - table_helpers = require("MHR_Overlay.Misc.table_helpers"); health_UI_entity = require("MHR_Overlay.UI.UI_Entities.health_UI_entity"); stamina_UI_entity = require("MHR_Overlay.UI.UI_Entities.stamina_UI_entity"); rage_UI_entity = require("MHR_Overlay.UI.UI_Entities.rage_UI_entity"); diff --git a/reframework/autorun/MHR_Overlay/UI/Modules/small_monster_UI.lua b/reframework/autorun/MHR_Overlay/UI/Modules/small_monster_UI.lua index dc07299..ec826d8 100644 --- a/reframework/autorun/MHR_Overlay/UI/Modules/small_monster_UI.lua +++ b/reframework/autorun/MHR_Overlay/UI/Modules/small_monster_UI.lua @@ -7,7 +7,6 @@ local customization_menu; local screen; local players; local drawing; -local table_helpers; local health_UI_entity; local stamina_UI_entity; @@ -39,6 +38,9 @@ local imgui = imgui; local draw = draw; local Vector2f = Vector2f; local reframework = reframework; +local os = os; +local ValueType = ValueType; +local package = package; 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"); @@ -192,7 +194,6 @@ function small_monster_UI.init_module() screen = require("MHR_Overlay.Game_Handler.screen"); players = require("MHR_Overlay.Damage_Meter.players"); drawing = require("MHR_Overlay.UI.drawing"); - table_helpers = require("MHR_Overlay.Misc.table_helpers"); health_UI_entity = require("MHR_Overlay.UI.UI_Entities.health_UI_entity"); stamina_UI_entity = require("MHR_Overlay.UI.UI_Entities.stamina_UI_entity"); end diff --git a/reframework/autorun/MHR_Overlay/UI/Modules/time_UI.lua b/reframework/autorun/MHR_Overlay/UI/Modules/time_UI.lua index 96339e3..7344406 100644 --- a/reframework/autorun/MHR_Overlay/UI/Modules/time_UI.lua +++ b/reframework/autorun/MHR_Overlay/UI/Modules/time_UI.lua @@ -4,7 +4,7 @@ local time; local screen; local config; local drawing; -local table_helpers; +local utils; local sdk = sdk; local tostring = tostring; @@ -34,6 +34,9 @@ local imgui = imgui; local draw = draw; local Vector2f = Vector2f; local reframework = reframework; +local os = os; +local ValueType = ValueType; +local package = package; time_UI.label = nil; @@ -51,7 +54,7 @@ function time_UI.draw() end function time_UI.init_UI() - time_UI.label = table_helpers.deep_copy(config.current_config.time_UI.time_label); + time_UI.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; @@ -64,7 +67,7 @@ function time_UI.init_module() screen = require("MHR_Overlay.Game_Handler.screen"); config = require("MHR_Overlay.Misc.config"); drawing = require("MHR_Overlay.UI.drawing"); - table_helpers = require("MHR_Overlay.Misc.table_helpers"); + utils = require("MHR_Overlay.Misc.utils"); time_UI.init_UI() end diff --git a/reframework/autorun/MHR_Overlay/UI/UI_Entities/ailment_UI_entity.lua b/reframework/autorun/MHR_Overlay/UI/UI_Entities/ailment_UI_entity.lua index c0eede8..d8808c2 100644 --- a/reframework/autorun/MHR_Overlay/UI/UI_Entities/ailment_UI_entity.lua +++ b/reframework/autorun/MHR_Overlay/UI/UI_Entities/ailment_UI_entity.lua @@ -1,7 +1,7 @@ local ailment_UI_entity = {}; local config; -local table_helpers; +local utils; local drawing; local language; @@ -33,6 +33,9 @@ local imgui = imgui; local draw = draw; local Vector2f = Vector2f; local reframework = reframework; +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) local entity = {}; @@ -40,12 +43,12 @@ function ailment_UI_entity.new(visibility, bar, name_label, text_label, value_la local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier; entity.visibility = visibility; - entity.bar = table_helpers.deep_copy(bar); - entity.name_label = table_helpers.deep_copy(name_label); - entity.text_label = table_helpers.deep_copy(text_label); - entity.value_label = table_helpers.deep_copy(value_label); - entity.percentage_label = table_helpers.deep_copy(percentage_label); - entity.timer_label = table_helpers.deep_copy(timer_label); + entity.bar = utils.table.deep_copy(bar); + entity.name_label = utils.table.deep_copy(name_label); + entity.text_label = utils.table.deep_copy(text_label); + entity.value_label = utils.table.deep_copy(value_label); + entity.percentage_label = utils.table.deep_copy(percentage_label); + entity.timer_label = utils.table.deep_copy(timer_label); entity.bar.offset.x = entity.bar.offset.x * global_scale_modifier; entity.bar.offset.y = entity.bar.offset.y * global_scale_modifier; @@ -116,7 +119,7 @@ function ailment_UI_entity.draw(ailment, ailment_UI, cached_config, position_on_ end function ailment_UI_entity.init_module() - table_helpers = require("MHR_Overlay.Misc.table_helpers"); + utils = require("MHR_Overlay.Misc.utils"); drawing = require("MHR_Overlay.UI.drawing"); config = require("MHR_Overlay.Misc.config"); language = require("MHR_Overlay.Misc.language"); diff --git a/reframework/autorun/MHR_Overlay/UI/UI_Entities/ailment_buildup_UI_entity.lua b/reframework/autorun/MHR_Overlay/UI/UI_Entities/ailment_buildup_UI_entity.lua index f4f8e77..1b54b4e 100644 --- a/reframework/autorun/MHR_Overlay/UI/UI_Entities/ailment_buildup_UI_entity.lua +++ b/reframework/autorun/MHR_Overlay/UI/UI_Entities/ailment_buildup_UI_entity.lua @@ -1,6 +1,6 @@ local ailment_buildup_UI_entity = {}; -local table_helpers; +local utils; local drawing; local config; local players; @@ -34,6 +34,9 @@ local imgui = imgui; local draw = draw; local Vector2f = Vector2f; local reframework = reframework; +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, buildup_value_label, buildup_percentage_label, total_buildup_label, @@ -43,14 +46,14 @@ function ailment_buildup_UI_entity.new(buildup_bar, highlighted_buildup_bar, ail local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier; --entity.visibility = visibility; - entity.buildup_bar = table_helpers.deep_copy(buildup_bar); - entity.highlighted_buildup_bar = table_helpers.deep_copy(highlighted_buildup_bar); - entity.ailment_name_label = table_helpers.deep_copy(ailment_name_label); - entity.player_name_label = table_helpers.deep_copy(player_name_label); - entity.buildup_value_label = table_helpers.deep_copy(buildup_value_label); - entity.buildup_percentage_label = table_helpers.deep_copy(buildup_percentage_label); - entity.total_buildup_label = table_helpers.deep_copy(total_buildup_label); - entity.total_buildup_value_label = table_helpers.deep_copy(total_buildup_value_label); + entity.buildup_bar = utils.table.deep_copy(buildup_bar); + entity.highlighted_buildup_bar = utils.table.deep_copy(highlighted_buildup_bar); + entity.ailment_name_label = utils.table.deep_copy(ailment_name_label); + entity.player_name_label = utils.table.deep_copy(player_name_label); + entity.buildup_value_label = utils.table.deep_copy(buildup_value_label); + entity.buildup_percentage_label = utils.table.deep_copy(buildup_percentage_label); + entity.total_buildup_label = utils.table.deep_copy(total_buildup_label); + entity.total_buildup_value_label = utils.table.deep_copy(total_buildup_value_label); entity.buildup_bar.offset.x = entity.buildup_bar.offset.x * global_scale_modifier; entity.buildup_bar.offset.y = entity.buildup_bar.offset.y * global_scale_modifier; @@ -115,7 +118,7 @@ function ailment_buildup_UI_entity.draw(player, player_buildup, ailment_buildup_ end function ailment_buildup_UI_entity.init_module() - table_helpers = require("MHR_Overlay.Misc.table_helpers"); + utils = require("MHR_Overlay.Misc.utils"); drawing = require("MHR_Overlay.UI.drawing"); config = require("MHR_Overlay.Misc.config"); players = require("MHR_Overlay.Damage_Meter.players"); diff --git a/reframework/autorun/MHR_Overlay/UI/UI_Entities/body_part_UI_entity.lua b/reframework/autorun/MHR_Overlay/UI/UI_Entities/body_part_UI_entity.lua index 6e428ac..9081321 100644 --- a/reframework/autorun/MHR_Overlay/UI/UI_Entities/body_part_UI_entity.lua +++ b/reframework/autorun/MHR_Overlay/UI/UI_Entities/body_part_UI_entity.lua @@ -1,7 +1,7 @@ local body_part_UI_entity = {}; local config; -local table_helpers; +local utils; local drawing; local sdk = sdk; @@ -32,6 +32,9 @@ local imgui = imgui; local draw = draw; local Vector2f = Vector2f; local reframework = reframework; +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, flinch_value_label, flinch_percentage_label, break_visibility, break_bar, break_text_label, break_value_label, @@ -46,15 +49,15 @@ function body_part_UI_entity.new(part_visibility, part_name_label, flinch_visibi entity.break_visibility = break_visibility; entity.loss_visibility = loss_visibility; - entity.part_name_label = table_helpers.deep_copy(part_name_label); + entity.part_name_label = utils.table.deep_copy(part_name_label); entity.part_name_label.offset.x = entity.part_name_label.offset.x * global_scale_modifier; entity.part_name_label.offset.y = entity.part_name_label.offset.y * global_scale_modifier; - entity.flinch_bar = table_helpers.deep_copy(flinch_bar); - entity.flinch_text_label = table_helpers.deep_copy(flinch_text_label); - entity.flinch_value_label = table_helpers.deep_copy(flinch_value_label); - entity.flinch_percentage_label = table_helpers.deep_copy(flinch_percentage_label); + entity.flinch_bar = utils.table.deep_copy(flinch_bar); + entity.flinch_text_label = utils.table.deep_copy(flinch_text_label); + entity.flinch_value_label = utils.table.deep_copy(flinch_value_label); + entity.flinch_percentage_label = utils.table.deep_copy(flinch_percentage_label); entity.flinch_bar.offset.x = entity.flinch_bar.offset.x * global_scale_modifier; entity.flinch_bar.offset.y = entity.flinch_bar.offset.y * global_scale_modifier; @@ -72,10 +75,10 @@ function body_part_UI_entity.new(part_visibility, part_name_label, flinch_visibi entity.flinch_percentage_label.offset.x = entity.flinch_percentage_label.offset.x * global_scale_modifier; entity.flinch_percentage_label.offset.y = entity.flinch_percentage_label.offset.y * global_scale_modifier; - entity.break_bar = table_helpers.deep_copy(break_bar); - entity.break_text_label = table_helpers.deep_copy(break_text_label); - entity.break_value_label = table_helpers.deep_copy(break_value_label); - entity.break_percentage_label = table_helpers.deep_copy(break_percentage_label); + entity.break_bar = utils.table.deep_copy(break_bar); + entity.break_text_label = utils.table.deep_copy(break_text_label); + entity.break_value_label = utils.table.deep_copy(break_value_label); + entity.break_percentage_label = utils.table.deep_copy(break_percentage_label); entity.break_bar.offset.x = entity.break_bar.offset.x * global_scale_modifier; entity.break_bar.offset.y = entity.break_bar.offset.y * global_scale_modifier; @@ -93,10 +96,10 @@ function body_part_UI_entity.new(part_visibility, part_name_label, flinch_visibi entity.break_percentage_label.offset.x = entity.break_percentage_label.offset.x * global_scale_modifier; entity.break_percentage_label.offset.y = entity.break_percentage_label.offset.y * global_scale_modifier; - entity.loss_bar = table_helpers.deep_copy(loss_bar); - entity.loss_text_label = table_helpers.deep_copy(loss_text_label); - entity.loss_value_label = table_helpers.deep_copy(loss_value_label); - entity.loss_health_percentage_label = table_helpers.deep_copy(loss_health_percentage_label); + entity.loss_bar = utils.table.deep_copy(loss_bar); + entity.loss_text_label = utils.table.deep_copy(loss_text_label); + entity.loss_value_label = utils.table.deep_copy(loss_value_label); + entity.loss_health_percentage_label = utils.table.deep_copy(loss_health_percentage_label); entity.loss_bar.offset.x = entity.loss_bar.offset.x * global_scale_modifier; entity.loss_bar.offset.y = entity.loss_bar.offset.y * global_scale_modifier; @@ -248,7 +251,7 @@ function body_part_UI_entity.draw(part, part_UI, cached_config, position_on_scre end function body_part_UI_entity.init_module() - table_helpers = require("MHR_Overlay.Misc.table_helpers"); + utils = require("MHR_Overlay.Misc.utils"); drawing = require("MHR_Overlay.UI.drawing"); config = require("MHR_Overlay.Misc.config"); end diff --git a/reframework/autorun/MHR_Overlay/UI/UI_Entities/buff_UI_entity.lua b/reframework/autorun/MHR_Overlay/UI/UI_Entities/buff_UI_entity.lua index 476d5e1..9b5058b 100644 --- a/reframework/autorun/MHR_Overlay/UI/UI_Entities/buff_UI_entity.lua +++ b/reframework/autorun/MHR_Overlay/UI/UI_Entities/buff_UI_entity.lua @@ -1,7 +1,7 @@ local buff_UI_entity = {}; local config; -local table_helpers; +local utils; local drawing; local language; @@ -33,6 +33,9 @@ local imgui = imgui; local draw = draw; local Vector2f = Vector2f; local reframework = reframework; +local os = os; +local ValueType = ValueType; +local package = package; function buff_UI_entity.new(bar, name_label, timer_label) local entity = {}; @@ -40,9 +43,9 @@ function buff_UI_entity.new(bar, name_label, timer_label) local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier; --entity.visibility = visibility; - entity.bar = table_helpers.deep_copy(bar); - entity.name_label = table_helpers.deep_copy(name_label); - entity.timer_label = table_helpers.deep_copy(timer_label); + entity.bar = utils.table.deep_copy(bar); + entity.name_label = utils.table.deep_copy(name_label); + entity.timer_label = utils.table.deep_copy(timer_label); entity.bar.offset.x = entity.bar.offset.x * global_scale_modifier; entity.bar.offset.y = entity.bar.offset.y * global_scale_modifier; @@ -79,7 +82,7 @@ function buff_UI_entity.draw(buff, buff_UI, position_on_screen, opacity_scale) end function buff_UI_entity.init_module() - table_helpers = require("MHR_Overlay.Misc.table_helpers"); + utils = require("MHR_Overlay.Misc.utils"); drawing = require("MHR_Overlay.UI.drawing"); config = require("MHR_Overlay.Misc.config"); language = require("MHR_Overlay.Misc.language"); diff --git a/reframework/autorun/MHR_Overlay/UI/UI_Entities/damage_UI_entity.lua b/reframework/autorun/MHR_Overlay/UI/UI_Entities/damage_UI_entity.lua index ae8091f..2682ae0 100644 --- a/reframework/autorun/MHR_Overlay/UI/UI_Entities/damage_UI_entity.lua +++ b/reframework/autorun/MHR_Overlay/UI/UI_Entities/damage_UI_entity.lua @@ -1,6 +1,6 @@ local damage_UI_entity = {}; -local table_helpers; +local utils; local drawing; local config; local players; @@ -36,19 +36,22 @@ local imgui = imgui; local draw = draw; local Vector2f = Vector2f; local reframework = reframework; +local os = os; +local ValueType = ValueType; +local package = package; function damage_UI_entity.new(damage_meter_UI_elements, type) local entity = {}; local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier; - entity.bar = table_helpers.deep_copy(damage_meter_UI_elements.damage_bar); - entity.name_label = table_helpers.deep_copy(damage_meter_UI_elements.name_label); - entity.hunter_rank_label = table_helpers.deep_copy(damage_meter_UI_elements.hunter_rank_label); - entity.cart_count_label = table_helpers.deep_copy(damage_meter_UI_elements.cart_count_label); - entity.dps_label = table_helpers.deep_copy(damage_meter_UI_elements.dps_label); - entity.value_label = table_helpers.deep_copy(damage_meter_UI_elements.damage_value_label); - entity.percentage_label = table_helpers.deep_copy(damage_meter_UI_elements.damage_percentage_label); + entity.bar = utils.table.deep_copy(damage_meter_UI_elements.damage_bar); + entity.name_label = utils.table.deep_copy(damage_meter_UI_elements.name_label); + entity.hunter_rank_label = utils.table.deep_copy(damage_meter_UI_elements.hunter_rank_label); + entity.cart_count_label = utils.table.deep_copy(damage_meter_UI_elements.cart_count_label); + entity.dps_label = utils.table.deep_copy(damage_meter_UI_elements.dps_label); + entity.value_label = utils.table.deep_copy(damage_meter_UI_elements.damage_value_label); + entity.percentage_label = utils.table.deep_copy(damage_meter_UI_elements.damage_percentage_label); entity.player_name_size_limit = config.current_config.damage_meter_UI.settings.player_name_size_limit; @@ -231,7 +234,7 @@ function damage_UI_entity.draw(player, position_on_screen, opacity_scale, top_da end function damage_UI_entity.init_module() - table_helpers = require("MHR_Overlay.Misc.table_helpers"); + utils = require("MHR_Overlay.Misc.utils"); drawing = require("MHR_Overlay.UI.drawing"); config = require("MHR_Overlay.Misc.config"); players = require("MHR_Overlay.Damage_Meter.players"); diff --git a/reframework/autorun/MHR_Overlay/UI/UI_Entities/health_UI_entity.lua b/reframework/autorun/MHR_Overlay/UI/UI_Entities/health_UI_entity.lua index 90831d5..b0ee955 100644 --- a/reframework/autorun/MHR_Overlay/UI/UI_Entities/health_UI_entity.lua +++ b/reframework/autorun/MHR_Overlay/UI/UI_Entities/health_UI_entity.lua @@ -1,6 +1,6 @@ local health_UI_entity = {}; -local table_helpers; +local utils; local drawing; local language; local config; @@ -33,6 +33,9 @@ local imgui = imgui; local draw = draw; local Vector2f = Vector2f; local reframework = reframework; +local os = os; +local ValueType = ValueType; +local package = package; function health_UI_entity.new(visibility, bar, text_label, value_label, percentage_label) local entity = {}; @@ -40,10 +43,10 @@ function health_UI_entity.new(visibility, bar, text_label, value_label, percenta local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier; entity.visibility = visibility; - entity.bar = table_helpers.deep_copy(bar); - entity.text_label = table_helpers.deep_copy(text_label); - entity.value_label = table_helpers.deep_copy(value_label); - entity.percentage_label = table_helpers.deep_copy(percentage_label); + entity.bar = utils.table.deep_copy(bar); + entity.text_label = utils.table.deep_copy(text_label); + entity.value_label = utils.table.deep_copy(value_label); + entity.percentage_label = utils.table.deep_copy(percentage_label); entity.bar.offset.x = entity.bar.offset.x * global_scale_modifier; entity.bar.offset.y = entity.bar.offset.y * global_scale_modifier; @@ -89,7 +92,7 @@ function health_UI_entity.draw(monster, health_UI, position_on_screen, opacity_s end function health_UI_entity.init_module() - table_helpers = require("MHR_Overlay.Misc.table_helpers"); + utils = require("MHR_Overlay.Misc.utils"); drawing = require("MHR_Overlay.UI.drawing"); language = require("MHR_Overlay.Misc.language"); config = require("MHR_Overlay.Misc.config"); diff --git a/reframework/autorun/MHR_Overlay/UI/UI_Entities/rage_UI_entity.lua b/reframework/autorun/MHR_Overlay/UI/UI_Entities/rage_UI_entity.lua index 255f977..627a837 100644 --- a/reframework/autorun/MHR_Overlay/UI/UI_Entities/rage_UI_entity.lua +++ b/reframework/autorun/MHR_Overlay/UI/UI_Entities/rage_UI_entity.lua @@ -1,6 +1,6 @@ local rage_UI_entity = {}; -local table_helpers; +local utils; local drawing; local language; local config; @@ -33,6 +33,9 @@ local imgui = imgui; local draw = draw; local Vector2f = Vector2f; local reframework = reframework; +local os = os; +local ValueType = ValueType; +local package = package; function rage_UI_entity.new(visibility, bar, text_label, value_label, percentage_label, timer_label) local entity = {}; @@ -40,11 +43,11 @@ function rage_UI_entity.new(visibility, bar, text_label, value_label, percentage local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier; entity.visibility = visibility; - entity.bar = table_helpers.deep_copy(bar); - entity.text_label = table_helpers.deep_copy(text_label); - entity.value_label = table_helpers.deep_copy(value_label); - entity.percentage_label = table_helpers.deep_copy(percentage_label); - entity.timer_label = table_helpers.deep_copy(timer_label); + entity.bar = utils.table.deep_copy(bar); + entity.text_label = utils.table.deep_copy(text_label); + entity.value_label = utils.table.deep_copy(value_label); + entity.percentage_label = utils.table.deep_copy(percentage_label); + entity.timer_label = utils.table.deep_copy(timer_label); entity.bar.offset.x = entity.bar.offset.x * global_scale_modifier; entity.bar.offset.y = entity.bar.offset.y * global_scale_modifier; @@ -103,7 +106,7 @@ function rage_UI_entity.draw(monster, rage_UI, position_on_screen, opacity_scale end function rage_UI_entity.init_module() - table_helpers = require("MHR_Overlay.Misc.table_helpers"); + utils = require("MHR_Overlay.Misc.utils"); drawing = require("MHR_Overlay.UI.drawing"); language = require("MHR_Overlay.Misc.language"); config = require("MHR_Overlay.Misc.config"); diff --git a/reframework/autorun/MHR_Overlay/UI/UI_Entities/stamina_UI_entity.lua b/reframework/autorun/MHR_Overlay/UI/UI_Entities/stamina_UI_entity.lua index 2bbe56a..beaf4e4 100644 --- a/reframework/autorun/MHR_Overlay/UI/UI_Entities/stamina_UI_entity.lua +++ b/reframework/autorun/MHR_Overlay/UI/UI_Entities/stamina_UI_entity.lua @@ -1,6 +1,6 @@ local stamina_UI_entity = {}; -local table_helpers; +local utils; local drawing; local language; local config; @@ -33,6 +33,9 @@ local imgui = imgui; local draw = draw; local Vector2f = Vector2f; local reframework = reframework; +local os = os; +local ValueType = ValueType; +local package = package; function stamina_UI_entity.new(visibility, bar, text_label, value_label, percentage_label, timer_label) local entity = {}; @@ -40,11 +43,11 @@ function stamina_UI_entity.new(visibility, bar, text_label, value_label, percent local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier; entity.visibility = visibility; - entity.bar = table_helpers.deep_copy(bar); - entity.text_label = table_helpers.deep_copy(text_label); - entity.value_label = table_helpers.deep_copy(value_label); - entity.percentage_label = table_helpers.deep_copy(percentage_label); - entity.timer_label = table_helpers.deep_copy(timer_label); + entity.bar = utils.table.deep_copy(bar); + entity.text_label = utils.table.deep_copy(text_label); + entity.value_label = utils.table.deep_copy(value_label); + entity.percentage_label = utils.table.deep_copy(percentage_label); + entity.timer_label = utils.table.deep_copy(timer_label); entity.bar.offset.x = entity.bar.offset.x * global_scale_modifier; entity.bar.offset.y = entity.bar.offset.y * global_scale_modifier; @@ -100,7 +103,7 @@ function stamina_UI_entity.draw(monster, stamina_UI, position_on_screen, opacity end function stamina_UI_entity.init_module() - table_helpers = require("MHR_Overlay.Misc.table_helpers"); + utils = require("MHR_Overlay.Misc.utils"); drawing = require("MHR_Overlay.UI.drawing"); language = require("MHR_Overlay.Misc.language"); config = require("MHR_Overlay.Misc.config"); diff --git a/reframework/autorun/MHR_Overlay/UI/customization_menu.lua b/reframework/autorun/MHR_Overlay/UI/customization_menu.lua index 219ca44..f01318e 100644 --- a/reframework/autorun/MHR_Overlay/UI/customization_menu.lua +++ b/reframework/autorun/MHR_Overlay/UI/customization_menu.lua @@ -1,6 +1,6 @@ local customization_menu = {}; -local table_helpers; +local utils; local config; local screen; local players; @@ -57,6 +57,9 @@ local imgui = imgui; local draw = draw; local Vector2f = Vector2f; local reframework = reframework; +local os = os; +local ValueType = ValueType; +local package = package; customization_menu.font = nil; customization_menu.font_range = {0x1, 0xFFFF, 0}; @@ -450,14 +453,14 @@ function customization_menu.draw_config() if imgui.tree_node(language.current_language.customization_menu.config) then changed, index = imgui.combo(language.current_language.customization_menu.config, - table_helpers.find_index(config.config_names, config.current_config_name), config.config_names); + utils.table.find_index(config.config_names, config.current_config_name), config.config_names); config_changed = config_changed or changed; if changed then config.current_config_name = config.config_names[index]; config.update(index); - language.update(table_helpers.find_index(language.language_names, config.current_config.global_settings.language, false)); + language.update(utils.table.find_index(language.language_names, config.current_config.global_settings.language, false)); customization_menu.init(); @@ -473,7 +476,7 @@ function customization_menu.draw_config() config.new(customization_menu.config_name_input); config_changed = config_changed or changed; - language.update(table_helpers.find_index(language.language_names, config.current_config.global_settings.language, false)); + language.update(utils.table.find_index(language.language_names, config.current_config.global_settings.language, false)); customization_menu.init(); @@ -491,7 +494,7 @@ function customization_menu.draw_config() config.duplicate(customization_menu.config_name_input); config_changed = config_changed or changed; - language.update(table_helpers.find_index(language.language_names, config.current_config.global_settings.language, false)); + language.update(utils.table.find_index(language.language_names, config.current_config.global_settings.language, false)); customization_menu.init(); @@ -508,7 +511,7 @@ function customization_menu.draw_config() if changed then config.reset(); - language.update(table_helpers.find_index(language.language_names, config.current_config.global_settings.language, false)); + language.update(utils.table.find_index(language.language_names, config.current_config.global_settings.language, false)); customization_menu.init(); @@ -814,7 +817,7 @@ function customization_menu.draw_global_settings(apply_font_requested, language_ imgui.text(language.current_language.customization_menu.menu_font_change_disclaimer); changed, index = imgui.combo(language.current_language.customization_menu.language .. "*", - table_helpers.find_index(language.language_names, cached_config.language), language.language_names); + utils.table.find_index(language.language_names, cached_config.language), language.language_names); config_changed = config_changed or changed; if changed then @@ -891,7 +894,7 @@ function customization_menu.draw_global_settings(apply_font_requested, language_ imgui.text(language.current_language.customization_menu.UI_font_notice); changed, index = imgui.combo(language.current_language.customization_menu.family, - table_helpers.find_index(customization_menu.fonts, cached_config.UI_font.family), customization_menu.fonts); + utils.table.find_index(customization_menu.fonts, cached_config.UI_font.family), customization_menu.fonts); config_changed = config_changed or changed; if changed then @@ -1089,7 +1092,7 @@ function customization_menu.draw_small_monster_UI() config_changed = config_changed or changed; changed, index = imgui.combo(language.current_language.customization_menu.static_orientation, - table_helpers.find_index(customization_menu.orientation_types, cached_config.settings.orientation), + utils.table.find_index(customization_menu.orientation_types, cached_config.settings.orientation), customization_menu.displayed_orientation_types); config_changed = config_changed or changed; @@ -1171,7 +1174,7 @@ function customization_menu.draw_small_monster_UI() config_changed = config_changed or changed; - changed, index = imgui.combo(language.current_language.customization_menu.anchor, table_helpers.find_index( + changed, index = imgui.combo(language.current_language.customization_menu.anchor, utils.table.find_index( customization_menu.anchor_types, cached_config.static_position.anchor), customization_menu.displayed_anchor_types); config_changed = config_changed or changed; @@ -1198,7 +1201,7 @@ function customization_menu.draw_small_monster_UI() end if imgui.tree_node(language.current_language.customization_menu.static_sorting) then - changed, index = imgui.combo(language.current_language.customization_menu.type, table_helpers.find_index( + changed, index = imgui.combo(language.current_language.customization_menu.type, utils.table.find_index( customization_menu.monster_UI_sorting_types, cached_config.static_sorting.type), customization_menu.displayed_monster_UI_sorting_types); @@ -1352,7 +1355,7 @@ function customization_menu.draw_large_monster_static_UI() changed, index = imgui.combo( language.current_language.customization_menu.highlighted_monster_location, - table_helpers.find_index(customization_menu.damage_meter_UI_my_damage_bar_location_types, cached_config.settings.highlighted_monster_location), + utils.table.find_index(customization_menu.damage_meter_UI_my_damage_bar_location_types, cached_config.settings.highlighted_monster_location), customization_menu.displayed_damage_meter_UI_my_damage_bar_location_types); config_changed = config_changed or changed; @@ -1363,7 +1366,7 @@ function customization_menu.draw_large_monster_static_UI() changed, index = imgui.combo( language.current_language.customization_menu.orientation, - table_helpers.find_index( customization_menu.orientation_types, cached_config.settings.orientation), + utils.table.find_index( customization_menu.orientation_types, cached_config.settings.orientation), customization_menu.displayed_orientation_types); config_changed = config_changed or changed; @@ -1388,7 +1391,7 @@ function customization_menu.draw_large_monster_static_UI() changed, index = imgui.combo( language.current_language.customization_menu.anchor, - table_helpers.find_index(customization_menu.anchor_types, cached_config.position.anchor), + utils.table.find_index(customization_menu.anchor_types, cached_config.position.anchor), customization_menu.displayed_anchor_types); config_changed = config_changed or changed; @@ -1417,7 +1420,7 @@ function customization_menu.draw_large_monster_static_UI() if imgui.tree_node(language.current_language.customization_menu.sorting) then changed, index = imgui.combo( language.current_language.customization_menu.type, - table_helpers.find_index(customization_menu.monster_UI_sorting_types, cached_config.sorting.type), + utils.table.find_index(customization_menu.monster_UI_sorting_types, cached_config.sorting.type), customization_menu.displayed_monster_UI_sorting_types); config_changed = config_changed or changed; @@ -1469,7 +1472,7 @@ function customization_menu.draw_large_monster_highlighted_UI() changed, index = imgui.combo( language.current_language.customization_menu.anchor, - table_helpers.find_index(customization_menu.anchor_types, cached_config.position.anchor), + utils.table.find_index(customization_menu.anchor_types, cached_config.position.anchor), customization_menu.displayed_anchor_types); config_changed = config_changed or changed; @@ -1489,7 +1492,7 @@ function customization_menu.draw_large_monster_highlighted_UI() changed, index = imgui.combo( language.current_language.customization_menu.mode, - table_helpers.find_index(customization_menu.auto_highlight_modes, cached_config.auto_highlight.mode), + utils.table.find_index(customization_menu.auto_highlight_modes, cached_config.auto_highlight.mode), customization_menu.displayed_auto_highlight_modes); config_changed = config_changed or changed; @@ -1536,7 +1539,7 @@ function customization_menu.draw_time_UI() changed, index = imgui.combo( language.current_language.customization_menu.anchor, - table_helpers.find_index(customization_menu.anchor_types, cached_config.position.anchor), + utils.table.find_index(customization_menu.anchor_types, cached_config.position.anchor), customization_menu.displayed_anchor_types); config_changed = config_changed or changed; @@ -1637,7 +1640,7 @@ function customization_menu.draw_damage_meter_UI() changed, index = imgui.combo( language.current_language.customization_menu.orientation, - table_helpers.find_index(customization_menu.orientation_types, cached_config.settings.orientation), + utils.table.find_index(customization_menu.orientation_types, cached_config.settings.orientation), customization_menu.displayed_orientation_types); config_changed = config_changed or changed; @@ -1648,7 +1651,7 @@ function customization_menu.draw_damage_meter_UI() changed, index = imgui.combo( language.current_language.customization_menu.highlighted, - table_helpers.find_index(customization_menu.damage_meter_UI_highlighted_entity_types, cached_config.settings.highlighted_bar), + utils.table.find_index(customization_menu.damage_meter_UI_highlighted_entity_types, cached_config.settings.highlighted_bar), customization_menu.displayed_damage_meter_UI_highlighted_entity_types); config_changed = config_changed or changed; @@ -1659,7 +1662,7 @@ function customization_menu.draw_damage_meter_UI() changed, index = imgui.combo( language.current_language.customization_menu.damage_bars_are_relative_to, - table_helpers.find_index(customization_menu.damage_meter_UI_damage_bar_relative_types, cached_config.settings.damage_bar_relative_to), + utils.table.find_index(customization_menu.damage_meter_UI_damage_bar_relative_types, cached_config.settings.damage_bar_relative_to), customization_menu.displayed_damage_meter_UI_damage_bar_relative_types); config_changed = config_changed or changed; @@ -1670,7 +1673,7 @@ function customization_menu.draw_damage_meter_UI() changed, index = imgui.combo( language.current_language.customization_menu.my_damage_bar_location, - table_helpers.find_index(customization_menu.damage_meter_UI_my_damage_bar_location_types, cached_config.settings.my_damage_bar_location), + utils.table.find_index(customization_menu.damage_meter_UI_my_damage_bar_location_types, cached_config.settings.my_damage_bar_location), customization_menu.displayed_damage_meter_UI_my_damage_bar_location_types); config_changed = config_changed or changed; @@ -1681,7 +1684,7 @@ function customization_menu.draw_damage_meter_UI() changed, index = imgui.combo( language.current_language.customization_menu.total_damage_location, - table_helpers.find_index(customization_menu.damage_meter_UI_total_damage_location_types, cached_config.settings.total_damage_location), + utils.table.find_index(customization_menu.damage_meter_UI_total_damage_location_types, cached_config.settings.total_damage_location), customization_menu.displayed_damage_meter_UI_total_damage_location_types); config_changed = config_changed or changed; @@ -1691,7 +1694,7 @@ function customization_menu.draw_damage_meter_UI() end changed, index = imgui.combo(language.current_language.customization_menu.dps_mode, - table_helpers.find_index(customization_menu.damage_meter_UI_dps_modes, cached_config.settings.dps_mode), + utils.table.find_index(customization_menu.damage_meter_UI_dps_modes, cached_config.settings.dps_mode), customization_menu.displayed_damage_meter_UI_dps_modes); config_changed = config_changed or changed; @@ -1818,7 +1821,7 @@ function customization_menu.draw_damage_meter_UI() changed, index = imgui.combo( language.current_language.customization_menu.anchor, - table_helpers.find_index(customization_menu.anchor_types, cached_config.position.anchor), + utils.table.find_index(customization_menu.anchor_types, cached_config.position.anchor), customization_menu.displayed_anchor_types); config_changed = config_changed or changed; @@ -1833,7 +1836,7 @@ function customization_menu.draw_damage_meter_UI() if imgui.tree_node(language.current_language.customization_menu.sorting) then changed, index = imgui.combo( language.current_language.customization_menu.type, - table_helpers.find_index(customization_menu.damage_meter_UI_sorting_types, cached_config.sorting.type), + utils.table.find_index(customization_menu.damage_meter_UI_sorting_types, cached_config.sorting.type), customization_menu.displayed_damage_meter_UI_sorting_types); config_changed = config_changed or changed; @@ -2160,7 +2163,7 @@ function customization_menu.draw_buff_UI() changed, index = imgui.combo( language.current_language.customization_menu.orientation, - table_helpers.find_index(customization_menu.orientation_types, cached_config.settings.orientation), + utils.table.find_index(customization_menu.orientation_types, cached_config.settings.orientation), customization_menu.displayed_orientation_types); config_changed = config_changed or changed; @@ -2199,7 +2202,7 @@ function customization_menu.draw_buff_UI() changed, index = imgui.combo( language.current_language.customization_menu.anchor, - table_helpers.find_index(customization_menu.anchor_types, cached_config.position.anchor), + utils.table.find_index(customization_menu.anchor_types, cached_config.position.anchor), customization_menu.displayed_anchor_types); config_changed = config_changed or changed; @@ -2214,7 +2217,7 @@ function customization_menu.draw_buff_UI() if imgui.tree_node(language.current_language.customization_menu.sorting) then changed, index = imgui.combo( language.current_language.customization_menu.type, - table_helpers.find_index(customization_menu.buff_UI_sorting_types, cached_config.sorting.type), + utils.table.find_index(customization_menu.buff_UI_sorting_types, cached_config.sorting.type), customization_menu.displayed_buff_UI_sorting_types); config_changed = config_changed or changed; @@ -2247,7 +2250,7 @@ function customization_menu.draw_buff_UI() end function customization_menu.init_module() - table_helpers = require("MHR_Overlay.Misc.table_helpers"); + utils = require("MHR_Overlay.Misc.utils"); language = require("MHR_Overlay.Misc.language"); config = require("MHR_Overlay.Misc.config"); screen = require("MHR_Overlay.Game_Handler.screen"); diff --git a/reframework/autorun/MHR_Overlay/UI/drawing.lua b/reframework/autorun/MHR_Overlay/UI/drawing.lua index 6f75c48..d8e5e3f 100644 --- a/reframework/autorun/MHR_Overlay/UI/drawing.lua +++ b/reframework/autorun/MHR_Overlay/UI/drawing.lua @@ -1,8 +1,7 @@ local drawing = {}; local config; -local table_helpers; -local unicode_helpers; +local utils; local sdk = sdk; local tostring = tostring; @@ -32,6 +31,9 @@ local imgui = imgui; local draw = draw; local Vector2f = Vector2f; local reframework = reframework; +local os = os; +local ValueType = ValueType; +local package = package; drawing.font = nil; @@ -77,7 +79,7 @@ function drawing.limit_text_size(text, size_limit) break else local old_limited_text = limited_text; - limited_text = unicode_helpers.sub(limited_text, 1, -5) .. "..."; + limited_text = utils.unicode.sub(limited_text, 1, -5) .. "..."; if limited_text == old_limited_text then break @@ -332,8 +334,7 @@ end function drawing.init_module() config = require("MHR_Overlay.Misc.config"); - table_helpers = require("MHR_Overlay.Misc.table_helpers"); - unicode_helpers = require("MHR_Overlay.Misc.unicode_helpers"); + utils = require("MHR_Overlay.Misc.utils"); end return drawing;