Implement Error Handler

This commit is contained in:
GreenComfyTea
2023-08-05 16:30:15 +03:00
parent 4bdb4ee2e6
commit dfb7893c1a
59 changed files with 1079 additions and 402 deletions

View File

@@ -14,6 +14,7 @@ local keyboard;
local customization_menu;
local label_customization;
local bar_customization;
local error_handler;
local sdk = sdk;
local tostring = tostring;
@@ -271,6 +272,7 @@ function this.init_dependencies()
label_customization = require("MHR_Overlay.UI.Customizations.label_customization");
bar_customization = require("MHR_Overlay.UI.Customizations.bar_customization");
error_handler = require("MHR_Overlay.Misc.error_handler");
end
function this.init_module()

View File

@@ -14,6 +14,7 @@ local keyboard;
local customization_menu;
local label_customization;
local bar_customization;
local error_handler;
local sdk = sdk;
local tostring = tostring;
@@ -401,6 +402,7 @@ function this.init_dependencies()
customization_menu = require("MHR_Overlay.UI.customization_menu");
label_customization = require("MHR_Overlay.UI.Customizations.label_customization");
bar_customization = require("MHR_Overlay.UI.Customizations.bar_customization");
error_handler = require("MHR_Overlay.Misc.error_handler");
end
function this.init_module()

View File

@@ -13,6 +13,7 @@ local time_UI;
local keyboard;
local customization_menu;
local line_customization;
local error_handler;
local sdk = sdk;
local tostring = tostring;
@@ -257,6 +258,7 @@ function this.init_dependencies()
keyboard = require("MHR_Overlay.Game_Handler.keyboard");
customization_menu = require("MHR_Overlay.UI.customization_menu");
line_customization = require("MHR_Overlay.UI.Customizations.line_customization");
error_handler = require("MHR_Overlay.Misc.error_handler");
end
function this.init_module()

View File

@@ -14,6 +14,7 @@ local keyboard;
local customization_menu;
local label_customization;
local bar_customization;
local error_handler;
local sdk = sdk;
local tostring = tostring;
@@ -526,6 +527,7 @@ function this.init_dependencies()
customization_menu = require("MHR_Overlay.UI.customization_menu");
label_customization = require("MHR_Overlay.UI.Customizations.label_customization");
bar_customization = require("MHR_Overlay.UI.Customizations.bar_customization");
error_handler = require("MHR_Overlay.Misc.error_handler");
end
function this.init_module()

View File

@@ -13,6 +13,7 @@ local keyboard;
local customization_menu;
local label_customization;
local bar_customization;
local error_handler;
local sdk = sdk;
local tostring = tostring;
@@ -102,6 +103,7 @@ function this.init_dependencies()
customization_menu = require("MHR_Overlay.UI.customization_menu");
label_customization = require("MHR_Overlay.UI.Customizations.label_customization");
bar_customization = require("MHR_Overlay.UI.Customizations.bar_customization");
error_handler = require("MHR_Overlay.Misc.error_handler");
end
function this.init_module()

View File

@@ -11,6 +11,7 @@ local part_names;
local time_UI;
local keyboard;
local customization_menu;
local error_handler;
local sdk = sdk;
local tostring = tostring;
@@ -134,6 +135,7 @@ function this.init_dependencies()
time_UI = require("MHR_Overlay.UI.Modules.time_UI");
keyboard = require("MHR_Overlay.Game_Handler.keyboard");
customization_menu = require("MHR_Overlay.UI.customization_menu");
error_handler = require("MHR_Overlay.Misc.error_handler");
end
function this.init_module()

View File

