Merge table_helpers and unicode_helpers into utils

This commit is contained in:
GreenComfyTea
2023-04-21 10:08:07 +03:00
parent 3dcb55e086
commit f627a0b19b
52 changed files with 677 additions and 585 deletions

View File

@@ -28,6 +28,9 @@ local imgui = imgui;
local draw = draw; local draw = draw;
local Vector2f = Vector2f; local Vector2f = Vector2f;
local reframework = reframework; local reframework = reframework;
local os = os;
local ValueType = ValueType;
local package = package;
local debug = require("MHR_Overlay.Misc.debug"); 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 config = require("MHR_Overlay.Misc.config");
local language = require("MHR_Overlay.Misc.language"); 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 part_names = require("MHR_Overlay.Misc.part_names");
local utils = require("MHR_Overlay.Misc.utils"); local utils = require("MHR_Overlay.Misc.utils");
@@ -98,8 +99,6 @@ local drawing = require("MHR_Overlay.UI.drawing");
-- #region -- #region
screen.init_module(); screen.init_module();
singletons.init_module(); singletons.init_module();
table_helpers.init_module();
unicode_helpers.init_module();
utils.init_module(); utils.init_module();
time.init_module(); time.init_module();

View File

@@ -31,6 +31,9 @@ local imgui = imgui;
local draw = draw; local draw = draw;
local Vector2f = Vector2f; local Vector2f = Vector2f;
local reframework = reframework; local reframework = reframework;
local os = os;
local ValueType = ValueType;
local package = package;
buffs.list = {}; buffs.list = {};

View File

@@ -5,7 +5,6 @@ local players;
local small_monster; local small_monster;
local large_monster; local large_monster;
local ailments; local ailments;
local table_helpers;
local singletons; local singletons;
local non_players; local non_players;
local utils; local utils;
@@ -38,6 +37,9 @@ local imgui = imgui;
local draw = draw; local draw = draw;
local Vector2f = Vector2f; local Vector2f = Vector2f;
local reframework = reframework; local reframework = reframework;
local os = os;
local ValueType = ValueType;
local package = package;
local wall_hit_damage_queue = {}; 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) function damage_hook.get_damage_source_type(damage_source_type_id, is_marionette_attack)
if is_marionette_attack then if is_marionette_attack then
return "wyvern riding"; return "wyvern riding";
elseif damage_source_type_id == 0 or damage_source_type_id == 7 or damage_source_type_id == 11 or 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
damage_source_type_id == 13 then
return "player"; return "player";
elseif damage_source_type_id == 1 or damage_source_type_id == 8 then elseif damage_source_type_id == 1 or damage_source_type_id == 8 then
return "bomb"; return "bomb";
@@ -93,11 +94,9 @@ function damage_hook.get_damage_source_type(damage_source_type_id, is_marionette
return "otomo"; return "otomo";
elseif damage_source_type_id >= 25 and damage_source_type_id <= 32 then elseif damage_source_type_id >= 25 and damage_source_type_id <= 32 then
return "endemic life"; return "endemic life";
elseif damage_source_type_id == 34 then
return "other";
end end
return tostring(damage_source_type_id); return "other";
end end
-- snow.hit.EnemyCalcDamageInfo.AfterCalcInfo_DamageSide -- 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 for enemy, monster in pairs(large_monster.list) do
if monster.unique_id == attacker_id then if monster.unique_id == attacker_id then
attacker_id = monster.rider_id; attacker_id = monster.rider_id;
break break;
end end
end 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(players.total, damage_source_type, is_large_monster, damage_object);
players.update_damage(player, 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 end
--function damage_hook.on_mystery_core_break(enemy) --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) 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 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(); large_monster.update_all_riders();
local attacker_id = monster.rider_id; local attacker_id = monster.rider_id;
@@ -330,7 +315,6 @@ function damage_hook.init_module()
small_monster = require("MHR_Overlay.Monsters.small_monster"); small_monster = require("MHR_Overlay.Monsters.small_monster");
large_monster = require("MHR_Overlay.Monsters.large_monster"); large_monster = require("MHR_Overlay.Monsters.large_monster");
ailments = require("MHR_Overlay.Monsters.ailments"); ailments = require("MHR_Overlay.Monsters.ailments");
table_helpers = require("MHR_Overlay.Misc.table_helpers");
singletons = require("MHR_Overlay.Game_Handler.singletons"); singletons = require("MHR_Overlay.Game_Handler.singletons");
non_players = require("MHR_Overlay.Damage_Meter.non_players"); non_players = require("MHR_Overlay.Damage_Meter.non_players");
utils = require("MHR_Overlay.Misc.utils"); utils = require("MHR_Overlay.Misc.utils");

View File

@@ -1,7 +1,6 @@
local non_players = {}; local non_players = {};
local config; local config;
local table_helpers;
local singletons; local singletons;
local customization_menu; local customization_menu;
local damage_UI_entity; local damage_UI_entity;
@@ -9,7 +8,6 @@ local time;
local quest_status; local quest_status;
local drawing; local drawing;
local language; local language;
local unicode_helpers;
local players; local players;
local sdk = sdk; local sdk = sdk;
@@ -40,6 +38,9 @@ local imgui = imgui;
local draw = draw; local draw = draw;
local Vector2f = Vector2f; local Vector2f = Vector2f;
local reframework = reframework; local reframework = reframework;
local os = os;
local ValueType = ValueType;
local package = package;
non_players.servant_list = {}; non_players.servant_list = {};
non_players.otomo_list = {}; non_players.otomo_list = {};
@@ -277,8 +278,6 @@ function non_players.update_servant_otomos()
goto continue; goto continue;
end end
--name = unicode_helpers.sub(name, 13);
if non_players.otomo_list[member_id] == nil then 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); non_players.otomo_list[member_id] = non_players.new(member_id, name, level, players.types.servant_otomo);
end end
@@ -380,7 +379,6 @@ end
function non_players.init_module() function non_players.init_module()
config = require("MHR_Overlay.Misc.config"); config = require("MHR_Overlay.Misc.config");
table_helpers = require("MHR_Overlay.Misc.table_helpers");
singletons = require("MHR_Overlay.Game_Handler.singletons"); singletons = require("MHR_Overlay.Game_Handler.singletons");
customization_menu = require("MHR_Overlay.UI.customization_menu"); customization_menu = require("MHR_Overlay.UI.customization_menu");
damage_UI_entity = require("MHR_Overlay.UI.UI_Entities.damage_UI_entity"); 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"); drawing = require("MHR_Overlay.UI.drawing");
language = require("MHR_Overlay.Misc.language"); language = require("MHR_Overlay.Misc.language");
players = require("MHR_Overlay.Damage_Meter.players"); players = require("MHR_Overlay.Damage_Meter.players");
unicode_helpers = require("MHR_Overlay.Misc.unicode_helpers");
non_players.init(); non_players.init();
end end

View File

@@ -1,7 +1,6 @@
local players = {}; local players = {};
local config; local config;
local table_helpers;
local singletons; local singletons;
local customization_menu; local customization_menu;
local damage_UI_entity; local damage_UI_entity;
@@ -39,6 +38,9 @@ local imgui = imgui;
local draw = draw; local draw = draw;
local Vector2f = Vector2f; local Vector2f = Vector2f;
local reframework = reframework; local reframework = reframework;
local os = os;
local ValueType = ValueType;
local package = package;
players.list = {}; players.list = {};
players.myself = nil; players.myself = nil;
@@ -692,7 +694,6 @@ end
function players.init_module() function players.init_module()
config = require("MHR_Overlay.Misc.config"); config = require("MHR_Overlay.Misc.config");
table_helpers = require("MHR_Overlay.Misc.table_helpers");
singletons = require("MHR_Overlay.Game_Handler.singletons"); singletons = require("MHR_Overlay.Game_Handler.singletons");
customization_menu = require("MHR_Overlay.UI.customization_menu"); customization_menu = require("MHR_Overlay.UI.customization_menu");
damage_UI_entity = require("MHR_Overlay.UI.UI_Entities.damage_UI_entity"); damage_UI_entity = require("MHR_Overlay.UI.UI_Entities.damage_UI_entity");

View File

@@ -4,7 +4,7 @@ local drawing;
local customization_menu; local customization_menu;
local singletons; local singletons;
local config; local config;
local table_helpers; local utils;
local sdk = sdk; local sdk = sdk;
local tostring = tostring; local tostring = tostring;
@@ -34,6 +34,9 @@ local imgui = imgui;
local draw = draw; local draw = draw;
local Vector2f = Vector2f; local Vector2f = Vector2f;
local reframework = reframework; local reframework = reframework;
local os = os;
local ValueType = ValueType;
local package = package;
env_creature.list = {}; env_creature.list = {};
@@ -89,7 +92,7 @@ function env_creature.init(creature, REcreature)
end end
function env_creature.init_UI(creature) function env_creature.init_UI(creature)
creature.name_label = table_helpers.deep_copy(config.current_config.endemic_life_UI.creature_name_label); creature.name_label = 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; 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"); singletons = require("MHR_Overlay.Game_Handler.singletons");
customization_menu = require("MHR_Overlay.UI.customization_menu"); customization_menu = require("MHR_Overlay.UI.customization_menu");
config = require("MHR_Overlay.Misc.config"); 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"); --health_UI_entity = require("MHR_Overlay.UI.UI_Entities.health_UI_entity");
--stamina_UI_entity = require("MHR_Overlay.UI.UI_Entities.stamina_UI_entity"); --stamina_UI_entity = require("MHR_Overlay.UI.UI_Entities.stamina_UI_entity");
--screen = require("MHR_Overlay.Game_Handler.screen"); --screen = require("MHR_Overlay.Game_Handler.screen");