@@ -11,6 +11,7 @@ local part_names;
local time_UI;
local keyboard;
local customization_menu;
local error_handler;
local label_customization;
local bar_customization;
@@ -93,9 +94,10 @@ function this.init_dependencies()
time_UI = require("MHR_Overlay.UI.Modules.time_UI");
keyboard = require("MHR_Overlay.Game_Handler.keyboard");
customization_menu = require("MHR_Overlay.UI.customization_menu");
error_handler = require("MHR_Overlay.Misc.error_handler");
label_customization = require("MHR_Overlay.UI.Customizations.label_customization");
bar_customization = require("MHR_Overlay.UI.Customizations.bar_customization");
health_customization = require("MHR_Overlay.UI.Customizations.health_customization");
stamina_customization = require("MHR_Overlay.UI.Customizations.stamina_customization");
rage_customization = require("MHR_Overlay.UI.Customizations.rage_customization");

View File

@@ -11,6 +11,7 @@ local part_names;
local time_UI;
local keyboard;
local customization_menu;
local error_handler;
local sdk = sdk;
local tostring = tostring;
@@ -107,6 +108,7 @@ function this.init_dependencies()
time_UI = require("MHR_Overlay.UI.Modules.time_UI");
keyboard = require("MHR_Overlay.Game_Handler.keyboard");
customization_menu = require("MHR_Overlay.UI.customization_menu");
error_handler = require("MHR_Overlay.Misc.error_handler");
end
function this.init_module()

View File

@@ -13,6 +13,7 @@ local keyboard;
local customization_menu;
local label_customization;
local bar_customization;
local error_handler;
local sdk = sdk;
local tostring = tostring;
@@ -113,6 +114,7 @@ function this.init_dependencies()
time_UI = require("MHR_Overlay.UI.Modules.time_UI");
keyboard = require("MHR_Overlay.Game_Handler.keyboard");
customization_menu = require("MHR_Overlay.UI.customization_menu");
error_handler = require("MHR_Overlay.Misc.error_handler");
end
function this.init_module()

View File

@@ -13,6 +13,7 @@ local keyboard;
local customization_menu;
local label_customization;
local bar_customization;
local error_handler;
local sdk = sdk;
local tostring = tostring;
@@ -105,6 +106,7 @@ function this.init_dependencies()
customization_menu = require("MHR_Overlay.UI.customization_menu");
label_customization = require("MHR_Overlay.UI.Customizations.label_customization");
bar_customization = require("MHR_Overlay.UI.Customizations.bar_customization");
error_handler = require("MHR_Overlay.Misc.error_handler");
end
function this.init_module()

View File

@@ -13,6 +13,7 @@ local keyboard;
local customization_menu;
local label_customization;
local bar_customization;
local error_handler;
local sdk = sdk;
local tostring = tostring;
@@ -105,6 +106,7 @@ function this.init_dependencies()
customization_menu = require("MHR_Overlay.UI.customization_menu");
label_customization = require("MHR_Overlay.UI.Customizations.label_customization");
bar_customization = require("MHR_Overlay.UI.Customizations.bar_customization");
error_handler = require("MHR_Overlay.Misc.error_handler");
end
function this.init_module()

View File

@@ -7,6 +7,7 @@ local consumables;
local melody_effects;
local screen;
local utils;
local error_handler;
local sdk = sdk;
local tostring = tostring;
@@ -49,23 +50,23 @@ function this.draw()
for key, consumable in pairs(consumables.list) do
if not consumable.is_active then
goto continue2;
goto continue;
end
table.insert(displayed_buffs, consumable);
::continue2::
::continue::
end
for _, melody_effect in pairs(melody_effects.list) do
if not melody_effect.is_active then
goto continue3;
goto continue2;
end
table.insert(displayed_buffs, melody_effect);
::continue3::
::continue2::
end
-- sort
@@ -107,7 +108,7 @@ function this.draw()
for _, buff in ipairs(displayed_buffs) do
if not buff.is_active then
goto continue4;
goto continue3;
end
buffs.draw(buff, buff.buff_UI, position_on_screen, 1);
@@ -118,7 +119,7 @@ function this.draw()
position_on_screen.y = position_on_screen.y + cached_config.spacing.y * global_scale_modifier;
end
::continue4::
::continue3::
end
end
@@ -137,6 +138,7 @@ function this.init_dependencies()
screen = require("MHR_Overlay.Game_Handler.screen");
--drawing = require("MHR_Overlay.UI.drawing");
utils = require("MHR_Overlay.Misc.utils");
error_handler = require("MHR_Overlay.Misc.error_handler");
end
function this.init_module()

View File

@@ -10,6 +10,7 @@ local screen;
local drawing;
local language;
local utils;
local error_handler;
local sdk = sdk;
local tostring = tostring;
@@ -46,17 +47,6 @@ local package = package;
this.last_displayed_players = {};
this.freeze_displayed_players = false;
local lobby_manager_type_def = sdk.find_type_definition("snow.LobbyManager");
local quest_hunter_info_field = lobby_manager_type_def:get_field("_questHunterInfo");
local hunter_info_field = lobby_manager_type_def:get_field("_hunterInfo");
local quest_hunter_info_type_def = quest_hunter_info_field:get_type();
local get_count_method = quest_hunter_info_type_def:get_method("get_Count");
local get_item_method = quest_hunter_info_type_def:get_method("get_Item");
local hunter_info_type_def = sdk.find_type_definition("snow.LobbyManager.HunterInfo");
local member_index_field = hunter_info_type_def:get_field("_memberIndex");
function this.draw()
local cached_config = config.current_config.damage_meter_UI;
local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
@@ -116,32 +106,32 @@ function this.draw()
for _, player in ipairs(quest_players) do
if player.display.total_damage == 0 and cached_config.settings.hide_player_if_player_damage_is_zero then
goto continue
goto continue;
end
if player.type == players.types.myself then
if cached_config.settings.hide_myself then
goto continue
goto continue;
end
elseif player.type == players.types.servant then
if cached_config.settings.hide_servants then
goto continue
goto continue;
end
elseif player.type == players.types.other_player then
if cached_config.settings.hide_other_players then
goto continue
goto continue;
end
elseif player.type == players.types.my_otomo then
if not cached_config.settings.show_my_otomos_separately then
goto continue
goto continue;
end
elseif player.type == players.types.other_player_otomo then
if not cached_config.settings.show_other_player_otomos_separately then
goto continue
goto continue;
end
elseif player.type == players.types.servant_otomo then
if not cached_config.settings.show_servant_otomos_separately then
goto continue
goto continue;
end
end
@@ -154,7 +144,6 @@ function this.draw()
end
::continue::
end
-- draw total damage
@@ -186,6 +175,7 @@ function this.init_dependencies()
drawing = require("MHR_Overlay.UI.drawing");
language = require("MHR_Overlay.Misc.language");
utils = require("MHR_Overlay.Misc.utils");
error_handler = require("MHR_Overlay.Misc.error_handler");
end
function this.init_module()

View File

@@ -11,6 +11,7 @@ local health_UI_entity;
local stamina_UI_entity;
local rage_UI_entity;
local env_creature;
local error_handler;
local sdk = sdk;
local tostring = tostring;
@@ -44,8 +45,6 @@ local os = os;
local ValueType = ValueType;
local package = package;
local enemy_manager_type_def = sdk.find_type_definition("snow.enemy.EnemyManager");
function this.draw()
if singletons.enemy_manager == nil then
return;
@@ -57,11 +56,11 @@ function this.draw()
for REcreature, creature in pairs(env_creature.list) do
if cached_config.settings.max_distance == 0 then
break
break;
end
if cached_config.settings.hide_inactive_creatures and creature.is_inactive then
goto continue
goto continue;
end
local position_on_screen = {};
@@ -72,7 +71,7 @@ function this.draw()
position_on_screen = draw.world_to_screen(creature.position + world_offset);
if position_on_screen == nil then
goto continue
goto continue;
end
position_on_screen.x = position_on_screen.x + cached_config.viewport_offset.x * global_scale_modifier;
@@ -82,7 +81,7 @@ function this.draw()
local opacity_scale = 1;
if creature.distance > cached_config.settings.max_distance then
goto continue
goto continue;
end
if cached_config.settings.opacity_falloff then
@@ -106,6 +105,7 @@ function this.init_dependencies()
stamina_UI_entity = require("MHR_Overlay.UI.UI_Entities.stamina_UI_entity");
rage_UI_entity = require("MHR_Overlay.UI.UI_Entities.rage_UI_entity");
env_creature = require("MHR_Overlay.Endemic_Life.env_creature");
error_handler = require("MHR_Overlay.Misc.error_handler");
end
function this.init_module()