View File

@@ -32,6 +32,9 @@ local imgui = imgui;
local draw = draw; local draw = draw;
local Vector2f = Vector2f; local Vector2f = Vector2f;
local reframework = reframework; 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 environment_creature_base_type_def = sdk.find_type_definition("snow.envCreature.EnvironmentCreatureBase");
local update_method = environment_creature_base_type_def:get_method("update"); local update_method = environment_creature_base_type_def:get_method("update");

View File

@@ -37,6 +37,9 @@ local imgui = imgui;
local draw = draw; local draw = draw;
local Vector2f = Vector2f; local Vector2f = Vector2f;
local reframework = reframework; local reframework = reframework;
local os = os;
local ValueType = ValueType;
local package = package;
local game_keyboard_type_def = sdk.find_type_definition("snow.GameKeyboard"); local game_keyboard_type_def = sdk.find_type_definition("snow.GameKeyboard");
local hard_keyboard_field = game_keyboard_type_def:get_field("hardKeyboard"); local hard_keyboard_field = game_keyboard_type_def:get_field("hardKeyboard");

View File

@@ -38,6 +38,9 @@ local imgui = imgui;
local draw = draw; local draw = draw;
local Vector2f = Vector2f; local Vector2f = Vector2f;
local reframework = reframework; local reframework = reframework;
local os = os;
local ValueType = ValueType;
local package = package;
quest_status.flow_states = { quest_status.flow_states = {
NONE = 0, NONE = 0,

View File

@@ -31,6 +31,9 @@ local imgui = imgui;
local draw = draw; local draw = draw;
local Vector2f = Vector2f; local Vector2f = Vector2f;
local reframework = reframework; local reframework = reframework;
local os = os;
local ValueType = ValueType;
local package = package;
screen.width = 1920; screen.width = 1920;
screen.height = 1080; screen.height = 1080;

View File

@@ -28,6 +28,9 @@ local imgui = imgui;
local draw = draw; local draw = draw;
local Vector2f = Vector2f; local Vector2f = Vector2f;
local reframework = reframework; local reframework = reframework;
local os = os;
local ValueType = ValueType;
local package = package;
singletons.message_manager = nil; singletons.message_manager = nil;
singletons.enemy_manager = nil; singletons.enemy_manager = nil;

View File

@@ -36,6 +36,9 @@ local imgui = imgui;
local draw = draw; local draw = draw;
local Vector2f = Vector2f; local Vector2f = Vector2f;
local reframework = reframework; local reframework = reframework;
local os = os;
local ValueType = ValueType;
local package = package;
local quest_manager_type_def = sdk.find_type_definition("snow.QuestManager"); 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"); local get_quest_elapsed_time_min_method = quest_manager_type_def:get_method("getQuestElapsedTimeMin");

View File

@@ -1,6 +1,6 @@
local config = {}; local config = {};
local table_helpers; local utils;
local language; local language;
local sdk = sdk; local sdk = sdk;
@@ -31,6 +31,9 @@ local imgui = imgui;
local draw = draw; local draw = draw;
local Vector2f = Vector2f; local Vector2f = Vector2f;
local reframework = reframework; local reframework = reframework;
local os = os;
local ValueType = ValueType;
local package = package;
config.version = "2.4.1"; config.version = "2.4.1";
@@ -5674,7 +5677,7 @@ function config.load_current_config_value()
}; };
config.current_config_name = "old_config"; 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.current_config.version = config.version;
config.save(config.config_folder .. "old_config.json", config.current_config); 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"); 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; merged_config.version = config.version;
table.insert(config.config_names, config_name); table.insert(config.config_names, config_name);
@@ -5737,7 +5740,7 @@ function config.load_configs()
config.current_config = config.configs[1]; config.current_config = config.configs[1];
else else
config.current_config_name = "default"; 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.config_names, config.current_config_name);
table.insert(config.configs, config.current_config); table.insert(config.configs, config.current_config);
@@ -5784,7 +5787,7 @@ function config.new(config_name)
return; return;
end 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); config.create_new(config_name, new_config);
end end
@@ -5794,15 +5797,15 @@ function config.duplicate(config_name)
return; return;
end 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); config.create_new(config_name, new_config);
end end
function config.reset() 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; config.configs[index] = config.current_config;
end end
@@ -5812,14 +5815,14 @@ function config.update(index)
end end
function config.init_module() function config.init_module()
table_helpers = require("MHR_Overlay.Misc.table_helpers"); utils = require("MHR_Overlay.Misc.utils");
language = require("MHR_Overlay.Misc.language"); language = require("MHR_Overlay.Misc.language");
config.init_default(); config.init_default();
config.load_current_config_value(); config.load_current_config_value();
config.load_configs(); 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 end
return config; return config;

View File

@@ -1,6 +1,6 @@
local language = {}; local language = {};
local table_helpers; local utils;
local sdk = sdk; local sdk = sdk;
local tostring = tostring; local tostring = tostring;
@@ -30,6 +30,9 @@ local imgui = imgui;
local draw = draw; local draw = draw;
local Vector2f = Vector2f; local Vector2f = Vector2f;
local reframework = reframework; local reframework = reframework;
local os = os;
local ValueType = ValueType;
local package = package;
language.language_folder = "MHR Overlay\\languages\\"; language.language_folder = "MHR Overlay\\languages\\";
@@ -523,7 +526,7 @@ function language.load()
log.info("[MHR Overlay] " .. language_file_name .. ".json loaded successfully"); log.info("[MHR Overlay] " .. language_file_name .. ".json loaded successfully");
table.insert(language.language_names, language_name); 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); table.insert(language.languages, merged_language);
language.save(language_file_name, merged_language); language.save(language_file_name, merged_language);
@@ -553,7 +556,7 @@ function language.update(index)
end end
function language.init_module() function language.init_module()
table_helpers = require("MHR_Overlay.Misc.table_helpers"); utils = require("MHR_Overlay.Misc.utils");
language.save_default(); language.save_default();
language.load(); language.load();

View File

@@ -1,7 +1,6 @@
local part_names = {}; local part_names = {};
local language; local language;
local table_helpers;
local sdk = sdk; local sdk = sdk;
local tostring = tostring; local tostring = tostring;
@@ -31,6 +30,9 @@ local imgui = imgui;
local draw = draw; local draw = draw;
local Vector2f = Vector2f; local Vector2f = Vector2f;
local reframework = reframework; local reframework = reframework;
local os = os;
local ValueType = ValueType;
local package = package;
part_names.list = {}; part_names.list = {};
@@ -898,7 +900,6 @@ end
function part_names.init_module() function part_names.init_module()
language = require("MHR_Overlay.Misc.language"); language = require("MHR_Overlay.Misc.language");
table_helpers = require("MHR_Overlay.Misc.table_helpers");
part_names.init(); part_names.init();
end end

View File

@@ -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;

View File

@@ -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;

View File

@@ -1,4 +1,4 @@
local utils = {}; local this = {};
local sdk = sdk; local sdk = sdk;
local tostring = tostring; local tostring = tostring;
@@ -28,16 +28,392 @@ local imgui = imgui;
local draw = draw; local draw = draw;
local Vector2f = Vector2f; local Vector2f = Vector2f;
local reframework = reframework; local reframework = reframework;
local os = os;
local ValueType = ValueType;
local package = package;
function utils.sign(v) local table_tostring;
return (v >= 0 and 1) or -1; 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 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; 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 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 end
return utils; -- 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;

View File

@@ -8,7 +8,6 @@ local ailment_buildup_UI_entity;
local time; local time;
local small_monster; local small_monster;
local large_monster; local large_monster;
local table_helpers;
local drawing; local drawing;
local sdk = sdk; local sdk = sdk;
@@ -39,6 +38,9 @@ local imgui = imgui;
local draw = draw; local draw = draw;
local Vector2f = Vector2f; local Vector2f = Vector2f;
local reframework = reframework; 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) 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"); time = require("MHR_Overlay.Game_Handler.time");
small_monster = require("MHR_Overlay.Monsters.small_monster"); small_monster = require("MHR_Overlay.Monsters.small_monster");
large_monster = require("MHR_Overlay.Monsters.large_monster"); large_monster = require("MHR_Overlay.Monsters.large_monster");
table_helpers = require("MHR_Overlay.Misc.table_helpers");
drawing = require("MHR_Overlay.UI.drawing"); drawing = require("MHR_Overlay.UI.drawing");
end end

View File