View File

@@ -10,6 +10,7 @@ local drawing;
local health_UI_entity;
local stamina_UI_entity;
local rage_UI_entity;
local error_handler;
local sdk = sdk;
local tostring = tostring;
@@ -78,6 +79,7 @@ function this.draw(dynamic_enabled, static_enabled, highlighted_enabled)
highlighted_id = get_targeting_enemy_index_field:get_data(gui_hud_target_camera);
if highlighted_id == nil then
error_handler.report("large_monster_UI.draw", "Failed to Access Data: highlighted_id");
highlighted_id = -1;
end
end
@@ -85,20 +87,21 @@ function this.draw(dynamic_enabled, static_enabled, highlighted_enabled)
local enemy_count = get_boss_enemy_count_method:call(singletons.enemy_manager);
if enemy_count == nil then
error_handler.report("large_monster_UI.draw", "Failed to Access Data: enemy_count");
return;
end
for i = 0, enemy_count - 1 do
local enemy = get_boss_enemy_method:call(singletons.enemy_manager, i);
if enemy == nil then
customization_menu.status = "No enemy";
goto continue
error_handler.report("large_monster_UI.draw", "Failed to Access Data: enemy No. " .. tostring(i));
goto continue;
end
local monster = large_monster.list[enemy];
if monster == nil then
customization_menu.status = "No large monster entry";
goto continue
error_handler.report("large_monster_UI.draw", "Missing Entry: monster No. " .. tostring(i));
goto continue;
end
if update_distance then
@@ -155,21 +158,21 @@ function this.draw(dynamic_enabled, static_enabled, highlighted_enabled)
if dynamic_enabled then
local success = pcall(this.draw_dynamic, displayed_monsters, highlighted_monster, cached_config);
if not success then
customization_menu.status = string.format("[%s] Dynamic Large Monster drawing function threw an exception");
error_handler.report("large_monster_UI.draw", "Dynamic Large Monster drawing function threw an exception");
end
end
if highlighted_enabled then
local success = pcall(this.draw_highlighted, highlighted_monster, cached_config);
if not success then
customization_menu.status = string.format("[%s] Highlighted Large Monster drawing function threw an exception");
error_handler.report("large_monster_UI.draw", "Highlighted Large Monster drawing function threw an exception");
end
end
if static_enabled then
local success = pcall(this.draw_static, displayed_monsters, highlighted_monster, cached_config);
if not success then
customization_menu.status = string.format("[%s] Static Large Monster drawing function threw an exception");
error_handler.report("large_monster_UI.draw", "Static Large Monster drawing function threw an exception");
end
end
end
@@ -181,24 +184,24 @@ function this.draw_dynamic(displayed_monsters, highlighted_monster, cached_confi
local i = 0;
for _, monster in ipairs(displayed_monsters) do
if cached_config.settings.max_distance == 0 then
break
break;
end
if monster.is_stealth then
goto continue
goto continue;
end
if monster.dead_or_captured and cached_config.settings.hide_dead_or_captured then
goto continue
goto continue;
end
if monster == highlighted_monster then
if not cached_config.settings.render_highlighted_monster then
goto continue
goto continue;
end
else
if not cached_config.settings.render_not_highlighted_monsters then
goto continue
goto continue;
end
end
@@ -281,16 +284,16 @@ function this.draw_static(displayed_monsters, highlighted_monster, cached_config
local i = 0;
for _, monster in ipairs(displayed_monsters) do
if monster.dead_or_captured and cached_config.settings.hide_dead_or_captured then
goto continue
goto continue;
end
if monster == highlighted_monster then
if not cached_config.settings.render_highlighted_monster then
goto continue
goto continue;
end
else
if not cached_config.settings.render_not_highlighted_monsters then
goto continue
goto continue;
end
end
@@ -339,6 +342,7 @@ function this.init_dependencies()
health_UI_entity = require("MHR_Overlay.UI.UI_Entities.health_UI_entity");
stamina_UI_entity = require("MHR_Overlay.UI.UI_Entities.stamina_UI_entity");
rage_UI_entity = require("MHR_Overlay.UI.UI_Entities.rage_UI_entity");
error_handler = require("MHR_Overlay.Misc.error_handler");
end
function this.init_module()

View File

@@ -9,6 +9,7 @@ local players;
local drawing;
local health_UI_entity;
local stamina_UI_entity;
local error_handler;
local sdk = sdk;
local tostring = tostring;
@@ -57,33 +58,33 @@ function this.draw()
local enemy_count = get_zako_enemy_count_method:call(singletons.enemy_manager);
if enemy_count == nil then
customization_menu.status = "No enemy count";
error_handler.report("small_monster_UI.draw", "Failed to Access Data: enemy_count");
return;
end
for i = 0, enemy_count - 1 do
local enemy = get_zako_enemy_method:call(singletons.enemy_manager, i);
if enemy == nil then
customization_menu.status = "No enemy";
goto continue
error_handler.report("small_monster_UI.draw", "Failed to Access Data: enemy No. " .. tostring(i));
goto continue;
end
local monster = small_monster.list[enemy];
if monster == nil then
customization_menu.status = "No small monster entry";
goto continue
error_handler.report("small_monster_UI.draw", "Missing Entry: monster No. " .. tostring(i));
goto continue;
end
if monster.dead_or_captured and cached_config.settings.hide_dead_or_captured then
goto continue
end
goto continue;
end;
table.insert(displayed_monsters, monster);
::continue::
end
if cached_config.dynamic_positioning.enabled
or (not cached_config.dynamic_positioning.enabled and cached_config.static_sorting.type == "Distance") then
or (not cached_config.dynamic_positioning.enabled and cached_config.static_sorting.type == "Distance") then
for _, monster in ipairs(displayed_monsters) do
monster.distance = (players.myself_position - monster.position):length();
end
@@ -159,9 +160,6 @@ function this.draw()
end
end
local opacity_scale = 1;
if cached_config.dynamic_positioning.enabled then
if cached_config.dynamic_positioning.max_distance == 0 then
@@ -177,8 +175,6 @@ function this.draw()
end
end
small_monster.draw(monster, cached_config, position_on_screen, opacity_scale);
i = i + 1;
@@ -196,6 +192,7 @@ function this.init_dependencies()
drawing = require("MHR_Overlay.UI.drawing");
health_UI_entity = require("MHR_Overlay.UI.UI_Entities.health_UI_entity");
stamina_UI_entity = require("MHR_Overlay.UI.UI_Entities.stamina_UI_entity");
error_handler = require("MHR_Overlay.Misc.error_handler");
end
function this.init_module()

View File

@@ -5,6 +5,7 @@ local screen;
local config;
local drawing;
local utils;
local error_handler;
local sdk = sdk;
local tostring = tostring;
@@ -68,6 +69,7 @@ function this.init_dependencies()
config = require("MHR_Overlay.Misc.config");
drawing = require("MHR_Overlay.UI.drawing");
utils = require("MHR_Overlay.Misc.utils");
error_handler = require("MHR_Overlay.Misc.error_handler");
end
function this.init_module()

View File

@@ -4,6 +4,7 @@ local config;
local utils;
local drawing;
local language;
local error_handler;
local sdk = sdk;
local tostring = tostring;
@@ -123,6 +124,7 @@ function this.init_dependencies()
drawing = require("MHR_Overlay.UI.drawing");
config = require("MHR_Overlay.Misc.config");
language = require("MHR_Overlay.Misc.language");
error_handler = require("MHR_Overlay.Misc.error_handler");
end
function this.init_module()

View File

@@ -5,6 +5,7 @@ local drawing;
local config;
local players;
local language;
local error_handler;
local sdk = sdk;
local tostring = tostring;
@@ -123,6 +124,7 @@ function this.init_dependencies()
config = require("MHR_Overlay.Misc.config");
players = require("MHR_Overlay.Damage_Meter.players");
language = require("MHR_Overlay.Misc.language");
error_handler = require("MHR_Overlay.Misc.error_handler");
end
function this.init_module()

View File

@@ -3,6 +3,7 @@ local this = {};
local config;
local utils;
local drawing;
local error_handler;
local sdk = sdk;
local tostring = tostring;
@@ -306,6 +307,7 @@ function this.init_dependencies()
utils = require("MHR_Overlay.Misc.utils");
drawing = require("MHR_Overlay.UI.drawing");
config = require("MHR_Overlay.Misc.config");
error_handler = require("MHR_Overlay.Misc.error_handler");
end
function this.init_module()

View File

@@ -4,6 +4,7 @@ local config;
local utils;
local drawing;
local language;
local error_handler;
local sdk = sdk;
local tostring = tostring;
@@ -86,6 +87,7 @@ function this.init_dependencies()
drawing = require("MHR_Overlay.UI.drawing");
config = require("MHR_Overlay.Misc.config");
language = require("MHR_Overlay.Misc.language");
error_handler = require("MHR_Overlay.Misc.error_handler");
end
function this.init_module()

View File

@@ -7,6 +7,7 @@ local players;
local language;
local quest_status;
local non_players;
local error_handler;
local sdk = sdk;
local tostring = tostring;
@@ -241,6 +242,7 @@ function this.init_dependencies()
language = require("MHR_Overlay.Misc.language");
quest_status = require("MHR_Overlay.Game_Handler.quest_status");
non_players = require("MHR_Overlay.Damage_Meter.non_players");
error_handler = require("MHR_Overlay.Misc.error_handler");
end
function this.init_module()

View File

@@ -4,6 +4,7 @@ local utils;
local drawing;
local language;
local config;
local error_handler;
local sdk = sdk;
local tostring = tostring;
@@ -96,6 +97,7 @@ function this.init_dependencies()
drawing = require("MHR_Overlay.UI.drawing");
language = require("MHR_Overlay.Misc.language");
config = require("MHR_Overlay.Misc.config");
error_handler = require("MHR_Overlay.Misc.error_handler");
end
function this.init_module()

View File

@@ -4,6 +4,7 @@ local utils;
local drawing;
local language;
local config;
local error_handler;
local sdk = sdk;
local tostring = tostring;
@@ -110,6 +111,7 @@ function this.init_dependencies()
drawing = require("MHR_Overlay.UI.drawing");
language = require("MHR_Overlay.Misc.language");
config = require("MHR_Overlay.Misc.config");
error_handler = require("MHR_Overlay.Misc.error_handler");
end
function this.init_module()

View File

@@ -4,6 +4,7 @@ local utils;
local drawing;
local language;
local config;
local error_handler;
local sdk = sdk;
local tostring = tostring;
@@ -107,6 +108,7 @@ function this.init_dependencies()
drawing = require("MHR_Overlay.UI.drawing");
language = require("MHR_Overlay.Misc.language");
config = require("MHR_Overlay.Misc.config");
error_handler = require("MHR_Overlay.Misc.error_handler");
end
function this.init_module()

View File

@@ -14,6 +14,8 @@ local keyboard;
local non_players;
local quest_status;
local buffs;
local error_handler;
local time;
local label_customization;
local bar_customization;
@@ -64,7 +66,6 @@ local package = package;
this.font = nil;
this.full_font_range = {0x1, 0xFFFF, 0};
this.is_opened = false;
this.status = "OK";
this.window_position = Vector2f.new(480, 200);
this.window_pivot = Vector2f.new(0, 0);
@@ -353,12 +354,9 @@ function this.draw()
local damage_meter_UI_changed = false;
local endemic_life_UI_changed = false;
local buff_UI_changed = false;
local debug_changed = false;
local apply_font_requested = false;
local status_string = tostring(this.status);
imgui.text(language.current_language.customization_menu.status .. ": " .. status_string);
config_changed, apply_font_requested = this.draw_config();
modules_changed = this.draw_modules();
this.draw_hotkeys();
@@ -376,6 +374,9 @@ function this.draw()
damage_meter_UI_changed = this.draw_damage_meter_UI();
endemic_life_UI_changed = this.draw_endemic_life_UI()
buff_UI_changed = this.draw_buff_UI();
imgui.new_line();
debug_changed = this.draw_debug();
imgui.pop_font();
imgui.end_window();
@@ -447,7 +448,7 @@ function this.draw()
if modules_changed or global_settings_changed or small_monster_UI_changed or large_monster_dynamic_UI_changed or
large_monster_static_UI_changed or large_monster_highlighted_UI_changed or time_UI_changed or damage_meter_UI_changed or
endemic_life_UI_changed or buff_UI_changed or modifiers_changed or config_changed then
endemic_life_UI_changed or buff_UI_changed or modifiers_changed or config_changed or debug_changed then
config.save_current();
end
end
@@ -2264,6 +2265,63 @@ function this.draw_buff_UI()
return config_changed;
end
function this.draw_debug()
local cached_config = config.current_config.debug;
local changed = false;
local config_changed = false;
if imgui.tree_node(language.current_language.customization_menu.debug) then
if error_handler.is_empty then
imgui.text(language.current_language.customization_menu.everything_seems_to_be_ok);
else
imgui.text_colored("Current Script Time:", 0xFFAAAA66);
imgui.same_line();
imgui.text(string.format("%.3fs", time.total_elapsed_script_seconds));
for error_key, error in pairs(error_handler.list) do
imgui.button(string.format("%.3fs", error.time));
imgui.same_line();
imgui.text_colored(error_key, 0xFFAA66AA);
imgui.same_line();
imgui.text(error.message);
end
end
if imgui.tree_node(language.current_language.customization_menu.error_history) then
changed, cached_config.history_size = imgui.drag_int(
language.current_language.customization_menu.history_size, cached_config.history_size, 1, 0, 1024);
config_changed = config_changed or changed;
if changed then
error_handler.history = {};
end
for index, error in pairs(error_handler.history) do
imgui.text_colored(index, 0xFF66AA66);
imgui.same_line();
imgui.button(string.format("%.3fs", error.time));
imgui.same_line();
imgui.text_colored(error.key, 0xFFAA66AA);
imgui.same_line();
imgui.text(error.message);
end
imgui.tree_pop();
end
imgui.tree_pop();
end
return config_changed;
end
function this.init_dependencies()
utils = require("MHR_Overlay.Misc.utils");
language = require("MHR_Overlay.Misc.language");
@@ -2279,6 +2337,8 @@ function this.init_dependencies()
non_players = require("MHR_Overlay.Damage_Meter.non_players");
quest_status = require("MHR_Overlay.Game_Handler.quest_status");
buffs = require("MHR_Overlay.Buffs.buffs");
error_handler = require("MHR_Overlay.Misc.error_handler");
time = require("MHR_Overlay.Game_Handler.time");
label_customization = require("MHR_Overlay.UI.Customizations.label_customization");
bar_customization = require("MHR_Overlay.UI.Customizations.bar_customization");

View File

@@ -2,6 +2,7 @@ local this = {};
local config;
local utils;
local error_handler;
local sdk = sdk;
local tostring = tostring;
@@ -82,7 +83,7 @@ function this.limit_text_size(text, size_limit)
limited_text = utils.unicode.sub(limited_text, 1, -5) .. "...";
if limited_text == old_limited_text then
break
break;
end
end
end
@@ -379,6 +380,7 @@ end
function this.init_dependencies()
config = require("MHR_Overlay.Misc.config");
utils = require("MHR_Overlay.Misc.utils");
error_handler = require("MHR_Overlay.Misc.error_handler");
end
function this.init_module()