@@ -4,7 +4,6 @@ local small_monster;
local large_monster; local large_monster;
local config; local config;
local ailments; local ailments;
local table_helpers;
local sdk = sdk; local sdk = sdk;
local tostring = tostring; local tostring = tostring;
@@ -34,6 +33,9 @@ local imgui = imgui;
local draw = draw; local draw = draw;
local Vector2f = Vector2f; local Vector2f = Vector2f;
local reframework = reframework; 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 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"); 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"); large_monster = require("MHR_Overlay.Monsters.large_monster");
config = require("MHR_Overlay.Misc.config"); config = require("MHR_Overlay.Misc.config");
ailments = require("MHR_Overlay.Monsters.ailments"); ailments = require("MHR_Overlay.Monsters.ailments");
table_helpers = require("MHR_Overlay.Misc.table_helpers");
sdk.hook(stock_damage_method, function(args) sdk.hook(stock_damage_method, function(args)
pcall(ailment_hook.stock_damage, sdk.to_managed_object(args[2])); pcall(ailment_hook.stock_damage, sdk.to_managed_object(args[2]));

View File

@@ -8,7 +8,6 @@ local ailment_buildup_UI_entity;
local time; local time;
local small_monster; local small_monster;
local large_monster; local large_monster;
local table_helpers;
local non_players; local non_players;
local sdk = sdk; local sdk = sdk;
@@ -39,6 +38,9 @@ local imgui = imgui;
local draw = draw; local draw = draw;
local Vector2f = Vector2f; local Vector2f = Vector2f;
local reframework = reframework; local reframework = reframework;
local os = os;
local ValueType = ValueType;
local package = package;
--0 Paralyze --0 Paralyze
--1 Sleep --1 Sleep
@@ -821,7 +823,6 @@ function ailments.init_module()
time = require("MHR_Overlay.Game_Handler.time"); time = require("MHR_Overlay.Game_Handler.time");
small_monster = require("MHR_Overlay.Monsters.small_monster"); small_monster = require("MHR_Overlay.Monsters.small_monster");
large_monster = require("MHR_Overlay.Monsters.large_monster"); large_monster = require("MHR_Overlay.Monsters.large_monster");
table_helpers = require("MHR_Overlay.Misc.table_helpers");
end end
return ailments; return ailments;

View File

@@ -3,7 +3,6 @@ local body_part = {};
local singletons; local singletons;
local customization_menu; local customization_menu;
local config; local config;
local table_helpers;
local health_UI_entity; local health_UI_entity;
local stamina_UI_entity; local stamina_UI_entity;
local rage_UI_entity; local rage_UI_entity;
@@ -41,6 +40,9 @@ local imgui = imgui;
local draw = draw; local draw = draw;
local Vector2f = Vector2f; local Vector2f = Vector2f;
local reframework = reframework; local reframework = reframework;
local os = os;
local ValueType = ValueType;
local package = package;
body_part.list = {}; body_part.list = {};
@@ -342,7 +344,6 @@ function body_part.init_module()
singletons = require("MHR_Overlay.Game_Handler.singletons"); singletons = require("MHR_Overlay.Game_Handler.singletons");
customization_menu = require("MHR_Overlay.UI.customization_menu"); customization_menu = require("MHR_Overlay.UI.customization_menu");
config = require("MHR_Overlay.Misc.config"); 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"); health_UI_entity = require("MHR_Overlay.UI.UI_Entities.health_UI_entity");
stamina_UI_entity = require("MHR_Overlay.UI.UI_Entities.stamina_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"); rage_UI_entity = require("MHR_Overlay.UI.UI_Entities.rage_UI_entity");

View File

@@ -4,7 +4,7 @@ local singletons;
local customization_menu; local customization_menu;
local config; local config;
local language; local language;
local table_helpers; local utils;
local health_UI_entity; local health_UI_entity;
local stamina_UI_entity; local stamina_UI_entity;
local rage_UI_entity; local rage_UI_entity;
@@ -48,6 +48,9 @@ local imgui = imgui;
local draw = draw; local draw = draw;
local Vector2f = Vector2f; local Vector2f = Vector2f;
local reframework = reframework; local reframework = reframework;
local os = os;
local ValueType = ValueType;
local package = package;
large_monster.list = {}; large_monster.list = {};
@@ -257,7 +260,7 @@ end
function large_monster.init_UI(monster, monster_UI, cached_config) function large_monster.init_UI(monster, monster_UI, cached_config)
local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier; 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( monster_UI.health_UI = health_UI_entity.new(
cached_config.health.visibility, cached_config.health.visibility,
@@ -910,7 +913,7 @@ function large_monster.init_module()
customization_menu = require("MHR_Overlay.UI.customization_menu"); customization_menu = require("MHR_Overlay.UI.customization_menu");
language = require("MHR_Overlay.Misc.language"); language = require("MHR_Overlay.Misc.language");
config = require("MHR_Overlay.Misc.config"); 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"); body_part = require("MHR_Overlay.Monsters.body_part");
health_UI_entity = require("MHR_Overlay.UI.UI_Entities.health_UI_entity"); health_UI_entity = require("MHR_Overlay.UI.UI_Entities.health_UI_entity");
stamina_UI_entity = require("MHR_Overlay.UI.UI_Entities.stamina_UI_entity"); stamina_UI_entity = require("MHR_Overlay.UI.UI_Entities.stamina_UI_entity");

View File

@@ -35,6 +35,9 @@ local imgui = imgui;
local draw = draw; local draw = draw;
local Vector2f = Vector2f; local Vector2f = Vector2f;
local reframework = reframework; 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_type_def = sdk.find_type_definition("snow.enemy.EnemyCharacterBase");
local enemy_character_base_update_method = enemy_character_base_type_def:get_method("update"); local enemy_character_base_update_method = enemy_character_base_type_def:get_method("update");

View File

@@ -3,7 +3,7 @@ local small_monster = {};
local singletons; local singletons;
local customization_menu; local customization_menu;
local config; local config;
local table_helpers; local utils;
local health_UI_entity; local health_UI_entity;
local stamina_UI_entity; local stamina_UI_entity;
local screen; local screen;
@@ -41,6 +41,9 @@ local imgui = imgui;
local draw = draw; local draw = draw;
local Vector2f = Vector2f; local Vector2f = Vector2f;
local reframework = reframework; local reframework = reframework;
local os = os;
local ValueType = ValueType;
local package = package;
small_monster.list = {}; small_monster.list = {};
@@ -113,7 +116,7 @@ function small_monster.init_UI(monster)
local monster_UI = monster.UI; 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.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; 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"); singletons = require("MHR_Overlay.Game_Handler.singletons");
customization_menu = require("MHR_Overlay.UI.customization_menu"); customization_menu = require("MHR_Overlay.UI.customization_menu");
config = require("MHR_Overlay.Misc.config"); 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"); health_UI_entity = require("MHR_Overlay.UI.UI_Entities.health_UI_entity");
stamina_UI_entity = require("MHR_Overlay.UI.UI_Entities.stamina_UI_entity"); stamina_UI_entity = require("MHR_Overlay.UI.UI_Entities.stamina_UI_entity");
screen = require("MHR_Overlay.Game_Handler.screen"); screen = require("MHR_Overlay.Game_Handler.screen");

View File

@@ -1,6 +1,6 @@
local ailment_buildups_customization = {}; local ailment_buildups_customization = {};
local table_helpers; local utils;
local config; local config;
local screen; local screen;
local players; local players;
@@ -43,6 +43,9 @@ local imgui = imgui;
local draw = draw; local draw = draw;
local Vector2f = Vector2f; local Vector2f = Vector2f;
local reframework = reframework; local reframework = reframework;
local os = os;
local ValueType = ValueType;
local package = package;
function ailment_buildups_customization.draw(cached_config) function ailment_buildups_customization.draw(cached_config)
local changed = false; 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 if imgui.tree_node(language.current_language.customization_menu.settings) then
changed, index = imgui.combo( changed, index = imgui.combo(
language.current_language.customization_menu.highlighted_bar, 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); customization_menu.displayed_highlighted_buildup_bar_types);
config_changed = config_changed or changed; config_changed = config_changed or changed;
@@ -111,7 +114,7 @@ function ailment_buildups_customization.draw(cached_config)
changed, index = imgui.combo( changed, index = imgui.combo(
language.current_language.customization_menu.buildup_bars_are_relative_to, 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); customization_menu.displayed_buildup_bar_relative_types);
config_changed = config_changed or changed; 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 if imgui.tree_node(language.current_language.customization_menu.sorting) then
changed, index = imgui.combo( changed, index = imgui.combo(
language.current_language.customization_menu.type, 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); customization_menu.displayed_ailment_buildups_sorting_types);
config_changed = config_changed or changed; config_changed = config_changed or changed;
@@ -198,7 +201,7 @@ function ailment_buildups_customization.draw(cached_config)
end end
function ailment_buildups_customization.init_module() 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"); language = require("MHR_Overlay.Misc.language");
config = require("MHR_Overlay.Misc.config"); config = require("MHR_Overlay.Misc.config");
screen = require("MHR_Overlay.Game_Handler.screen"); screen = require("MHR_Overlay.Game_Handler.screen");

View File

@@ -1,6 +1,6 @@
local ailments_customization = {}; local ailments_customization = {};
local table_helpers; local utils;
local config; local config;
local screen; local screen;
local players; local players;
@@ -43,6 +43,9 @@ local imgui = imgui;
local draw = draw; local draw = draw;
local Vector2f = Vector2f; local Vector2f = Vector2f;
local reframework = reframework; local reframework = reframework;
local os = os;
local ValueType = ValueType;
local package = package;
function ailments_customization.draw(cached_config) function ailments_customization.draw(cached_config)
local changed = false; local changed = false;
@@ -140,7 +143,7 @@ function ailments_customization.draw(cached_config)
if imgui.tree_node(language.current_language.customization_menu.sorting) then if imgui.tree_node(language.current_language.customization_menu.sorting) then
changed, index = imgui.combo( changed, index = imgui.combo(
language.current_language.customization_menu.type, 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); customization_menu.displayed_ailments_sorting_types);
config_changed = config_changed or changed; config_changed = config_changed or changed;
@@ -363,7 +366,7 @@ function ailments_customization.draw(cached_config)
end end
function ailments_customization.init_module() 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"); language = require("MHR_Overlay.Misc.language");
config = require("MHR_Overlay.Misc.config"); config = require("MHR_Overlay.Misc.config");
screen = require("MHR_Overlay.Game_Handler.screen"); screen = require("MHR_Overlay.Game_Handler.screen");

View File

@@ -1,6 +1,6 @@
local bar_customization = {}; local bar_customization = {};
local table_helpers; local utils;
local config; local config;
local screen; local screen;
local players; local players;
@@ -42,6 +42,9 @@ local imgui = imgui;
local draw = draw; local draw = draw;
local Vector2f = Vector2f; local Vector2f = Vector2f;
local reframework = reframework; local reframework = reframework;
local os = os;
local ValueType = ValueType;
local package = package;
function bar_customization.draw(bar_name, bar) function bar_customization.draw(bar_name, bar)
if bar == nil then 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, 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), bar.outline.style),
customization_menu.displayed_outline_styles); customization_menu.displayed_outline_styles);
bar_changed = bar_changed or changed; bar_changed = bar_changed or changed;
@@ -189,7 +192,7 @@ function bar_customization.draw(bar_name, bar)
end end
function bar_customization.init_module() 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"); language = require("MHR_Overlay.Misc.language");
config = require("MHR_Overlay.Misc.config"); config = require("MHR_Overlay.Misc.config");
screen = require("MHR_Overlay.Game_Handler.screen"); screen = require("MHR_Overlay.Game_Handler.screen");

View File

@@ -1,6 +1,6 @@
local body_parts_customization = {}; local body_parts_customization = {};
local table_helpers; local utils;
local config; local config;
local screen; local screen;
local players; local players;
@@ -43,6 +43,9 @@ local imgui = imgui;
local draw = draw; local draw = draw;
local Vector2f = Vector2f; local Vector2f = Vector2f;
local reframework = reframework; local reframework = reframework;
local os = os;
local ValueType = ValueType;
local package = package;
function body_parts_customization.draw(cached_config) function body_parts_customization.draw(cached_config)
local changed = false; local changed = false;
@@ -88,7 +91,7 @@ function body_parts_customization.draw(cached_config)
config_changed = config_changed or changed; config_changed = config_changed or changed;
changed, index = imgui.combo(language.current_language.customization_menu.filter_mode, 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); customization_menu.displayed_large_monster_UI_parts_filter_types);
config_changed = config_changed or changed; 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 if imgui.tree_node(language.current_language.customization_menu.sorting) then
changed, index = imgui.combo( changed, index = imgui.combo(
language.current_language.customization_menu.type, 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); customization_menu.displayed_large_monster_UI_parts_sorting_types);
config_changed = config_changed or changed; config_changed = config_changed or changed;
@@ -366,7 +369,7 @@ function body_parts_customization.draw(cached_config)
end end
function body_parts_customization.init_module() 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"); language = require("MHR_Overlay.Misc.language");
config = require("MHR_Overlay.Misc.config"); config = require("MHR_Overlay.Misc.config");
screen = require("MHR_Overlay.Game_Handler.screen"); screen = require("MHR_Overlay.Game_Handler.screen");

View File

@@ -1,6 +1,5 @@
local large_monster_UI_customization = {}; local large_monster_UI_customization = {};
local table_helpers;
local config; local config;
local screen; local screen;
local players; local players;
@@ -43,6 +42,9 @@ local imgui = imgui;
local draw = draw; local draw = draw;
local Vector2f = Vector2f; local Vector2f = Vector2f;
local reframework = reframework; local reframework = reframework;
local os = os;
local ValueType = ValueType;
local package = package;
function large_monster_UI_customization.draw(cached_config) function large_monster_UI_customization.draw(cached_config)
local changed = false; local changed = false;
@@ -87,7 +89,6 @@ function large_monster_UI_customization.draw(cached_config)
end end
function large_monster_UI_customization.init_module() function large_monster_UI_customization.init_module()
table_helpers = require("MHR_Overlay.Misc.table_helpers");
language = require("MHR_Overlay.Misc.language"); language = require("MHR_Overlay.Misc.language");
config = require("MHR_Overlay.Misc.config"); config = require("MHR_Overlay.Misc.config");
screen = require("MHR_Overlay.Game_Handler.screen"); screen = require("MHR_Overlay.Game_Handler.screen");

View File

@@ -1,6 +1,5 @@
local label_customization = {}; local label_customization = {};
local table_helpers;
local config; local config;
local screen; local screen;
local players; local players;
@@ -41,6 +40,9 @@ local imgui = imgui;
local draw = draw; local draw = draw;
local Vector2f = Vector2f; local Vector2f = Vector2f;
local reframework = reframework; local reframework = reframework;
local os = os;
local ValueType = ValueType;
local package = package;
function label_customization.draw(label_name, label) function label_customization.draw(label_name, label)
local label_changed = false; local label_changed = false;
@@ -114,7 +116,6 @@ function label_customization.draw(label_name, label)
end end
function label_customization.init_module() function label_customization.init_module()
table_helpers = require("MHR_Overlay.Misc.table_helpers");
language = require("MHR_Overlay.Misc.language"); language = require("MHR_Overlay.Misc.language");
config = require("MHR_Overlay.Misc.config"); config = require("MHR_Overlay.Misc.config");
screen = require("MHR_Overlay.Game_Handler.screen"); screen = require("MHR_Overlay.Game_Handler.screen");

View File

@@ -1,6 +1,5 @@
local large_monster_UI_customization = {}; local large_monster_UI_customization = {};
local table_helpers;
local config; local config;
local screen; local screen;
local players; local players;
@@ -50,6 +49,9 @@ local imgui = imgui;
local draw = draw; local draw = draw;
local Vector2f = Vector2f; local Vector2f = Vector2f;
local reframework = reframework; local reframework = reframework;
local os = os;
local ValueType = ValueType;
local package = package;
function large_monster_UI_customization.draw(cached_config) function large_monster_UI_customization.draw(cached_config)
local changed = false; local changed = false;
@@ -80,7 +82,6 @@ function large_monster_UI_customization.draw(cached_config)
end end
function large_monster_UI_customization.init_module() function large_monster_UI_customization.init_module()
table_helpers = require("MHR_Overlay.Misc.table_helpers");
language = require("MHR_Overlay.Misc.language"); language = require("MHR_Overlay.Misc.language");
config = require("MHR_Overlay.Misc.config"); config = require("MHR_Overlay.Misc.config");
screen = require("MHR_Overlay.Game_Handler.screen"); screen = require("MHR_Overlay.Game_Handler.screen");

View File

@@ -1,6 +1,5 @@
local line_customization = {}; local line_customization = {};
local table_helpers;
local config; local config;
local screen; local screen;
local players; local players;
@@ -41,6 +40,9 @@ local imgui = imgui;
local draw = draw; local draw = draw;
local Vector2f = Vector2f; local Vector2f = Vector2f;
local reframework = reframework; local reframework = reframework;
local os = os;
local ValueType = ValueType;
local package = package;
function line_customization.draw(line_name, line) function line_customization.draw(line_name, line)
if line == nil then if line == nil then
@@ -94,7 +96,6 @@ function line_customization.draw(line_name, line)
end end
function line_customization.init_module() function line_customization.init_module()
table_helpers = require("MHR_Overlay.Misc.table_helpers");
language = require("MHR_Overlay.Misc.language"); language = require("MHR_Overlay.Misc.language");
config = require("MHR_Overlay.Misc.config"); config = require("MHR_Overlay.Misc.config");
screen = require("MHR_Overlay.Game_Handler.screen"); screen = require("MHR_Overlay.Game_Handler.screen");

View File

@@ -1,6 +1,5 @@
local module_visibility_customization = {}; local module_visibility_customization = {};
local table_helpers;
local config; local config;
local screen; local screen;
local players; local players;
@@ -43,6 +42,9 @@ local imgui = imgui;
local draw = draw; local draw = draw;
local Vector2f = Vector2f; local Vector2f = Vector2f;
local reframework = reframework; local reframework = reframework;
local os = os;
local ValueType = ValueType;
local package = package;
function module_visibility_customization.draw(cached_config) function module_visibility_customization.draw(cached_config)
local changed = false; local changed = false;
@@ -100,7 +102,6 @@ function module_visibility_customization.draw(cached_config)
end end
function module_visibility_customization.init_module() function module_visibility_customization.init_module()
table_helpers = require("MHR_Overlay.Misc.table_helpers");
language = require("MHR_Overlay.Misc.language"); language = require("MHR_Overlay.Misc.language");
config = require("MHR_Overlay.Misc.config"); config = require("MHR_Overlay.Misc.config");
screen = require("MHR_Overlay.Game_Handler.screen"); screen = require("MHR_Overlay.Game_Handler.screen");

View File

@@ -1,6 +1,5 @@
local rage_customization = {}; local rage_customization = {};
local table_helpers;
local config; local config;
local screen; local screen;
local players; local players;
@@ -43,6 +42,9 @@ local imgui = imgui;
local draw = draw; local draw = draw;
local Vector2f = Vector2f; local Vector2f = Vector2f;
local reframework = reframework; local reframework = reframework;
local os = os;
local ValueType = ValueType;
local package = package;
function rage_customization.draw(cached_config) function rage_customization.draw(cached_config)
local changed = false; local changed = false;
@@ -90,7 +92,6 @@ function rage_customization.draw(cached_config)
end end
function rage_customization.init_module() function rage_customization.init_module()
table_helpers = require("MHR_Overlay.Misc.table_helpers");
language = require("MHR_Overlay.Misc.language"); language = require("MHR_Overlay.Misc.language");
config = require("MHR_Overlay.Misc.config"); config = require("MHR_Overlay.Misc.config");
screen = require("MHR_Overlay.Game_Handler.screen"); screen = require("MHR_Overlay.Game_Handler.screen");

View File

@@ -1,6 +1,5 @@
local stamina_customization = {}; local stamina_customization = {};
local table_helpers;
local config; local config;
local screen; local screen;
local players; local players;
@@ -43,6 +42,9 @@ local imgui = imgui;
local draw = draw; local draw = draw;
local Vector2f = Vector2f; local Vector2f = Vector2f;
local reframework = reframework; local reframework = reframework;
local os = os;
local ValueType = ValueType;
local package = package;
function stamina_customization.draw(cached_config) function stamina_customization.draw(cached_config)
local changed = false; local changed = false;
@@ -90,7 +92,6 @@ function stamina_customization.draw(cached_config)
end end
function stamina_customization.init_module() function stamina_customization.init_module()
table_helpers = require("MHR_Overlay.Misc.table_helpers");
language = require("MHR_Overlay.Misc.language"); language = require("MHR_Overlay.Misc.language");
config = require("MHR_Overlay.Misc.config"); config = require("MHR_Overlay.Misc.config");
screen = require("MHR_Overlay.Game_Handler.screen"); screen = require("MHR_Overlay.Game_Handler.screen");

View File

@@ -4,7 +4,6 @@ local buff_UI_entity;
local config; local config;
local buffs; local buffs;
local screen; local screen;
local table_helpers;
local sdk = sdk; local sdk = sdk;
local tostring = tostring; local tostring = tostring;
@@ -34,6 +33,9 @@ local imgui = imgui;
local draw = draw; local draw = draw;
local Vector2f = Vector2f; local Vector2f = Vector2f;
local reframework = reframework; local reframework = reframework;
local os = os;
local ValueType = ValueType;
local package = package;
function buff_UI.draw() function buff_UI.draw()
local cached_config = config.current_config.buff_UI; 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"); buff_UI_entity = require("MHR_Overlay.UI.UI_Entities.buff_UI_entity");
buffs = require("MHR_Overlay.Buffs.buffs"); buffs = require("MHR_Overlay.Buffs.buffs");
--singletons = require("MHR_Overlay.Game_Handler.singletons"); --singletons = require("MHR_Overlay.Game_Handler.singletons");
table_helpers = require("MHR_Overlay.Misc.table_helpers");
config = require("MHR_Overlay.Misc.config"); config = require("MHR_Overlay.Misc.config");
--customization_menu = require("MHR_Overlay.UI.customization_menu"); --customization_menu = require("MHR_Overlay.UI.customization_menu");
--players = require("MHR_Overlay.Damage_Meter.players"); --players = require("MHR_Overlay.Damage_Meter.players");

View File

@@ -9,7 +9,7 @@ local quest_status;
local screen; local screen;
local drawing; local drawing;
local language; local language;
local table_helpers; local utils;
local sdk = sdk; local sdk = sdk;
local tostring = tostring; local tostring = tostring;
@@ -39,6 +39,9 @@ local imgui = imgui;
local draw = draw; local draw = draw;
local Vector2f = Vector2f; local Vector2f = Vector2f;
local reframework = reframework; local reframework = reframework;
local os = os;
local ValueType = ValueType;
local package = package;
damage_meter_UI.last_displayed_players = {}; damage_meter_UI.last_displayed_players = {};
damage_meter_UI.freeze_displayed_players = false; damage_meter_UI.freeze_displayed_players = false;
@@ -64,7 +67,7 @@ function damage_meter_UI.draw()
local quest_players = {}; 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; quest_players = damage_meter_UI.last_displayed_players;
else else
quest_players = players.display_list; quest_players = players.display_list;
@@ -182,7 +185,7 @@ function damage_meter_UI.init_module()
screen = require("MHR_Overlay.Game_Handler.screen"); screen = require("MHR_Overlay.Game_Handler.screen");
drawing = require("MHR_Overlay.UI.drawing"); drawing = require("MHR_Overlay.UI.drawing");
language = require("MHR_Overlay.Misc.language"); language = require("MHR_Overlay.Misc.language");
table_helpers = require("MHR_Overlay.Misc.table_helpers"); utils = require("MHR_Overlay.Misc.utils");
end end
return damage_meter_UI; return damage_meter_UI;

View File

@@ -7,7 +7,6 @@ local large_monster;
local screen; local screen;
local players; local players;
local drawing; local drawing;
local table_helpers;
local health_UI_entity; local health_UI_entity;
local stamina_UI_entity; local stamina_UI_entity;
local rage_UI_entity; local rage_UI_entity;
@@ -41,6 +40,9 @@ local imgui = imgui;
local draw = draw; local draw = draw;
local Vector2f = Vector2f; local Vector2f = Vector2f;
local reframework = reframework; 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 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"); screen = require("MHR_Overlay.Game_Handler.screen");
players = require("MHR_Overlay.Damage_Meter.players"); players = require("MHR_Overlay.Damage_Meter.players");
drawing = require("MHR_Overlay.UI.drawing"); 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"); health_UI_entity = require("MHR_Overlay.UI.UI_Entities.health_UI_entity");
stamina_UI_entity = require("MHR_Overlay.UI.UI_Entities.stamina_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"); rage_UI_entity = require("MHR_Overlay.UI.UI_Entities.rage_UI_entity");

View File

@@ -7,7 +7,6 @@ local large_monster;
local screen; local screen;
local players; local players;
local drawing; local drawing;
local table_helpers;
local health_UI_entity; local health_UI_entity;
local stamina_UI_entity; local stamina_UI_entity;
local rage_UI_entity; local rage_UI_entity;
@@ -40,6 +39,9 @@ local imgui = imgui;
local draw = draw; local draw = draw;
local Vector2f = Vector2f; local Vector2f = Vector2f;
local reframework = reframework; 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 enemy_manager_type_def = sdk.find_type_definition("snow.enemy.EnemyManager");
local get_boss_enemy_count_method = enemy_manager_type_def:get_method("getBossEnemyCount"); local get_boss_enemy_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"); screen = require("MHR_Overlay.Game_Handler.screen");
players = require("MHR_Overlay.Damage_Meter.players"); players = require("MHR_Overlay.Damage_Meter.players");
drawing = require("MHR_Overlay.UI.drawing"); 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"); health_UI_entity = require("MHR_Overlay.UI.UI_Entities.health_UI_entity");
stamina_UI_entity = require("MHR_Overlay.UI.UI_Entities.stamina_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"); rage_UI_entity = require("MHR_Overlay.UI.UI_Entities.rage_UI_entity");

View File

@@ -7,7 +7,6 @@ local customization_menu;
local screen; local screen;
local players; local players;
local drawing; local drawing;
local table_helpers;
local health_UI_entity; local health_UI_entity;
local stamina_UI_entity; local stamina_UI_entity;
@@ -39,6 +38,9 @@ local imgui = imgui;
local draw = draw; local draw = draw;
local Vector2f = Vector2f; local Vector2f = Vector2f;
local reframework = reframework; 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 enemy_manager_type_def = sdk.find_type_definition("snow.enemy.EnemyManager");
local get_zako_enemy_count_method = enemy_manager_type_def:get_method("getZakoEnemyCount"); local get_zako_enemy_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"); screen = require("MHR_Overlay.Game_Handler.screen");
players = require("MHR_Overlay.Damage_Meter.players"); players = require("MHR_Overlay.Damage_Meter.players");
drawing = require("MHR_Overlay.UI.drawing"); 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"); health_UI_entity = require("MHR_Overlay.UI.UI_Entities.health_UI_entity");
stamina_UI_entity = require("MHR_Overlay.UI.UI_Entities.stamina_UI_entity"); stamina_UI_entity = require("MHR_Overlay.UI.UI_Entities.stamina_UI_entity");
end end

View File

@@ -4,7 +4,7 @@ local time;
local screen; local screen;
local config; local config;
local drawing; local drawing;
local table_helpers; local utils;
local sdk = sdk; local sdk = sdk;
local tostring = tostring; local tostring = tostring;
@@ -34,6 +34,9 @@ local imgui = imgui;
local draw = draw; local draw = draw;
local Vector2f = Vector2f; local Vector2f = Vector2f;
local reframework = reframework; local reframework = reframework;
local os = os;
local ValueType = ValueType;
local package = package;
time_UI.label = nil; time_UI.label = nil;
@@ -51,7 +54,7 @@ function time_UI.draw()
end end
function time_UI.init_UI() function time_UI.init_UI()
time_UI.label = table_helpers.deep_copy(config.current_config.time_UI.time_label); time_UI.label = utils.table.deep_copy(config.current_config.time_UI.time_label);
local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier; 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"); screen = require("MHR_Overlay.Game_Handler.screen");
config = require("MHR_Overlay.Misc.config"); config = require("MHR_Overlay.Misc.config");
drawing = require("MHR_Overlay.UI.drawing"); drawing = require("MHR_Overlay.UI.drawing");
table_helpers = require("MHR_Overlay.Misc.table_helpers"); utils = require("MHR_Overlay.Misc.utils");
time_UI.init_UI() time_UI.init_UI()
end end

View File

@@ -1,7 +1,7 @@
local ailment_UI_entity = {}; local ailment_UI_entity = {};
local config; local config;
local table_helpers; local utils;
local drawing; local drawing;
local language; local language;
@@ -33,6 +33,9 @@ local imgui = imgui;
local draw = draw; local draw = draw;
local Vector2f = Vector2f; local Vector2f = Vector2f;
local reframework = reframework; 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) function ailment_UI_entity.new(visibility, bar, name_label, text_label, value_label, percentage_label, timer_label)
local entity = {}; 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; local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
entity.visibility = visibility; entity.visibility = visibility;
entity.bar = table_helpers.deep_copy(bar); entity.bar = utils.table.deep_copy(bar);
entity.name_label = table_helpers.deep_copy(name_label); entity.name_label = utils.table.deep_copy(name_label);
entity.text_label = table_helpers.deep_copy(text_label); entity.text_label = utils.table.deep_copy(text_label);
entity.value_label = table_helpers.deep_copy(value_label); entity.value_label = utils.table.deep_copy(value_label);
entity.percentage_label = table_helpers.deep_copy(percentage_label); entity.percentage_label = utils.table.deep_copy(percentage_label);
entity.timer_label = table_helpers.deep_copy(timer_label); entity.timer_label = utils.table.deep_copy(timer_label);
entity.bar.offset.x = entity.bar.offset.x * global_scale_modifier; entity.bar.offset.x = entity.bar.offset.x * global_scale_modifier;
entity.bar.offset.y = entity.bar.offset.y * 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 end
function ailment_UI_entity.init_module() 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"); drawing = require("MHR_Overlay.UI.drawing");
config = require("MHR_Overlay.Misc.config"); config = require("MHR_Overlay.Misc.config");
language = require("MHR_Overlay.Misc.language"); language = require("MHR_Overlay.Misc.language");

View File

@@ -1,6 +1,6 @@
local ailment_buildup_UI_entity = {}; local ailment_buildup_UI_entity = {};
local table_helpers; local utils;
local drawing; local drawing;
local config; local config;
local players; local players;
@@ -34,6 +34,9 @@ local imgui = imgui;
local draw = draw; local draw = draw;
local Vector2f = Vector2f; local Vector2f = Vector2f;
local reframework = reframework; 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, 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, 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; local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
--entity.visibility = visibility; --entity.visibility = visibility;
entity.buildup_bar = table_helpers.deep_copy(buildup_bar); entity.buildup_bar = utils.table.deep_copy(buildup_bar);
entity.highlighted_buildup_bar = table_helpers.deep_copy(highlighted_buildup_bar); entity.highlighted_buildup_bar = utils.table.deep_copy(highlighted_buildup_bar);
entity.ailment_name_label = table_helpers.deep_copy(ailment_name_label); entity.ailment_name_label = utils.table.deep_copy(ailment_name_label);
entity.player_name_label = table_helpers.deep_copy(player_name_label); entity.player_name_label = utils.table.deep_copy(player_name_label);
entity.buildup_value_label = table_helpers.deep_copy(buildup_value_label); entity.buildup_value_label = utils.table.deep_copy(buildup_value_label);
entity.buildup_percentage_label = table_helpers.deep_copy(buildup_percentage_label); entity.buildup_percentage_label = utils.table.deep_copy(buildup_percentage_label);
entity.total_buildup_label = table_helpers.deep_copy(total_buildup_label); entity.total_buildup_label = utils.table.deep_copy(total_buildup_label);
entity.total_buildup_value_label = table_helpers.deep_copy(total_buildup_value_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.x = entity.buildup_bar.offset.x * global_scale_modifier;
entity.buildup_bar.offset.y = entity.buildup_bar.offset.y * 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 end
function ailment_buildup_UI_entity.init_module() 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"); drawing = require("MHR_Overlay.UI.drawing");
config = require("MHR_Overlay.Misc.config"); config = require("MHR_Overlay.Misc.config");
players = require("MHR_Overlay.Damage_Meter.players"); players = require("MHR_Overlay.Damage_Meter.players");

View File

@@ -1,7 +1,7 @@
local body_part_UI_entity = {}; local body_part_UI_entity = {};
local config; local config;
local table_helpers; local utils;
local drawing; local drawing;
local sdk = sdk; local sdk = sdk;
@@ -32,6 +32,9 @@ local imgui = imgui;
local draw = draw; local draw = draw;
local Vector2f = Vector2f; local Vector2f = Vector2f;
local reframework = reframework; 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, 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, 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.break_visibility = break_visibility;
entity.loss_visibility = loss_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.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.part_name_label.offset.y = entity.part_name_label.offset.y * global_scale_modifier;
entity.flinch_bar = table_helpers.deep_copy(flinch_bar); entity.flinch_bar = utils.table.deep_copy(flinch_bar);
entity.flinch_text_label = table_helpers.deep_copy(flinch_text_label); entity.flinch_text_label = utils.table.deep_copy(flinch_text_label);
entity.flinch_value_label = table_helpers.deep_copy(flinch_value_label); entity.flinch_value_label = utils.table.deep_copy(flinch_value_label);
entity.flinch_percentage_label = table_helpers.deep_copy(flinch_percentage_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.x = entity.flinch_bar.offset.x * global_scale_modifier;
entity.flinch_bar.offset.y = entity.flinch_bar.offset.y * 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.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.flinch_percentage_label.offset.y = entity.flinch_percentage_label.offset.y * global_scale_modifier;
entity.break_bar = table_helpers.deep_copy(break_bar); entity.break_bar = utils.table.deep_copy(break_bar);
entity.break_text_label = table_helpers.deep_copy(break_text_label); entity.break_text_label = utils.table.deep_copy(break_text_label);
entity.break_value_label = table_helpers.deep_copy(break_value_label); entity.break_value_label = utils.table.deep_copy(break_value_label);
entity.break_percentage_label = table_helpers.deep_copy(break_percentage_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.x = entity.break_bar.offset.x * global_scale_modifier;
entity.break_bar.offset.y = entity.break_bar.offset.y * 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.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.break_percentage_label.offset.y = entity.break_percentage_label.offset.y * global_scale_modifier;
entity.loss_bar = table_helpers.deep_copy(loss_bar); entity.loss_bar = utils.table.deep_copy(loss_bar);
entity.loss_text_label = table_helpers.deep_copy(loss_text_label); entity.loss_text_label = utils.table.deep_copy(loss_text_label);
entity.loss_value_label = table_helpers.deep_copy(loss_value_label); entity.loss_value_label = utils.table.deep_copy(loss_value_label);
entity.loss_health_percentage_label = table_helpers.deep_copy(loss_health_percentage_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.x = entity.loss_bar.offset.x * global_scale_modifier;
entity.loss_bar.offset.y = entity.loss_bar.offset.y * 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 end
function body_part_UI_entity.init_module() 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"); drawing = require("MHR_Overlay.UI.drawing");
config = require("MHR_Overlay.Misc.config"); config = require("MHR_Overlay.Misc.config");
end end

View File

@@ -1,7 +1,7 @@
local buff_UI_entity = {}; local buff_UI_entity = {};
local config; local config;
local table_helpers; local utils;
local drawing; local drawing;
local language; local language;
@@ -33,6 +33,9 @@ local imgui = imgui;
local draw = draw; local draw = draw;
local Vector2f = Vector2f; local Vector2f = Vector2f;
local reframework = reframework; local reframework = reframework;
local os = os;
local ValueType = ValueType;
local package = package;
function buff_UI_entity.new(bar, name_label, timer_label) function buff_UI_entity.new(bar, name_label, timer_label)
local entity = {}; 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; local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
--entity.visibility = visibility; --entity.visibility = visibility;
entity.bar = table_helpers.deep_copy(bar); entity.bar = utils.table.deep_copy(bar);
entity.name_label = table_helpers.deep_copy(name_label); entity.name_label = utils.table.deep_copy(name_label);
entity.timer_label = table_helpers.deep_copy(timer_label); entity.timer_label = utils.table.deep_copy(timer_label);
entity.bar.offset.x = entity.bar.offset.x * global_scale_modifier; entity.bar.offset.x = entity.bar.offset.x * global_scale_modifier;
entity.bar.offset.y = entity.bar.offset.y * 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 end
function buff_UI_entity.init_module() 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"); drawing = require("MHR_Overlay.UI.drawing");
config = require("MHR_Overlay.Misc.config"); config = require("MHR_Overlay.Misc.config");
language = require("MHR_Overlay.Misc.language"); language = require("MHR_Overlay.Misc.language");

View File

@@ -1,6 +1,6 @@
local damage_UI_entity = {}; local damage_UI_entity = {};
local table_helpers; local utils;
local drawing; local drawing;
local config; local config;
local players; local players;
@@ -36,19 +36,22 @@ local imgui = imgui;
local draw = draw; local draw = draw;
local Vector2f = Vector2f; local Vector2f = Vector2f;
local reframework = reframework; local reframework = reframework;
local os = os;
local ValueType = ValueType;
local package = package;
function damage_UI_entity.new(damage_meter_UI_elements, type) function damage_UI_entity.new(damage_meter_UI_elements, type)
local entity = {}; local entity = {};
local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier; 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.bar = utils.table.deep_copy(damage_meter_UI_elements.damage_bar);
entity.name_label = table_helpers.deep_copy(damage_meter_UI_elements.name_label); entity.name_label = utils.table.deep_copy(damage_meter_UI_elements.name_label);
entity.hunter_rank_label = table_helpers.deep_copy(damage_meter_UI_elements.hunter_rank_label); entity.hunter_rank_label = utils.table.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.cart_count_label = utils.table.deep_copy(damage_meter_UI_elements.cart_count_label);
entity.dps_label = table_helpers.deep_copy(damage_meter_UI_elements.dps_label); entity.dps_label = utils.table.deep_copy(damage_meter_UI_elements.dps_label);
entity.value_label = table_helpers.deep_copy(damage_meter_UI_elements.damage_value_label); entity.value_label = utils.table.deep_copy(damage_meter_UI_elements.damage_value_label);
entity.percentage_label = table_helpers.deep_copy(damage_meter_UI_elements.damage_percentage_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; 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 end
function damage_UI_entity.init_module() 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"); drawing = require("MHR_Overlay.UI.drawing");
config = require("MHR_Overlay.Misc.config"); config = require("MHR_Overlay.Misc.config");
players = require("MHR_Overlay.Damage_Meter.players"); players = require("MHR_Overlay.Damage_Meter.players");

View File

@@ -1,6 +1,6 @@
local health_UI_entity = {}; local health_UI_entity = {};
local table_helpers; local utils;
local drawing; local drawing;
local language; local language;
local config; local config;
@@ -33,6 +33,9 @@ local imgui = imgui;
local draw = draw; local draw = draw;
local Vector2f = Vector2f; local Vector2f = Vector2f;
local reframework = reframework; 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) function health_UI_entity.new(visibility, bar, text_label, value_label, percentage_label)
local entity = {}; 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; local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
entity.visibility = visibility; entity.visibility = visibility;
entity.bar = table_helpers.deep_copy(bar); entity.bar = utils.table.deep_copy(bar);
entity.text_label = table_helpers.deep_copy(text_label); entity.text_label = utils.table.deep_copy(text_label);
entity.value_label = table_helpers.deep_copy(value_label); entity.value_label = utils.table.deep_copy(value_label);
entity.percentage_label = table_helpers.deep_copy(percentage_label); entity.percentage_label = utils.table.deep_copy(percentage_label);
entity.bar.offset.x = entity.bar.offset.x * global_scale_modifier; entity.bar.offset.x = entity.bar.offset.x * global_scale_modifier;
entity.bar.offset.y = entity.bar.offset.y * 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 end
function health_UI_entity.init_module() 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"); drawing = require("MHR_Overlay.UI.drawing");
language = require("MHR_Overlay.Misc.language"); language = require("MHR_Overlay.Misc.language");
config = require("MHR_Overlay.Misc.config"); config = require("MHR_Overlay.Misc.config");

View File

@@ -1,6 +1,6 @@
local rage_UI_entity = {}; local rage_UI_entity = {};
local table_helpers; local utils;
local drawing; local drawing;
local language; local language;
local config; local config;
@@ -33,6 +33,9 @@ local imgui = imgui;
local draw = draw; local draw = draw;
local Vector2f = Vector2f; local Vector2f = Vector2f;
local reframework = reframework; 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) function rage_UI_entity.new(visibility, bar, text_label, value_label, percentage_label, timer_label)
local entity = {}; 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; local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
entity.visibility = visibility; entity.visibility = visibility;
entity.bar = table_helpers.deep_copy(bar); entity.bar = utils.table.deep_copy(bar);
entity.text_label = table_helpers.deep_copy(text_label); entity.text_label = utils.table.deep_copy(text_label);
entity.value_label = table_helpers.deep_copy(value_label); entity.value_label = utils.table.deep_copy(value_label);
entity.percentage_label = table_helpers.deep_copy(percentage_label); entity.percentage_label = utils.table.deep_copy(percentage_label);
entity.timer_label = table_helpers.deep_copy(timer_label); entity.timer_label = utils.table.deep_copy(timer_label);
entity.bar.offset.x = entity.bar.offset.x * global_scale_modifier; entity.bar.offset.x = entity.bar.offset.x * global_scale_modifier;
entity.bar.offset.y = entity.bar.offset.y * 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 end
function rage_UI_entity.init_module() 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"); drawing = require("MHR_Overlay.UI.drawing");
language = require("MHR_Overlay.Misc.language"); language = require("MHR_Overlay.Misc.language");
config = require("MHR_Overlay.Misc.config"); config = require("MHR_Overlay.Misc.config");

View File

@@ -1,6 +1,6 @@
local stamina_UI_entity = {}; local stamina_UI_entity = {};
local table_helpers; local utils;
local drawing; local drawing;
local language; local language;
local config; local config;
@@ -33,6 +33,9 @@ local imgui = imgui;
local draw = draw; local draw = draw;
local Vector2f = Vector2f; local Vector2f = Vector2f;
local reframework = reframework; 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) function stamina_UI_entity.new(visibility, bar, text_label, value_label, percentage_label, timer_label)
local entity = {}; 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; local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
entity.visibility = visibility; entity.visibility = visibility;
entity.bar = table_helpers.deep_copy(bar); entity.bar = utils.table.deep_copy(bar);
entity.text_label = table_helpers.deep_copy(text_label); entity.text_label = utils.table.deep_copy(text_label);
entity.value_label = table_helpers.deep_copy(value_label); entity.value_label = utils.table.deep_copy(value_label);
entity.percentage_label = table_helpers.deep_copy(percentage_label); entity.percentage_label = utils.table.deep_copy(percentage_label);
entity.timer_label = table_helpers.deep_copy(timer_label); entity.timer_label = utils.table.deep_copy(timer_label);
entity.bar.offset.x = entity.bar.offset.x * global_scale_modifier; entity.bar.offset.x = entity.bar.offset.x * global_scale_modifier;
entity.bar.offset.y = entity.bar.offset.y * 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 end
function stamina_UI_entity.init_module() 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"); drawing = require("MHR_Overlay.UI.drawing");
language = require("MHR_Overlay.Misc.language"); language = require("MHR_Overlay.Misc.language");
config = require("MHR_Overlay.Misc.config"); config = require("MHR_Overlay.Misc.config");

View File

@@ -1,6 +1,6 @@
local customization_menu = {}; local customization_menu = {};
local table_helpers; local utils;
local config; local config;
local screen; local screen;
local players; local players;
@@ -57,6 +57,9 @@ local imgui = imgui;
local draw = draw; local draw = draw;
local Vector2f = Vector2f; local Vector2f = Vector2f;
local reframework = reframework; local reframework = reframework;
local os = os;
local ValueType = ValueType;
local package = package;
customization_menu.font = nil; customization_menu.font = nil;
customization_menu.font_range = {0x1, 0xFFFF, 0}; 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 if imgui.tree_node(language.current_language.customization_menu.config) then
changed, index = imgui.combo(language.current_language.customization_menu.config, 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; config_changed = config_changed or changed;
if changed then if changed then
config.current_config_name = config.config_names[index]; config.current_config_name = config.config_names[index];
config.update(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(); customization_menu.init();
@@ -473,7 +476,7 @@ function customization_menu.draw_config()
config.new(customization_menu.config_name_input); config.new(customization_menu.config_name_input);
config_changed = config_changed or changed; 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(); customization_menu.init();
@@ -491,7 +494,7 @@ function customization_menu.draw_config()
config.duplicate(customization_menu.config_name_input); config.duplicate(customization_menu.config_name_input);
config_changed = config_changed or changed; 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(); customization_menu.init();
@@ -508,7 +511,7 @@ function customization_menu.draw_config()
if changed then if changed then
config.reset(); 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(); 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); imgui.text(language.current_language.customization_menu.menu_font_change_disclaimer);
changed, index = imgui.combo(language.current_language.customization_menu.language .. "*", 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; config_changed = config_changed or changed;
if changed then 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); imgui.text(language.current_language.customization_menu.UI_font_notice);
changed, index = imgui.combo(language.current_language.customization_menu.family, 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; config_changed = config_changed or changed;
if changed then if changed then
@@ -1089,7 +1092,7 @@ function customization_menu.draw_small_monster_UI()
config_changed = config_changed or changed; config_changed = config_changed or changed;
changed, index = imgui.combo(language.current_language.customization_menu.static_orientation, 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); customization_menu.displayed_orientation_types);
config_changed = config_changed or changed; config_changed = config_changed or changed;
@@ -1171,7 +1174,7 @@ function customization_menu.draw_small_monster_UI()
config_changed = config_changed or changed; 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); customization_menu.anchor_types, cached_config.static_position.anchor), customization_menu.displayed_anchor_types);
config_changed = config_changed or changed; config_changed = config_changed or changed;
@@ -1198,7 +1201,7 @@ function customization_menu.draw_small_monster_UI()
end end
if imgui.tree_node(language.current_language.customization_menu.static_sorting) then 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.monster_UI_sorting_types, cached_config.static_sorting.type),
customization_menu.displayed_monster_UI_sorting_types); customization_menu.displayed_monster_UI_sorting_types);
@@ -1352,7 +1355,7 @@ function customization_menu.draw_large_monster_static_UI()
changed, index = imgui.combo( changed, index = imgui.combo(
language.current_language.customization_menu.highlighted_monster_location, 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); customization_menu.displayed_damage_meter_UI_my_damage_bar_location_types);
config_changed = config_changed or changed; config_changed = config_changed or changed;
@@ -1363,7 +1366,7 @@ function customization_menu.draw_large_monster_static_UI()
changed, index = imgui.combo( changed, index = imgui.combo(
language.current_language.customization_menu.orientation, 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); customization_menu.displayed_orientation_types);
config_changed = config_changed or changed; config_changed = config_changed or changed;
@@ -1388,7 +1391,7 @@ function customization_menu.draw_large_monster_static_UI()
changed, index = imgui.combo( changed, index = imgui.combo(
language.current_language.customization_menu.anchor, 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); customization_menu.displayed_anchor_types);
config_changed = config_changed or changed; 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 if imgui.tree_node(language.current_language.customization_menu.sorting) then
changed, index = imgui.combo( changed, index = imgui.combo(
language.current_language.customization_menu.type, 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); customization_menu.displayed_monster_UI_sorting_types);
config_changed = config_changed or changed; config_changed = config_changed or changed;
@@ -1469,7 +1472,7 @@ function customization_menu.draw_large_monster_highlighted_UI()
changed, index = imgui.combo( changed, index = imgui.combo(
language.current_language.customization_menu.anchor, 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); customization_menu.displayed_anchor_types);
config_changed = config_changed or changed; config_changed = config_changed or changed;
@@ -1489,7 +1492,7 @@ function customization_menu.draw_large_monster_highlighted_UI()
changed, index = imgui.combo( changed, index = imgui.combo(
language.current_language.customization_menu.mode, 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); customization_menu.displayed_auto_highlight_modes);
config_changed = config_changed or changed; config_changed = config_changed or changed;
@@ -1536,7 +1539,7 @@ function customization_menu.draw_time_UI()
changed, index = imgui.combo( changed, index = imgui.combo(
language.current_language.customization_menu.anchor, 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); customization_menu.displayed_anchor_types);
config_changed = config_changed or changed; config_changed = config_changed or changed;
@@ -1637,7 +1640,7 @@ function customization_menu.draw_damage_meter_UI()
changed, index = imgui.combo( changed, index = imgui.combo(
language.current_language.customization_menu.orientation, 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); customization_menu.displayed_orientation_types);
config_changed = config_changed or changed; config_changed = config_changed or changed;
@@ -1648,7 +1651,7 @@ function customization_menu.draw_damage_meter_UI()
changed, index = imgui.combo( changed, index = imgui.combo(
language.current_language.customization_menu.highlighted, 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); customization_menu.displayed_damage_meter_UI_highlighted_entity_types);
config_changed = config_changed or changed; config_changed = config_changed or changed;
@@ -1659,7 +1662,7 @@ function customization_menu.draw_damage_meter_UI()
changed, index = imgui.combo( changed, index = imgui.combo(
language.current_language.customization_menu.damage_bars_are_relative_to, 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); customization_menu.displayed_damage_meter_UI_damage_bar_relative_types);
config_changed = config_changed or changed; config_changed = config_changed or changed;
@@ -1670,7 +1673,7 @@ function customization_menu.draw_damage_meter_UI()
changed, index = imgui.combo( changed, index = imgui.combo(
language.current_language.customization_menu.my_damage_bar_location, 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); customization_menu.displayed_damage_meter_UI_my_damage_bar_location_types);
config_changed = config_changed or changed; config_changed = config_changed or changed;
@@ -1681,7 +1684,7 @@ function customization_menu.draw_damage_meter_UI()
changed, index = imgui.combo( changed, index = imgui.combo(
language.current_language.customization_menu.total_damage_location, 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); customization_menu.displayed_damage_meter_UI_total_damage_location_types);
config_changed = config_changed or changed; config_changed = config_changed or changed;
@@ -1691,7 +1694,7 @@ function customization_menu.draw_damage_meter_UI()
end end
changed, index = imgui.combo(language.current_language.customization_menu.dps_mode, 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); customization_menu.displayed_damage_meter_UI_dps_modes);
config_changed = config_changed or changed; config_changed = config_changed or changed;
@@ -1818,7 +1821,7 @@ function customization_menu.draw_damage_meter_UI()
changed, index = imgui.combo( changed, index = imgui.combo(
language.current_language.customization_menu.anchor, 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); customization_menu.displayed_anchor_types);
config_changed = config_changed or changed; 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 if imgui.tree_node(language.current_language.customization_menu.sorting) then
changed, index = imgui.combo( changed, index = imgui.combo(
language.current_language.customization_menu.type, 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); customization_menu.displayed_damage_meter_UI_sorting_types);
config_changed = config_changed or changed; config_changed = config_changed or changed;
@@ -2160,7 +2163,7 @@ function customization_menu.draw_buff_UI()
changed, index = imgui.combo( changed, index = imgui.combo(
language.current_language.customization_menu.orientation, 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); customization_menu.displayed_orientation_types);
config_changed = config_changed or changed; config_changed = config_changed or changed;
@@ -2199,7 +2202,7 @@ function customization_menu.draw_buff_UI()
changed, index = imgui.combo( changed, index = imgui.combo(
language.current_language.customization_menu.anchor, 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); customization_menu.displayed_anchor_types);
config_changed = config_changed or changed; 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 if imgui.tree_node(language.current_language.customization_menu.sorting) then
changed, index = imgui.combo( changed, index = imgui.combo(
language.current_language.customization_menu.type, 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); customization_menu.displayed_buff_UI_sorting_types);
config_changed = config_changed or changed; config_changed = config_changed or changed;
@@ -2247,7 +2250,7 @@ function customization_menu.draw_buff_UI()
end end
function customization_menu.init_module() 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"); language = require("MHR_Overlay.Misc.language");
config = require("MHR_Overlay.Misc.config"); config = require("MHR_Overlay.Misc.config");
screen = require("MHR_Overlay.Game_Handler.screen"); screen = require("MHR_Overlay.Game_Handler.screen");

View File

@@ -1,8 +1,7 @@
local drawing = {}; local drawing = {};
local config; local config;
local table_helpers; local utils;
local unicode_helpers;
local sdk = sdk; local sdk = sdk;
local tostring = tostring; local tostring = tostring;
@@ -32,6 +31,9 @@ local imgui = imgui;
local draw = draw; local draw = draw;
local Vector2f = Vector2f; local Vector2f = Vector2f;
local reframework = reframework; local reframework = reframework;
local os = os;
local ValueType = ValueType;
local package = package;
drawing.font = nil; drawing.font = nil;
@@ -77,7 +79,7 @@ function drawing.limit_text_size(text, size_limit)
break break
else else
local old_limited_text = limited_text; 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 if limited_text == old_limited_text then
break break
@@ -332,8 +334,7 @@ end
function drawing.init_module() function drawing.init_module()
config = require("MHR_Overlay.Misc.config"); config = require("MHR_Overlay.Misc.config");
table_helpers = require("MHR_Overlay.Misc.table_helpers"); utils = require("MHR_Overlay.Misc.utils");
unicode_helpers = require("MHR_Overlay.Misc.unicode_helpers");
end end
return drawing; return drawing;