diff --git a/reframework/autorun/MHR_Overlay/Buffs/buffs.lua b/reframework/autorun/MHR_Overlay/Buffs/buffs.lua index e185398..d8820ec 100644 --- a/reframework/autorun/MHR_Overlay/Buffs/buffs.lua +++ b/reframework/autorun/MHR_Overlay/Buffs/buffs.lua @@ -1,4 +1,4 @@ -local buffs = {}; +local this = {}; local buff_UI_entity; local config; @@ -35,9 +35,9 @@ local os = os; local ValueType = ValueType; local package = package; -buffs.list = {}; +this.list = {}; -function buffs.new(name) +function this.new(name) local buff = {}; buff.name = name; @@ -53,48 +53,48 @@ function buffs.new(name) buff.is_infinite = false; - buffs.init_UI(buff); + this.init_UI(buff); return buff; end -function buffs.init_buffs() - buffs.list = {}; +function this.init_buffs() + this.list = {}; end -function buffs.init_UI(buff) +function this.init_UI(buff) local cached_config = config.current_config.buff_UI; buff.buff_UI = buff_UI_entity.new(cached_config.bar, cached_config.name_label, cached_config.timer_label); end -function buffs.draw(buff, buff_UI, position_on_screen, opacity_scale) +function this.draw(buff, buff_UI, position_on_screen, opacity_scale) buff_UI_entity.draw(buff, buff_UI, position_on_screen, opacity_scale); end -function buffs.init_module() +function this.init_module() config = require("MHR_Overlay.Misc.config"); buff_UI_entity = require("MHR_Overlay.UI.UI_Entities.buff_UI_entity"); - local buff = buffs.new("Enviroment Damage Negated"); + local buff = this.new("Enviroment Damage Negated"); buff.duration = 90; buff.timer = 65; buff.timer_percentage = 0.66; buff.minutes_left = 1; buff.seconds_left = 5 - buffs.list["Enviroment Damage Negated"] = buff; + this.list["Enviroment Damage Negated"] = buff; - local buff = buffs.new("Sharpness Loss Reduced"); + local buff = this.new("Sharpness Loss Reduced"); buff.duration = 120; buff.timer = 70; buff.timer_percentage = 0.583; buff.minutes_left = 1; buff.seconds_left = 10 - buffs.list["Sharpness Loss Reduced"] = buff; + this.list["Sharpness Loss Reduced"] = buff; - local buff = buffs.new("Sharpness Loss Reduced 2"); + local buff = this.new("Sharpness Loss Reduced 2"); buff.duration = 120; buff.timer = 70; buff.timer_percentage = 0.583; @@ -102,7 +102,7 @@ function buffs.init_module() buff.seconds_left = 10 buff.is_infinite = true; - buffs.list["Sharpness Loss Reduced 2"] = buff; + this.list["Sharpness Loss Reduced 2"] = buff; end -return buffs; \ No newline at end of file +return this; \ No newline at end of file diff --git a/reframework/autorun/MHR_Overlay/Damage_Meter/damage_hook.lua b/reframework/autorun/MHR_Overlay/Damage_Meter/damage_hook.lua index f53860f..4897097 100644 --- a/reframework/autorun/MHR_Overlay/Damage_Meter/damage_hook.lua +++ b/reframework/autorun/MHR_Overlay/Damage_Meter/damage_hook.lua @@ -1,4 +1,4 @@ -local damage_hook = {}; +local this = {}; local quest_status; local players; @@ -79,7 +79,7 @@ local packet_quest_forfeit_type_def = sdk.find_type_definition("snow.QuestManage local dead_player_id_field = packet_quest_forfeit_type_def:get_field("_DeadPlIndex"); local is_from_host_field = packet_quest_forfeit_type_def:get_field("_IsFromQuestHostPacket"); -function damage_hook.get_damage_source_type(damage_source_type_id, is_marionette_attack) +function this.get_damage_source_type(damage_source_type_id, is_marionette_attack) if is_marionette_attack then return "wyvern riding"; elseif damage_source_type_id == 0 or damage_source_type_id == 7 or damage_source_type_id == 11 or damage_source_type_id == 13 then @@ -100,7 +100,7 @@ function damage_hook.get_damage_source_type(damage_source_type_id, is_marionette end -- snow.hit.EnemyCalcDamageInfo.AfterCalcInfo_DamageSide -function damage_hook.update_damage(enemy, enemy_calc_damage_info) +function this.update_damage(enemy, enemy_calc_damage_info) local is_large_monster = is_boss_enemy_method:call(enemy); if is_large_monster == nil then @@ -184,7 +184,7 @@ function damage_hook.update_damage(enemy, enemy_calc_damage_info) -- 31 - EcSwampLeech -- 32 - EcPenetrateFish - local damage_source_type = damage_hook.get_damage_source_type(attacker_type, is_marionette_attack); + local damage_source_type = this.get_damage_source_type(attacker_type, is_marionette_attack); local monster; if is_large_monster then @@ -232,7 +232,7 @@ end --end -function damage_hook.cart(dead_player_id, flag_cat_skill_insurance) +function this.cart(dead_player_id, flag_cat_skill_insurance) -- flag_cat_skill_insurance = 0 -- flag_cat_skill_insurance = 1 local player = players.list[dead_player_id]; @@ -245,7 +245,7 @@ function damage_hook.cart(dead_player_id, flag_cat_skill_insurance) quest_status.get_cart_count(); 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 this.on_stock_direct_marionette_finish_shoot_hit_parts_damage(enemy, damage_rate, is_endure, is_ignore_multi_rate, category, no) local monster = large_monster.get_monster(enemy); local damage = utils.math.round(monster.max_health * damage_rate); @@ -273,7 +273,7 @@ function damage_hook.on_stock_direct_marionette_finish_shoot_hit_parts_damage(en return; end - local damage_source_type = damage_hook.get_damage_source_type(0, true); + local damage_source_type = this.get_damage_source_type(0, true); local is_large_monster = monster.is_large; local large_monster_damage_object = {}; @@ -309,7 +309,7 @@ function damage_hook.on_stock_direct_marionette_finish_shoot_hit_parts_damage(en players.update_damage(player, damage_source_type, true, large_monster_damage_object); end -function damage_hook.init_module() +function this.init_module() quest_status = require("MHR_Overlay.Game_Handler.quest_status"); players = require("MHR_Overlay.Damage_Meter.players"); small_monster = require("MHR_Overlay.Monsters.small_monster"); @@ -327,19 +327,19 @@ function damage_hook.init_module() local category = sdk.to_int64(args[6]); --snow.enemy.EnemyDef.VitalCategory local no = sdk.to_int64(args[7]); - damage_hook.on_stock_direct_marionette_finish_shoot_hit_parts_damage(enemy, damage_rate, is_endure, is_ignore_multi_rate, category, no); + this.on_stock_direct_marionette_finish_shoot_hit_parts_damage(enemy, damage_rate, is_endure, is_ignore_multi_rate, category, no); end, function(retval) return retval; end); sdk.hook(enemy_character_base_after_calc_damage_damage_side_method, function(args) - pcall(damage_hook.update_damage, sdk.to_managed_object(args[2]), sdk.to_managed_object(args[3])); + pcall(this.update_damage, sdk.to_managed_object(args[2]), sdk.to_managed_object(args[3])); end, function(retval) return retval; end); sdk.hook(quest_forfeit_method, function(args) - pcall(damage_hook.cart, sdk.to_int64(args[3]), (sdk.to_int64(args[4]) & 0xFFFFFFFF)); + pcall(this.cart, sdk.to_int64(args[3]), (sdk.to_int64(args[4]) & 0xFFFFFFFF)); end, function(retval) return retval; end); @@ -351,4 +351,4 @@ function damage_hook.init_module() --end); end -return damage_hook; +return this; diff --git a/reframework/autorun/MHR_Overlay/Damage_Meter/non_players.lua b/reframework/autorun/MHR_Overlay/Damage_Meter/non_players.lua index 6284319..000e76b 100644 --- a/reframework/autorun/MHR_Overlay/Damage_Meter/non_players.lua +++ b/reframework/autorun/MHR_Overlay/Damage_Meter/non_players.lua @@ -1,4 +1,4 @@ -local non_players = {}; +local this = {}; local config; local singletons; @@ -42,12 +42,12 @@ local os = os; local ValueType = ValueType; local package = package; -non_players.servant_list = {}; -non_players.otomo_list = {}; +this.servant_list = {}; +this.otomo_list = {}; -non_players.my_second_otomo_id = -1; +this.my_second_otomo_id = -1; -function non_players.new(id, name, level, type) +function this.new(id, name, level, type) local non_player = {}; non_player.id = id; non_player.name = name; @@ -68,22 +68,22 @@ function non_players.new(id, name, level, type) non_player.display.elemental_damage = 0; non_player.display.ailment_damage = 0; - non_players.init_UI(non_player); + this.init_UI(non_player); return non_player; end -function non_players.get_servant(servant_id) - return non_players.servant_list[servant_id]; +function this.get_servant(servant_id) + return this.servant_list[servant_id]; end -function non_players.get_otomo(otomo_id) - return non_players.otomo_list[otomo_id]; +function this.get_otomo(otomo_id) + return this.otomo_list[otomo_id]; end -function non_players.init() - non_players.servant_list = {}; - non_players.otomo_list = {}; +function this.init() + this.servant_list = {}; + this.otomo_list = {}; end local servant_manager_type_def = sdk.find_type_definition("snow.ai.ServantManager"); @@ -128,7 +128,7 @@ local otomo_info_name_field = otomo_info_type_def:get_field("_Name"); local otomo_info_level_field = otomo_info_type_def:get_field("_Level"); local otomo_info_order_field = otomo_info_type_def:get_field("_Order"); -function non_players.update_servant_list() +function this.update_servant_list() local cached_config = config.current_config.damage_meter_UI; if singletons.servant_manager == nil then @@ -176,40 +176,40 @@ function non_players.update_servant_list() goto continue; end - if non_players.servant_list[id] == nil then - non_players.servant_list[id] = non_players.new(id, name, 0, players.types.servant); + if this.servant_list[id] == nil then + this.servant_list[id] = this.new(id, name, 0, players.types.servant); end if not cached_config.settings.hide_servants then - table.insert(players.display_list, non_players.servant_list[id]); + table.insert(players.display_list, this.servant_list[id]); end ::continue:: end end -function non_players.update_otomo_list(is_on_quest, is_online) +function this.update_otomo_list(is_on_quest, is_online) if is_online then if is_on_quest then --non_players.update_my_otomos(); - non_players.update_otomos(quest_otomo_info_field); + this.update_otomos(quest_otomo_info_field); else - non_players.update_otomos(otomo_info_field); + this.update_otomos(otomo_info_field); end else if is_on_quest then - non_players.update_my_otomos(); - non_players.update_servant_otomos(); + this.update_my_otomos(); + this.update_servant_otomos(); else - non_players.update_my_otomos(); + this.update_my_otomos(); end end end -function non_players.update_my_otomos() +function this.update_my_otomos() local cached_config = config.current_config.damage_meter_UI; local first_otomo = get_master_otomo_info_method:call(singletons.otomo_manager, 0); @@ -219,12 +219,12 @@ function non_players.update_my_otomos() local level = otomo_create_data_level_field:get_data(first_otomo) or 0; local myself_id = players.myself.id; - if non_players.otomo_list[myself_id] == nil then - non_players.otomo_list[myself_id] = non_players.new(0, name, level, players.types.my_otomo); + if this.otomo_list[myself_id] == nil then + this.otomo_list[myself_id] = this.new(0, name, level, players.types.my_otomo); end if cached_config.settings.show_my_otomos_separately then - table.insert(players.display_list, non_players.otomo_list[myself_id]); + table.insert(players.display_list, this.otomo_list[myself_id]); end end end @@ -236,18 +236,18 @@ function non_players.update_my_otomos() local level = otomo_create_data_level_field:get_data(second_otomo) or 0; -- the secondary otomo is actually the 4th one! - if non_players.otomo_list[non_players.my_second_otomo_id] == nil then - non_players.otomo_list[non_players.my_second_otomo_id] = non_players.new(non_players.my_second_otomo_id, name, level, players.types.my_otomo); + if this.otomo_list[this.my_second_otomo_id] == nil then + this.otomo_list[this.my_second_otomo_id] = this.new(this.my_second_otomo_id, name, level, players.types.my_otomo); end if cached_config.settings.show_my_otomos_separately then - table.insert(players.display_list, non_players.otomo_list[non_players.my_second_otomo_id]); + table.insert(players.display_list, this.otomo_list[this.my_second_otomo_id]); end end end end -function non_players.update_servant_otomos() +function this.update_servant_otomos() local cached_config = config.current_config.damage_meter_UI; local servant_otomo_list = get_servant_otomo_list_method:call(singletons.otomo_manager); @@ -278,12 +278,12 @@ function non_players.update_servant_otomos() goto continue; end - 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); + if this.otomo_list[member_id] == nil then + this.otomo_list[member_id] = this.new(member_id, name, level, players.types.servant_otomo); end if cached_config.settings.show_servant_otomos_separately then - table.insert(players.display_list, non_players.otomo_list[member_id]); + table.insert(players.display_list, this.otomo_list[member_id]); end end @@ -292,7 +292,7 @@ function non_players.update_servant_otomos() end -function non_players.update_otomos(otomo_info_field_) +function this.update_otomos(otomo_info_field_) local cached_config = config.current_config.damage_meter_UI; if singletons.lobby_manager == nil then @@ -325,22 +325,22 @@ function non_players.update_otomos(otomo_info_field_) local level = otomo_info_level_field:get_data(otomo_info) or 0; - local otomo = non_players.otomo_list[id]; + local otomo = this.otomo_list[id]; if otomo == nil or (otomo.name ~= name and level ~= otomo.level) or (otomo.type == players.types.my_otomo and otomo.id ~= players.myself.id) or (otomo.type ~= players.types.my_otomo and otomo.id == players.myself.id) then if id == players.myself.id then - otomo = non_players.new(id, name, level, players.types.my_otomo); - non_players.otomo_list[id] = otomo; + otomo = this.new(id, name, level, players.types.my_otomo); + this.otomo_list[id] = otomo; elseif id >= 4 then - otomo = non_players.new(id, name, level, players.types.servant_otomo); - non_players.otomo_list[id] = otomo; + otomo = this.new(id, name, level, players.types.servant_otomo); + this.otomo_list[id] = otomo; else - otomo = non_players.new(id, name, level, players.types.other_player_otomo); - non_players.otomo_list[id] = otomo; + otomo = this.new(id, name, level, players.types.other_player_otomo); + this.otomo_list[id] = otomo; end end @@ -363,7 +363,7 @@ function non_players.update_otomos(otomo_info_field_) end end -function non_players.init_UI(non_player) +function this.init_UI(non_player) local cached_config = config.current_config.damage_meter_UI; if non_player.type == players.types.servant then @@ -377,7 +377,7 @@ function non_players.init_UI(non_player) end end -function non_players.init_module() +function this.init_module() config = require("MHR_Overlay.Misc.config"); singletons = require("MHR_Overlay.Game_Handler.singletons"); customization_menu = require("MHR_Overlay.UI.customization_menu"); @@ -388,7 +388,7 @@ function non_players.init_module() language = require("MHR_Overlay.Misc.language"); players = require("MHR_Overlay.Damage_Meter.players"); - non_players.init(); + this.init(); end -return non_players; \ No newline at end of file +return this; \ No newline at end of file diff --git a/reframework/autorun/MHR_Overlay/Damage_Meter/players.lua b/reframework/autorun/MHR_Overlay/Damage_Meter/players.lua index 1862fa6..db82810 100644 --- a/reframework/autorun/MHR_Overlay/Damage_Meter/players.lua +++ b/reframework/autorun/MHR_Overlay/Damage_Meter/players.lua @@ -1,4 +1,4 @@ -local players = {}; +local this = {}; local config; local singletons; @@ -42,16 +42,16 @@ local os = os; local ValueType = ValueType; local package = package; -players.list = {}; -players.myself = nil; -players.myself_position = Vector3f.new(0, 0, 0); -players.total = nil; +this.list = {}; +this.myself = nil; +this.myself_position = Vector3f.new(0, 0, 0); +this.total = nil; -players.display_list = {}; +this.display_list = {}; -players.highlighted_damage_UI = nil; +this.highlighted_damage_UI = nil; -players.types = { +this.types = { ["myself"] = 0, ["other_player"] = 1, ["servant"] = 2, @@ -63,7 +63,7 @@ players.types = { } -function players.new(id, name, master_rank, hunter_rank, type) +function this.new(id, name, master_rank, hunter_rank, type) local player = {}; player.id = id; player.name = name; @@ -78,8 +78,8 @@ function players.new(id, name, master_rank, hunter_rank, type) player.first_hit_time = -1; player.dps = 0; - player.small_monsters = players.init_damage_sources() - player.large_monsters = players.init_damage_sources(); + player.small_monsters = this.init_damage_sources() + player.large_monsters = this.init_damage_sources(); player.display = {}; player.display.total_damage = 0; @@ -87,16 +87,16 @@ function players.new(id, name, master_rank, hunter_rank, type) player.display.elemental_damage = 0; player.display.ailment_damage = 0; - players.init_UI(player); + this.init_UI(player); - if players.highlighted_damage_UI == nil then - players.init_highlighted_UI(); + if this.highlighted_damage_UI == nil then + this.init_highlighted_UI(); end return player; end -function players.init_damage_sources() +function this.init_damage_sources() local monster_type = {}; monster_type.total_damage = 0; @@ -174,15 +174,15 @@ function players.init_damage_sources() return monster_type; end -function players.get_player(player_id) +function this.get_player(player_id) if player_id == non_players.my_second_otomo_id then - return players.myself; + return this.myself; end - return players.list[player_id]; + return this.list[player_id]; end -function players.update_damage(player, damage_source_type, is_large_monster, damage_object) +function this.update_damage(player, damage_source_type, is_large_monster, damage_object) if player == nil then return; end @@ -197,37 +197,37 @@ function players.update_damage(player, damage_source_type, is_large_monster, dam end if damage_source_type == "player" then - players.merge_damage(player_monster_type, damage_object); + this.merge_damage(player_monster_type, damage_object); elseif damage_source_type == "bomb" then - players.merge_damage(player_monster_type.bombs, damage_object); + this.merge_damage(player_monster_type.bombs, damage_object); elseif damage_source_type == "kunai" then - players.merge_damage(player_monster_type.kunai, damage_object); + this.merge_damage(player_monster_type.kunai, damage_object); elseif damage_source_type == "installation" then - players.merge_damage(player_monster_type.installations, damage_object); + this.merge_damage(player_monster_type.installations, damage_object); elseif damage_source_type == "otomo" then - players.merge_damage(player_monster_type.otomo, damage_object); + this.merge_damage(player_monster_type.otomo, damage_object); elseif damage_source_type == "wyvern riding" then - players.merge_damage(player_monster_type.wyvern_riding, damage_object); + this.merge_damage(player_monster_type.wyvern_riding, damage_object); elseif damage_source_type == "poison" then - players.merge_damage(player_monster_type.poison, damage_object); + this.merge_damage(player_monster_type.poison, damage_object); elseif damage_source_type == "blast" then - players.merge_damage(player_monster_type.blast, damage_object); + this.merge_damage(player_monster_type.blast, damage_object); elseif damage_source_type == "otomo poison" then - players.merge_damage(player_monster_type.otomo_poison, damage_object); + this.merge_damage(player_monster_type.otomo_poison, damage_object); elseif damage_source_type == "otomo blast" then - players.merge_damage(player_monster_type.otomo_blast, damage_object); + this.merge_damage(player_monster_type.otomo_blast, damage_object); elseif damage_source_type == "endemic life" then - players.merge_damage(player_monster_type.endemic_life, damage_object); + this.merge_damage(player_monster_type.endemic_life, damage_object); elseif damage_source_type == "other" then - players.merge_damage(player_monster_type.other, damage_object); + this.merge_damage(player_monster_type.other, damage_object); else - players.merge_damage(player_monster_type, damage_object); + this.merge_damage(player_monster_type, damage_object); end - players.update_display(player); + this.update_display(player); end -function players.update_display(player) +function this.update_display(player) if player == nil then return; end @@ -251,152 +251,152 @@ function players.update_display(player) for _, monster_type in ipairs(monster_types) do if cached_config.tracked_damage_types.player_damage then - players.merge_damage(player.display, monster_type); + this.merge_damage(player.display, monster_type); end if cached_config.tracked_damage_types.bomb_damage then - players.merge_damage(player.display, monster_type.bombs); + this.merge_damage(player.display, monster_type.bombs); end if cached_config.tracked_damage_types.kunai_damage then - players.merge_damage(player.display, monster_type.kunai); + this.merge_damage(player.display, monster_type.kunai); end if cached_config.tracked_damage_types.installation_damage then - players.merge_damage(player.display, monster_type.installations); + this.merge_damage(player.display, monster_type.installations); end if cached_config.tracked_damage_types.otomo_damage then - if player.type == players.types.myself then + if player.type == this.types.myself then if not cached_config.settings.show_my_otomos_separately then - players.merge_damage(player.display, monster_type.otomo); + this.merge_damage(player.display, monster_type.otomo); end - elseif player.type == players.types.other_player then + elseif player.type == this.types.other_player then if not cached_config.settings.show_other_player_otomos_separately then - players.merge_damage(player.display, monster_type.otomo); + this.merge_damage(player.display, monster_type.otomo); end - elseif player.type == players.types.servant then + elseif player.type == this.types.servant then if not cached_config.settings.show_servant_otomos_separately then - players.merge_damage(player.display, monster_type.otomo); + this.merge_damage(player.display, monster_type.otomo); end - elseif player.type == players.types.my_otomo then + elseif player.type == this.types.my_otomo then if cached_config.settings.show_my_otomos_separately then - players.merge_damage(player.display, monster_type.otomo); + this.merge_damage(player.display, monster_type.otomo); end - elseif player.type == players.types.other_player_otomo then + elseif player.type == this.types.other_player_otomo then if cached_config.settings.show_other_player_otomos_separately then - players.merge_damage(player.display, monster_type.otomo); + this.merge_damage(player.display, monster_type.otomo); end - elseif player.type == players.types.servant_otomo then + elseif player.type == this.types.servant_otomo then if cached_config.settings.show_servant_otomos_separately then - players.merge_damage(player.display, monster_type.otomo); + this.merge_damage(player.display, monster_type.otomo); end - elseif player.type == players.types.total then + elseif player.type == this.types.total then - players.merge_damage(player.display, monster_type.otomo); + this.merge_damage(player.display, monster_type.otomo); end end if cached_config.tracked_damage_types.wyvern_riding_damage then - players.merge_damage(player.display, monster_type.wyvern_riding); + this.merge_damage(player.display, monster_type.wyvern_riding); end if cached_config.tracked_damage_types.poison_damage then - players.merge_damage(player.display, monster_type.poison); + this.merge_damage(player.display, monster_type.poison); - if player.type == players.types.myself then + if player.type == this.types.myself then if not cached_config.settings.show_my_otomos_separately then - players.merge_damage(player.display, monster_type.otomo_poison); + this.merge_damage(player.display, monster_type.otomo_poison); end - elseif player.type == players.types.other_player then + elseif player.type == this.types.other_player then if not cached_config.settings.show_other_player_otomos_separately then - players.merge_damage(player.display, monster_type.otomo_poison); + this.merge_damage(player.display, monster_type.otomo_poison); end - elseif player.type == players.types.servant then + elseif player.type == this.types.servant then if not cached_config.settings.show_servant_otomos_separately then - players.merge_damage(player.display, monster_type.otomo_poison); + this.merge_damage(player.display, monster_type.otomo_poison); end - elseif player.type == players.types.my_otomo then + elseif player.type == this.types.my_otomo then if cached_config.settings.show_my_otomos_separately then - players.merge_damage(player.display, monster_type.otomo_poison); + this.merge_damage(player.display, monster_type.otomo_poison); end - elseif player.type == players.types.other_player_otomo then + elseif player.type == this.types.other_player_otomo then if cached_config.settings.show_other_player_otomos_separately then - players.merge_damage(player.display, monster_type.otomo_poison); + this.merge_damage(player.display, monster_type.otomo_poison); end - elseif player.type == players.types.servant_otomo then + elseif player.type == this.types.servant_otomo then if cached_config.settings.show_servant_otomos_separately then - players.merge_damage(player.display, monster_type.otomo_poison); + this.merge_damage(player.display, monster_type.otomo_poison); end - elseif player.type == players.types.total then + elseif player.type == this.types.total then - players.merge_damage(player.display, monster_type.otomo_poison); + this.merge_damage(player.display, monster_type.otomo_poison); end end if cached_config.tracked_damage_types.blast_damage then - players.merge_damage(player.display, monster_type.blast); + this.merge_damage(player.display, monster_type.blast); - if player.type == players.types.myself then + if player.type == this.types.myself then if not cached_config.settings.show_my_otomos_separately then - players.merge_damage(player.display, monster_type.otomo_blast); + this.merge_damage(player.display, monster_type.otomo_blast); end - elseif player.type == players.types.other_player then + elseif player.type == this.types.other_player then if not cached_config.settings.show_other_player_otomos_separately then - players.merge_damage(player.display, monster_type.otomo_blast); + this.merge_damage(player.display, monster_type.otomo_blast); end - elseif player.type == players.types.servant then + elseif player.type == this.types.servant then if not cached_config.settings.show_servant_otomos_separately then - players.merge_damage(player.display, monster_type.otomo_blast); + this.merge_damage(player.display, monster_type.otomo_blast); end - elseif player.type == players.types.my_otomo then + elseif player.type == this.types.my_otomo then if cached_config.settings.show_my_otomos_separately then - players.merge_damage(player.display, monster_type.otomo_blast); + this.merge_damage(player.display, monster_type.otomo_blast); end - elseif player.type == players.types.other_player_otomo then + elseif player.type == this.types.other_player_otomo then if cached_config.settings.show_other_player_otomos_separately then - players.merge_damage(player.display, monster_type.otomo_blast); + this.merge_damage(player.display, monster_type.otomo_blast); end - elseif player.type == players.types.servant_otomo then + elseif player.type == this.types.servant_otomo then if cached_config.settings.show_servant_otomos_separately then - players.merge_damage(player.display, monster_type.otomo_blast); + this.merge_damage(player.display, monster_type.otomo_blast); end - elseif player.type == players.types.total then + elseif player.type == this.types.total then - players.merge_damage(player.display, monster_type.otomo_blast); + this.merge_damage(player.display, monster_type.otomo_blast); end end if cached_config.tracked_damage_types.endemic_life_damage then - players.merge_damage(player.display, monster_type.endemic_life); + this.merge_damage(player.display, monster_type.endemic_life); end if cached_config.tracked_damage_types.other_damage then - players.merge_damage(player.display, monster_type.other); + this.merge_damage(player.display, monster_type.other); end end end -function players.merge_damage(first, second) +function this.merge_damage(first, second) first.total_damage = first.total_damage + second.total_damage; first.physical_damage = first.physical_damage + second.physical_damage; first.elemental_damage = first.elemental_damage + second.elemental_damage; @@ -405,28 +405,28 @@ function players.merge_damage(first, second) return first; end -function players.update_dps(bypass_freeze) +function this.update_dps(bypass_freeze) local cached_config = config.current_config.damage_meter_UI.settings; if cached_config.freeze_dps_on_quest_end and quest_status.flow_state >= quest_status.flow_states.KILLCAM and not bypass_freeze then return; end - players.total.dps = 0; - for _, player in pairs(players.list) do - players.update_player_dps(player); + this.total.dps = 0; + for _, player in pairs(this.list) do + this.update_player_dps(player); end for _, servant in pairs(non_players.servant_list) do - players.update_player_dps(servant); + this.update_player_dps(servant); end for _, otomo in pairs(non_players.otomo_list) do - players.update_player_dps(otomo); + this.update_player_dps(otomo); end end -function players.update_player_dps(player) +function this.update_player_dps(player) local cached_config = config.current_config.damage_meter_UI.settings; if player.join_time == -1 then @@ -447,54 +447,54 @@ function players.update_player_dps(player) end end - players.total.dps = players.total.dps + player.dps; + this.total.dps = this.total.dps + player.dps; end -function players.sort_players() +function this.sort_players() local cached_config = config.current_config.damage_meter_UI; if cached_config.settings.my_damage_bar_location == "Normal" then - table.insert(players.display_list, players.myself); + table.insert(this.display_list, this.myself); end -- sort here if cached_config.sorting.type == "Normal" then if cached_config.sorting.reversed_order then - table.sort(players.display_list, function(left, right) + table.sort(this.display_list, function(left, right) return left.id > right.id; end); else - table.sort(players.display_list, function(left, right) + table.sort(this.display_list, function(left, right) return left.id < right.id; end); end elseif cached_config.sorting.type == "DPS" then if cached_config.sorting.reversed_order then - table.sort(players.display_list, function(left, right) + table.sort(this.display_list, function(left, right) return left.dps < right.dps; end); else - table.sort(players.display_list, function(left, right) + table.sort(this.display_list, function(left, right) return left.dps > right.dps; end); end else if cached_config.sorting.reversed_order then - table.sort(players.display_list, function(left, right) + table.sort(this.display_list, function(left, right) return left.display.total_damage < right.display.total_damage; end); else - table.sort(players.display_list, function(left, right) + table.sort(this.display_list, function(left, right) return left.display.total_damage > right.display.total_damage; end); end end if cached_config.settings.my_damage_bar_location == "First" then - table.insert(players.display_list, 1, players.myself); + table.insert(this.display_list, 1, this.myself); elseif cached_config.settings.my_damage_bar_location == "Last" then - table.insert(players.display_list, players.myself); + table.insert(this.display_list, this.myself); end end @@ -504,7 +504,7 @@ local find_master_player_method = player_manager_type_def:get_method("findMaster local player_base_type_def = sdk.find_type_definition("snow.player.PlayerBase"); local get_pos_field = player_base_type_def:get_method("get_Pos"); -function players.update_myself_position() +function this.update_myself_position() if singletons.player_manager == nil then customization_menu.status = "No player manager"; return; @@ -518,15 +518,15 @@ function players.update_myself_position() local position = get_pos_field:call(master_player); if position ~= nil then - players.myself_position = position; + this.myself_position = position; end end -function players.init() - players.list = {}; - players.display_list = {}; - players.total = players.new(0, "Total", 0, 0, players.types.total); - players.myself = players.new(-1, "DummyMHROverlay", -1, -1, players.types.myself); +function this.init() + this.list = {}; + this.display_list = {}; + this.total = this.new(0, "Total", 0, 0, this.types.total); + this.myself = this.new(-1, "DummyMHROverlay", -1, -1, this.types.myself); end local lobby_manager_type_def = sdk.find_type_definition("snow.LobbyManager"); @@ -556,15 +556,15 @@ local get_master_rank_method = progress_manager_type_def:get_method("get_MasterR local get_master_player_id_method = player_manager_type_def:get_method("getMasterPlayerID"); -function players.update_player_list(is_on_quest) +function this.update_player_list(is_on_quest) if is_on_quest then - players.update_player_list_(quest_hunter_info_field); + this.update_player_list_(quest_hunter_info_field); else - players.update_player_list_(hunter_info_field); + this.update_player_list_(hunter_info_field); end end -function players.update_player_list_(hunter_info_field_) +function this.update_player_list_(hunter_info_field_) local cached_config = config.current_config.damage_meter_UI; if singletons.lobby_manager == nil then @@ -598,10 +598,10 @@ function players.update_player_list_(hunter_info_field_) return; end - if players.myself == nil or myself_id ~= players.myself.id then - players.list[players.myself.id] = nil; - players.myself = players.new(myself_id, myself_player_name, myself_master_rank, myself_hunter_rank, players.types.myself); - players.list[myself_id] = players.myself; + if this.myself == nil or myself_id ~= this.myself.id then + this.list[this.myself.id] = nil; + this.myself = this.new(myself_id, myself_player_name, myself_master_rank, myself_hunter_rank, this.types.myself); + this.list[myself_id] = this.myself; end -- other players @@ -637,62 +637,62 @@ function players.update_player_list_(hunter_info_field_) goto continue end - local player = players.list[id]; + local player = this.list[id]; if player == nil then - if name == players.myself.name then - player = players.new(id, name, master_rank, hunter_rank, players.types.myself); - players.myself = player; - players.list[id] = player; + if name == this.myself.name then + player = this.new(id, name, master_rank, hunter_rank, this.types.myself); + this.myself = player; + this.list[id] = player; else - player = players.new(id, name, master_rank, hunter_rank, players.types.other_player); - players.list[id] = player; + player = this.new(id, name, master_rank, hunter_rank, this.types.other_player); + this.list[id] = player; end elseif player.name ~= name or player.hunter_rank ~= hunter_rank or player.master_rank ~= master_rank then - if name == players.myself.name then - player = players.new(id, name, master_rank, hunter_rank, players.types.myself); - players.myself = player; - players.list[id] = player; + if name == this.myself.name then + player = this.new(id, name, master_rank, hunter_rank, this.types.myself); + this.myself = player; + this.list[id] = player; else - player = players.new(id, name, master_rank, hunter_rank, players.types.other_player); - players.list[id] = player; + player = this.new(id, name, master_rank, hunter_rank, this.types.other_player); + this.list[id] = player; end end - if player ~= players.myself then - table.insert(players.display_list, player); + if player ~= this.myself then + table.insert(this.display_list, player); end ::continue:: end end -function players.init_UI(player) +function this.init_UI(player) local cached_config = config.current_config.damage_meter_UI; - if player.type == players.types.myself then + if player.type == this.types.myself then player.damage_UI = damage_UI_entity.new(cached_config.myself, player.type); - elseif player.type == players.types.other_player then + elseif player.type == this.types.other_player then player.damage_UI = damage_UI_entity.new(cached_config.other_players, player.type); - elseif player.type == players.types.total then + elseif player.type == this.types.total then player.damage_UI = damage_UI_entity.new(cached_config.total, player.type); end end -function players.init_highlighted_UI() +function this.init_highlighted_UI() local cached_config = config.current_config.damage_meter_UI; - players.highlighted_damage_UI = damage_UI_entity.new(cached_config.highlighted, players.types.highlight); + this.highlighted_damage_UI = damage_UI_entity.new(cached_config.highlighted, this.types.highlight); end -function players.draw(player, position_on_screen, opacity_scale, top_damage, top_dps) +function this.draw(player, position_on_screen, opacity_scale, top_damage, top_dps) damage_UI_entity.draw(player, position_on_screen, opacity_scale, top_damage, top_dps); end -function players.init_module() +function this.init_module() config = require("MHR_Overlay.Misc.config"); singletons = require("MHR_Overlay.Game_Handler.singletons"); customization_menu = require("MHR_Overlay.UI.customization_menu"); @@ -703,7 +703,7 @@ function players.init_module() language = require("MHR_Overlay.Misc.language"); non_players = require("MHR_Overlay.Damage_Meter.non_players"); - players.init(); + this.init(); end -return players; +return this; diff --git a/reframework/autorun/MHR_Overlay/Endemic_Life/env_creature.lua b/reframework/autorun/MHR_Overlay/Endemic_Life/env_creature.lua index bd9daa4..ff74c46 100644 --- a/reframework/autorun/MHR_Overlay/Endemic_Life/env_creature.lua +++ b/reframework/autorun/MHR_Overlay/Endemic_Life/env_creature.lua @@ -1,4 +1,4 @@ -local env_creature = {}; +local this = {}; local drawing; local customization_menu; @@ -38,9 +38,9 @@ local os = os; local ValueType = ValueType; local package = package; -env_creature.list = {}; +this.list = {}; -function env_creature.new(REcreature) +function this.new(REcreature) local creature = {}; creature.life = 0; @@ -50,22 +50,22 @@ function env_creature.new(REcreature) creature.position = Vector3f.new(0, 0, 0); creature.distance = 0; - env_creature.init(creature, REcreature); - env_creature.init_UI(creature); + this.init(creature, REcreature); + this.init_UI(creature); - if env_creature.list[REcreature] == nil then - env_creature.list[REcreature] = creature; + if this.list[REcreature] == nil then + this.list[REcreature] = creature; end return creature; end -function env_creature.get_creature(REcreature) - if env_creature.list[REcreature] == nil then - env_creature.list[REcreature] = env_creature.new(REcreature); +function this.get_creature(REcreature) + if this.list[REcreature] == nil then + this.list[REcreature] = this.new(REcreature); end - return env_creature.list[REcreature]; + return this.list[REcreature]; end local environment_creature_base_type_def = sdk.find_type_definition("snow.envCreature.EnvironmentCreatureBase"); @@ -77,7 +77,7 @@ local get_env_creature_name_message_method = message_manager_type_def:get_method local get_pos_method = environment_creature_base_type_def:get_method("get_Pos"); -function env_creature.init(creature, REcreature) +function this.init(creature, REcreature) local creature_type = creature_type_field:get_data(REcreature); if creature_type == nil then customization_menu.status = "No env creature type"; @@ -91,7 +91,7 @@ function env_creature.init(creature, REcreature) end end -function env_creature.init_UI(creature) +function this.init_UI(creature) 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; @@ -100,13 +100,13 @@ function env_creature.init_UI(creature) creature.name_label.offset.y = creature.name_label.offset.y * global_scale_modifier; end -function env_creature.update_position(REcreature, creature) +function this.update_position(REcreature, creature) if not config.current_config.endemic_life_UI.enabled then return; end if creature == nil then - creature = env_creature.get_creature(REcreature); + creature = this.get_creature(REcreature); end local position = get_pos_method:call(REcreature); @@ -115,13 +115,13 @@ function env_creature.update_position(REcreature, creature) end end -function env_creature.update(REcreature, creature) +function this.update(REcreature, creature) if not config.current_config.endemic_life_UI.enabled then return; end if creature == nil then - creature = env_creature.get_creature(REcreature); + creature = this.get_creature(REcreature); end local is_inactive = creature_is_inactive_field:get_data(REcreature); @@ -130,7 +130,7 @@ function env_creature.update(REcreature, creature) end end -function env_creature.draw(creature, position_on_screen, opacity_scale) +function this.draw(creature, position_on_screen, opacity_scale) if d2d ~= nil and config.current_config.global_settings.renderer.use_d2d_if_available then local text_width, text_height = drawing.font:measure(creature.name); position_on_screen.x = position_on_screen.x - text_width / 2; @@ -139,11 +139,11 @@ function env_creature.draw(creature, position_on_screen, opacity_scale) drawing.draw_label(creature.name_label, position_on_screen, opacity_scale, creature.name); end -function env_creature.init_list() - env_creature.list = {}; +function this.init_list() + this.list = {}; end -function env_creature.init_module() +function this.init_module() singletons = require("MHR_Overlay.Game_Handler.singletons"); customization_menu = require("MHR_Overlay.UI.customization_menu"); config = require("MHR_Overlay.Misc.config"); @@ -156,4 +156,4 @@ function env_creature.init_module() --ailment_UI_entity = require("MHR_Overlay.UI.UI_Entities.ailment_UI_entity"); end -return env_creature; +return this; diff --git a/reframework/autorun/MHR_Overlay/Endemic_Life/env_creature_hook.lua b/reframework/autorun/MHR_Overlay/Endemic_Life/env_creature_hook.lua index b38c6f5..b471e89 100644 --- a/reframework/autorun/MHR_Overlay/Endemic_Life/env_creature_hook.lua +++ b/reframework/autorun/MHR_Overlay/Endemic_Life/env_creature_hook.lua @@ -1,4 +1,4 @@ -local env_creature_hook = {}; +local this = {}; local env_creature; local config; @@ -39,22 +39,22 @@ local package = package; local environment_creature_base_type_def = sdk.find_type_definition("snow.envCreature.EnvironmentCreatureBase"); local update_method = environment_creature_base_type_def:get_method("update"); -function env_creature_hook.update(REcreature) +function this.update(REcreature) local creature = env_creature.get_creature(REcreature); env_creature.update(REcreature, creature); env_creature.update_position(REcreature, creature); end -function env_creature_hook.init_module() +function this.init_module() config = require("MHR_Overlay.Misc.config"); env_creature = require("MHR_Overlay.Endemic_Life.env_creature"); time = require("MHR_Overlay.Game_Handler.time"); sdk.hook(update_method, function(args) - pcall(env_creature_hook.update, sdk.to_managed_object(args[2])); + pcall(this.update, sdk.to_managed_object(args[2])); end, function(retval) return retval; end); end -return env_creature_hook; +return this; diff --git a/reframework/autorun/MHR_Overlay/Game_Handler/keyboard.lua b/reframework/autorun/MHR_Overlay/Game_Handler/keyboard.lua index eaee324..10299d7 100644 --- a/reframework/autorun/MHR_Overlay/Game_Handler/keyboard.lua +++ b/reframework/autorun/MHR_Overlay/Game_Handler/keyboard.lua @@ -1,4 +1,4 @@ -local keyboard = {}; +local this = {}; local config; local singletons; @@ -49,13 +49,13 @@ local get_down_method = hard_keyboard_field_type_def:get_method("getDown"); local get_trigger_method = hard_keyboard_field_type_def:get_method("getTrg"); local get_release_method = hard_keyboard_field_type_def:get_method("getRelease"); -keyboard.hotkey_modifiers_down = { +this.hotkey_modifiers_down = { ctrl = false, shift = false, alt = false }; -keyboard.keys = { +this.keys = { [0] = "None", [1] = "Left Mouse Button", [2] = "Right Mouse Button", @@ -334,7 +334,7 @@ keyboard.keys = { }; -function keyboard.update() +function this.update() if singletons.game_keyboard == nil then customization_menu.status = "No game keyboard"; return; @@ -346,137 +346,137 @@ function keyboard.update() return; end - keyboard.check_modifiers(hard_keyboard); + this.check_modifiers(hard_keyboard); - local new_hotkey_registered = keyboard.register_hotkey(hard_keyboard); + local new_hotkey_registered = this.register_hotkey(hard_keyboard); if new_hotkey_registered then config.save(); else - keyboard.check_hotkeys(hard_keyboard); + this.check_hotkeys(hard_keyboard); end - keyboard.hotkey_modifiers_down.ctrl = false; - keyboard.hotkey_modifiers_down.shift = false; - keyboard.hotkey_modifiers_down.alt = false + this.hotkey_modifiers_down.ctrl = false; + this.hotkey_modifiers_down.shift = false; + this.hotkey_modifiers_down.alt = false end -function keyboard.check_modifiers(hard_keyboard) +function this.check_modifiers(hard_keyboard) local is_ctrl_down = get_down_method:call(hard_keyboard, 17); if is_ctrl_down ~= nil then - keyboard.hotkey_modifiers_down.ctrl = is_ctrl_down; + this.hotkey_modifiers_down.ctrl = is_ctrl_down; end local is_shift_down = get_down_method:call(hard_keyboard, 16); if is_shift_down ~= nil then - keyboard.hotkey_modifiers_down.shift = is_shift_down; + this.hotkey_modifiers_down.shift = is_shift_down; end local is_alt_down = get_down_method:call(hard_keyboard, 18); if is_alt_down ~= nil then - keyboard.hotkey_modifiers_down.alt = is_alt_down; + this.hotkey_modifiers_down.alt = is_alt_down; end end -function keyboard.register_hotkey(hard_keyboard) +function this.register_hotkey(hard_keyboard) local cached_config = config.current_config.global_settings.hotkeys_with_modifiers; if customization_menu.all_UI_waiting_for_key then - for key, key_name in pairs(keyboard.keys) do + for key, key_name in pairs(this.keys) do if get_release_method:call(hard_keyboard, key) then - cached_config.all_UI.ctrl = keyboard.hotkey_modifiers_down.ctrl; - cached_config.all_UI.shift = keyboard.hotkey_modifiers_down.shift; - cached_config.all_UI.alt = keyboard.hotkey_modifiers_down.alt; + cached_config.all_UI.ctrl = this.hotkey_modifiers_down.ctrl; + cached_config.all_UI.shift = this.hotkey_modifiers_down.shift; + cached_config.all_UI.alt = this.hotkey_modifiers_down.alt; cached_config.all_UI.key = key; customization_menu.all_UI_waiting_for_key = false; return true; end end elseif customization_menu.small_monster_UI_waiting_for_key then - for key, key_name in pairs(keyboard.keys) do + for key, key_name in pairs(this.keys) do if get_release_method:call(hard_keyboard, key) then - cached_config.small_monster_UI.ctrl = keyboard.hotkey_modifiers_down.ctrl; - cached_config.small_monster_UI.shift = keyboard.hotkey_modifiers_down.shift; - cached_config.small_monster_UI.alt = keyboard.hotkey_modifiers_down.alt; + cached_config.small_monster_UI.ctrl = this.hotkey_modifiers_down.ctrl; + cached_config.small_monster_UI.shift = this.hotkey_modifiers_down.shift; + cached_config.small_monster_UI.alt = this.hotkey_modifiers_down.alt; cached_config.small_monster_UI.key = key; customization_menu.small_monster_UI_waiting_for_key = false; return true; end end elseif customization_menu.large_monster_UI_waiting_for_key then - for key, key_name in pairs(keyboard.keys) do + for key, key_name in pairs(this.keys) do if get_release_method:call(hard_keyboard, key) then - cached_config.large_monster_UI.ctrl = keyboard.hotkey_modifiers_down.ctrl; - cached_config.large_monster_UI.shift = keyboard.hotkey_modifiers_down.shift; - cached_config.large_monster_UI.alt = keyboard.hotkey_modifiers_down.alt; + cached_config.large_monster_UI.ctrl = this.hotkey_modifiers_down.ctrl; + cached_config.large_monster_UI.shift = this.hotkey_modifiers_down.shift; + cached_config.large_monster_UI.alt = this.hotkey_modifiers_down.alt; cached_config.large_monster_UI.key = key; customization_menu.large_monster_UI_waiting_for_key = false; return true; end end elseif customization_menu.large_monster_dynamic_UI_waiting_for_key then - for key, key_name in pairs(keyboard.keys) do + for key, key_name in pairs(this.keys) do if get_release_method:call(hard_keyboard, key) then - cached_config.large_monster_dynamic_UI.ctrl = keyboard.hotkey_modifiers_down.ctrl; - cached_config.large_monster_dynamic_UI.shift = keyboard.hotkey_modifiers_down.shift; - cached_config.large_monster_dynamic_UI.alt = keyboard.hotkey_modifiers_down.alt; + cached_config.large_monster_dynamic_UI.ctrl = this.hotkey_modifiers_down.ctrl; + cached_config.large_monster_dynamic_UI.shift = this.hotkey_modifiers_down.shift; + cached_config.large_monster_dynamic_UI.alt = this.hotkey_modifiers_down.alt; cached_config.large_monster_dynamic_UI.key = key; customization_menu.large_monster_dynamic_UI_waiting_for_key = false; return true; end end elseif customization_menu.large_monster_static_UI_waiting_for_key then - for key, key_name in pairs(keyboard.keys) do + for key, key_name in pairs(this.keys) do if get_release_method:call(hard_keyboard, key) then - cached_config.large_monster_static_UI.ctrl = keyboard.hotkey_modifiers_down.ctrl; - cached_config.large_monster_static_UI.shift = keyboard.hotkey_modifiers_down.shift; - cached_config.large_monster_static_UI.alt = keyboard.hotkey_modifiers_down.alt; + cached_config.large_monster_static_UI.ctrl = this.hotkey_modifiers_down.ctrl; + cached_config.large_monster_static_UI.shift = this.hotkey_modifiers_down.shift; + cached_config.large_monster_static_UI.alt = this.hotkey_modifiers_down.alt; cached_config.large_monster_static_UI.key = key; customization_menu.large_monster_static_UI_waiting_for_key = false; return true; end end elseif customization_menu.large_monster_highlighted_UI_waiting_for_key then - for key, key_name in pairs(keyboard.keys) do + for key, key_name in pairs(this.keys) do if get_release_method:call(hard_keyboard, key) then - cached_config.large_monster_highlighted_UI.ctrl = keyboard.hotkey_modifiers_down.ctrl; - cached_config.large_monster_highlighted_UI.shift = keyboard.hotkey_modifiers_down.shift; - cached_config.large_monster_highlighted_UI.alt = keyboard.hotkey_modifiers_down.alt; + cached_config.large_monster_highlighted_UI.ctrl = this.hotkey_modifiers_down.ctrl; + cached_config.large_monster_highlighted_UI.shift = this.hotkey_modifiers_down.shift; + cached_config.large_monster_highlighted_UI.alt = this.hotkey_modifiers_down.alt; cached_config.large_monster_highlighted_UI.key = key; customization_menu.large_monster_highlighted_UI_waiting_for_key = false; return true; end end elseif customization_menu.time_UI_waiting_for_key then - for key, key_name in pairs(keyboard.keys) do + for key, key_name in pairs(this.keys) do if get_release_method:call(hard_keyboard, key) then - cached_config.time_UI.ctrl = keyboard.hotkey_modifiers_down.ctrl; - cached_config.time_UI.shift = keyboard.hotkey_modifiers_down.shift; - cached_config.time_UI.alt = keyboard.hotkey_modifiers_down.alt; + cached_config.time_UI.ctrl = this.hotkey_modifiers_down.ctrl; + cached_config.time_UI.shift = this.hotkey_modifiers_down.shift; + cached_config.time_UI.alt = this.hotkey_modifiers_down.alt; cached_config.time_UI.key = key; customization_menu.time_UI_waiting_for_key = false; return true; end end elseif customization_menu.damage_meter_UI_waiting_for_key then - for key, key_name in pairs(keyboard.keys) do + for key, key_name in pairs(this.keys) do if get_release_method:call(hard_keyboard, key) then - cached_config.damage_meter_UI.ctrl = keyboard.hotkey_modifiers_down.ctrl; - cached_config.damage_meter_UI.shift = keyboard.hotkey_modifiers_down.shift; - cached_config.damage_meter_UI.alt = keyboard.hotkey_modifiers_down.alt; + cached_config.damage_meter_UI.ctrl = this.hotkey_modifiers_down.ctrl; + cached_config.damage_meter_UI.shift = this.hotkey_modifiers_down.shift; + cached_config.damage_meter_UI.alt = this.hotkey_modifiers_down.alt; cached_config.damage_meter_UI.key = key; customization_menu.damage_meter_UI_waiting_for_key = false; return true; end end elseif customization_menu.endemic_life_UI_waiting_for_key then - for key, key_name in pairs(keyboard.keys) do + for key, key_name in pairs(this.keys) do if get_release_method:call(hard_keyboard, key) then - cached_config.endemic_life_UI.ctrl = keyboard.hotkey_modifiers_down.ctrl; - cached_config.endemic_life_UI.shift = keyboard.hotkey_modifiers_down.shift; - cached_config.endemic_life_UI.alt = keyboard.hotkey_modifiers_down.alt; + cached_config.endemic_life_UI.ctrl = this.hotkey_modifiers_down.ctrl; + cached_config.endemic_life_UI.shift = this.hotkey_modifiers_down.shift; + cached_config.endemic_life_UI.alt = this.hotkey_modifiers_down.alt; cached_config.endemic_life_UI.key = key; customization_menu.endemic_life_UI_waiting_for_key = false; return true; @@ -487,12 +487,12 @@ function keyboard.register_hotkey(hard_keyboard) return false; end -function keyboard.check_hotkeys(hard_keyboard) +function this.check_hotkeys(hard_keyboard) local cached_config = config.current_config.global_settings.hotkeys_with_modifiers; - if not (cached_config.all_UI.ctrl and not keyboard.hotkey_modifiers_down.ctrl) - and not (cached_config.all_UI.shift and not keyboard.hotkey_modifiers_down.shift) - and not (cached_config.all_UI.alt and not keyboard.hotkey_modifiers_down.alt) then + if not (cached_config.all_UI.ctrl and not this.hotkey_modifiers_down.ctrl) + and not (cached_config.all_UI.shift and not this.hotkey_modifiers_down.shift) + and not (cached_config.all_UI.alt and not this.hotkey_modifiers_down.alt) then if get_release_method:call(hard_keyboard, math.tointeger(cached_config.all_UI.key)) then local is_any_enabled = config.current_config.time_UI.enabled @@ -511,17 +511,17 @@ function keyboard.check_hotkeys(hard_keyboard) end end - if not (cached_config.small_monster_UI.ctrl and not keyboard.hotkey_modifiers_down.ctrl) - and not (cached_config.small_monster_UI.shift and not keyboard.hotkey_modifiers_down.shift) - and not (cached_config.small_monster_UI.alt and not keyboard.hotkey_modifiers_down.alt) then + if not (cached_config.small_monster_UI.ctrl and not this.hotkey_modifiers_down.ctrl) + and not (cached_config.small_monster_UI.shift and not this.hotkey_modifiers_down.shift) + and not (cached_config.small_monster_UI.alt and not this.hotkey_modifiers_down.alt) then if get_release_method:call(hard_keyboard, math.tointeger(cached_config.small_monster_UI.key)) then config.current_config.small_monster_UI.enabled = not config.current_config.small_monster_UI.enabled; end end - if not (cached_config.large_monster_UI.ctrl and not keyboard.hotkey_modifiers_down.ctrl) - and not (cached_config.large_monster_UI.shift and not keyboard.hotkey_modifiers_down.shift) - and not (cached_config.large_monster_UI.alt and not keyboard.hotkey_modifiers_down.alt) then + if not (cached_config.large_monster_UI.ctrl and not this.hotkey_modifiers_down.ctrl) + and not (cached_config.large_monster_UI.shift and not this.hotkey_modifiers_down.shift) + and not (cached_config.large_monster_UI.alt and not this.hotkey_modifiers_down.alt) then if get_release_method:call(hard_keyboard, math.tointeger(cached_config.large_monster_UI.key)) then local is_any_enabled = config.current_config.large_monster_UI.dynamic.enabled or config.current_config.large_monster_UI.static.enabled @@ -533,27 +533,27 @@ function keyboard.check_hotkeys(hard_keyboard) end end - if not (cached_config.large_monster_dynamic_UI.ctrl and not keyboard.hotkey_modifiers_down.ctrl) - and not (cached_config.large_monster_dynamic_UI.shift and not keyboard.hotkey_modifiers_down.shift) - and not (cached_config.large_monster_dynamic_UI.alt and not keyboard.hotkey_modifiers_down.alt) then + if not (cached_config.large_monster_dynamic_UI.ctrl and not this.hotkey_modifiers_down.ctrl) + and not (cached_config.large_monster_dynamic_UI.shift and not this.hotkey_modifiers_down.shift) + and not (cached_config.large_monster_dynamic_UI.alt and not this.hotkey_modifiers_down.alt) then if get_release_method:call(hard_keyboard, math.tointeger(cached_config.large_monster_dynamic_UI.key)) then config.current_config.large_monster_UI.dynamic.enabled = not config.current_config.large_monster_UI.dynamic.enabled; end end - if not (cached_config.large_monster_static_UI.ctrl and not keyboard.hotkey_modifiers_down.ctrl) - and not (cached_config.large_monster_static_UI.shift and not keyboard.hotkey_modifiers_down.shift) - and not (cached_config.large_monster_static_UI.alt and not keyboard.hotkey_modifiers_down.alt) then + if not (cached_config.large_monster_static_UI.ctrl and not this.hotkey_modifiers_down.ctrl) + and not (cached_config.large_monster_static_UI.shift and not this.hotkey_modifiers_down.shift) + and not (cached_config.large_monster_static_UI.alt and not this.hotkey_modifiers_down.alt) then if get_release_method:call(hard_keyboard, math.tointeger(cached_config.large_monster_static_UI.key)) then config.current_config.large_monster_UI.static.enabled = not config.current_config.large_monster_UI.static.enabled; end end - if not (cached_config.large_monster_highlighted_UI.ctrl and not keyboard.hotkey_modifiers_down.ctrl) - and not (cached_config.large_monster_highlighted_UI.shift and not keyboard.hotkey_modifiers_down.shift) - and not (cached_config.large_monster_highlighted_UI.alt and not keyboard.hotkey_modifiers_down.alt) then + if not (cached_config.large_monster_highlighted_UI.ctrl and not this.hotkey_modifiers_down.ctrl) + and not (cached_config.large_monster_highlighted_UI.shift and not this.hotkey_modifiers_down.shift) + and not (cached_config.large_monster_highlighted_UI.alt and not this.hotkey_modifiers_down.alt) then if get_release_method:call(hard_keyboard, math.tointeger(cached_config.large_monster_highlighted_UI.key)) then config.current_config.large_monster_UI.highlighted.enabled = not @@ -561,32 +561,32 @@ function keyboard.check_hotkeys(hard_keyboard) end end - if not (cached_config.time_UI.ctrl and not keyboard.hotkey_modifiers_down.ctrl) - and not (cached_config.time_UI.shift and not keyboard.hotkey_modifiers_down.shift) - and not (cached_config.time_UI.alt and not keyboard.hotkey_modifiers_down.alt) then + if not (cached_config.time_UI.ctrl and not this.hotkey_modifiers_down.ctrl) + and not (cached_config.time_UI.shift and not this.hotkey_modifiers_down.shift) + and not (cached_config.time_UI.alt and not this.hotkey_modifiers_down.alt) then if get_release_method:call(hard_keyboard, math.tointeger(cached_config.time_UI.key)) then config.current_config.time_UI.enabled = not config.current_config.time_UI.enabled; end end - if not (cached_config.damage_meter_UI.ctrl and not keyboard.hotkey_modifiers_down.ctrl) - and not (cached_config.damage_meter_UI.shift and not keyboard.hotkey_modifiers_down.shift) - and not (cached_config.damage_meter_UI.alt and not keyboard.hotkey_modifiers_down.alt) then + if not (cached_config.damage_meter_UI.ctrl and not this.hotkey_modifiers_down.ctrl) + and not (cached_config.damage_meter_UI.shift and not this.hotkey_modifiers_down.shift) + and not (cached_config.damage_meter_UI.alt and not this.hotkey_modifiers_down.alt) then if get_release_method:call(hard_keyboard, math.tointeger(cached_config.damage_meter_UI.key)) then config.current_config.damage_meter_UI.enabled = not config.current_config.damage_meter_UI.enabled; end end - if not (cached_config.endemic_life_UI.ctrl and not keyboard.hotkey_modifiers_down.ctrl) - and not (cached_config.endemic_life_UI.shift and not keyboard.hotkey_modifiers_down.shift) - and not (cached_config.endemic_life_UI.alt and not keyboard.hotkey_modifiers_down.alt) then + if not (cached_config.endemic_life_UI.ctrl and not this.hotkey_modifiers_down.ctrl) + and not (cached_config.endemic_life_UI.shift and not this.hotkey_modifiers_down.shift) + and not (cached_config.endemic_life_UI.alt and not this.hotkey_modifiers_down.alt) then if get_release_method:call(hard_keyboard, math.tointeger(cached_config.endemic_life_UI.key)) then config.current_config.endemic_life_UI.enabled = not config.current_config.endemic_life_UI.enabled; end end end -function keyboard.get_hotkey_name(hotkey) +function this.get_hotkey_name(hotkey) local hotkey_name = ""; if hotkey.ctrl then @@ -601,10 +601,10 @@ function keyboard.get_hotkey_name(hotkey) hotkey_name = hotkey_name .. "Alt + "; end - return hotkey_name .. tostring(keyboard.keys[hotkey.key]); + return hotkey_name .. tostring(this.keys[hotkey.key]); end -function keyboard.init_module() +function this.init_module() config = require "MHR_Overlay.Misc.config" singletons = require("MHR_Overlay.Game_Handler.singletons"); customization_menu = require("MHR_Overlay.UI.customization_menu"); @@ -615,4 +615,4 @@ function keyboard.init_module() time = require("MHR_Overlay.Game_Handler.time"); end -return keyboard; +return this; diff --git a/reframework/autorun/MHR_Overlay/Game_Handler/quest_status.lua b/reframework/autorun/MHR_Overlay/Game_Handler/quest_status.lua index 8721d42..8f784a9 100644 --- a/reframework/autorun/MHR_Overlay/Game_Handler/quest_status.lua +++ b/reframework/autorun/MHR_Overlay/Game_Handler/quest_status.lua @@ -1,4 +1,4 @@ -local quest_status = {}; +local this = {}; local singletons; local customization_menu; @@ -42,7 +42,7 @@ local os = os; local ValueType = ValueType; local package = package; -quest_status.flow_states = { +this.flow_states = { NONE = 0, IN_LOBBY = 1, IN_TRAINING_AREA = 2, @@ -64,15 +64,15 @@ quest_status.flow_states = { SUMMARY_SCREEN = 32768, }; -quest_status.previous_flow_state = quest_status.flow_states.NONE; -quest_status.flow_state = quest_status.flow_states.NONE; +this.previous_flow_state = this.flow_states.NONE; +this.flow_state = this.flow_states.NONE; -quest_status.index = 0; -quest_status.is_online = false; +this.index = 0; +this.is_online = false; --quest_status.is_quest_host = false; -quest_status.cart_count = 0; -quest_status.max_cart_count = 3; +this.cart_count = 0; +this.max_cart_count = 3; local quest_manager_type_def = sdk.find_type_definition("snow.QuestManager"); local on_changed_game_status_method = quest_manager_type_def:get_method("onChangedGameStatus"); @@ -116,8 +116,8 @@ local unique_event_manager_type_def = sdk.find_type_definition("snow.eventcut.Un local play_event_common_method = unique_event_manager_type_def:get_method("playEventCommon"); local event_manager_dispose_method = unique_event_manager_type_def:get_method("dispose"); -function quest_status.get_flow_state_name(flow_state, new_line) - for key, value in pairs(quest_status.flow_states) do +function this.get_flow_state_name(flow_state, new_line) + for key, value in pairs(this.flow_states) do if value == flow_state then if new_line then return "\n" .. tostring(key); @@ -128,52 +128,52 @@ function quest_status.get_flow_state_name(flow_state, new_line) end end -function quest_status.set_flow_state(new_flow_state) - quest_status.previous_flow_state = quest_status.flow_state; - quest_status.flow_state = new_flow_state; +function this.set_flow_state(new_flow_state) + this.previous_flow_state = this.flow_state; + this.flow_state = new_flow_state; - if quest_status.flow_state >= quest_status.flow_states.KILLCAM then + if this.flow_state >= this.flow_states.KILLCAM then damage_meter_UI.freeze_displayed_players = true; else damage_meter_UI.freeze_displayed_players = false; end - if quest_status.flow_state == quest_status.flow_states.IN_LOBBY or quest_status.flow_state == quest_status.flow_states.IN_TRAINING_AREA then + if this.flow_state == this.flow_states.IN_LOBBY or this.flow_state == this.flow_states.IN_TRAINING_AREA then players.init(); non_players.init(); small_monster.init_list(); large_monster.init_list(); env_creature.init_list(); damage_meter_UI.last_displayed_players = {}; - elseif quest_status.flow_state >= quest_status.flow_states.LOADING_QUEST then - quest_status.get_cart_count(); - quest_status.get_max_cart_count(); + elseif this.flow_state >= this.flow_states.LOADING_QUEST then + this.get_cart_count(); + this.get_max_cart_count(); end end -function quest_status.get_cart_count() +function this.get_cart_count() local death_num = get_death_num_method:call(singletons.quest_manager); if death_num ~= nil then - quest_status.cart_count = death_num; + this.cart_count = death_num; end end -function quest_status.get_max_cart_count() +function this.get_max_cart_count() local quest_life = get_quest_life_method:call(singletons.quest_manager); if quest_life ~= nil then - quest_status.max_cart_count = quest_life; + this.max_cart_count = quest_life; end end --type 2 = quest start --type 3 = monster killcam --type 5 = end screen -function quest_status.on_demo_request_activation(request_data_base) +function this.on_demo_request_activation(request_data_base) if request_data_base == nil then return; end - if quest_status.index ~= 2 then + if this.index ~= 2 then return; end @@ -184,125 +184,125 @@ function quest_status.on_demo_request_activation(request_data_base) -- QUEST_START_ANIMATION if request_data_type == 2 then - quest_status.set_flow_state(quest_status.flow_states.QUEST_START_ANIMATION); + this.set_flow_state(this.flow_states.QUEST_START_ANIMATION); -- KILLCAM elseif request_data_type == 3 then - quest_status.set_flow_state(quest_status.flow_states.KILLCAM); + this.set_flow_state(this.flow_states.KILLCAM); -- QUEST_END_ANIMATION elseif request_data_type == 5 or request_data_type == 6 or request_data_type == 7 then - quest_status.set_flow_state(quest_status.flow_states.QUEST_END_ANIMATION); + this.set_flow_state(this.flow_states.QUEST_END_ANIMATION); -- PLAYER_DEATH_ANIMATION elseif request_data_type == 8 then - quest_status.set_flow_state(quest_status.flow_states.PLAYER_DEATH_ANIMATION); + this.set_flow_state(this.flow_states.PLAYER_DEATH_ANIMATION); -- PLAYER_CART_ANIMATION elseif request_data_type == 9 then - quest_status.set_flow_state(quest_status.flow_states.PLAYER_CART_ANIMATION); + this.set_flow_state(this.flow_states.PLAYER_CART_ANIMATION); -- FAST_TRAVEL_ANIMATION elseif request_data_type == 10 then - quest_status.set_flow_state(quest_status.flow_states.FAST_TRAVEL_ANIMATION); + this.set_flow_state(this.flow_states.FAST_TRAVEL_ANIMATION); -- WYVERN_RIDING_START_ANIMATION elseif request_data_type == 11 then - quest_status.set_flow_state(quest_status.flow_states.WYVERN_RIDING_START_ANIMATION); + this.set_flow_state(this.flow_states.WYVERN_RIDING_START_ANIMATION); end end -function quest_status.on_demo_end() - if quest_status.index == 2 then - if quest_status.flow_state == quest_status.flow_states.PLAYER_DEATH_ANIMATION - or quest_status.flow_state == quest_status.flow_states.PLAYER_CART_ANIMATION - or quest_status.flow_state == quest_status.flow_states.FAST_TRAVEL_ANIMATION - or quest_status.flow_state == quest_status.flow_states.WYVERN_RIDING_START_ANIMATION then +function this.on_demo_end() + if this.index == 2 then + if this.flow_state == this.flow_states.PLAYER_DEATH_ANIMATION + or this.flow_state == this.flow_states.PLAYER_CART_ANIMATION + or this.flow_state == this.flow_states.FAST_TRAVEL_ANIMATION + or this.flow_state == this.flow_states.WYVERN_RIDING_START_ANIMATION then - quest_status.set_flow_state(quest_status.previous_flow_state); + this.set_flow_state(this.previous_flow_state); - elseif quest_status.flow_state == quest_status.flow_states.QUEST_START_ANIMATION then + elseif this.flow_state == this.flow_states.QUEST_START_ANIMATION then - quest_status.set_flow_state(quest_status.flow_states.PLAYING_QUEST); + this.set_flow_state(this.flow_states.PLAYING_QUEST); - elseif quest_status.flow_state == quest_status.flow_states.KILLCAM then + elseif this.flow_state == this.flow_states.KILLCAM then - quest_status.set_flow_state(quest_status.flow_states.QUEST_END_TIMER); + this.set_flow_state(this.flow_states.QUEST_END_TIMER); end end end -function quest_status.on_set_quest_clear() - if quest_status.index == 2 and quest_status.flow_state ~= quest_status.flow_states.KILLCAM then - quest_status.set_flow_state(quest_status.flow_states.QUEST_END_TIMER); +function this.on_set_quest_clear() + if this.index == 2 and this.flow_state ~= this.flow_states.KILLCAM then + this.set_flow_state(this.flow_states.QUEST_END_TIMER); end end -function quest_status.on_quest_end_set_state() - if quest_status.index == 2 then - quest_status.set_flow_state(quest_status.flow_states.QUEST_END_SCREEN); +function this.on_quest_end_set_state() + if this.index == 2 then + this.set_flow_state(this.flow_states.QUEST_END_SCREEN); end end -function quest_status.on_gui_result_reward_do_open() - if quest_status.index == 3 then - quest_status.set_flow_state(quest_status.flow_states.REWARD_SCREEN); +function this.on_gui_result_reward_do_open() + if this.index == 3 then + this.set_flow_state(this.flow_states.REWARD_SCREEN); end end -function quest_status.on_gui_result_pay_off_do_open() - if quest_status.index == 3 then - quest_status.set_flow_state(quest_status.flow_states.SUMMARY_SCREEN); +function this.on_gui_result_pay_off_do_open() + if this.index == 3 then + this.set_flow_state(this.flow_states.SUMMARY_SCREEN); end end -function quest_status.on_play_event_common() - quest_status.set_flow_state(quest_status.flow_states.CUTSCENE); +function this.on_play_event_common() + this.set_flow_state(this.flow_states.CUTSCENE); end -function quest_status.on_event_manager_dispose() - if quest_status.flow_state == quest_status.flow_states.CUTSCENE then - quest_status.set_flow_state(quest_status.previous_flow_state); +function this.on_event_manager_dispose() + if this.flow_state == this.flow_states.CUTSCENE then + this.set_flow_state(this.previous_flow_state); end end -function quest_status.on_set_quest_fail() - if quest_status.flow_state == quest_status.flow_states.PLAYER_DEATH_ANIMATION or - quest_status.flow_state == quest_status.flow_states.PLAYER_CART_ANIMATION or - quest_status.flow_state == quest_status.flow_states.FAST_TRAVEL_ANIMATION or - quest_status.flow_state == quest_status.flow_states.WYVERN_RIDING_START_ANIMATION then +function this.on_set_quest_fail() + if this.flow_state == this.flow_states.PLAYER_DEATH_ANIMATION or + this.flow_state == this.flow_states.PLAYER_CART_ANIMATION or + this.flow_state == this.flow_states.FAST_TRAVEL_ANIMATION or + this.flow_state == this.flow_states.WYVERN_RIDING_START_ANIMATION then - quest_status.set_flow_state(quest_status.flow_states.QUEST_END_ANIMATION); + this.set_flow_state(this.flow_states.QUEST_END_ANIMATION); end end -function quest_status.on_village_fast_travel(area) +function this.on_village_fast_travel(area) if area == nil then return; end if area == 7 then - quest_status.set_flow_state(quest_status.flow_states.IN_TRAINING_AREA); + this.set_flow_state(this.flow_states.IN_TRAINING_AREA); else - quest_status.set_flow_state(quest_status.flow_states.IN_LOBBY); + this.set_flow_state(this.flow_states.IN_LOBBY); end end -function quest_status.on_changed_game_status(new_quest_status) - quest_status.index = new_quest_status; +function this.on_changed_game_status(new_quest_status) + this.index = new_quest_status; - if quest_status.index == 0 then - quest_status.set_flow_state(quest_status.flow_states.NONE); - elseif quest_status.index == 1 then - quest_status.set_flow_state(quest_status.flow_states.IN_LOBBY); - elseif quest_status.index == 2 then - quest_status.set_flow_state(quest_status.flow_states.LOADING_QUEST); - elseif quest_status.index == 3 then - quest_status.set_flow_state(quest_status.flow_states.SUMMARY_SCREEN); + if this.index == 0 then + this.set_flow_state(this.flow_states.NONE); + elseif this.index == 1 then + this.set_flow_state(this.flow_states.IN_LOBBY); + elseif this.index == 2 then + this.set_flow_state(this.flow_states.LOADING_QUEST); + elseif this.index == 3 then + this.set_flow_state(this.flow_states.SUMMARY_SCREEN); end end -function quest_status.init() +function this.init() if singletons.quest_manager == nil then return; end @@ -313,22 +313,22 @@ function quest_status.init() return; end - quest_status.index = new_quest_status; + this.index = new_quest_status; - if quest_status.index == 0 then - quest_status.set_flow_state(quest_status.flow_states.NONE); - elseif quest_status.index == 1 then - quest_status.set_flow_state(quest_status.flow_states.IN_LOBBY); - elseif quest_status.index == 2 then - quest_status.set_flow_state(quest_status.flow_states.PLAYING_QUEST); - elseif quest_status.index == 3 then - quest_status.set_flow_state(quest_status.flow_states.SUMMARY_SCREEN); + if this.index == 0 then + this.set_flow_state(this.flow_states.NONE); + elseif this.index == 1 then + this.set_flow_state(this.flow_states.IN_LOBBY); + elseif this.index == 2 then + this.set_flow_state(this.flow_states.PLAYING_QUEST); + elseif this.index == 3 then + this.set_flow_state(this.flow_states.SUMMARY_SCREEN); end - quest_status.update_is_training_area(); + this.update_is_training_area(); end -function quest_status.update_is_online() +function this.update_is_online() if singletons.lobby_manager == nil then return; end @@ -338,7 +338,7 @@ function quest_status.update_is_online() return; end - quest_status.is_online = is_quest_online; + this.is_online = is_quest_online; end --[[function quest_status.update_is_quest_host() @@ -354,7 +354,7 @@ end quest_status.is_quest_host = is_quest_host; end--]] -function quest_status.update_is_training_area() +function this.update_is_training_area() if singletons.village_area_manager == nil then customization_menu.status = "No village area manager"; return; @@ -366,11 +366,11 @@ function quest_status.update_is_training_area() end if _is_training_area then - quest_status.set_flow_state(quest_status.flow_states.IN_TRAINING_AREA); + this.set_flow_state(this.flow_states.IN_TRAINING_AREA); end end -function quest_status.init_module() +function this.init_module() singletons = require("MHR_Overlay.Game_Handler.singletons"); customization_menu = require("MHR_Overlay.UI.customization_menu"); players = require("MHR_Overlay.Damage_Meter.players"); @@ -381,63 +381,63 @@ function quest_status.init_module() env_creature = require("MHR_Overlay.Endemic_Life.env_creature"); non_players = require("MHR_Overlay.Damage_Meter.non_players"); - quest_status.init(); + this.init(); sdk.hook(on_changed_game_status_method, function(args) - quest_status.on_changed_game_status(sdk.to_int64(args[3])); + this.on_changed_game_status(sdk.to_int64(args[3])); end, function(retval) return retval; end); sdk.hook(set_quest_clear_method, function(args) - quest_status.on_set_quest_clear(); + this.on_set_quest_clear(); end, function(retval) return retval; end); sdk.hook(set_quest_clear_sub_method, function(args) - quest_status.on_set_quest_clear(); + this.on_set_quest_clear(); end, function(retval) return retval; end); sdk.hook(set_quest_clear_sub_hyakurui_method, function(args) - quest_status.on_set_quest_clear(); + this.on_set_quest_clear(); end, function(retval) return retval; end); sdk.hook(demo_request_activation_method, function(args) - quest_status.on_demo_request_activation(sdk.to_managed_object(args[3])); + this.on_demo_request_activation(sdk.to_managed_object(args[3])); end, function(retval) return retval; end); sdk.hook(demo_end_method, function(args) - quest_status.on_demo_end(); + this.on_demo_end(); end, function(retval) return retval; end); sdk.hook(set_quest_clear_method, function(args) - quest_status.on_set_quest_clear(); + this.on_set_quest_clear(); end, function(retval) return retval; end); sdk.hook(quest_end_set_state_method, function(args) - quest_status.on_quest_end_set_state(); + this.on_quest_end_set_state(); end, function(retval) return retval; end); sdk.hook(gui_result_reward_do_open_method, function(args) - quest_status.on_gui_result_reward_do_open(); + this.on_gui_result_reward_do_open(); end, function(retval) return retval; end); sdk.hook(gui_result_pay_off_do_open_method, function(args) - quest_status.on_gui_result_pay_off_do_open(); + this.on_gui_result_pay_off_do_open(); end, function(retval) return retval; end); sdk.hook(play_event_common_method, function(args) - quest_status.on_play_event_common(); + this.on_play_event_common(); end, function(retval) return retval; end); sdk.hook(event_manager_dispose_method, function(args) - quest_status.on_event_manager_dispose(); + this.on_event_manager_dispose(); end, function(retval) return retval; end); sdk.hook(set_quest_fail_method, function(args) - quest_status.on_set_quest_fail(); + this.on_set_quest_fail(); end, function(retval) return retval; end); sdk.hook(fast_travel_method, function(args) - quest_status.on_village_fast_travel(sdk.to_int64(args[3])); + this.on_village_fast_travel(sdk.to_int64(args[3])); end, function(retval) return retval; end); end -return quest_status; +return this; diff --git a/reframework/autorun/MHR_Overlay/Game_Handler/screen.lua b/reframework/autorun/MHR_Overlay/Game_Handler/screen.lua index fd845fd..61d8531 100644 --- a/reframework/autorun/MHR_Overlay/Game_Handler/screen.lua +++ b/reframework/autorun/MHR_Overlay/Game_Handler/screen.lua @@ -1,4 +1,4 @@ -local screen = {}; +local this = {}; local config; local singletons; @@ -35,25 +35,25 @@ local os = os; local ValueType = ValueType; local package = package; -screen.width = 1920; -screen.height = 1080; +this.width = 1920; +this.height = 1080; -function screen.update_window_size() +function this.update_window_size() local width; local height; if d2d ~= nil and config.current_config.global_settings.renderer.use_d2d_if_available then width, height = d2d.surface_size(); else - width, height = screen.get_game_window_size(); + width, height = this.get_game_window_size(); end if width ~= nil then - screen.width = width; + this.width = width; end if height ~= nil then - screen.height = height; + this.height = height; end end @@ -65,7 +65,7 @@ local size_type = get_size_method:get_return_type(); local width_field = size_type:get_field("w"); local height_field = size_type:get_field("h"); -function screen.get_game_window_size() +function this.get_game_window_size() if scene_view == nil then scene_view = sdk.call_native_func(singletons.scene_manager, sdk.find_type_definition("via.SceneManager") , "get_MainView"); @@ -96,7 +96,7 @@ function screen.get_game_window_size() return screen_width, screen_height; end -function screen.calculate_absolute_coordinates(position) +function this.calculate_absolute_coordinates(position) local global_position_modifier = config.current_config.global_settings.modifiers.global_position_modifier; local _position = { @@ -111,29 +111,29 @@ function screen.calculate_absolute_coordinates(position) -- top right if position.anchor == "Top-Right" then - local screen_x = screen.width - _position.x; + local screen_x = this.width - _position.x; return { x = screen_x, y = _position.y }; end -- bottom left if position.anchor == "Bottom-Left" then - local screen_y = screen.height - _position.y; + local screen_y = this.height - _position.y; return { x = _position.x, y = screen_y }; end -- bottom right if position.anchor == "Bottom-Right" then - local screen_x = screen.width - _position.x; - local screen_y = screen.height - _position.y; + local screen_x = this.width - _position.x; + local screen_y = this.height - _position.y; return { x = screen_x, y = screen_y }; end return { x = _position.x, y = _position.y }; end -function screen.init_module() +function this.init_module() config = require("MHR_Overlay.Misc.config"); singletons = require("MHR_Overlay.Game_Handler.singletons"); end -return screen; +return this; diff --git a/reframework/autorun/MHR_Overlay/Game_Handler/singletons.lua b/reframework/autorun/MHR_Overlay/Game_Handler/singletons.lua index 9aa0693..2ee5e76 100644 --- a/reframework/autorun/MHR_Overlay/Game_Handler/singletons.lua +++ b/reframework/autorun/MHR_Overlay/Game_Handler/singletons.lua @@ -1,4 +1,4 @@ -local singletons = {}; +local this = {}; local sdk = sdk; local tostring = tostring; @@ -32,207 +32,207 @@ local os = os; local ValueType = ValueType; local package = package; -singletons.message_manager = nil; -singletons.enemy_manager = nil; -singletons.lobby_manager = nil; -singletons.progress_manager = nil; -singletons.quest_manager = nil; -singletons.player_manager = nil; -singletons.village_area_manager = nil; -singletons.gui_manager = nil; -singletons.game_keyboard = nil; -singletons.scene_manager = nil; -singletons.game_manager = nil; +this.message_manager = nil; +this.enemy_manager = nil; +this.lobby_manager = nil; +this.progress_manager = nil; +this.quest_manager = nil; +this.player_manager = nil; +this.village_area_manager = nil; +this.gui_manager = nil; +this.game_keyboard = nil; +this.scene_manager = nil; +this.game_manager = nil; -function singletons.init() - singletons.init_message_manager(); - singletons.init_enemy_manager(); - singletons.init_lobby_manager() - singletons.init_progress_manager(); - singletons.init_quest_manager(); - singletons.init_player_manager(); - singletons.init_village_area_manager(); - singletons.init_gui_manager(); - singletons.init_game_keyboard(); - singletons.init_scene_manager(); - singletons.init_game_manager(); - singletons.init_servant_manager(); - singletons.init_otomo_manager(); +function this.init() + this.init_message_manager(); + this.init_enemy_manager(); + this.init_lobby_manager() + this.init_progress_manager(); + this.init_quest_manager(); + this.init_player_manager(); + this.init_village_area_manager(); + this.init_gui_manager(); + this.init_game_keyboard(); + this.init_scene_manager(); + this.init_game_manager(); + this.init_servant_manager(); + this.init_otomo_manager(); end -function singletons.init_message_manager() - if singletons.message_manager ~= nil then +function this.init_message_manager() + if this.message_manager ~= nil then return; end - singletons.message_manager = sdk.get_managed_singleton("snow.gui.MessageManager"); - if singletons.message_manager == nil then + this.message_manager = sdk.get_managed_singleton("snow.gui.MessageManager"); + if this.message_manager == nil then --log.error("[MHR Overlay] No message manager"); end - return singletons.message_manager; + return this.message_manager; end -function singletons.init_enemy_manager() - if singletons.enemy_manager ~= nil then +function this.init_enemy_manager() + if this.enemy_manager ~= nil then return; end - singletons.enemy_manager = sdk.get_managed_singleton("snow.enemy.EnemyManager"); - if singletons.enemy_manager == nil then + this.enemy_manager = sdk.get_managed_singleton("snow.enemy.EnemyManager"); + if this.enemy_manager == nil then --log.error("[MHR Overlay] No enemy manager"); end - return singletons.enemy_manager; + return this.enemy_manager; end -function singletons.init_lobby_manager() - if singletons.lobby_manager ~= nil then +function this.init_lobby_manager() + if this.lobby_manager ~= nil then return; end - singletons.lobby_manager = sdk.get_managed_singleton("snow.LobbyManager"); - if singletons.lobby_manager == nil then + this.lobby_manager = sdk.get_managed_singleton("snow.LobbyManager"); + if this.lobby_manager == nil then --log.error("[MHR Overlay] No lobby manager"); return false; end - return singletons.lobby_manager; + return this.lobby_manager; end -function singletons.init_progress_manager() - if singletons.progress_manager ~= nil then +function this.init_progress_manager() + if this.progress_manager ~= nil then return; end - singletons.progress_manager = sdk.get_managed_singleton("snow.progress.ProgressManager"); - if singletons.progress_manager == nil then + this.progress_manager = sdk.get_managed_singleton("snow.progress.ProgressManager"); + if this.progress_manager == nil then --log.error("[MHR Overlay] No progress manager"); return false; end - return singletons.progress_manager; + return this.progress_manager; end -function singletons.init_quest_manager() - if singletons.quest_manager ~= nil then +function this.init_quest_manager() + if this.quest_manager ~= nil then return; end - singletons.quest_manager = sdk.get_managed_singleton("snow.QuestManager"); - if singletons.quest_manager == nil then + this.quest_manager = sdk.get_managed_singleton("snow.QuestManager"); + if this.quest_manager == nil then --log.error("[MHR Overlay] No quest manager"); end - return singletons.quest_manager; + return this.quest_manager; end -function singletons.init_player_manager() - if singletons.player_manager ~= nil then +function this.init_player_manager() + if this.player_manager ~= nil then return; end - singletons.player_manager = sdk.get_managed_singleton("snow.player.PlayerManager"); - if singletons.player_manager == nil then + this.player_manager = sdk.get_managed_singleton("snow.player.PlayerManager"); + if this.player_manager == nil then --log.error("[MHR Overlay] No player manager"); end - return singletons.player_manager; + return this.player_manager; end -function singletons.init_village_area_manager() - if singletons.village_area_manager ~= nil then +function this.init_village_area_manager() + if this.village_area_manager ~= nil then return; end - singletons.village_area_manager = sdk.get_managed_singleton("snow.VillageAreaManager"); - if singletons.village_area_manager == nil then + this.village_area_manager = sdk.get_managed_singleton("snow.VillageAreaManager"); + if this.village_area_manager == nil then --log.error("[MHR Overlay] No village area manager"); end - return singletons.village_area_manager; + return this.village_area_manager; end -function singletons.init_gui_manager() - if singletons.gui_manager ~= nil then +function this.init_gui_manager() + if this.gui_manager ~= nil then return; end - singletons.gui_manager = sdk.get_managed_singleton("snow.gui.GuiManager"); - if singletons.gui_manager == nil then + this.gui_manager = sdk.get_managed_singleton("snow.gui.GuiManager"); + if this.gui_manager == nil then --log.error("[MHR Overlay] No gui manager"); end - return singletons.gui_manager; + return this.gui_manager; end -function singletons.init_game_keyboard() - if singletons.game_keyboard ~= nil then +function this.init_game_keyboard() + if this.game_keyboard ~= nil then return; end - singletons.game_keyboard = sdk.get_managed_singleton("snow.GameKeyboard"); - if singletons.game_keyboard == nil then + this.game_keyboard = sdk.get_managed_singleton("snow.GameKeyboard"); + if this.game_keyboard == nil then --log.error("[MHR Overlay] No game keyboard"); end - return singletons.game_keyboard; + return this.game_keyboard; end -function singletons.init_scene_manager() - if singletons.scene_manager ~= nil then +function this.init_scene_manager() + if this.scene_manager ~= nil then return; end - singletons.scene_manager = sdk.get_native_singleton("via.SceneManager"); - if singletons.scene_manager == nil then + this.scene_manager = sdk.get_native_singleton("via.SceneManager"); + if this.scene_manager == nil then --log.error("[MHR Overlay] No enemy manager"); end - return singletons.scene_manager; + return this.scene_manager; end -function singletons.init_game_manager() - if singletons.game_manager ~= nil then +function this.init_game_manager() + if this.game_manager ~= nil then return; end - singletons.game_manager = sdk.get_managed_singleton("snow.SnowGameManager"); - if singletons.game_manager == nil then + this.game_manager = sdk.get_managed_singleton("snow.SnowGameManager"); + if this.game_manager == nil then --log.error("[MHR Overlay] No enemy manager"); end - return singletons.game_manager; + return this.game_manager; end -function singletons.init_servant_manager() - if singletons.servant_manager ~= nil then +function this.init_servant_manager() + if this.servant_manager ~= nil then return; end - singletons.servant_manager = sdk.get_managed_singleton("snow.ai.ServantManager"); - if singletons.servant_manager == nil then + this.servant_manager = sdk.get_managed_singleton("snow.ai.ServantManager"); + if this.servant_manager == nil then --log.error("[MHR Overlay] No enemy manager"); end - return singletons.servant_manager; + return this.servant_manager; end -function singletons.init_otomo_manager() - if singletons.otomo_manager ~= nil then +function this.init_otomo_manager() + if this.otomo_manager ~= nil then return; end - singletons.otomo_manager = sdk.get_managed_singleton("snow.otomo.OtomoManager"); - if singletons.otomo_manager == nil then + this.otomo_manager = sdk.get_managed_singleton("snow.otomo.OtomoManager"); + if this.otomo_manager == nil then --log.error("[MHR Overlay] No enemy manager"); end - return singletons.otomo_manager; + return this.otomo_manager; end -function singletons.init_module() - singletons.init(); +function this.init_module() + this.init(); end -return singletons; +return this; diff --git a/reframework/autorun/MHR_Overlay/Game_Handler/time.lua b/reframework/autorun/MHR_Overlay/Game_Handler/time.lua index 13e739d..f82b413 100644 --- a/reframework/autorun/MHR_Overlay/Game_Handler/time.lua +++ b/reframework/autorun/MHR_Overlay/Game_Handler/time.lua @@ -1,4 +1,4 @@ -local time = {}; +local this = {}; local singletons; local customization_menu; @@ -44,19 +44,19 @@ 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_sec_method = quest_manager_type_def:get_method("getQuestElapsedTimeSec"); -time.total_elapsed_seconds = 0; -time.elapsed_minutes = 0; -time.elapsed_seconds = 0; +this.total_elapsed_seconds = 0; +this.elapsed_minutes = 0; +this.elapsed_seconds = 0; -time.total_elapsed_script_seconds = 0; -time.last_elapsed_script_seconds = 0; +this.total_elapsed_script_seconds = 0; +this.last_elapsed_script_seconds = 0; -function time.update_script_time() - time.total_elapsed_script_seconds = os.clock(); +function this.update_script_time() + this.total_elapsed_script_seconds = os.clock(); end -function time.tick() - time.update_script_time(); +function this.tick() + this.update_script_time(); if singletons.quest_manager == nil then return; @@ -66,20 +66,20 @@ function time.tick() if quest_time_elapsed_minutes == nil then customization_menu.status = "No quest time elapsed minutes"; else - time.elapsed_minutes = quest_time_elapsed_minutes; + this.elapsed_minutes = quest_time_elapsed_minutes; end local quest_time_total_elapsed_seconds = get_quest_elapsed_time_sec_method:call(singletons.quest_manager); if quest_time_total_elapsed_seconds == nil then customization_menu.status = "No quest time total elapsed seconds"; else - time.total_elapsed_seconds = quest_time_total_elapsed_seconds; + this.total_elapsed_seconds = quest_time_total_elapsed_seconds; end - time.elapsed_seconds = quest_time_total_elapsed_seconds - quest_time_elapsed_minutes * 60; + this.elapsed_seconds = quest_time_total_elapsed_seconds - quest_time_elapsed_minutes * 60; - if time.total_elapsed_script_seconds - time.last_elapsed_script_seconds > 0.5 then - time.last_elapsed_script_seconds = time.total_elapsed_script_seconds; + if this.total_elapsed_script_seconds - this.last_elapsed_script_seconds > 0.5 then + this.last_elapsed_script_seconds = this.total_elapsed_script_seconds; local is_on_quest = quest_status.flow_state ~= quest_status.flow_states.IN_LOBBY and quest_status.flow_state ~= quest_status.flow_states.IN_TRAINING_AREA; @@ -93,7 +93,7 @@ function time.tick() end end -function time.init_module() +function this.init_module() players = require("MHR_Overlay.Damage_Meter.players"); singletons = require("MHR_Overlay.Game_Handler.singletons"); customization_menu = require("MHR_Overlay.UI.customization_menu"); @@ -103,4 +103,4 @@ function time.init_module() non_players = require("MHR_Overlay.Damage_Meter.non_players"); end -return time; +return this; diff --git a/reframework/autorun/MHR_Overlay/Misc/config.lua b/reframework/autorun/MHR_Overlay/Misc/config.lua index 83511d3..7bd31f2 100644 --- a/reframework/autorun/MHR_Overlay/Misc/config.lua +++ b/reframework/autorun/MHR_Overlay/Misc/config.lua @@ -1,4 +1,4 @@ -local config = {}; +local this = {}; local utils; local language; @@ -35,24 +35,24 @@ local os = os; local ValueType = ValueType; local package = package; -config.version = "2.4.1"; +this.version = "2.4.1"; -config.config_folder = "MHR Overlay\\configs\\"; -config.current_config_value_file_name = "MHR Overlay\\config.json"; +this.config_folder = "MHR Overlay\\configs\\"; +this.current_config_value_file_name = "MHR Overlay\\config.json"; -config.current_config_name = nil; -config.current_config = nil; +this.current_config_name = nil; +this.current_config = nil; -config.config_names = {}; -config.configs = {}; +this.config_names = {}; +this.configs = {}; -config.default_config = nil; +this.default_config = nil; local is_old_config_transferred = false; -function config.init_default() - config.default_config = { - version = config.version, +function this.init_default() + this.default_config = { + version = this.version, global_settings = { language = "default", @@ -5666,37 +5666,37 @@ function config.init_default() }; end -function config.load_current_config_value() - local loaded_config = json.load_file(config.current_config_value_file_name); +function this.load_current_config_value() + local loaded_config = json.load_file(this.current_config_value_file_name); if loaded_config ~= nil then if loaded_config.config == nil then log.info("[MHR Overlay] old config.json loaded successfully"); local config_save = { - config = config.current_config_name + config = this.current_config_name }; - config.current_config_name = "old_config"; - config.current_config = utils.table.merge(config.default_config, loaded_config); - config.current_config.version = config.version; + this.current_config_name = "old_config"; + this.current_config = utils.table.merge(this.default_config, loaded_config); + this.current_config.version = this.version; - config.save(config.config_folder .. "old_config.json", config.current_config); - config.save_current_config_name(); + this.save(this.config_folder .. "old_config.json", this.current_config); + this.save_current_config_name(); - table.insert(config.config_names, "old_config"); - table.insert(config.configs, config.current_config); + table.insert(this.config_names, "old_config"); + table.insert(this.configs, this.current_config); is_old_config_transferred = true; else log.info("[MHR Overlay] config.json loaded successfully"); - config.current_config_name = loaded_config.config; + this.current_config_name = loaded_config.config; end else log.error("[MHR Overlay] Failed to load config.json"); end end -function config.load_configs() +function this.load_configs() local config_files = fs.glob([[MHR Overlay\\configs\\.*json]]); if config_files == nil then @@ -5705,7 +5705,7 @@ function config.load_configs() for i, config_file_name in ipairs(config_files) do - local config_name = config_file_name:gsub(config.config_folder, ""):gsub(".json",""); + local config_name = config_file_name:gsub(this.config_folder, ""):gsub(".json",""); if config_name == "old_config" and is_old_config_transferred then goto continue; @@ -5716,16 +5716,16 @@ function config.load_configs() log.info("[MHR Overlay] " .. config_name .. ".json loaded successfully"); - local merged_config = utils.table.merge(config.default_config, loaded_config); - merged_config.version = config.version; + local merged_config = utils.table.merge(this.default_config, loaded_config); + merged_config.version = this.version; - table.insert(config.config_names, config_name); - table.insert(config.configs, merged_config); + table.insert(this.config_names, config_name); + table.insert(this.configs, merged_config); - config.save(config_file_name, merged_config); + this.save(config_file_name, merged_config); - if config_name == config.current_config_name then - config.current_config = merged_config; + if config_name == this.current_config_name then + this.current_config = merged_config; end else log.error("[MHR Overlay] Failed to load " .. config_name .. ".json"); @@ -5734,29 +5734,29 @@ function config.load_configs() ::continue:: end - if config.current_config == nil then - if #config.configs > 0 then - config.current_config_name = config.config_names[1]; - config.current_config = config.configs[1]; + if this.current_config == nil then + if #this.configs > 0 then + this.current_config_name = this.config_names[1]; + this.current_config = this.configs[1]; else - config.current_config_name = "default"; - config.current_config = utils.table.deep_copy(config.default_config); + this.current_config_name = "default"; + this.current_config = utils.table.deep_copy(this.default_config); - table.insert(config.config_names, config.current_config_name); - table.insert(config.configs, config.current_config); + table.insert(this.config_names, this.current_config_name); + table.insert(this.configs, this.current_config); - config.save(config.current_config_name, config.current_config); + this.save(this.current_config_name, this.current_config); end - config.save_current_config_name(); + this.save_current_config_name(); end end -function config.save_current_config_name() - config.save(config.current_config_value_file_name, { config = config.current_config_name }); +function this.save_current_config_name() + this.save(this.current_config_value_file_name, { config = this.current_config_name }); end -function config.save(file_name, config_table) +function this.save(file_name, config_table) -- save current config to disk, replacing any existing file local success = json.dump_file(file_name, config_table); if success then @@ -5766,63 +5766,63 @@ function config.save(file_name, config_table) end end -function config.save_current() - config.save(config.config_folder .. config.current_config_name .. ".json", config.current_config); +function this.save_current() + this.save(this.config_folder .. this.current_config_name .. ".json", this.current_config); end -function config.create_new(config_file_name, config_table) - table.insert(config.config_names, config_file_name); - table.insert(config.configs, config_table); +function this.create_new(config_file_name, config_table) + table.insert(this.config_names, config_file_name); + table.insert(this.configs, config_table); - config.save(config.config_folder .. config_file_name .. ".json", config_table); + this.save(this.config_folder .. config_file_name .. ".json", config_table); - config.current_config_name = config_file_name; - config.current_config = config_table; + this.current_config_name = config_file_name; + this.current_config = config_table; - config.save_current_config_name(); + this.save_current_config_name(); end -function config.new(config_name) +function this.new(config_name) if config_name == "" then return; end - local new_config = utils.table.deep_copy(config.default_config); + local new_config = utils.table.deep_copy(this.default_config); - config.create_new(config_name, new_config); + this.create_new(config_name, new_config); end -function config.duplicate(config_name) +function this.duplicate(config_name) if config_name == "" then return; end - local new_config = utils.table.deep_copy(config.current_config); + local new_config = utils.table.deep_copy(this.current_config); - config.create_new(config_name, new_config); + this.create_new(config_name, new_config); end -function config.reset() - config.current_config = utils.table.deep_copy(config.default_config); +function this.reset() + this.current_config = utils.table.deep_copy(this.default_config); - local index = utils.table.find_index(config.config_names, config.current_config_name); - config.configs[index] = config.current_config; + local index = utils.table.find_index(this.config_names, this.current_config_name); + this.configs[index] = this.current_config; end -function config.update(index) - config.current_config = config.configs[index]; - config.save_current_config_name(); +function this.update(index) + this.current_config = this.configs[index]; + this.save_current_config_name(); end -function config.init_module() +function this.init_module() utils = require("MHR_Overlay.Misc.utils"); language = require("MHR_Overlay.Misc.language"); - config.init_default(); - config.load_current_config_value(); - config.load_configs(); + this.init_default(); + this.load_current_config_value(); + this.load_configs(); - language.update(utils.table.find_index(language.language_names, config.current_config.global_settings.language, false)); + language.update(utils.table.find_index(language.language_names, this.current_config.global_settings.language, false)); end -return config; \ No newline at end of file +return this; \ No newline at end of file diff --git a/reframework/autorun/MHR_Overlay/Misc/debug.lua b/reframework/autorun/MHR_Overlay/Misc/debug.lua deleted file mode 100644 index 42ad7ec..0000000 --- a/reframework/autorun/MHR_Overlay/Misc/debug.lua +++ /dev/null @@ -1,5 +0,0 @@ -local debug = {}; - -debug.enabled = false; - -return debug; \ No newline at end of file diff --git a/reframework/autorun/MHR_Overlay/Misc/language.lua b/reframework/autorun/MHR_Overlay/Misc/language.lua index 12f45df..a824b51 100644 --- a/reframework/autorun/MHR_Overlay/Misc/language.lua +++ b/reframework/autorun/MHR_Overlay/Misc/language.lua @@ -1,4 +1,4 @@ -local language = {}; +local this = {}; local utils; @@ -34,12 +34,12 @@ local os = os; local ValueType = ValueType; local package = package; -language.language_folder = "MHR Overlay\\languages\\"; +this.language_folder = "MHR Overlay\\languages\\"; -language.current_language = {}; +this.current_language = {}; -language.default_language = { +this.default_language = { font_name = "NotoSansKR-Bold.otf", parts = { head = "Head", @@ -509,10 +509,10 @@ language.default_language = { } }; -language.language_names = { "default"}; -language.languages = { language.default_language }; +this.language_names = { "default"}; +this.languages = { this.default_language }; -function language.load() +function this.load() local language_files = fs.glob([[MHR Overlay\\languages\\.*json]]); if language_files == nil then @@ -520,18 +520,18 @@ function language.load() end for i, language_file_name in ipairs(language_files) do - local language_name = language_file_name:gsub(language.language_folder, ""):gsub(".json",""); + local language_name = language_file_name:gsub(this.language_folder, ""):gsub(".json",""); local loaded_language = json.load_file(language_file_name); if loaded_language ~= nil then log.info("[MHR Overlay] " .. language_file_name .. ".json loaded successfully"); - table.insert(language.language_names, language_name); + table.insert(this.language_names, language_name); - local merged_language = utils.table.merge(language.default_language, loaded_language); - table.insert(language.languages, merged_language); + local merged_language = utils.table.merge(this.default_language, loaded_language); + table.insert(this.languages, merged_language); - language.save(language_file_name, merged_language); + this.save(language_file_name, merged_language); else @@ -540,7 +540,7 @@ function language.load() end end -function language.save(file_name, language_table) +function this.save(file_name, language_table) local success = json.dump_file(file_name, language_table); if success then log.info("[MHR Overlay] " .. file_name .. " saved successfully"); @@ -549,20 +549,20 @@ function language.save(file_name, language_table) end end -function language.save_default() - language.save(language.language_folder .. "en-us.json", language.default_language); +function this.save_default() + this.save(this.language_folder .. "en-us.json", this.default_language); end -function language.update(index) - language.current_language = language.languages[index]; +function this.update(index) + this.current_language = this.languages[index]; end -function language.init_module() +function this.init_module() utils = require("MHR_Overlay.Misc.utils"); - language.save_default(); - language.load(); - language.current_language = language.default_language; + this.save_default(); + this.load(); + this.current_language = this.default_language; end -return language; +return this; diff --git a/reframework/autorun/MHR_Overlay/Misc/part_names.lua b/reframework/autorun/MHR_Overlay/Misc/part_names.lua index 240e576..7534367 100644 --- a/reframework/autorun/MHR_Overlay/Misc/part_names.lua +++ b/reframework/autorun/MHR_Overlay/Misc/part_names.lua @@ -1,4 +1,4 @@ -local part_names = {}; +local this = {}; local language; @@ -34,10 +34,10 @@ local os = os; local ValueType = ValueType; local package = package; -part_names.list = {}; +this.list = {}; -function part_names.init() - part_names.list = { +function this.init() + this.list = { [98] = -- Great Izuchi 98 { language.current_language.parts.head, @@ -922,8 +922,8 @@ function part_names.init() }; end -function part_names.get_part_name(monster_id, part_id) - local monster_parts = part_names.list[monster_id]; +function this.get_part_name(monster_id, part_id) + local monster_parts = this.list[monster_id]; if monster_parts == nil then return "?"; end @@ -932,10 +932,10 @@ function part_names.get_part_name(monster_id, part_id) return part_name; end -function part_names.init_module() +function this.init_module() language = require("MHR_Overlay.Misc.language"); - part_names.init(); + this.init(); end -return part_names; +return this; diff --git a/reframework/autorun/MHR_Overlay/Monsters/ailment_buildup.lua b/reframework/autorun/MHR_Overlay/Monsters/ailment_buildup.lua index 7146136..7735472 100644 --- a/reframework/autorun/MHR_Overlay/Monsters/ailment_buildup.lua +++ b/reframework/autorun/MHR_Overlay/Monsters/ailment_buildup.lua @@ -1,4 +1,4 @@ -local ailment_buildup = {}; +local this = {}; local players; local language; @@ -42,7 +42,7 @@ 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 this.draw(monster, ailment_buildup_UI, cached_config, ailment_buildups_position_on_screen, opacity_scale) local cached_config = cached_config.ailment_buildups; local cached_damage_meter_UI_config = config.current_config.damage_meter_UI; @@ -231,7 +231,7 @@ function ailment_buildup.draw(monster, ailment_buildup_UI, cached_config, ailmen end -function ailment_buildup.init_module() +function this.init_module() players = require("MHR_Overlay.Damage_Meter.players"); language = require("MHR_Overlay.Misc.language"); config = require("MHR_Overlay.Misc.config"); @@ -243,4 +243,4 @@ function ailment_buildup.init_module() drawing = require("MHR_Overlay.UI.drawing"); end -return ailment_buildup; +return this; diff --git a/reframework/autorun/MHR_Overlay/Monsters/ailment_hook.lua b/reframework/autorun/MHR_Overlay/Monsters/ailment_hook.lua index d86432d..de009bb 100644 --- a/reframework/autorun/MHR_Overlay/Monsters/ailment_hook.lua +++ b/reframework/autorun/MHR_Overlay/Monsters/ailment_hook.lua @@ -1,4 +1,4 @@ -local ailment_hook = {}; +local this = {}; local small_monster; local large_monster; @@ -60,7 +60,7 @@ local blast_param_type = blast_param_field:get_type(); local blast_damage_method = blast_param_type:get_method("get_BlastDamage"); local blast_adjust_rate_method = blast_param_type:get_method("get_BlastDamageAdjustRateByEnemyLv"); -function ailment_hook.poison_proc(poison_param) +function this.poison_proc(poison_param) if poison_param == nil then return; end @@ -88,7 +88,7 @@ function ailment_hook.poison_proc(poison_param) ailments.clear_ailment_contribution(monster, ailments.poison_id); end -function ailment_hook.blast_proc(blast_param) +function this.blast_proc(blast_param) if blast_param == nil then return; end @@ -118,7 +118,7 @@ function ailment_hook.blast_proc(blast_param) ailments.clear_ailment_contribution(monster, ailments.blast_id); end -function ailment_hook.stock_damage() +function this.stock_damage() for enemy, monster in pairs(large_monster.list) do local damage_param = damage_param_field:get_data(enemy); if damage_param == nil then @@ -144,29 +144,29 @@ function ailment_hook.stock_damage() end end -function ailment_hook.init_module() +function this.init_module() small_monster = require("MHR_Overlay.Monsters.small_monster"); large_monster = require("MHR_Overlay.Monsters.large_monster"); config = require("MHR_Overlay.Misc.config"); ailments = require("MHR_Overlay.Monsters.ailments"); sdk.hook(stock_damage_method, function(args) - pcall(ailment_hook.stock_damage, sdk.to_managed_object(args[2])); + pcall(this.stock_damage, sdk.to_managed_object(args[2])); end, function(retval) return retval; end); sdk.hook(on_poison_activate_proc_method, function(args) - pcall(ailment_hook.poison_proc, sdk.to_managed_object(args[2])); + pcall(this.poison_proc, sdk.to_managed_object(args[2])); end, function(retval) return retval; end); sdk.hook(on_blast_activate_proc_method, function(args) - pcall(ailment_hook.blast_proc, sdk.to_managed_object(args[2])); + pcall(this.blast_proc, sdk.to_managed_object(args[2])); end, function(retval) return retval; end); end -return ailment_hook; +return this; diff --git a/reframework/autorun/MHR_Overlay/Monsters/ailments.lua b/reframework/autorun/MHR_Overlay/Monsters/ailments.lua index ba85d47..71d1ba1 100644 --- a/reframework/autorun/MHR_Overlay/Monsters/ailments.lua +++ b/reframework/autorun/MHR_Overlay/Monsters/ailments.lua @@ -1,4 +1,4 @@ -local ailments = {}; +local this = {}; local players; local language; @@ -60,29 +60,29 @@ local package = package; --15 Koyashi --16 SteelFang -ailments.paralyze_id = 0; -ailments.sleep_id = 1; -ailments.stun_id = 2; -ailments.flash_id = 3; -ailments.poison_id = 4; -ailments.blast_id = 5; -ailments.exhaust_id = 6; -ailments.ride_id = 7; -ailments.water_id = 8; -ailments.fire_id = 9; -ailments.ice_id = 10; -ailments.thunder_id = 11; -ailments.fall_trap_id = 12; -ailments.shock_trap_id = 13; -ailments.capture_id = 14 --tranq bomb -ailments.koyashi_id = 15; --dung bomb -ailments.steel_fang_id = 16; +this.paralyze_id = 0; +this.sleep_id = 1; +this.stun_id = 2; +this.flash_id = 3; +this.poison_id = 4; +this.blast_id = 5; +this.exhaust_id = 6; +this.ride_id = 7; +this.water_id = 8; +this.fire_id = 9; +this.ice_id = 10; +this.thunder_id = 11; +this.fall_trap_id = 12; +this.shock_trap_id = 13; +this.capture_id = 14 --tranq bomb +this.koyashi_id = 15; --dung bomb +this.steel_fang_id = 16; -ailments.fall_quick_sand_id = 17; -ailments.fall_otomo_trap_id = 18; -ailments.shock_otomo_trap_id = 19; +this.fall_quick_sand_id = 17; +this.fall_otomo_trap_id = 18; +this.shock_otomo_trap_id = 19; -function ailments.new(_ailments, ailment_id) +function this.new(_ailments, ailment_id) local new_ailment = {} new_ailment = {}; @@ -105,140 +105,140 @@ function ailments.new(_ailments, ailment_id) new_ailment.last_change_time = time.total_elapsed_script_seconds; - if ailment_id == ailments.paralyze_id then + if ailment_id == this.paralyze_id then new_ailment.name = language.current_language.ailments.paralysis; - elseif ailment_id == ailments.sleep_id then + elseif ailment_id == this.sleep_id then new_ailment.name = language.current_language.ailments.sleep; - elseif ailment_id == ailments.stun_id then + elseif ailment_id == this.stun_id then new_ailment.name = language.current_language.ailments.stun; - elseif ailment_id == ailments.flash_id then + elseif ailment_id == this.flash_id then new_ailment.name = language.current_language.ailments.flash; - elseif ailment_id == ailments.poison_id then + elseif ailment_id == this.poison_id then new_ailment.name = language.current_language.ailments.poison; - elseif ailment_id == ailments.blast_id then + elseif ailment_id == this.blast_id then new_ailment.name = language.current_language.ailments.blast; - elseif ailment_id == ailments.exhaust_id then + elseif ailment_id == this.exhaust_id then new_ailment.name = language.current_language.ailments.exhaust; - elseif ailment_id == ailments.ride_id then + elseif ailment_id == this.ride_id then new_ailment.name = language.current_language.ailments.ride; - elseif ailment_id == ailments.water_id then + elseif ailment_id == this.water_id then new_ailment.name = language.current_language.ailments.waterblight; - elseif ailment_id == ailments.fire_id then + elseif ailment_id == this.fire_id then new_ailment.name = language.current_language.ailments.fireblight; - elseif ailment_id == ailments.ice_id then + elseif ailment_id == this.ice_id then new_ailment.name = language.current_language.ailments.iceblight; - elseif ailment_id == ailments.thunder_id then + elseif ailment_id == this.thunder_id then new_ailment.name = language.current_language.ailments.thunderblight; - elseif ailment_id == ailments.fall_trap_id then + elseif ailment_id == this.fall_trap_id then new_ailment.name = language.current_language.ailments.fall_trap; - elseif ailment_id == ailments.shock_trap_id then + elseif ailment_id == this.shock_trap_id then new_ailment.name = language.current_language.ailments.shock_trap; - elseif ailment_id == ailments.capture_id then + elseif ailment_id == this.capture_id then new_ailment.name = language.current_language.ailments.tranq_bomb; - elseif ailment_id == ailments.koyashi_id then + elseif ailment_id == this.koyashi_id then new_ailment.name = language.current_language.ailments.dung_bomb; - elseif ailment_id == ailments.steel_fang_id then + elseif ailment_id == this.steel_fang_id then new_ailment.name = language.current_language.ailments.steel_fang; - elseif ailment_id == ailments.fall_quick_sand_id then + elseif ailment_id == this.fall_quick_sand_id then new_ailment.name = language.current_language.ailments.quick_sand; - elseif ailment_id == ailments.fall_otomo_trap_id then + elseif ailment_id == this.fall_otomo_trap_id then new_ailment.name = language.current_language.ailments.fall_otomo_trap; - elseif ailment_id == ailments.shock_otomo_trap_id then + elseif ailment_id == this.shock_otomo_trap_id then new_ailment.name = language.current_language.ailments.shock_otomo_trap; end _ailments[ailment_id] = new_ailment; end -function ailments.init_ailments() +function this.init_ailments() local _ailments = {}; - ailments.new(_ailments, ailments.paralyze_id); - ailments.new(_ailments, ailments.sleep_id); - ailments.new(_ailments, ailments.stun_id); - ailments.new(_ailments, ailments.flash_id); - ailments.new(_ailments, ailments.poison_id); - ailments.new(_ailments, ailments.blast_id); - ailments.new(_ailments, ailments.exhaust_id); - ailments.new(_ailments, ailments.ride_id); - ailments.new(_ailments, ailments.water_id); - ailments.new(_ailments, ailments.fire_id); - ailments.new(_ailments, ailments.ice_id); - ailments.new(_ailments, ailments.thunder_id); + this.new(_ailments, this.paralyze_id); + this.new(_ailments, this.sleep_id); + this.new(_ailments, this.stun_id); + this.new(_ailments, this.flash_id); + this.new(_ailments, this.poison_id); + this.new(_ailments, this.blast_id); + this.new(_ailments, this.exhaust_id); + this.new(_ailments, this.ride_id); + this.new(_ailments, this.water_id); + this.new(_ailments, this.fire_id); + this.new(_ailments, this.ice_id); + this.new(_ailments, this.thunder_id); - ailments.new(_ailments, ailments.fall_trap_id); - ailments.new(_ailments, ailments.shock_trap_id); - ailments.new(_ailments, ailments.capture_id); --tranq bomb - ailments.new(_ailments, ailments.koyashi_id); --dung bomb - ailments.new(_ailments, ailments.steel_fang_id); + this.new(_ailments, this.fall_trap_id); + this.new(_ailments, this.shock_trap_id); + this.new(_ailments, this.capture_id); --tranq bomb + this.new(_ailments, this.koyashi_id); --dung bomb + this.new(_ailments, this.steel_fang_id); --ailments.new(_ailments, ailments.fall_quick_sand_id); --ailments.new(_ailments, ailments.fall_otomo_trap_id); --ailments.new(_ailments, ailments.shock_otomo_trap_id); - _ailments[ailments.poison_id].buildup = {}; - _ailments[ailments.poison_id].buildup_share = {}; - _ailments[ailments.poison_id].cached_buildup_share = {}; + _ailments[this.poison_id].buildup = {}; + _ailments[this.poison_id].buildup_share = {}; + _ailments[this.poison_id].cached_buildup_share = {}; - _ailments[ailments.blast_id].buildup = {}; - _ailments[ailments.blast_id].buildup_share = {}; + _ailments[this.blast_id].buildup = {}; + _ailments[this.blast_id].buildup_share = {}; - _ailments[ailments.stun_id].buildup = {}; - _ailments[ailments.stun_id].buildup_share = {}; + _ailments[this.stun_id].buildup = {}; + _ailments[this.stun_id].buildup_share = {}; - _ailments[ailments.poison_id].otomo_buildup = {}; - _ailments[ailments.poison_id].otomo_buildup_share = {}; - _ailments[ailments.poison_id].cached_otomo_buildup_share = {}; + _ailments[this.poison_id].otomo_buildup = {}; + _ailments[this.poison_id].otomo_buildup_share = {}; + _ailments[this.poison_id].cached_otomo_buildup_share = {}; - _ailments[ailments.blast_id].otomo_buildup = {}; - _ailments[ailments.blast_id].otomo_buildup_share = {}; + _ailments[this.blast_id].otomo_buildup = {}; + _ailments[this.blast_id].otomo_buildup_share = {}; - _ailments[ailments.stun_id].otomo_buildup = {}; - _ailments[ailments.stun_id].otomo_buildup_share = {}; + _ailments[this.stun_id].otomo_buildup = {}; + _ailments[this.stun_id].otomo_buildup_share = {}; return _ailments; end -function ailments.init_ailment_names(_ailments) +function this.init_ailment_names(_ailments) for ailment_id, ailment in pairs(_ailments) do - if ailment_id == ailments.paralyze_id then + if ailment_id == this.paralyze_id then ailment.name = language.current_language.ailments.paralysis; - elseif ailment_id == ailments.sleep_id then + elseif ailment_id == this.sleep_id then ailment.name = language.current_language.ailments.sleep; - elseif ailment_id == ailments.stun_id then + elseif ailment_id == this.stun_id then ailment.name = language.current_language.ailments.stun; - elseif ailment_id == ailments.flash_id then + elseif ailment_id == this.flash_id then ailment.name = language.current_language.ailments.flash; - elseif ailment_id == ailments.poison_id then + elseif ailment_id == this.poison_id then ailment.name = language.current_language.ailments.poison; - elseif ailment_id == ailments.blast_id then + elseif ailment_id == this.blast_id then ailment.name = language.current_language.ailments.blast; - elseif ailment_id == ailments.exhaust_id then + elseif ailment_id == this.exhaust_id then ailment.name = language.current_language.ailments.exhaust; - elseif ailment_id == ailments.ride_id then + elseif ailment_id == this.ride_id then ailment.name = language.current_language.ailments.ride; - elseif ailment_id == ailments.water_id then + elseif ailment_id == this.water_id then ailment.name = language.current_language.ailments.waterblight; - elseif ailment_id == ailments.fire_id then + elseif ailment_id == this.fire_id then ailment.name = language.current_language.ailments.fireblight; - elseif ailment_id == ailments.ice_id then + elseif ailment_id == this.ice_id then ailment.name = language.current_language.ailments.iceblight; - elseif ailment_id == ailments.thunder_id then + elseif ailment_id == this.thunder_id then ailment.name = language.current_language.ailments.thunderblight; - elseif ailment_id == ailments.fall_trap_id then + elseif ailment_id == this.fall_trap_id then ailment.name = language.current_language.ailments.fall_trap; - elseif ailment_id == ailments.shock_trap_id then + elseif ailment_id == this.shock_trap_id then ailment.name = language.current_language.ailments.shock_trap; - elseif ailment_id == ailments.capture_id then + elseif ailment_id == this.capture_id then ailment.name = language.current_language.ailments.tranq_bomb; - elseif ailment_id == ailments.koyashi_id then + elseif ailment_id == this.koyashi_id then ailment.name = language.current_language.ailments.dung_bomb; - elseif ailment_id == ailments.steel_fang_id then + elseif ailment_id == this.steel_fang_id then ailment.name = language.current_language.ailments.steel_fang; - elseif ailment_id == ailments.fall_quick_sand_id then + elseif ailment_id == this.fall_quick_sand_id then ailment.name = language.current_language.ailments.quick_sand; - elseif ailment_id == ailments.fall_otomo_trap_id then + elseif ailment_id == this.fall_otomo_trap_id then ailment.name = language.current_language.ailments.fall_otomo_trap; - elseif ailment_id == ailments.shock_otomo_trap_id then + elseif ailment_id == this.shock_otomo_trap_id then ailment.name = language.current_language.ailments.shock_otomo_trap; end end @@ -274,7 +274,7 @@ local system_array_type_def = sdk.find_type_definition("System.Array"); local length_method = system_array_type_def:get_method("get_Length"); local get_value_method = system_array_type_def:get_method("GetValue(System.Int32)"); -function ailments.update_ailments(enemy, monster) +function this.update_ailments(enemy, monster) if enemy == nil then return; end @@ -283,7 +283,7 @@ function ailments.update_ailments(enemy, monster) return; end - ailments.update_stun_poison_blast_ailments(monster, damage_param); + this.update_stun_poison_blast_ailments(monster, damage_param); if not config.current_config.large_monster_UI.dynamic.ailments.visibility and not config.current_config.large_monster_UI.static.ailments.visibility @@ -307,7 +307,7 @@ function ailments.update_ailments(enemy, monster) end for id = 0, condition_param_array_length - 1 do - if id == ailments.stun_id or id == ailments.poison_id or id == ailments.blast_id then + if id == this.stun_id or id == this.poison_id or id == this.blast_id then goto continue end @@ -316,29 +316,29 @@ function ailments.update_ailments(enemy, monster) goto continue end - ailments.update_ailment(monster, ailment_param, id); + this.update_ailment(monster, ailment_param, id); ::continue:: end end -function ailments.update_stun_poison_blast_ailments(monster, damage_param) +function this.update_stun_poison_blast_ailments(monster, damage_param) local stun_param = stun_param_field:get_data(damage_param); if stun_param ~= nil then - ailments.update_ailment(monster, stun_param, ailments.stun_id); + this.update_ailment(monster, stun_param, this.stun_id); end local poison_param = poison_param_field:get_data(damage_param); if poison_param ~= nil then - ailments.update_ailment(monster, poison_param, ailments.poison_id); + this.update_ailment(monster, poison_param, this.poison_id); end local blast_param = blast_param_field:get_data(damage_param); if blast_param ~= nil then - ailments.update_ailment(monster, blast_param, ailments.blast_id); + this.update_ailment(monster, blast_param, this.blast_id); end end -function ailments.update_ailment(monster, ailment_param, id) +function this.update_ailment(monster, ailment_param, id) local is_enable = get_is_enable_method:call(ailment_param); local activate_count_array = get_activate_count_method:call(ailment_param); local buildup_array = get_stock_method:call(ailment_param); @@ -413,17 +413,17 @@ function ailments.update_ailment(monster, ailment_param, id) end if is_enable ~= monster.ailments[id].is_enable then - ailments.update_last_change_time(monster, id); + this.update_last_change_time(monster, id); end monster.ailments[id].is_enable = is_enable; if activate_count ~= nil then if activate_count ~= monster.ailments[id].activate_count then - ailments.update_last_change_time(monster, id); + this.update_last_change_time(monster, id); - if id == ailments.stun_id then - ailments.clear_ailment_contribution(monster, ailments.stun_id); + if id == this.stun_id then + this.clear_ailment_contribution(monster, this.stun_id); end end @@ -432,7 +432,7 @@ function ailments.update_ailment(monster, ailment_param, id) if buildup ~= nil then if buildup ~= monster.ailments[id].total_buildup then - ailments.update_last_change_time(monster, id); + this.update_last_change_time(monster, id); end monster.ailments[id].total_buildup = buildup; @@ -440,7 +440,7 @@ function ailments.update_ailment(monster, ailment_param, id) if buildup_limit ~= nil then if buildup_limit ~= monster.ailments[id].buildup_limit then - ailments.update_last_change_time(monster, id); + this.update_last_change_time(monster, id); end monster.ailments[id].buildup_limit = buildup_limit; @@ -452,7 +452,7 @@ function ailments.update_ailment(monster, ailment_param, id) if timer ~= nil then if timer ~= monster.ailments[id].timer then - ailments.update_last_change_time(monster, id); + this.update_last_change_time(monster, id); end monster.ailments[id].timer = timer; @@ -460,7 +460,7 @@ function ailments.update_ailment(monster, ailment_param, id) if is_active ~= nil then if is_active ~= monster.ailments[id].is_active then - ailments.update_last_change_time(monster, id); + this.update_last_change_time(monster, id); end monster.ailments[id].is_active = is_active; @@ -468,7 +468,7 @@ function ailments.update_ailment(monster, ailment_param, id) if duration ~= nil and not monster.ailments[id].is_active then if duration ~= monster.ailments[id].duration then - ailments.update_last_change_time(monster, id); + this.update_last_change_time(monster, id); end monster.ailments[id].duration = duration; @@ -495,12 +495,12 @@ function ailments.update_ailment(monster, ailment_param, id) end end -function ailments.update_last_change_time(monster, id) +function this.update_last_change_time(monster, id) monster.ailments[id].last_change_time = time.total_elapsed_script_seconds; end -- Code by coavins -function ailments.update_poison(monster, poison_param) +function this.update_poison(monster, poison_param) if monster == nil then return; end @@ -511,95 +511,95 @@ function ailments.update_poison(monster, poison_param) if is_damage then local poison_damage = poison_damage_field:get_data(poison_param); - ailments.apply_ailment_damage(monster, ailments.poison_id, poison_damage); + this.apply_ailment_damage(monster, this.poison_id, poison_damage); end end end -function ailments.draw(monster, ailment_UI, cached_config, ailments_position_on_screen, opacity_scale) +function this.draw(monster, ailment_UI, cached_config, ailments_position_on_screen, opacity_scale) local cached_config = cached_config.ailments; local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier; --sort parts here local displayed_ailments = {}; for id, ailment in pairs(monster.ailments) do - if id == ailments.paralyze_id then + if id == this.paralyze_id then if not cached_config.filter.paralysis then goto continue end - elseif id == ailments.sleep_id then + elseif id == this.sleep_id then if not cached_config.filter.sleep then goto continue end - elseif id == ailments.stun_id then + elseif id == this.stun_id then if not cached_config.filter.stun then goto continue end - elseif id == ailments.flash_id then + elseif id == this.flash_id then if not cached_config.filter.flash then goto continue end - elseif id == ailments.poison_id then + elseif id == this.poison_id then if not cached_config.filter.poison then goto continue end - elseif id == ailments.blast_id then + elseif id == this.blast_id then if not cached_config.filter.blast then goto continue end - elseif id == ailments.exhaust_id then + elseif id == this.exhaust_id then if not cached_config.filter.exhaust then goto continue end - elseif id == ailments.ride_id then + elseif id == this.ride_id then if not cached_config.filter.ride then goto continue end - elseif id == ailments.water_id then + elseif id == this.water_id then if not cached_config.filter.waterblight then goto continue end - elseif id == ailments.fire_id then + elseif id == this.fire_id then if not cached_config.filter.fireblight then goto continue end - elseif id == ailments.ice_id then + elseif id == this.ice_id then if not cached_config.filter.iceblight then goto continue end - elseif id == ailments.thunder_id then + elseif id == this.thunder_id then if not cached_config.filter.thunderblight then goto continue end - elseif id == ailments.fall_trap_id then + elseif id == this.fall_trap_id then if not cached_config.filter.fall_trap then goto continue end - elseif id == ailments.shock_trap_id then + elseif id == this.shock_trap_id then if not cached_config.filter.shock_trap then goto continue end - elseif id == ailments.capture_id then + elseif id == this.capture_id then if not cached_config.filter.tranq_bomb then goto continue end - elseif id == ailments.koyashi_id then + elseif id == this.koyashi_id then if not cached_config.filter.dung_bomb then goto continue end - elseif id == ailments.steel_fang_id then + elseif id == this.steel_fang_id then if not cached_config.filter.steel_fang then goto continue end - elseif id == ailments.fall_quick_sand_id then + elseif id == this.fall_quick_sand_id then if not cached_config.filter.quick_sand then goto continue end - elseif id == ailments.fall_otomo_trap_id then + elseif id == this.fall_otomo_trap_id then if not cached_config.filter.fall_otomo_trap then goto continue end - elseif id == ailments.shock_otomo_trap_id then + elseif id == this.shock_otomo_trap_id then if not cached_config.filter.shock_otomo_trap then goto continue end @@ -685,9 +685,9 @@ function ailments.draw(monster, ailment_UI, cached_config, ailments_position_on_ end -function ailments.apply_ailment_buildup(monster, player, otomo, ailment_type, ailment_buildup) +function this.apply_ailment_buildup(monster, player, otomo, ailment_type, ailment_buildup) if monster == nil or - (ailment_type ~= ailments.poison_id and ailment_type ~= ailments.blast_id and ailment_type ~= ailments.stun_id) + (ailment_type ~= this.poison_id and ailment_type ~= this.blast_id and ailment_type ~= this.stun_id) or (ailment_buildup == 0 or ailment_buildup == nil) then return; end @@ -709,11 +709,11 @@ function ailments.apply_ailment_buildup(monster, player, otomo, ailment_type, ai end - ailments.calculate_ailment_contribution(monster, ailment_type); + this.calculate_ailment_contribution(monster, ailment_type); end -- Code by coavins -function ailments.calculate_ailment_contribution(monster, ailment_type) +function this.calculate_ailment_contribution(monster, ailment_type) -- get total local total = 0; for player, player_buildup in pairs(monster.ailments[ailment_type].buildup) do @@ -739,7 +739,7 @@ function ailments.calculate_ailment_contribution(monster, ailment_type) end end -function ailments.clear_ailment_contribution(monster, ailment_type) +function this.clear_ailment_contribution(monster, ailment_type) monster.ailments[ailment_type].buildup = {}; monster.ailments[ailment_type].otomo_buildup = {}; @@ -748,7 +748,7 @@ function ailments.clear_ailment_contribution(monster, ailment_type) end -- Code by coavins -function ailments.apply_ailment_damage(monster, ailment_type, ailment_damage) +function this.apply_ailment_damage(monster, ailment_type, ailment_damage) -- we only track poison and blast for now if ailment_type == nil or ailment_damage == nil then return; @@ -759,13 +759,13 @@ function ailments.apply_ailment_damage(monster, ailment_type, ailment_damage) local buildup_share = monster.ailments[ailment_type].buildup_share; local otomo_buildup_share = monster.ailments[ailment_type].otomo_buildup_share; - if ailment_type == ailments.poison_id then + if ailment_type == this.poison_id then damage_source_type = "poison"; otomo_damage_source_type = "otomo poison"; buildup_share = monster.ailments[ailment_type].cached_buildup_share; otomo_buildup_share = monster.ailments[ailment_type].cached_otomo_buildup_share; - elseif ailment_type == ailments.blast_id then + elseif ailment_type == this.blast_id then damage_source_type = "blast"; otomo_damage_source_type = "otomo blast"; else @@ -813,7 +813,7 @@ function ailments.apply_ailment_damage(monster, ailment_type, ailment_damage) players.update_damage(players.total, damage_source_type, monster.is_large, damage_object); end -function ailments.init_module() +function this.init_module() players = require("MHR_Overlay.Damage_Meter.players"); non_players = require("MHR_Overlay.Damage_Meter.non_players"); language = require("MHR_Overlay.Misc.language"); @@ -825,4 +825,4 @@ function ailments.init_module() large_monster = require("MHR_Overlay.Monsters.large_monster"); end -return ailments; +return this; diff --git a/reframework/autorun/MHR_Overlay/Monsters/body_part.lua b/reframework/autorun/MHR_Overlay/Monsters/body_part.lua index 822c7af..6849e55 100644 --- a/reframework/autorun/MHR_Overlay/Monsters/body_part.lua +++ b/reframework/autorun/MHR_Overlay/Monsters/body_part.lua @@ -1,4 +1,4 @@ -local body_part = {}; +local this = {}; local singletons; local customization_menu; @@ -44,9 +44,9 @@ local os = os; local ValueType = ValueType; local package = package; -body_part.list = {}; +this.list = {}; -function body_part.new(id, name) +function this.new(id, name) local part = {}; part.id = id; @@ -73,7 +73,7 @@ function body_part.new(id, name) return part; end -function body_part.update_flinch(part, part_current, part_max) +function this.update_flinch(part, part_current, part_max) if part_current > part.health then part.flinch_count = part.flinch_count + 1; end @@ -94,7 +94,7 @@ function body_part.update_flinch(part, part_current, part_max) end end -function body_part.update_break(part, part_break_current, part_break_max, part_break_count, part_break_max_count) +function this.update_break(part, part_break_current, part_break_max, part_break_count, part_break_max_count) if part.break_health ~= part_break_current then part.last_change_time = time.total_elapsed_script_seconds; @@ -123,7 +123,7 @@ function body_part.update_break(part, part_break_current, part_break_max, part_b end end -function body_part.update_loss(part, part_loss_current, part_loss_max, is_severed) +function this.update_loss(part, part_loss_current, part_loss_max, is_severed) if part.loss_health ~= part_loss_current then part.last_change_time = time.total_elapsed_script_seconds; end @@ -147,7 +147,7 @@ function body_part.update_loss(part, part_loss_current, part_loss_max, is_severe end -function body_part.draw(monster, part_UI, cached_config, parts_position_on_screen, opacity_scale) +function this.draw(monster, part_UI, cached_config, parts_position_on_screen, opacity_scale) local cached_config = cached_config.body_parts; local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier; @@ -340,7 +340,7 @@ function body_part.draw(monster, part_UI, cached_config, parts_position_on_scree return last_part_position_on_screen; end -function body_part.init_module() +function this.init_module() singletons = require("MHR_Overlay.Game_Handler.singletons"); customization_menu = require("MHR_Overlay.UI.customization_menu"); config = require("MHR_Overlay.Misc.config"); @@ -354,4 +354,4 @@ function body_part.init_module() time = require("MHR_Overlay.Game_Handler.time"); end -return body_part; +return this; diff --git a/reframework/autorun/MHR_Overlay/Monsters/large_monster.lua b/reframework/autorun/MHR_Overlay/Monsters/large_monster.lua index 3b6dce3..5e7cc3e 100644 --- a/reframework/autorun/MHR_Overlay/Monsters/large_monster.lua +++ b/reframework/autorun/MHR_Overlay/Monsters/large_monster.lua @@ -1,4 +1,4 @@ -local large_monster = {}; +local this = {}; local singletons; local customization_menu; @@ -52,9 +52,9 @@ local os = os; local ValueType = ValueType; local package = package; -large_monster.list = {}; +this.list = {}; -function large_monster.new(enemy) +function this.new(enemy) local monster = {}; monster.enemy = enemy; monster.is_large = true; @@ -124,35 +124,35 @@ function large_monster.new(enemy) monster.static_UI = {}; monster.highlighted_UI = {}; - large_monster.init(monster, enemy); - large_monster.init_UI(monster, monster.dynamic_UI, config.current_config.large_monster_UI.dynamic); - large_monster.init_UI(monster, monster.static_UI, config.current_config.large_monster_UI.static); - large_monster.init_UI(monster, monster.highlighted_UI, config.current_config.large_monster_UI.highlighted); + this.init(monster, enemy); + this.init_UI(monster, monster.dynamic_UI, config.current_config.large_monster_UI.dynamic); + this.init_UI(monster, monster.static_UI, config.current_config.large_monster_UI.static); + this.init_UI(monster, monster.highlighted_UI, config.current_config.large_monster_UI.highlighted); - large_monster.update_position(enemy, monster); + this.update_position(enemy, monster); - local physical_param = large_monster.update_health(enemy, monster); + local physical_param = this.update_health(enemy, monster); - large_monster.update_stamina(enemy, monster, nil); - large_monster.update_stamina_timer(enemy, monster, nil); + this.update_stamina(enemy, monster, nil); + this.update_stamina_timer(enemy, monster, nil); - large_monster.update_rage(enemy, monster, nil); - large_monster.update_rage_timer(enemy, monster, nil); + this.update_rage(enemy, monster, nil); + this.update_rage_timer(enemy, monster, nil); - large_monster.update(enemy, monster); - pcall(large_monster.update_parts, enemy, monster, physical_param); + this.update(enemy, monster); + pcall(this.update_parts, enemy, monster, physical_param); - if large_monster.list[enemy] == nil then - large_monster.list[enemy] = monster; + if this.list[enemy] == nil then + this.list[enemy] = monster; end return monster; end -function large_monster.get_monster(enemy) - local monster = large_monster.list[enemy]; +function this.get_monster(enemy) + local monster = this.list[enemy]; if monster == nil then - monster = large_monster.new(enemy); + monster = this.new(enemy); end return monster; end @@ -178,7 +178,7 @@ local get_set_info_method = enemy_character_base_type_def:get_method("get_SetInf local set_info_type = get_set_info_method:get_return_type(); local get_unique_id_method = set_info_type:get_method("get_UniqueId"); -function large_monster.init(monster, enemy) +function this.init(monster, enemy) local enemy_type = enemy_type_field:get_data(enemy); if enemy_type == nil then customization_menu.status = "No enemy type"; @@ -257,7 +257,7 @@ function large_monster.init(monster, enemy) monster.is_capturable = is_capture_enable and not is_anomaly; end -function large_monster.init_UI(monster, monster_UI, cached_config) +function this.init_UI(monster, monster_UI, cached_config) local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier; monster_UI.monster_name_label = utils.table.deep_copy(cached_config.monster_name_label); @@ -383,7 +383,7 @@ local system_array_type_def = sdk.find_type_definition("System.Array"); local length_method = system_array_type_def:get_method("get_Length"); local get_value_method = system_array_type_def:get_method("GetValue(System.Int32)"); -function large_monster.update_position(enemy, monster) +function this.update_position(enemy, monster) if not config.current_config.large_monster_UI.dynamic.enabled and config.current_config.large_monster_UI.static.sorting.type ~= "Distance" then return; @@ -396,8 +396,8 @@ function large_monster.update_position(enemy, monster) end -- Code by coavins -function large_monster.update_all_riders() - for enemy, monster in pairs(large_monster.list) do +function this.update_all_riders() + for enemy, monster in pairs(this.list) do -- get marionette rider local mario_param = enemy:get_field("k__BackingField"); if mario_param ~= nil then @@ -422,7 +422,7 @@ function large_monster.update_all_riders() end -function large_monster.update(enemy, monster) +function this.update(enemy, monster) local cached_config = config.current_config.large_monster_UI; if not cached_config.dynamic.enabled @@ -471,7 +471,7 @@ function large_monster.update(enemy, monster) pcall(ailments.update_ailments, enemy, monster); end -function large_monster.update_health(enemy, monster) +function this.update_health(enemy, monster) local cached_config = config.current_config.large_monster_UI; if not cached_config.dynamic.enabled @@ -511,7 +511,7 @@ function large_monster.update_health(enemy, monster) return physical_param; end -function large_monster.update_stamina(enemy, monster, stamina_param) +function this.update_stamina(enemy, monster, stamina_param) local cached_config = config.current_config.large_monster_UI; if not cached_config.dynamic.enabled @@ -548,7 +548,7 @@ function large_monster.update_stamina(enemy, monster, stamina_param) end end -function large_monster.update_stamina_timer(enemy, monster, stamina_param) +function this.update_stamina_timer(enemy, monster, stamina_param) local cached_config = config.current_config.large_monster_UI; if not cached_config.dynamic.enabled @@ -595,7 +595,7 @@ function large_monster.update_stamina_timer(enemy, monster, stamina_param) end end -function large_monster.update_rage(enemy, monster, anger_param) +function this.update_rage(enemy, monster, anger_param) local cached_config = config.current_config.large_monster_UI; if not cached_config.dynamic.enabled @@ -627,7 +627,7 @@ function large_monster.update_rage(enemy, monster, anger_param) end end -function large_monster.update_rage_timer(enemy, monster, anger_param) +function this.update_rage_timer(enemy, monster, anger_param) local cached_config = config.current_config.large_monster_UI; if not cached_config.dynamic.enabled @@ -673,7 +673,7 @@ function large_monster.update_rage_timer(enemy, monster, anger_param) end end -function large_monster.update_parts(enemy, monster, physical_param) +function this.update_parts(enemy, monster, physical_param) local cached_config = config.current_config.large_monster_UI; if not cached_config.dynamic.enabled @@ -807,7 +807,7 @@ function large_monster.update_parts(enemy, monster, physical_param) end end -function large_monster.draw(monster, type, cached_config, position_on_screen, opacity_scale) +function this.draw(monster, type, cached_config, position_on_screen, opacity_scale) local monster_UI; if type == "dynamic" then @@ -904,11 +904,11 @@ function large_monster.draw(monster, type, cached_config, position_on_screen, op drawing.draw_label(monster_UI.monster_name_label, position_on_screen, opacity_scale, monster_name_text); end -function large_monster.init_list() - large_monster.list = {}; +function this.init_list() + this.list = {}; end -function large_monster.init_module() +function this.init_module() singletons = require("MHR_Overlay.Game_Handler.singletons"); customization_menu = require("MHR_Overlay.UI.customization_menu"); language = require("MHR_Overlay.Misc.language"); @@ -931,4 +931,4 @@ function large_monster.init_module() ailment_buildup = require("MHR_Overlay.Monsters.ailment_buildup"); end -return large_monster; \ No newline at end of file +return this; \ No newline at end of file diff --git a/reframework/autorun/MHR_Overlay/Monsters/monster_hook.lua b/reframework/autorun/MHR_Overlay/Monsters/monster_hook.lua index c558ec1..fbc7504 100644 --- a/reframework/autorun/MHR_Overlay/Monsters/monster_hook.lua +++ b/reframework/autorun/MHR_Overlay/Monsters/monster_hook.lua @@ -1,4 +1,4 @@ -local monster_hook = {}; +local this = {}; local small_monster; local large_monster; @@ -87,7 +87,7 @@ re.on_pre_application_entry("UpdateBehavior", function() end end) -function monster_hook.update_monster(enemy) +function this.update_monster(enemy) if enemy == nil then return; end @@ -108,13 +108,13 @@ function monster_hook.update_monster(enemy) end if is_large then - monster_hook.update_large_monster(enemy); + this.update_large_monster(enemy); else - monster_hook.update_small_monster(enemy); + this.update_small_monster(enemy); end end -function monster_hook.update_large_monster(enemy) +function this.update_large_monster(enemy) local cached_config = config.current_config.large_monster_UI; if not cached_config.dynamic.enabled and @@ -161,7 +161,7 @@ function monster_hook.update_large_monster(enemy) large_monster.update(enemy, monster); end -function monster_hook.update_small_monster(enemy) +function this.update_small_monster(enemy) if not config.current_config.small_monster_UI.enabled then return; end @@ -198,7 +198,7 @@ function monster_hook.update_small_monster(enemy) end end -function monster_hook.update_health(enemy_damage_check) +function this.update_health(enemy_damage_check) local enemy = get_ref_enemy:call(enemy_damage_check); if enemy == nil then return; @@ -220,7 +220,7 @@ function monster_hook.update_health(enemy_damage_check) end end -function monster_hook.update_stamina(stamina_param, stamina_sub) +function this.update_stamina(stamina_param, stamina_sub) if stamina_sub <= 0 then return; end @@ -234,12 +234,12 @@ function monster_hook.update_stamina(stamina_param, stamina_sub) large_monster.update_stamina(enemy, monster, stamina_param); end -function monster_hook.update_stamina_timer(stamina_param, enemy) +function this.update_stamina_timer(stamina_param, enemy) local monster = large_monster.get_monster(enemy); large_monster.update_stamina_timer(enemy, monster, stamina_param); end -function monster_hook.update_rage(anger_param, anger_add, enemy) +function this.update_rage(anger_param, anger_add, enemy) if anger_add <= 0 then return; end @@ -248,12 +248,12 @@ function monster_hook.update_rage(anger_param, anger_add, enemy) large_monster.update_rage(enemy, monster, anger_param); end -function monster_hook.update_rage_timer(anger_param, enemy) +function this.update_rage_timer(anger_param, enemy) local monster = large_monster.get_monster(enemy); large_monster.update_rage_timer(enemy, monster, anger_param); end -function monster_hook.init_module() +function this.init_module() small_monster = require("MHR_Overlay.Monsters.small_monster"); large_monster = require("MHR_Overlay.Monsters.large_monster"); config = require("MHR_Overlay.Misc.config"); @@ -262,29 +262,29 @@ function monster_hook.init_module() quest_status = require("MHR_Overlay.Game_Handler.quest_status"); sdk.hook(enemy_character_base_update_method, function(args) - pcall(monster_hook.update_monster, sdk.to_managed_object(args[2])); + pcall(this.update_monster, sdk.to_managed_object(args[2])); end, function(retval) return retval; end); sdk.hook(damage_check_update_param_update_method, function(args) - pcall(monster_hook.update_health, sdk.to_managed_object(args[2])); + pcall(this.update_health, sdk.to_managed_object(args[2])); end, function(retval) return retval; end); sdk.hook(stamina_sub_method, function(args) - pcall(monster_hook.update_stamina, sdk.to_managed_object(args[2]), sdk.to_float(args[3])); + pcall(this.update_stamina, sdk.to_managed_object(args[2]), sdk.to_float(args[3])); end, function(retval) return retval; end); sdk.hook(anger_add_method, function(args) - pcall(monster_hook.update_rage, sdk.to_managed_object(args[2]), sdk.to_float(args[3]), + pcall(this.update_rage, sdk.to_managed_object(args[2]), sdk.to_float(args[3]), sdk.to_managed_object(args[4])); end, function(retval) return retval; end); end -return monster_hook; +return this; diff --git a/reframework/autorun/MHR_Overlay/Monsters/small_monster.lua b/reframework/autorun/MHR_Overlay/Monsters/small_monster.lua index d3e584e..fd31917 100644 --- a/reframework/autorun/MHR_Overlay/Monsters/small_monster.lua +++ b/reframework/autorun/MHR_Overlay/Monsters/small_monster.lua @@ -1,4 +1,4 @@ -local small_monster = {}; +local this = {}; local singletons; local customization_menu; @@ -45,9 +45,9 @@ local os = os; local ValueType = ValueType; local package = package; -small_monster.list = {}; +this.list = {}; -function small_monster.new(enemy) +function this.new(enemy) local monster = {}; monster.is_large = false; @@ -66,24 +66,24 @@ function small_monster.new(enemy) monster.UI = {}; - small_monster.init(monster, enemy); - small_monster.init_UI(monster); + this.init(monster, enemy); + this.init_UI(monster); - small_monster.update_position(enemy, monster); - small_monster.update_health(enemy, monster); - small_monster.update(enemy, monster); + this.update_position(enemy, monster); + this.update_health(enemy, monster); + this.update(enemy, monster); - if small_monster.list[enemy] == nil then - small_monster.list[enemy] = monster; + if this.list[enemy] == nil then + this.list[enemy] = monster; end return monster; end -function small_monster.get_monster(enemy) - local monster = small_monster.list[enemy]; +function this.get_monster(enemy) + local monster = this.list[enemy]; if monster == nil then - monster = small_monster.new(enemy); + monster = this.new(enemy); end return monster; @@ -95,7 +95,7 @@ local enemy_type_field = enemy_character_base_type_def:get_field("k__ local message_manager_type_def = sdk.find_type_definition("snow.gui.MessageManager"); local get_enemy_name_message_method = message_manager_type_def:get_method("getEnemyNameMessage"); -function small_monster.init(monster, enemy) +function this.init(monster, enemy) local enemy_type = enemy_type_field:get_data(enemy); if enemy_type == nil then customization_menu.status = "No enemy type"; @@ -110,7 +110,7 @@ function small_monster.init(monster, enemy) end end -function small_monster.init_UI(monster) +function this.init_UI(monster) local cached_config = config.current_config.small_monster_UI; local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier; @@ -163,7 +163,7 @@ local get_max_method = vital_param_type:get_method("get_Max"); local get_pos_field = enemy_character_base_type_def:get_method("get_Pos"); -function small_monster.update_position(enemy, monster) +function this.update_position(enemy, monster) local cached_config = config.current_config.small_monster_UI; if not cached_config.enabled then @@ -180,7 +180,7 @@ function small_monster.update_position(enemy, monster) end end -function small_monster.update(enemy, monster) +function this.update(enemy, monster) if not config.current_config.small_monster_UI.enabled then return; end @@ -193,7 +193,7 @@ function small_monster.update(enemy, monster) pcall(ailments.update_ailments, enemy, monster); end -function small_monster.update_health(enemy, monster) +function this.update_health(enemy, monster) if not config.current_config.small_monster_UI.enabled or not config.current_config.small_monster_UI.health.visibility then return; end @@ -220,7 +220,7 @@ function small_monster.update_health(enemy, monster) end end -function small_monster.draw(monster, cached_config, position_on_screen, opacity_scale) +function this.draw(monster, cached_config, position_on_screen, opacity_scale) local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier; drawing.draw_label(monster.UI.name_label, position_on_screen, opacity_scale, monster.name); @@ -245,11 +245,11 @@ function small_monster.draw(monster, cached_config, position_on_screen, opacity_ ailment_buildup.draw(monster, monster.UI.ailment_buildup_UI, cached_config, ailment_buildups_position_on_screen, opacity_scale); end -function small_monster.init_list() - small_monster.list = {}; +function this.init_list() + this.list = {}; end -function small_monster.init_module() +function this.init_module() singletons = require("MHR_Overlay.Game_Handler.singletons"); customization_menu = require("MHR_Overlay.UI.customization_menu"); config = require("MHR_Overlay.Misc.config"); @@ -264,4 +264,4 @@ function small_monster.init_module() ailment_buildup_UI_entity = require("MHR_Overlay.UI.UI_Entities.ailment_buildup_UI_entity"); end -return small_monster; +return this; diff --git a/reframework/autorun/MHR_Overlay/UI/Customizations/ailment_buildups_customization.lua b/reframework/autorun/MHR_Overlay/UI/Customizations/ailment_buildups_customization.lua index 67097c0..751757a 100644 --- a/reframework/autorun/MHR_Overlay/UI/Customizations/ailment_buildups_customization.lua +++ b/reframework/autorun/MHR_Overlay/UI/Customizations/ailment_buildups_customization.lua @@ -1,4 +1,4 @@ -local ailment_buildups_customization = {}; +local this = {}; local utils; local config; @@ -47,7 +47,7 @@ local os = os; local ValueType = ValueType; local package = package; -function ailment_buildups_customization.draw(cached_config) +function this.draw(cached_config) local changed = false; local config_changed = false; local index = 1; @@ -200,7 +200,7 @@ function ailment_buildups_customization.draw(cached_config) return config_changed; end -function ailment_buildups_customization.init_module() +function this.init_module() utils = require("MHR_Overlay.Misc.utils"); language = require("MHR_Overlay.Misc.language"); config = require("MHR_Overlay.Misc.config"); @@ -218,4 +218,4 @@ function ailment_buildups_customization.init_module() bar_customization = require("MHR_Overlay.UI.Customizations.bar_customization"); end -return ailment_buildups_customization; \ No newline at end of file +return this; \ No newline at end of file diff --git a/reframework/autorun/MHR_Overlay/UI/Customizations/ailments_customization.lua b/reframework/autorun/MHR_Overlay/UI/Customizations/ailments_customization.lua index 6e940a0..1535907 100644 --- a/reframework/autorun/MHR_Overlay/UI/Customizations/ailments_customization.lua +++ b/reframework/autorun/MHR_Overlay/UI/Customizations/ailments_customization.lua @@ -1,4 +1,4 @@ -local ailments_customization = {}; +local this = {}; local utils; local config; @@ -47,7 +47,7 @@ local os = os; local ValueType = ValueType; local package = package; -function ailments_customization.draw(cached_config) +function this.draw(cached_config) local changed = false; local config_changed = false; local index = 0; @@ -365,7 +365,7 @@ function ailments_customization.draw(cached_config) return config_changed; end -function ailments_customization.init_module() +function this.init_module() utils = require("MHR_Overlay.Misc.utils"); language = require("MHR_Overlay.Misc.language"); config = require("MHR_Overlay.Misc.config"); @@ -382,4 +382,4 @@ function ailments_customization.init_module() bar_customization = require("MHR_Overlay.UI.Customizations.bar_customization"); end -return ailments_customization; \ No newline at end of file +return this; \ No newline at end of file diff --git a/reframework/autorun/MHR_Overlay/UI/Customizations/bar_customization.lua b/reframework/autorun/MHR_Overlay/UI/Customizations/bar_customization.lua index 5e73cc8..b697262 100644 --- a/reframework/autorun/MHR_Overlay/UI/Customizations/bar_customization.lua +++ b/reframework/autorun/MHR_Overlay/UI/Customizations/bar_customization.lua @@ -1,4 +1,4 @@ -local bar_customization = {}; +local this = {}; local utils; local config; @@ -46,7 +46,7 @@ local os = os; local ValueType = ValueType; local package = package; -function bar_customization.draw(bar_name, bar) +function this.draw(bar_name, bar) if bar == nil then return false; end @@ -191,7 +191,7 @@ function bar_customization.draw(bar_name, bar) return bar_changed; end -function bar_customization.init_module() +function this.init_module() utils = require("MHR_Overlay.Misc.utils"); language = require("MHR_Overlay.Misc.language"); config = require("MHR_Overlay.Misc.config"); @@ -207,4 +207,4 @@ function bar_customization.init_module() line_customization = require("MHR_Overlay.UI.Customizations.line_customization"); end -return bar_customization; +return this; diff --git a/reframework/autorun/MHR_Overlay/UI/Customizations/body_parts_customization.lua b/reframework/autorun/MHR_Overlay/UI/Customizations/body_parts_customization.lua index 91ac6dc..3e4e062 100644 --- a/reframework/autorun/MHR_Overlay/UI/Customizations/body_parts_customization.lua +++ b/reframework/autorun/MHR_Overlay/UI/Customizations/body_parts_customization.lua @@ -1,4 +1,4 @@ -local body_parts_customization = {}; +local this = {}; local utils; local config; @@ -47,7 +47,7 @@ local os = os; local ValueType = ValueType; local package = package; -function body_parts_customization.draw(cached_config) +function this.draw(cached_config) local changed = false; local config_changed = false; local index = 0; @@ -368,7 +368,7 @@ function body_parts_customization.draw(cached_config) return config_changed; end -function body_parts_customization.init_module() +function this.init_module() utils = require("MHR_Overlay.Misc.utils"); language = require("MHR_Overlay.Misc.language"); config = require("MHR_Overlay.Misc.config"); @@ -385,4 +385,4 @@ function body_parts_customization.init_module() bar_customization = require("MHR_Overlay.UI.Customizations.bar_customization"); end -return body_parts_customization; \ No newline at end of file +return this; \ No newline at end of file diff --git a/reframework/autorun/MHR_Overlay/UI/Customizations/health_customization.lua b/reframework/autorun/MHR_Overlay/UI/Customizations/health_customization.lua index 5d55a73..6efe13d 100644 --- a/reframework/autorun/MHR_Overlay/UI/Customizations/health_customization.lua +++ b/reframework/autorun/MHR_Overlay/UI/Customizations/health_customization.lua @@ -1,4 +1,4 @@ -local large_monster_UI_customization = {}; +local this = {}; local config; local screen; @@ -46,7 +46,7 @@ local os = os; local ValueType = ValueType; local package = package; -function large_monster_UI_customization.draw(cached_config) +function this.draw(cached_config) local changed = false; local config_changed = false; @@ -88,7 +88,7 @@ function large_monster_UI_customization.draw(cached_config) return config_changed; end -function large_monster_UI_customization.init_module() +function this.init_module() language = require("MHR_Overlay.Misc.language"); config = require("MHR_Overlay.Misc.config"); screen = require("MHR_Overlay.Game_Handler.screen"); @@ -104,4 +104,4 @@ function large_monster_UI_customization.init_module() bar_customization = require("MHR_Overlay.UI.Customizations.bar_customization"); end -return large_monster_UI_customization; \ No newline at end of file +return this; \ No newline at end of file diff --git a/reframework/autorun/MHR_Overlay/UI/Customizations/label_customization.lua b/reframework/autorun/MHR_Overlay/UI/Customizations/label_customization.lua index fbb9ec7..37d9337 100644 --- a/reframework/autorun/MHR_Overlay/UI/Customizations/label_customization.lua +++ b/reframework/autorun/MHR_Overlay/UI/Customizations/label_customization.lua @@ -1,4 +1,4 @@ -local label_customization = {}; +local this = {}; local config; local screen; @@ -44,7 +44,7 @@ local os = os; local ValueType = ValueType; local package = package; -function label_customization.draw(label_name, label) +function this.draw(label_name, label) local label_changed = false; local changed = false; @@ -115,7 +115,7 @@ function label_customization.draw(label_name, label) return label_changed; end -function label_customization.init_module() +function this.init_module() language = require("MHR_Overlay.Misc.language"); config = require("MHR_Overlay.Misc.config"); screen = require("MHR_Overlay.Game_Handler.screen"); @@ -129,4 +129,4 @@ function label_customization.init_module() customization_menu = require("MHR_Overlay.UI.customization_menu"); end -return label_customization; +return this; diff --git a/reframework/autorun/MHR_Overlay/UI/Customizations/large_monster_UI_customization.lua b/reframework/autorun/MHR_Overlay/UI/Customizations/large_monster_UI_customization.lua index 9aef7d8..150da47 100644 --- a/reframework/autorun/MHR_Overlay/UI/Customizations/large_monster_UI_customization.lua +++ b/reframework/autorun/MHR_Overlay/UI/Customizations/large_monster_UI_customization.lua @@ -1,4 +1,4 @@ -local large_monster_UI_customization = {}; +local this = {}; local config; local screen; @@ -53,7 +53,7 @@ local os = os; local ValueType = ValueType; local package = package; -function large_monster_UI_customization.draw(cached_config) +function this.draw(cached_config) local changed = false; local config_changed = false; @@ -81,7 +81,7 @@ function large_monster_UI_customization.draw(cached_config) return config_changed; end -function large_monster_UI_customization.init_module() +function this.init_module() language = require("MHR_Overlay.Misc.language"); config = require("MHR_Overlay.Misc.config"); screen = require("MHR_Overlay.Game_Handler.screen"); @@ -104,4 +104,4 @@ function large_monster_UI_customization.init_module() ailment_buildups_customization = require("MHR_Overlay.UI.Customizations.ailment_buildups_customization"); end -return large_monster_UI_customization; \ No newline at end of file +return this; \ No newline at end of file diff --git a/reframework/autorun/MHR_Overlay/UI/Customizations/line_customization.lua b/reframework/autorun/MHR_Overlay/UI/Customizations/line_customization.lua index a332a33..cc7aebb 100644 --- a/reframework/autorun/MHR_Overlay/UI/Customizations/line_customization.lua +++ b/reframework/autorun/MHR_Overlay/UI/Customizations/line_customization.lua @@ -1,4 +1,4 @@ -local line_customization = {}; +local this = {}; local config; local screen; @@ -44,7 +44,7 @@ local os = os; local ValueType = ValueType; local package = package; -function line_customization.draw(line_name, line) +function this.draw(line_name, line) if line == nil then return; end @@ -95,7 +95,7 @@ function line_customization.draw(line_name, line) return line_changed; end -function line_customization.init_module() +function this.init_module() language = require("MHR_Overlay.Misc.language"); config = require("MHR_Overlay.Misc.config"); screen = require("MHR_Overlay.Game_Handler.screen"); @@ -109,4 +109,4 @@ function line_customization.init_module() customization_menu = require("MHR_Overlay.UI.customization_menu"); end -return line_customization; +return this; diff --git a/reframework/autorun/MHR_Overlay/UI/Customizations/module_visibility_customization.lua b/reframework/autorun/MHR_Overlay/UI/Customizations/module_visibility_customization.lua index d59216e..e678a41 100644 --- a/reframework/autorun/MHR_Overlay/UI/Customizations/module_visibility_customization.lua +++ b/reframework/autorun/MHR_Overlay/UI/Customizations/module_visibility_customization.lua @@ -1,4 +1,4 @@ -local module_visibility_customization = {}; +local this = {}; local config; local screen; @@ -46,7 +46,7 @@ local os = os; local ValueType = ValueType; local package = package; -function module_visibility_customization.draw(cached_config) +function this.draw(cached_config) local changed = false; local config_changed = false; @@ -101,7 +101,7 @@ function module_visibility_customization.draw(cached_config) return config_changed; end -function module_visibility_customization.init_module() +function this.init_module() language = require("MHR_Overlay.Misc.language"); config = require("MHR_Overlay.Misc.config"); screen = require("MHR_Overlay.Game_Handler.screen"); @@ -115,4 +115,4 @@ function module_visibility_customization.init_module() customization_menu = require("MHR_Overlay.UI.customization_menu"); end -return module_visibility_customization; \ No newline at end of file +return this; \ No newline at end of file diff --git a/reframework/autorun/MHR_Overlay/UI/Customizations/rage_customization.lua b/reframework/autorun/MHR_Overlay/UI/Customizations/rage_customization.lua index 5c121e2..03f490c 100644 --- a/reframework/autorun/MHR_Overlay/UI/Customizations/rage_customization.lua +++ b/reframework/autorun/MHR_Overlay/UI/Customizations/rage_customization.lua @@ -1,4 +1,4 @@ -local rage_customization = {}; +local this = {}; local config; local screen; @@ -46,7 +46,7 @@ local os = os; local ValueType = ValueType; local package = package; -function rage_customization.draw(cached_config) +function this.draw(cached_config) local changed = false; local config_changed = false; @@ -91,7 +91,7 @@ function rage_customization.draw(cached_config) return config_changed; end -function rage_customization.init_module() +function this.init_module() language = require("MHR_Overlay.Misc.language"); config = require("MHR_Overlay.Misc.config"); screen = require("MHR_Overlay.Game_Handler.screen"); @@ -107,4 +107,4 @@ function rage_customization.init_module() bar_customization = require("MHR_Overlay.UI.Customizations.bar_customization"); end -return rage_customization; \ No newline at end of file +return this; \ No newline at end of file diff --git a/reframework/autorun/MHR_Overlay/UI/Customizations/stamina_customization.lua b/reframework/autorun/MHR_Overlay/UI/Customizations/stamina_customization.lua index 9da0a3b..1b08d09 100644 --- a/reframework/autorun/MHR_Overlay/UI/Customizations/stamina_customization.lua +++ b/reframework/autorun/MHR_Overlay/UI/Customizations/stamina_customization.lua @@ -1,4 +1,4 @@ -local stamina_customization = {}; +local this = {}; local config; local screen; @@ -46,7 +46,7 @@ local os = os; local ValueType = ValueType; local package = package; -function stamina_customization.draw(cached_config) +function this.draw(cached_config) local changed = false; local config_changed = false; @@ -91,7 +91,7 @@ function stamina_customization.draw(cached_config) return config_changed; end -function stamina_customization.init_module() +function this.init_module() language = require("MHR_Overlay.Misc.language"); config = require("MHR_Overlay.Misc.config"); screen = require("MHR_Overlay.Game_Handler.screen"); @@ -107,4 +107,4 @@ function stamina_customization.init_module() bar_customization = require("MHR_Overlay.UI.Customizations.bar_customization"); end -return stamina_customization; \ No newline at end of file +return this; \ No newline at end of file diff --git a/reframework/autorun/MHR_Overlay/UI/Modules/buff_UI.lua b/reframework/autorun/MHR_Overlay/UI/Modules/buff_UI.lua index fa9c7c6..6002f0b 100644 --- a/reframework/autorun/MHR_Overlay/UI/Modules/buff_UI.lua +++ b/reframework/autorun/MHR_Overlay/UI/Modules/buff_UI.lua @@ -1,4 +1,4 @@ -local buff_UI = {}; +local this = {}; local buff_UI_entity; local config; @@ -37,7 +37,7 @@ local os = os; local ValueType = ValueType; local package = package; -function buff_UI.draw() +function this.draw() local cached_config = config.current_config.buff_UI; local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier; @@ -110,7 +110,7 @@ function buff_UI.draw() end end -function buff_UI.init_module() +function this.init_module() config = require("MHR_Overlay.Misc.config"); buff_UI_entity = require("MHR_Overlay.UI.UI_Entities.buff_UI_entity"); buffs = require("MHR_Overlay.Buffs.buffs"); @@ -124,4 +124,4 @@ function buff_UI.init_module() --drawing = require("MHR_Overlay.UI.drawing"); end -return buff_UI; \ No newline at end of file +return this; \ No newline at end of file diff --git a/reframework/autorun/MHR_Overlay/UI/Modules/damage_meter_UI.lua b/reframework/autorun/MHR_Overlay/UI/Modules/damage_meter_UI.lua index 8835526..c96c78b 100644 --- a/reframework/autorun/MHR_Overlay/UI/Modules/damage_meter_UI.lua +++ b/reframework/autorun/MHR_Overlay/UI/Modules/damage_meter_UI.lua @@ -1,4 +1,4 @@ -local damage_meter_UI = {}; +local this = {}; local singletons; local config; @@ -43,8 +43,8 @@ local os = os; local ValueType = ValueType; local package = package; -damage_meter_UI.last_displayed_players = {}; -damage_meter_UI.freeze_displayed_players = false; +this.last_displayed_players = {}; +this.freeze_displayed_players = false; local lobby_manager_type_def = sdk.find_type_definition("snow.LobbyManager"); local quest_hunter_info_field = lobby_manager_type_def:get_field("_questHunterInfo"); @@ -57,7 +57,7 @@ local get_item_method = quest_hunter_info_type_def:get_method("get_Item"); local hunter_info_type_def = sdk.find_type_definition("snow.LobbyManager.HunterInfo"); local member_index_field = hunter_info_type_def:get_field("_memberIndex"); -function damage_meter_UI.draw() +function this.draw() local cached_config = config.current_config.damage_meter_UI; local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier; @@ -67,13 +67,13 @@ function damage_meter_UI.draw() local quest_players = {}; - if damage_meter_UI.freeze_displayed_players and not utils.table.is_empty(damage_meter_UI.last_displayed_players) then - quest_players = damage_meter_UI.last_displayed_players; + if this.freeze_displayed_players and not utils.table.is_empty(this.last_displayed_players) then + quest_players = this.last_displayed_players; else quest_players = players.display_list; end - damage_meter_UI.last_displayed_players = quest_players; + this.last_displayed_players = quest_players; local top_damage = 0; local top_dps = 0; @@ -175,7 +175,7 @@ function damage_meter_UI.draw() end end -function damage_meter_UI.init_module() +function this.init_module() singletons = require("MHR_Overlay.Game_Handler.singletons"); config = require("MHR_Overlay.Misc.config"); customization_menu = require("MHR_Overlay.UI.customization_menu"); @@ -188,4 +188,4 @@ function damage_meter_UI.init_module() utils = require("MHR_Overlay.Misc.utils"); end -return damage_meter_UI; +return this; diff --git a/reframework/autorun/MHR_Overlay/UI/Modules/env_creature_UI.lua b/reframework/autorun/MHR_Overlay/UI/Modules/env_creature_UI.lua index e596fca..edfafb7 100644 --- a/reframework/autorun/MHR_Overlay/UI/Modules/env_creature_UI.lua +++ b/reframework/autorun/MHR_Overlay/UI/Modules/env_creature_UI.lua @@ -1,4 +1,4 @@ -local env_creature_UI = {}; +local this = {}; local singletons; local config; @@ -46,7 +46,7 @@ local package = package; local enemy_manager_type_def = sdk.find_type_definition("snow.enemy.EnemyManager"); -function env_creature_UI.draw() +function this.draw() if singletons.enemy_manager == nil then return; end @@ -94,7 +94,7 @@ function env_creature_UI.draw() end end -function env_creature_UI.init_module() +function this.init_module() singletons = require("MHR_Overlay.Game_Handler.singletons"); config = require("MHR_Overlay.Misc.config"); customization_menu = require("MHR_Overlay.UI.customization_menu"); @@ -108,4 +108,4 @@ function env_creature_UI.init_module() env_creature = require("MHR_Overlay.Endemic_Life.env_creature"); end -return env_creature_UI; +return this; diff --git a/reframework/autorun/MHR_Overlay/UI/Modules/large_monster_UI.lua b/reframework/autorun/MHR_Overlay/UI/Modules/large_monster_UI.lua index 6fd993c..4b3d5c5 100644 --- a/reframework/autorun/MHR_Overlay/UI/Modules/large_monster_UI.lua +++ b/reframework/autorun/MHR_Overlay/UI/Modules/large_monster_UI.lua @@ -1,4 +1,4 @@ -local large_monster_UI = {}; +local this = {}; local singletons; local config; @@ -53,7 +53,7 @@ local get_tg_camera_method = gui_manager_type_def:get_method("get_refGuiHud_TgCa local tg_camera_type_def = get_tg_camera_method:get_return_type(); local get_targeting_enemy_index_field = tg_camera_type_def:get_field("OldTargetingEmIndex"); -function large_monster_UI.draw(dynamic_enabled, static_enabled, highlighted_enabled) +function this.draw(dynamic_enabled, static_enabled, highlighted_enabled) local cached_config = config.current_config.large_monster_UI; if singletons.enemy_manager == nil then @@ -153,27 +153,27 @@ function large_monster_UI.draw(dynamic_enabled, static_enabled, highlighted_enab end if dynamic_enabled then - local success = pcall(large_monster_UI.draw_dynamic, displayed_monsters, highlighted_monster, cached_config); + local success = pcall(this.draw_dynamic, displayed_monsters, highlighted_monster, cached_config); if not success then customization_menu.status = string.format("[%s] Dynamic Large Monster drawing function threw an exception"); end end if highlighted_enabled then - local success = pcall(large_monster_UI.draw_highlighted, highlighted_monster, cached_config); + local success = pcall(this.draw_highlighted, highlighted_monster, cached_config); if not success then customization_menu.status = string.format("[%s] Highlighted Large Monster drawing function threw an exception"); end end if static_enabled then - local success = pcall(large_monster_UI.draw_static, displayed_monsters, highlighted_monster, cached_config); + local success = pcall(this.draw_static, displayed_monsters, highlighted_monster, cached_config); if not success then customization_menu.status = string.format("[%s] Static Large Monster drawing function threw an exception"); end end end -function large_monster_UI.draw_dynamic(displayed_monsters, highlighted_monster, cached_config) +function this.draw_dynamic(displayed_monsters, highlighted_monster, cached_config) cached_config = cached_config.dynamic; local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier; @@ -230,7 +230,7 @@ function large_monster_UI.draw_dynamic(displayed_monsters, highlighted_monster, end end -function large_monster_UI.draw_static(displayed_monsters, highlighted_monster, cached_config) +function this.draw_static(displayed_monsters, highlighted_monster, cached_config) cached_config = cached_config.static; local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier; @@ -311,7 +311,7 @@ function large_monster_UI.draw_static(displayed_monsters, highlighted_monster, c end end -function large_monster_UI.draw_highlighted(monster, cached_config) +function this.draw_highlighted(monster, cached_config) cached_config = cached_config.highlighted; if monster == nil then @@ -327,7 +327,7 @@ function large_monster_UI.draw_highlighted(monster, cached_config) large_monster.draw(monster, "highlighted", cached_config, position_on_screen, 1); end -function large_monster_UI.init_module() +function this.init_module() singletons = require("MHR_Overlay.Game_Handler.singletons"); config = require("MHR_Overlay.Misc.config"); customization_menu = require("MHR_Overlay.UI.customization_menu"); @@ -340,4 +340,4 @@ function large_monster_UI.init_module() rage_UI_entity = require("MHR_Overlay.UI.UI_Entities.rage_UI_entity"); end -return large_monster_UI; +return this; diff --git a/reframework/autorun/MHR_Overlay/UI/Modules/small_monster_UI.lua b/reframework/autorun/MHR_Overlay/UI/Modules/small_monster_UI.lua index ec826d8..c78beb1 100644 --- a/reframework/autorun/MHR_Overlay/UI/Modules/small_monster_UI.lua +++ b/reframework/autorun/MHR_Overlay/UI/Modules/small_monster_UI.lua @@ -1,4 +1,4 @@ -local small_monster_UI = {}; +local this = {}; local singletons; local config; @@ -46,7 +46,7 @@ local enemy_manager_type_def = sdk.find_type_definition("snow.enemy.EnemyManager local get_zako_enemy_count_method = enemy_manager_type_def:get_method("getZakoEnemyCount"); local get_zako_enemy_method = enemy_manager_type_def:get_method("getZakoEnemy"); -function small_monster_UI.draw() +function this.draw() if singletons.enemy_manager == nil then return; end @@ -186,7 +186,7 @@ function small_monster_UI.draw() end end -function small_monster_UI.init_module() +function this.init_module() singletons = require("MHR_Overlay.Game_Handler.singletons"); config = require("MHR_Overlay.Misc.config"); customization_menu = require("MHR_Overlay.UI.customization_menu"); @@ -198,4 +198,4 @@ function small_monster_UI.init_module() stamina_UI_entity = require("MHR_Overlay.UI.UI_Entities.stamina_UI_entity"); end -return small_monster_UI; +return this; diff --git a/reframework/autorun/MHR_Overlay/UI/Modules/time_UI.lua b/reframework/autorun/MHR_Overlay/UI/Modules/time_UI.lua index 7344406..12ca62b 100644 --- a/reframework/autorun/MHR_Overlay/UI/Modules/time_UI.lua +++ b/reframework/autorun/MHR_Overlay/UI/Modules/time_UI.lua @@ -1,4 +1,4 @@ -local time_UI = {}; +local this = {}; local time; local screen; @@ -38,9 +38,9 @@ local os = os; local ValueType = ValueType; local package = package; -time_UI.label = nil; +this.label = nil; -function time_UI.draw() +function this.draw() local elapsed_minutes = time.elapsed_minutes; local elapsed_seconds = time.elapsed_seconds; @@ -50,26 +50,26 @@ function time_UI.draw() local position_on_screen = screen.calculate_absolute_coordinates(config.current_config.time_UI.position); - drawing.draw_label(time_UI.label, position_on_screen, 1, elapsed_minutes, elapsed_seconds); + drawing.draw_label(this.label, position_on_screen, 1, elapsed_minutes, elapsed_seconds); end -function time_UI.init_UI() - time_UI.label = utils.table.deep_copy(config.current_config.time_UI.time_label); +function this.init_UI() + this.label = utils.table.deep_copy(config.current_config.time_UI.time_label); local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier; - time_UI.label.offset.x = time_UI.label.offset.x * global_scale_modifier; - time_UI.label.offset.y = time_UI.label.offset.y * global_scale_modifier; + this.label.offset.x = this.label.offset.x * global_scale_modifier; + this.label.offset.y = this.label.offset.y * global_scale_modifier; end -function time_UI.init_module() +function this.init_module() time = require("MHR_Overlay.Game_Handler.time"); screen = require("MHR_Overlay.Game_Handler.screen"); config = require("MHR_Overlay.Misc.config"); drawing = require("MHR_Overlay.UI.drawing"); utils = require("MHR_Overlay.Misc.utils"); - time_UI.init_UI() + this.init_UI() end -return time_UI; +return this; diff --git a/reframework/autorun/MHR_Overlay/UI/UI_Entities/ailment_UI_entity.lua b/reframework/autorun/MHR_Overlay/UI/UI_Entities/ailment_UI_entity.lua index d8808c2..3192f2a 100644 --- a/reframework/autorun/MHR_Overlay/UI/UI_Entities/ailment_UI_entity.lua +++ b/reframework/autorun/MHR_Overlay/UI/UI_Entities/ailment_UI_entity.lua @@ -1,4 +1,4 @@ -local ailment_UI_entity = {}; +local this = {}; local config; local utils; @@ -37,7 +37,7 @@ local os = os; local ValueType = ValueType; local package = package; -function ailment_UI_entity.new(visibility, bar, name_label, text_label, value_label, percentage_label, timer_label) +function this.new(visibility, bar, name_label, text_label, value_label, percentage_label, timer_label) local entity = {}; local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier; @@ -75,7 +75,7 @@ function ailment_UI_entity.new(visibility, bar, name_label, text_label, value_la return entity; end -function ailment_UI_entity.draw(ailment, ailment_UI, cached_config, position_on_screen, opacity_scale) +function this.draw(ailment, ailment_UI, cached_config, position_on_screen, opacity_scale) if not ailment_UI.visibility then return; end @@ -118,11 +118,11 @@ function ailment_UI_entity.draw(ailment, ailment_UI, cached_config, position_on_ end end -function ailment_UI_entity.init_module() +function this.init_module() utils = require("MHR_Overlay.Misc.utils"); drawing = require("MHR_Overlay.UI.drawing"); config = require("MHR_Overlay.Misc.config"); language = require("MHR_Overlay.Misc.language"); end -return ailment_UI_entity; +return this; diff --git a/reframework/autorun/MHR_Overlay/UI/UI_Entities/ailment_buildup_UI_entity.lua b/reframework/autorun/MHR_Overlay/UI/UI_Entities/ailment_buildup_UI_entity.lua index 1b54b4e..704a623 100644 --- a/reframework/autorun/MHR_Overlay/UI/UI_Entities/ailment_buildup_UI_entity.lua +++ b/reframework/autorun/MHR_Overlay/UI/UI_Entities/ailment_buildup_UI_entity.lua @@ -1,4 +1,4 @@ -local ailment_buildup_UI_entity = {}; +local this = {}; local utils; local drawing; @@ -38,7 +38,7 @@ local os = os; local ValueType = ValueType; local package = package; -function ailment_buildup_UI_entity.new(buildup_bar, highlighted_buildup_bar, ailment_name_label, player_name_label, +function this.new(buildup_bar, highlighted_buildup_bar, ailment_name_label, player_name_label, buildup_value_label, buildup_percentage_label, total_buildup_label, total_buildup_value_label) local entity = {}; @@ -88,7 +88,7 @@ function ailment_buildup_UI_entity.new(buildup_bar, highlighted_buildup_bar, ail return entity; end -function ailment_buildup_UI_entity.draw(player, player_buildup, ailment_buildup_UI, cached_config, position_on_screen, opacity_scale, top_buildup) +function this.draw(player, player_buildup, ailment_buildup_UI, cached_config, position_on_screen, opacity_scale, top_buildup) local player_buildup_bar_percentage = 0; if cached_config.settings.buildup_bar_relative_to == "Total Buildup" then @@ -117,7 +117,7 @@ function ailment_buildup_UI_entity.draw(player, player_buildup, ailment_buildup_ drawing.draw_label(ailment_buildup_UI.buildup_percentage_label, position_on_screen, opacity_scale, 100 * player_buildup.buildup_share); end -function ailment_buildup_UI_entity.init_module() +function this.init_module() utils = require("MHR_Overlay.Misc.utils"); drawing = require("MHR_Overlay.UI.drawing"); config = require("MHR_Overlay.Misc.config"); @@ -125,4 +125,4 @@ function ailment_buildup_UI_entity.init_module() language = require("MHR_Overlay.Misc.language"); end -return ailment_buildup_UI_entity; +return this; diff --git a/reframework/autorun/MHR_Overlay/UI/UI_Entities/body_part_UI_entity.lua b/reframework/autorun/MHR_Overlay/UI/UI_Entities/body_part_UI_entity.lua index 9081321..cde69e0 100644 --- a/reframework/autorun/MHR_Overlay/UI/UI_Entities/body_part_UI_entity.lua +++ b/reframework/autorun/MHR_Overlay/UI/UI_Entities/body_part_UI_entity.lua @@ -1,4 +1,4 @@ -local body_part_UI_entity = {}; +local this = {}; local config; local utils; @@ -36,7 +36,7 @@ local os = os; local ValueType = ValueType; local package = package; -function body_part_UI_entity.new(part_visibility, part_name_label, flinch_visibility, flinch_bar, flinch_text_label, +function this.new(part_visibility, part_name_label, flinch_visibility, flinch_bar, flinch_text_label, flinch_value_label, flinch_percentage_label, break_visibility, break_bar, break_text_label, break_value_label, break_percentage_label, loss_visibility, loss_bar, loss_text_label, loss_value_label, loss_health_percentage_label) @@ -120,7 +120,7 @@ function body_part_UI_entity.new(part_visibility, part_name_label, flinch_visibi return entity; end -function body_part_UI_entity.draw(part, part_UI, cached_config, position_on_screen, opacity_scale) +function this.draw(part, part_UI, cached_config, position_on_screen, opacity_scale) if not part_UI.part_visibility then return; end @@ -250,10 +250,10 @@ function body_part_UI_entity.draw(part, part_UI, cached_config, position_on_scre end end -function body_part_UI_entity.init_module() +function this.init_module() utils = require("MHR_Overlay.Misc.utils"); drawing = require("MHR_Overlay.UI.drawing"); config = require("MHR_Overlay.Misc.config"); end -return body_part_UI_entity; +return this; diff --git a/reframework/autorun/MHR_Overlay/UI/UI_Entities/buff_UI_entity.lua b/reframework/autorun/MHR_Overlay/UI/UI_Entities/buff_UI_entity.lua index 9b5058b..42d9d2f 100644 --- a/reframework/autorun/MHR_Overlay/UI/UI_Entities/buff_UI_entity.lua +++ b/reframework/autorun/MHR_Overlay/UI/UI_Entities/buff_UI_entity.lua @@ -1,4 +1,4 @@ -local buff_UI_entity = {}; +local this = {}; local config; local utils; @@ -37,7 +37,7 @@ local os = os; local ValueType = ValueType; local package = package; -function buff_UI_entity.new(bar, name_label, timer_label) +function this.new(bar, name_label, timer_label) local entity = {}; local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier; @@ -63,7 +63,7 @@ function buff_UI_entity.new(bar, name_label, timer_label) return entity; end -function buff_UI_entity.draw(buff, buff_UI, position_on_screen, opacity_scale) +function this.draw(buff, buff_UI, position_on_screen, opacity_scale) local cached_config = config.current_config.buff_UI; if not buff.is_infinite then @@ -81,11 +81,11 @@ function buff_UI_entity.draw(buff, buff_UI, position_on_screen, opacity_scale) end end -function buff_UI_entity.init_module() +function this.init_module() utils = require("MHR_Overlay.Misc.utils"); drawing = require("MHR_Overlay.UI.drawing"); config = require("MHR_Overlay.Misc.config"); language = require("MHR_Overlay.Misc.language"); end -return buff_UI_entity; \ No newline at end of file +return this; \ No newline at end of file diff --git a/reframework/autorun/MHR_Overlay/UI/UI_Entities/damage_UI_entity.lua b/reframework/autorun/MHR_Overlay/UI/UI_Entities/damage_UI_entity.lua index 2682ae0..1948155 100644 --- a/reframework/autorun/MHR_Overlay/UI/UI_Entities/damage_UI_entity.lua +++ b/reframework/autorun/MHR_Overlay/UI/UI_Entities/damage_UI_entity.lua @@ -1,4 +1,4 @@ -local damage_UI_entity = {}; +local this = {}; local utils; local drawing; @@ -40,7 +40,7 @@ local os = os; local ValueType = ValueType; local package = package; -function damage_UI_entity.new(damage_meter_UI_elements, type) +function this.new(damage_meter_UI_elements, type) local entity = {}; local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier; @@ -111,7 +111,7 @@ function damage_UI_entity.new(damage_meter_UI_elements, type) return entity; end -function damage_UI_entity.draw(player, position_on_screen, opacity_scale, top_damage, top_dps) +function this.draw(player, position_on_screen, opacity_scale, top_damage, top_dps) local cached_config = config.current_config.damage_meter_UI; local name_include = nil; @@ -233,7 +233,7 @@ function damage_UI_entity.draw(player, position_on_screen, opacity_scale, top_da end end -function damage_UI_entity.init_module() +function this.init_module() utils = require("MHR_Overlay.Misc.utils"); drawing = require("MHR_Overlay.UI.drawing"); config = require("MHR_Overlay.Misc.config"); @@ -243,4 +243,4 @@ function damage_UI_entity.init_module() non_players = require("MHR_Overlay.Damage_Meter.non_players"); end -return damage_UI_entity; +return this; diff --git a/reframework/autorun/MHR_Overlay/UI/UI_Entities/health_UI_entity.lua b/reframework/autorun/MHR_Overlay/UI/UI_Entities/health_UI_entity.lua index b0ee955..5cac172 100644 --- a/reframework/autorun/MHR_Overlay/UI/UI_Entities/health_UI_entity.lua +++ b/reframework/autorun/MHR_Overlay/UI/UI_Entities/health_UI_entity.lua @@ -1,4 +1,4 @@ -local health_UI_entity = {}; +local this = {}; local utils; local drawing; @@ -37,7 +37,7 @@ local os = os; local ValueType = ValueType; local package = package; -function health_UI_entity.new(visibility, bar, text_label, value_label, percentage_label) +function this.new(visibility, bar, text_label, value_label, percentage_label) local entity = {}; local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier; @@ -67,7 +67,7 @@ function health_UI_entity.new(visibility, bar, text_label, value_label, percenta return entity; end -function health_UI_entity.draw(monster, health_UI, position_on_screen, opacity_scale) +function this.draw(monster, health_UI, position_on_screen, opacity_scale) if not health_UI.visibility then return; end @@ -91,11 +91,11 @@ function health_UI_entity.draw(monster, health_UI, position_on_screen, opacity_s drawing.draw_label(health_UI.percentage_label, position_on_screen, opacity_scale, 100 * monster.health_percentage); end -function health_UI_entity.init_module() +function this.init_module() utils = require("MHR_Overlay.Misc.utils"); drawing = require("MHR_Overlay.UI.drawing"); language = require("MHR_Overlay.Misc.language"); config = require("MHR_Overlay.Misc.config"); end -return health_UI_entity; +return this; diff --git a/reframework/autorun/MHR_Overlay/UI/UI_Entities/rage_UI_entity.lua b/reframework/autorun/MHR_Overlay/UI/UI_Entities/rage_UI_entity.lua index 627a837..9866c19 100644 --- a/reframework/autorun/MHR_Overlay/UI/UI_Entities/rage_UI_entity.lua +++ b/reframework/autorun/MHR_Overlay/UI/UI_Entities/rage_UI_entity.lua @@ -1,4 +1,4 @@ -local rage_UI_entity = {}; +local this = {}; local utils; local drawing; @@ -37,7 +37,7 @@ local os = os; local ValueType = ValueType; local package = package; -function rage_UI_entity.new(visibility, bar, text_label, value_label, percentage_label, timer_label) +function this.new(visibility, bar, text_label, value_label, percentage_label, timer_label) local entity = {}; local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier; @@ -71,7 +71,7 @@ function rage_UI_entity.new(visibility, bar, text_label, value_label, percentage return entity; end -function rage_UI_entity.draw(monster, rage_UI, position_on_screen, opacity_scale) +function this.draw(monster, rage_UI, position_on_screen, opacity_scale) if not rage_UI.visibility then return; end @@ -105,11 +105,11 @@ function rage_UI_entity.draw(monster, rage_UI, position_on_screen, opacity_scale end end -function rage_UI_entity.init_module() +function this.init_module() utils = require("MHR_Overlay.Misc.utils"); drawing = require("MHR_Overlay.UI.drawing"); language = require("MHR_Overlay.Misc.language"); config = require("MHR_Overlay.Misc.config"); end -return rage_UI_entity; +return this; diff --git a/reframework/autorun/MHR_Overlay/UI/UI_Entities/stamina_UI_entity.lua b/reframework/autorun/MHR_Overlay/UI/UI_Entities/stamina_UI_entity.lua index beaf4e4..f030313 100644 --- a/reframework/autorun/MHR_Overlay/UI/UI_Entities/stamina_UI_entity.lua +++ b/reframework/autorun/MHR_Overlay/UI/UI_Entities/stamina_UI_entity.lua @@ -1,4 +1,4 @@ -local stamina_UI_entity = {}; +local this = {}; local utils; local drawing; @@ -37,7 +37,7 @@ local os = os; local ValueType = ValueType; local package = package; -function stamina_UI_entity.new(visibility, bar, text_label, value_label, percentage_label, timer_label) +function this.new(visibility, bar, text_label, value_label, percentage_label, timer_label) local entity = {}; local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier; @@ -69,7 +69,7 @@ function stamina_UI_entity.new(visibility, bar, text_label, value_label, percent return entity; end -function stamina_UI_entity.draw(monster, stamina_UI, position_on_screen, opacity_scale) +function this.draw(monster, stamina_UI, position_on_screen, opacity_scale) if not stamina_UI.visibility then return; end @@ -102,11 +102,11 @@ function stamina_UI_entity.draw(monster, stamina_UI, position_on_screen, opacity end end -function stamina_UI_entity.init_module() +function this.init_module() utils = require("MHR_Overlay.Misc.utils"); drawing = require("MHR_Overlay.UI.drawing"); language = require("MHR_Overlay.Misc.language"); config = require("MHR_Overlay.Misc.config"); end -return stamina_UI_entity; +return this; diff --git a/reframework/autorun/MHR_Overlay/UI/customization_menu.lua b/reframework/autorun/MHR_Overlay/UI/customization_menu.lua index f01318e..319cf41 100644 --- a/reframework/autorun/MHR_Overlay/UI/customization_menu.lua +++ b/reframework/autorun/MHR_Overlay/UI/customization_menu.lua @@ -1,4 +1,4 @@ -local customization_menu = {}; +local this = {}; local utils; local config; @@ -61,65 +61,65 @@ local os = os; local ValueType = ValueType; local package = package; -customization_menu.font = nil; -customization_menu.font_range = {0x1, 0xFFFF, 0}; -customization_menu.is_opened = false; -customization_menu.status = "OK"; +this.font = nil; +this.font_range = {0x1, 0xFFFF, 0}; +this.is_opened = false; +this.status = "OK"; -customization_menu.window_position = Vector2f.new(480, 200); -customization_menu.window_pivot = Vector2f.new(0, 0); -customization_menu.window_size = Vector2f.new(720, 720); -customization_menu.window_flags = 0x10120; -customization_menu.color_picker_flags = 327680; -customization_menu.decimal_input_flags = 33; +this.window_position = Vector2f.new(480, 200); +this.window_pivot = Vector2f.new(0, 0); +this.window_size = Vector2f.new(720, 720); +this.window_flags = 0x10120; +this.color_picker_flags = 327680; +this.decimal_input_flags = 33; -customization_menu.displayed_orientation_types = {}; -customization_menu.displayed_anchor_types = {}; -customization_menu.displayed_outline_styles = {}; +this.displayed_orientation_types = {}; +this.displayed_anchor_types = {}; +this.displayed_outline_styles = {}; -customization_menu.displayed_monster_UI_sorting_types = {}; -customization_menu.displayed_large_monster_UI_parts_sorting_types = {}; -customization_menu.displayed_large_monster_UI_parts_filter_types = {}; -customization_menu.displayed_ailments_sorting_types = {}; -customization_menu.displayed_ailment_buildups_sorting_types = {}; -customization_menu.displayed_highlighted_buildup_bar_types = {}; -customization_menu.displayed_buildup_bar_relative_types = {}; -customization_menu.displayed_buff_UI_sorting_types = {}; +this.displayed_monster_UI_sorting_types = {}; +this.displayed_large_monster_UI_parts_sorting_types = {}; +this.displayed_large_monster_UI_parts_filter_types = {}; +this.displayed_ailments_sorting_types = {}; +this.displayed_ailment_buildups_sorting_types = {}; +this.displayed_highlighted_buildup_bar_types = {}; +this.displayed_buildup_bar_relative_types = {}; +this.displayed_buff_UI_sorting_types = {}; -customization_menu.displayed_damage_meter_UI_highlighted_entity_types = {}; -customization_menu.displayed_damage_meter_UI_damage_bar_relative_types = {}; -customization_menu.displayed_damage_meter_UI_my_damage_bar_location_types = {}; -customization_menu.displayed_damage_meter_UI_total_damage_location_types = {}; -customization_menu.displayed_damage_meter_UI_sorting_types = {}; -customization_menu.displayed_damage_meter_UI_dps_modes = {}; +this.displayed_damage_meter_UI_highlighted_entity_types = {}; +this.displayed_damage_meter_UI_damage_bar_relative_types = {}; +this.displayed_damage_meter_UI_my_damage_bar_location_types = {}; +this.displayed_damage_meter_UI_total_damage_location_types = {}; +this.displayed_damage_meter_UI_sorting_types = {}; +this.displayed_damage_meter_UI_dps_modes = {}; -customization_menu.displayed_auto_highlight_modes = {}; +this.displayed_auto_highlight_modes = {}; -customization_menu.orientation_types = {}; -customization_menu.anchor_types = {}; -customization_menu.outline_styles = {}; +this.orientation_types = {}; +this.anchor_types = {}; +this.outline_styles = {}; -customization_menu.monster_UI_sorting_types = {}; -customization_menu.large_monster_UI_parts_sorting_types = {}; -customization_menu.large_monster_UI_parts_filter_types = {}; -customization_menu.ailments_sorting_types = {}; -customization_menu.ailment_buildups_sorting_types = {}; -customization_menu.highlighted_buildup_bar_types = {}; -customization_menu.buildup_bar_relative_types = {}; -customization_menu.buff_UI_sorting_types = {}; +this.monster_UI_sorting_types = {}; +this.large_monster_UI_parts_sorting_types = {}; +this.large_monster_UI_parts_filter_types = {}; +this.ailments_sorting_types = {}; +this.ailment_buildups_sorting_types = {}; +this.highlighted_buildup_bar_types = {}; +this.buildup_bar_relative_types = {}; +this.buff_UI_sorting_types = {}; -customization_menu.damage_meter_UI_highlighted_entity_types = {}; -customization_menu.damage_meter_UI_damage_bar_relative_types = {}; -customization_menu.damage_meter_UI_my_damage_bar_location_types = {}; -customization_menu.damage_meter_UI_total_damage_location_types = {}; -customization_menu.damage_meter_UI_sorting_types = {}; -customization_menu.damage_meter_UI_dps_modes = {}; +this.damage_meter_UI_highlighted_entity_types = {}; +this.damage_meter_UI_damage_bar_relative_types = {}; +this.damage_meter_UI_my_damage_bar_location_types = {}; +this.damage_meter_UI_total_damage_location_types = {}; +this.damage_meter_UI_sorting_types = {}; +this.damage_meter_UI_dps_modes = {}; -customization_menu.auto_highlight_modes = {}; +this.auto_highlight_modes = {}; -customization_menu.fonts = {"Arial", "Arial Black", "Bahnschrift", "Calibri", "Cambria", "Cambria Math", "Candara", +this.fonts = {"Arial", "Arial Black", "Bahnschrift", "Calibri", "Cambria", "Cambria Math", "Candara", "Comic Sans MS", "Consolas", "Constantia", "Corbel", "Courier New", "Ebrima", "Franklin Gothic Medium", "Gabriola", "Gadugi", "Georgia", "HoloLens MDL2 Assets", "Impact", "Ink Free", "Javanese Text", "Leelawadee UI", "Lucida Console", "Lucida Sans Unicode", @@ -132,69 +132,69 @@ customization_menu.fonts = {"Arial", "Arial Black", "Bahnschrift", "Calibri", "C "Trebuchet MS", "Verdana", "Webdings", "Wingdings", "Yu Gothic" }; -customization_menu.all_UI_waiting_for_key = false; -customization_menu.small_monster_UI_waiting_for_key = false; -customization_menu.large_monster_UI_waiting_for_key = false; -customization_menu.large_monster_dynamic_UI_waiting_for_key = false; -customization_menu.large_monster_static_UI_waiting_for_key = false; -customization_menu.large_monster_highlighted_UI_waiting_for_key = false; -customization_menu.time_UI_waiting_for_key = false; -customization_menu.damage_meter_UI_waiting_for_key = false; -customization_menu.endemic_life_UI_waiting_for_key = false; -customization_menu.menu_font_changed = false; +this.all_UI_waiting_for_key = false; +this.small_monster_UI_waiting_for_key = false; +this.large_monster_UI_waiting_for_key = false; +this.large_monster_dynamic_UI_waiting_for_key = false; +this.large_monster_static_UI_waiting_for_key = false; +this.large_monster_highlighted_UI_waiting_for_key = false; +this.time_UI_waiting_for_key = false; +this.damage_meter_UI_waiting_for_key = false; +this.endemic_life_UI_waiting_for_key = false; +this.menu_font_changed = false; -customization_menu.config_name_input = ""; +this.config_name_input = ""; -function customization_menu.reload_font(pop_push) - customization_menu.font = imgui.load_font(language.current_language.font_name, - config.current_config.global_settings.menu_font.size, customization_menu.font_range); +function this.reload_font(pop_push) + this.font = imgui.load_font(language.current_language.font_name, + config.current_config.global_settings.menu_font.size, this.font_range); if pop_push then imgui.pop_font(); - imgui.push_font(customization_menu.font); + imgui.push_font(this.font); end end -function customization_menu.init() +function this.init() local current = language.current_language.customization_menu; local default = language.default_language.customization_menu; - customization_menu.displayed_orientation_types = { current.horizontal, + this.displayed_orientation_types = { current.horizontal, current.vertical}; - customization_menu.orientation_types = { default.horizontal, + this.orientation_types = { default.horizontal, default.vertical}; - customization_menu.displayed_anchor_types = { current.top_left, + this.displayed_anchor_types = { current.top_left, current.top_right, current.bottom_left, current.bottom_right}; - customization_menu.anchor_types = { default.top_left, + this.anchor_types = { default.top_left, default.top_right, default.bottom_left, default.bottom_right}; - customization_menu.displayed_outline_styles = { current.inside, + this.displayed_outline_styles = { current.inside, current.center, current.outside}; - customization_menu.outline_styles = { default.inside, + this.outline_styles = { default.inside, default.center, default.outside}; - customization_menu.displayed_monster_UI_sorting_types = { current.normal, + this.displayed_monster_UI_sorting_types = { current.normal, current.health, current.health_percentage, current.distance}; - customization_menu.monster_UI_sorting_types = { default.normal, + this.monster_UI_sorting_types = { default.normal, default.health, default.health_percentage, default.distance}; - customization_menu.displayed_large_monster_UI_parts_sorting_types = { current.normal, + this.displayed_large_monster_UI_parts_sorting_types = { current.normal, current.health, current.health_percentage, current.flinch_count, @@ -204,7 +204,7 @@ function customization_menu.init() current.loss_health, current.loss_health_percentage}; - customization_menu.large_monster_UI_parts_sorting_types = { default.normal, + this.large_monster_UI_parts_sorting_types = { default.normal, default.health, default.health_percentage, default.flinch_count, @@ -214,102 +214,102 @@ function customization_menu.init() default.loss_health, default.loss_health_percentage}; - customization_menu.displayed_large_monster_UI_parts_filter_types = { current.current_state, + this.displayed_large_monster_UI_parts_filter_types = { current.current_state, current.default_state}; - customization_menu.large_monster_UI_parts_filter_types = { default.current_state, + this.large_monster_UI_parts_filter_types = { default.current_state, default.default_state}; - customization_menu.displayed_ailments_sorting_types = { current.normal, + this.displayed_ailments_sorting_types = { current.normal, current.buildup, current.buildup_percentage}; - customization_menu.ailments_sorting_types = { default.normal, + this.ailments_sorting_types = { default.normal, default.buildup, default.buildup_percentage}; - customization_menu.displayed_buff_UI_sorting_types = { current.name, + this.displayed_buff_UI_sorting_types = { current.name, current.timer, current.duration}; - customization_menu.buff_UI_sorting_types = { default.name, + this.buff_UI_sorting_types = { default.name, default.timer, default.duration}; - customization_menu.displayed_ailment_buildups_sorting_types = { current.normal, + this.displayed_ailment_buildups_sorting_types = { current.normal, current.buildup, current.buildup_percentage}; - customization_menu.ailment_buildups_sorting_types = { default.normal, + this.ailment_buildups_sorting_types = { default.normal, default.buildup, default.buildup_percentage}; - customization_menu.displayed_highlighted_buildup_bar_types = { current.me, + this.displayed_highlighted_buildup_bar_types = { current.me, current.top_buildup, current.none}; - customization_menu.highlighted_buildup_bar_types = { default.me, + this.highlighted_buildup_bar_types = { default.me, default.top_buildup, default.none}; - customization_menu.displayed_buildup_bar_relative_types = { current.total_buildup, + this.displayed_buildup_bar_relative_types = { current.total_buildup, current.top_buildup}; - customization_menu.buildup_bar_relative_types = { default.total_buildup, + this.buildup_bar_relative_types = { default.total_buildup, default.top_buildup}; - customization_menu.displayed_damage_meter_UI_highlighted_entity_types = { current.top_damage, + this.displayed_damage_meter_UI_highlighted_entity_types = { current.top_damage, current.top_dps, current.none}; - customization_menu.damage_meter_UI_highlighted_entity_types = { default.top_damage, + this.damage_meter_UI_highlighted_entity_types = { default.top_damage, default.top_dps, default.none}; - customization_menu.displayed_damage_meter_UI_damage_bar_relative_types = { current.total_damage, + this.displayed_damage_meter_UI_damage_bar_relative_types = { current.total_damage, current.top_damage}; - customization_menu.damage_meter_UI_damage_bar_relative_types = { default.total_damage, + this.damage_meter_UI_damage_bar_relative_types = { default.total_damage, default.top_damage}; - customization_menu.displayed_damage_meter_UI_my_damage_bar_location_types = { current.normal, + this.displayed_damage_meter_UI_my_damage_bar_location_types = { current.normal, current.first, current.last}; - customization_menu.damage_meter_UI_my_damage_bar_location_types = { default.normal, + this.damage_meter_UI_my_damage_bar_location_types = { default.normal, default.first, default.last}; - customization_menu.displayed_damage_meter_UI_total_damage_location_types = { current.first, + this.displayed_damage_meter_UI_total_damage_location_types = { current.first, current.last}; - customization_menu.damage_meter_UI_total_damage_location_types = { default.first, + this.damage_meter_UI_total_damage_location_types = { default.first, default.last}; - customization_menu.displayed_damage_meter_UI_sorting_types = { current.normal, + this.displayed_damage_meter_UI_sorting_types = { current.normal, current.damage, current.dps}; - customization_menu.damage_meter_UI_sorting_types = { default.normal, + this.damage_meter_UI_sorting_types = { default.normal, default.damage, default.dps}; - customization_menu.displayed_damage_meter_UI_dps_modes = { current.first_hit, + this.displayed_damage_meter_UI_dps_modes = { current.first_hit, current.quest_time, current.join_time}; - customization_menu.damage_meter_UI_dps_modes = { default.first_hit, + this.damage_meter_UI_dps_modes = { default.first_hit, default.quest_time, default.join_time}; - customization_menu.displayed_auto_highlight_modes = { current.closest, + this.displayed_auto_highlight_modes = { current.closest, current.farthest, current.lowest_health, current.highest_health, current.lowest_health_percentage, current.highest_health_percentage}; - customization_menu.auto_highlight_modes = { default.closest, + this.auto_highlight_modes = { default.closest, default.farthest, default.lowest_health, default.highest_health, @@ -317,20 +317,20 @@ function customization_menu.init() default.highest_health_percentage}; end -function customization_menu.draw() - imgui.set_next_window_pos(customization_menu.window_position, 1 << 3, customization_menu.window_pivot); - imgui.set_next_window_size(customization_menu.window_size, 1 << 3); +function this.draw() + imgui.set_next_window_pos(this.window_position, 1 << 3, this.window_pivot); + imgui.set_next_window_size(this.window_size, 1 << 3); - customization_menu.is_opened = imgui.begin_window( - language.current_language.customization_menu.mod_name .. " v" .. config.current_config.version, customization_menu.is_opened, - customization_menu.window_flags); + this.is_opened = imgui.begin_window( + language.current_language.customization_menu.mod_name .. " v" .. config.current_config.version, this.is_opened, + this.window_flags); - if not customization_menu.is_opened then + if not this.is_opened then imgui.end_window(); return; end - imgui.push_font(customization_menu.font); + imgui.push_font(this.font); local config_changed = false; local language_changed = false; @@ -347,26 +347,26 @@ function customization_menu.draw() local buff_UI_changed = false; local apply_font_requested = false; - local status_string = tostring(customization_menu.status); + local status_string = tostring(this.status); imgui.text(language.current_language.customization_menu.status .. ": " .. status_string); - config_changed, apply_font_requested = customization_menu.draw_config(); - modules_changed = customization_menu.draw_modules(); - customization_menu.draw_hotkeys(); - global_settings_changed, modifiers_changed, apply_font_requested, language_changed = customization_menu.draw_global_settings(apply_font_requested, config_changed); - small_monster_UI_changed = customization_menu.draw_small_monster_UI(); + config_changed, apply_font_requested = this.draw_config(); + modules_changed = this.draw_modules(); + this.draw_hotkeys(); + global_settings_changed, modifiers_changed, apply_font_requested, language_changed = this.draw_global_settings(apply_font_requested, config_changed); + small_monster_UI_changed = this.draw_small_monster_UI(); if imgui.tree_node(language.current_language.customization_menu.large_monster_UI) then - large_monster_dynamic_UI_changed = customization_menu.draw_large_monster_dynamic_UI() - large_monster_static_UI_changed = customization_menu.draw_large_monster_static_UI() - large_monster_highlighted_UI_changed = customization_menu.draw_large_monster_highlighted_UI() + large_monster_dynamic_UI_changed = this.draw_large_monster_dynamic_UI() + large_monster_static_UI_changed = this.draw_large_monster_static_UI() + large_monster_highlighted_UI_changed = this.draw_large_monster_highlighted_UI() imgui.tree_pop(); end - time_UI_changed = customization_menu.draw_time_UI(); - damage_meter_UI_changed = customization_menu.draw_damage_meter_UI(); - endemic_life_UI_changed = customization_menu.draw_endemic_life_UI() + time_UI_changed = this.draw_time_UI(); + damage_meter_UI_changed = this.draw_damage_meter_UI(); + endemic_life_UI_changed = this.draw_endemic_life_UI() --buff_UI_changed = customization_menu.draw_buff_UI(); imgui.pop_font(); @@ -432,9 +432,9 @@ function customization_menu.draw() end end]] - if customization_menu.menu_font_changed and (apply_font_requested or config_changed) then - customization_menu.menu_font_changed = false; - customization_menu.reload_font(false); + if this.menu_font_changed and (apply_font_requested or config_changed) then + this.menu_font_changed = false; + this.reload_font(false); end if modules_changed or global_settings_changed or small_monster_UI_changed or large_monster_dynamic_UI_changed or @@ -444,7 +444,7 @@ function customization_menu.draw() end end -function customization_menu.draw_config() +function this.draw_config() local index = 1; local changed = false; local config_changed = false; @@ -462,25 +462,25 @@ function customization_menu.draw_config() language.update(utils.table.find_index(language.language_names, config.current_config.global_settings.language, false)); - customization_menu.init(); + this.init(); - customization_menu.menu_font_changed = true; + this.menu_font_changed = true; apply_font_requested = true; end - changed, customization_menu.config_name_input = imgui.input_text(language.current_language.customization_menu.config_name, customization_menu.config_name_input); + changed, this.config_name_input = imgui.input_text(language.current_language.customization_menu.config_name, this.config_name_input); changed = imgui.button(language.current_language.customization_menu.new); if changed then - if customization_menu.config_name_input ~= "" then - config.new(customization_menu.config_name_input); + if this.config_name_input ~= "" then + config.new(this.config_name_input); config_changed = config_changed or changed; language.update(utils.table.find_index(language.language_names, config.current_config.global_settings.language, false)); - customization_menu.init(); + this.init(); - customization_menu.menu_font_changed = true; + this.menu_font_changed = true; apply_font_requested = true; end @@ -490,15 +490,15 @@ function customization_menu.draw_config() changed = imgui.button(language.current_language.customization_menu.duplicate); if changed then - if customization_menu.config_name_input ~= "" then - config.duplicate(customization_menu.config_name_input); + if this.config_name_input ~= "" then + config.duplicate(this.config_name_input); config_changed = config_changed or changed; language.update(utils.table.find_index(language.language_names, config.current_config.global_settings.language, false)); - customization_menu.init(); + this.init(); - customization_menu.menu_font_changed = true; + this.menu_font_changed = true; apply_font_requested = true; end @@ -513,9 +513,9 @@ function customization_menu.draw_config() language.update(utils.table.find_index(language.language_names, config.current_config.global_settings.language, false)); - customization_menu.init(); + this.init(); - customization_menu.menu_font_changed = true; + this.menu_font_changed = true; apply_font_requested = true; end @@ -525,7 +525,7 @@ function customization_menu.draw_config() return config_changed, apply_font_requested; end -function customization_menu.draw_modules() +function this.draw_modules() local changed = false; local config_changed = false; @@ -571,103 +571,103 @@ function customization_menu.draw_modules() return config_changed; end -function customization_menu.draw_hotkeys() +function this.draw_hotkeys() if imgui.tree_node(language.current_language.customization_menu.hotkeys) then - if customization_menu.all_UI_waiting_for_key then + if this.all_UI_waiting_for_key then if imgui.button(language.current_language.customization_menu.press_any_key) then config.current_config.global_settings.hotkeys_with_modifiers.all_UI.key = 0; config.current_config.global_settings.hotkeys_with_modifiers.all_UI.ctrl = false; config.current_config.global_settings.hotkeys_with_modifiers.all_UI.shift = false; config.current_config.global_settings.hotkeys_with_modifiers.all_UI.alt = false; - customization_menu.all_UI_waiting_for_key = false; + this.all_UI_waiting_for_key = false; end elseif imgui.button(language.current_language.customization_menu.all_UI) then - local is_any_other_waiting = customization_menu.small_monster_UI_waiting_for_key or - customization_menu.large_monster_UI_waiting_for_key or - customization_menu.large_monster_dynamic_UI_waiting_for_key or - customization_menu.large_monster_static_UI_waiting_for_key or - customization_menu.large_monster_highlighted_UI_waiting_for_key or - customization_menu.time_UI_waiting_for_key or - customization_menu.damage_meter_UI_waiting_for_key or - customization_menu.endemic_life_UI_waiting_for_key; + local is_any_other_waiting = this.small_monster_UI_waiting_for_key or + this.large_monster_UI_waiting_for_key or + this.large_monster_dynamic_UI_waiting_for_key or + this.large_monster_static_UI_waiting_for_key or + this.large_monster_highlighted_UI_waiting_for_key or + this.time_UI_waiting_for_key or + this.damage_meter_UI_waiting_for_key or + this.endemic_life_UI_waiting_for_key; if not is_any_other_waiting then - customization_menu.all_UI_waiting_for_key = true; + this.all_UI_waiting_for_key = true; end end imgui.same_line(); imgui.text(keyboard.get_hotkey_name(config.current_config.global_settings.hotkeys_with_modifiers.all_UI)); - if customization_menu.small_monster_UI_waiting_for_key then + if this.small_monster_UI_waiting_for_key then if imgui.button(language.current_language.customization_menu.press_any_key) then config.current_config.global_settings.hotkeys_with_modifiers.small_monster_UI.key = 0; config.current_config.global_settings.hotkeys_with_modifiers.small_monster_UI.ctrl = false; config.current_config.global_settings.hotkeys_with_modifiers.small_monster_UI.shift = false; config.current_config.global_settings.hotkeys_with_modifiers.small_monster_UI.alt = false; - customization_menu.small_monster_UI_waiting_for_key = false; + this.small_monster_UI_waiting_for_key = false; end elseif imgui.button(language.current_language.customization_menu.small_monster_UI) then - local is_any_other_waiting = customization_menu.all_UI_waiting_for_key or - customization_menu.large_monster_UI_waiting_for_key or - customization_menu.large_monster_dynamic_UI_waiting_for_key or - customization_menu.large_monster_static_UI_waiting_for_key or - customization_menu.large_monster_highlighted_UI_waiting_for_key or - customization_menu.time_UI_waiting_for_key or - customization_menu.damage_meter_UI_waiting_for_key or - customization_menu.endemic_life_UI_waiting_for_key; + local is_any_other_waiting = this.all_UI_waiting_for_key or + this.large_monster_UI_waiting_for_key or + this.large_monster_dynamic_UI_waiting_for_key or + this.large_monster_static_UI_waiting_for_key or + this.large_monster_highlighted_UI_waiting_for_key or + this.time_UI_waiting_for_key or + this.damage_meter_UI_waiting_for_key or + this.endemic_life_UI_waiting_for_key; if not is_any_other_waiting then - customization_menu.small_monster_UI_waiting_for_key = true; + this.small_monster_UI_waiting_for_key = true; end end imgui.same_line(); imgui.text(keyboard.get_hotkey_name(config.current_config.global_settings.hotkeys_with_modifiers.small_monster_UI)); - if customization_menu.large_monster_UI_waiting_for_key then + if this.large_monster_UI_waiting_for_key then if imgui.button(language.current_language.customization_menu.press_any_key) then config.current_config.global_settings.hotkeys_with_modifiers.large_monster_UI.key = 0; config.current_config.global_settings.hotkeys_with_modifiers.large_monster_UI.ctrl = false; config.current_config.global_settings.hotkeys_with_modifiers.large_monster_UI.shift = false; config.current_config.global_settings.hotkeys_with_modifiers.large_monster_UI.alt = false; - customization_menu.large_monster_UI_waiting_for_key = false; + this.large_monster_UI_waiting_for_key = false; end elseif imgui.button(language.current_language.customization_menu.large_monster_UI) then - local is_any_other_waiting = customization_menu.all_UI_waiting_for_key or - customization_menu.small_monster_UI_waiting_for_key or - customization_menu.large_monster_dynamic_UI_waiting_for_key or - customization_menu.large_monster_static_UI_waiting_for_key or - customization_menu.large_monster_highlighted_UI_waiting_for_key or - customization_menu.time_UI_waiting_for_key or - customization_menu.damage_meter_UI_waiting_for_key or - customization_menu.endemic_life_UI_waiting_for_key; + local is_any_other_waiting = this.all_UI_waiting_for_key or + this.small_monster_UI_waiting_for_key or + this.large_monster_dynamic_UI_waiting_for_key or + this.large_monster_static_UI_waiting_for_key or + this.large_monster_highlighted_UI_waiting_for_key or + this.time_UI_waiting_for_key or + this.damage_meter_UI_waiting_for_key or + this.endemic_life_UI_waiting_for_key; if not is_any_other_waiting then - customization_menu.large_monster_UI_waiting_for_key = true; + this.large_monster_UI_waiting_for_key = true; end end imgui.same_line(); imgui.text(keyboard.get_hotkey_name(config.current_config.global_settings.hotkeys_with_modifiers.large_monster_UI)); - if customization_menu.large_monster_dynamic_UI_waiting_for_key then + if this.large_monster_dynamic_UI_waiting_for_key then if imgui.button(language.current_language.customization_menu.press_any_key) then config.current_config.global_settings.hotkeys_with_modifiers.large_monster_dynamic_UI.key = 0; config.current_config.global_settings.hotkeys_with_modifiers.large_monster_dynamic_UI.ctrl = false; config.current_config.global_settings.hotkeys_with_modifiers.large_monster_dynamic_UI.shift = false; config.current_config.global_settings.hotkeys_with_modifiers.large_monster_dynamic_UI.alt = false; - customization_menu.large_monster_dynamic_UI_waiting_for_key = false; + this.large_monster_dynamic_UI_waiting_for_key = false; end elseif imgui.button(language.current_language.customization_menu.large_monster_dynamic_UI) then - local is_any_other_waiting = customization_menu.all_UI_waiting_for_key or - customization_menu.small_monster_UI_waiting_for_key or - customization_menu.large_monster_UI_waiting_for_key or - customization_menu.large_monster_static_UI_waiting_for_key or - customization_menu.large_monster_highlighted_UI_waiting_for_key or - customization_menu.time_UI_waiting_for_key or - customization_menu.damage_meter_UI_waiting_for_key or - customization_menu.endemic_life_UI_waiting_for_key; + local is_any_other_waiting = this.all_UI_waiting_for_key or + this.small_monster_UI_waiting_for_key or + this.large_monster_UI_waiting_for_key or + this.large_monster_static_UI_waiting_for_key or + this.large_monster_highlighted_UI_waiting_for_key or + this.time_UI_waiting_for_key or + this.damage_meter_UI_waiting_for_key or + this.endemic_life_UI_waiting_for_key; if not is_any_other_waiting then - customization_menu.large_monster_dynamic_UI_waiting_for_key = true; + this.large_monster_dynamic_UI_waiting_for_key = true; end end @@ -675,25 +675,25 @@ function customization_menu.draw_hotkeys() imgui.text(keyboard.get_hotkey_name(config.current_config.global_settings.hotkeys_with_modifiers .large_monster_dynamic_UI)); - if customization_menu.large_monster_static_UI_waiting_for_key then + if this.large_monster_static_UI_waiting_for_key then if imgui.button(language.current_language.customization_menu.press_any_key) then config.current_config.global_settings.hotkeys_with_modifiers.large_monster_static_UI.key = 0; config.current_config.global_settings.hotkeys_with_modifiers.large_monster_static_UI.ctrl = false; config.current_config.global_settings.hotkeys_with_modifiers.large_monster_static_UI.shift = false; config.current_config.global_settings.hotkeys_with_modifiers.large_monster_static_UI.alt = false; - customization_menu.large_monster_static_UI_waiting_for_key = false; + this.large_monster_static_UI_waiting_for_key = false; end elseif imgui.button(language.current_language.customization_menu.large_monster_static_UI) then - local is_any_other_waiting = customization_menu.all_UI_waiting_for_key or - customization_menu.small_monster_UI_waiting_for_key or - customization_menu.large_monster_UI_waiting_for_key or - customization_menu.large_monster_dynamic_UI_waiting_for_key or - customization_menu.large_monster_highlighted_UI_waiting_for_key or - customization_menu.time_UI_waiting_for_key or - customization_menu.damage_meter_UI_waiting_for_key or - customization_menu.endemic_life_UI_waiting_for_key; + local is_any_other_waiting = this.all_UI_waiting_for_key or + this.small_monster_UI_waiting_for_key or + this.large_monster_UI_waiting_for_key or + this.large_monster_dynamic_UI_waiting_for_key or + this.large_monster_highlighted_UI_waiting_for_key or + this.time_UI_waiting_for_key or + this.damage_meter_UI_waiting_for_key or + this.endemic_life_UI_waiting_for_key; if not is_any_other_waiting then - customization_menu.large_monster_static_UI_waiting_for_key = true; + this.large_monster_static_UI_waiting_for_key = true; end end @@ -701,99 +701,99 @@ function customization_menu.draw_hotkeys() imgui.text(keyboard.get_hotkey_name(config.current_config.global_settings.hotkeys_with_modifiers .large_monster_static_UI)); - if customization_menu.large_monster_highlighted_UI_waiting_for_key then + if this.large_monster_highlighted_UI_waiting_for_key then if imgui.button(language.current_language.customization_menu.press_any_key) then config.current_config.global_settings.hotkeys_with_modifiers.large_monster_highlighted_UI.key = 0; config.current_config.global_settings.hotkeys_with_modifiers.large_monster_highlighted_UI.ctrl = false; config.current_config.global_settings.hotkeys_with_modifiers.large_monster_highlighted_UI.shift = false; config.current_config.global_settings.hotkeys_with_modifiers.large_monster_highlighted_UI.alt = false; - customization_menu.large_monster_highlighted_UI_waiting_for_key = false; + this.large_monster_highlighted_UI_waiting_for_key = false; end elseif imgui.button(language.current_language.customization_menu.large_monster_highlighted_UI) then - local is_any_other_waiting = customization_menu.all_UI_waiting_for_key or - customization_menu.small_monster_UI_waiting_for_key or - customization_menu.large_monster_UI_waiting_for_key or - customization_menu.large_monster_dynamic_UI_waiting_for_key or - customization_menu.large_monster_static_UI_waiting_for_key or - customization_menu.time_UI_waiting_for_key or - customization_menu.damage_meter_UI_waiting_for_key or - customization_menu.endemic_life_UI_waiting_for_key; + local is_any_other_waiting = this.all_UI_waiting_for_key or + this.small_monster_UI_waiting_for_key or + this.large_monster_UI_waiting_for_key or + this.large_monster_dynamic_UI_waiting_for_key or + this.large_monster_static_UI_waiting_for_key or + this.time_UI_waiting_for_key or + this.damage_meter_UI_waiting_for_key or + this.endemic_life_UI_waiting_for_key; if not is_any_other_waiting then - customization_menu.large_monster_highlighted_UI_waiting_for_key = true; + this.large_monster_highlighted_UI_waiting_for_key = true; end end imgui.same_line(); imgui.text(keyboard.get_hotkey_name(config.current_config.global_settings.hotkeys_with_modifiers .large_monster_highlighted_UI)); - if customization_menu.time_UI_waiting_for_key then + if this.time_UI_waiting_for_key then if imgui.button(language.current_language.customization_menu.press_any_key) then config.current_config.global_settings.hotkeys_with_modifiers.time_UI.key = 0; config.current_config.global_settings.hotkeys_with_modifiers.time_UI.ctrl = false; config.current_config.global_settings.hotkeys_with_modifiers.time_UI.shift = false; config.current_config.global_settings.hotkeys_with_modifiers.time_UI.alt = false; - customization_menu.time_UI_waiting_for_key = false; + this.time_UI_waiting_for_key = false; end elseif imgui.button(language.current_language.customization_menu.time_UI) then - local is_any_other_waiting = customization_menu.all_UI_waiting_for_key or - customization_menu.small_monster_UI_waiting_for_key or - customization_menu.large_monster_UI_waiting_for_key or - customization_menu.large_monster_dynamic_UI_waiting_for_key or - customization_menu.large_monster_static_UI_waiting_for_key or - customization_menu.large_monster_highlighted_UI_waiting_for_key or - customization_menu.damage_meter_UI_waiting_for_key or - customization_menu.endemic_life_UI_waiting_for_key; + local is_any_other_waiting = this.all_UI_waiting_for_key or + this.small_monster_UI_waiting_for_key or + this.large_monster_UI_waiting_for_key or + this.large_monster_dynamic_UI_waiting_for_key or + this.large_monster_static_UI_waiting_for_key or + this.large_monster_highlighted_UI_waiting_for_key or + this.damage_meter_UI_waiting_for_key or + this.endemic_life_UI_waiting_for_key; if not is_any_other_waiting then - customization_menu.time_UI_waiting_for_key = true; + this.time_UI_waiting_for_key = true; end end imgui.same_line(); imgui.text(keyboard.get_hotkey_name(config.current_config.global_settings.hotkeys_with_modifiers.time_UI)); - if customization_menu.damage_meter_UI_waiting_for_key then + if this.damage_meter_UI_waiting_for_key then if imgui.button(language.current_language.customization_menu.press_any_key) then config.current_config.global_settings.hotkeys_with_modifiers.damage_meter_UI.key = 0; config.current_config.global_settings.hotkeys_with_modifiers.damage_meter_UI.ctrl = false; config.current_config.global_settings.hotkeys_with_modifiers.damage_meter_UI.shift = false; config.current_config.global_settings.hotkeys_with_modifiers.damage_meter_UI.alt = false; - customization_menu.damage_meter_UI_waiting_for_key = false; + this.damage_meter_UI_waiting_for_key = false; end elseif imgui.button(language.current_language.customization_menu.damage_meter_UI) then - local is_any_other_waiting = customization_menu.all_UI_waiting_for_key or - customization_menu.small_monster_UI_waiting_for_key or - customization_menu.large_monster_UI_waiting_for_key or - customization_menu.large_monster_dynamic_UI_waiting_for_key or - customization_menu.large_monster_static_UI_waiting_for_key or - customization_menu.large_monster_highlighted_UI_waiting_for_key or - customization_menu.time_UI_waiting_for_key or - customization_menu.endemic_life_UI_waiting_for_key; + local is_any_other_waiting = this.all_UI_waiting_for_key or + this.small_monster_UI_waiting_for_key or + this.large_monster_UI_waiting_for_key or + this.large_monster_dynamic_UI_waiting_for_key or + this.large_monster_static_UI_waiting_for_key or + this.large_monster_highlighted_UI_waiting_for_key or + this.time_UI_waiting_for_key or + this.endemic_life_UI_waiting_for_key; if not is_any_other_waiting then - customization_menu.damage_meter_UI_waiting_for_key = true; + this.damage_meter_UI_waiting_for_key = true; end end imgui.same_line(); imgui.text(keyboard.get_hotkey_name(config.current_config.global_settings.hotkeys_with_modifiers.damage_meter_UI)); - if customization_menu.endemic_life_UI_waiting_for_key then + if this.endemic_life_UI_waiting_for_key then if imgui.button(language.current_language.customization_menu.press_any_key) then config.current_config.global_settings.hotkeys_with_modifiers.endemic_life_UI.key = 0; config.current_config.global_settings.hotkeys_with_modifiers.endemic_life_UI.ctrl = false; config.current_config.global_settings.hotkeys_with_modifiers.endemic_life_UI.shift = false; config.current_config.global_settings.hotkeys_with_modifiers.endemic_life_UI.alt = false; - customization_menu.endemic_life_UI_waiting_for_key = false; + this.endemic_life_UI_waiting_for_key = false; end elseif imgui.button(language.current_language.customization_menu.endemic_life_UI) then - local is_any_other_waiting = customization_menu.all_UI_waiting_for_key or - customization_menu.small_monster_UI_waiting_for_key or - customization_menu.large_monster_UI_waiting_for_key or - customization_menu.large_monster_dynamic_UI_waiting_for_key or - customization_menu.large_monster_static_UI_waiting_for_key or - customization_menu.large_monster_highlighted_UI_waiting_for_key or - customization_menu.time_UI_waiting_for_key or - customization_menu.endemic_life_UI_waiting_for_key; + local is_any_other_waiting = this.all_UI_waiting_for_key or + this.small_monster_UI_waiting_for_key or + this.large_monster_UI_waiting_for_key or + this.large_monster_dynamic_UI_waiting_for_key or + this.large_monster_static_UI_waiting_for_key or + this.large_monster_highlighted_UI_waiting_for_key or + this.time_UI_waiting_for_key or + this.endemic_life_UI_waiting_for_key; if not is_any_other_waiting then - customization_menu.endemic_life_UI_waiting_for_key = true; + this.endemic_life_UI_waiting_for_key = true; end end @@ -804,7 +804,7 @@ function customization_menu.draw_hotkeys() end end -function customization_menu.draw_global_settings(apply_font_requested, language_changed) +function this.draw_global_settings(apply_font_requested, language_changed) local changed = false; local config_changed = false; local modifiers_changed = false; @@ -823,17 +823,17 @@ function customization_menu.draw_global_settings(apply_font_requested, language_ if changed then cached_config.language = language.language_names[index]; language.update(index); - customization_menu.init(); + this.init(); language_changed = true; - customization_menu.menu_font_changed = true; + this.menu_font_changed = true; modifiers_changed = true; apply_font_requested = true; end if imgui.tree_node(language.current_language.customization_menu.menu_font) then local new_value = cached_config.menu_font.size; - changed, new_value = imgui.input_text(" ", cached_config.menu_font.size, customization_menu.decimal_input_flags); + changed, new_value = imgui.input_text(" ", cached_config.menu_font.size, this.decimal_input_flags); new_value = tonumber(new_value); if new_value ~= nil then @@ -847,7 +847,7 @@ function customization_menu.draw_global_settings(apply_font_requested, language_ end config_changed = config_changed or changed; - customization_menu.menu_font_changed = customization_menu.menu_font_changed or changed; + this.menu_font_changed = this.menu_font_changed or changed; imgui.same_line(); @@ -862,7 +862,7 @@ function customization_menu.draw_global_settings(apply_font_requested, language_ if cached_config.menu_font.size < 5 then cached_config.menu_font.size = 5; else - customization_menu.menu_font_changed = customization_menu.menu_font_changed or changed; + this.menu_font_changed = this.menu_font_changed or changed; end end @@ -877,7 +877,7 @@ function customization_menu.draw_global_settings(apply_font_requested, language_ if cached_config.menu_font.size > 100 then cached_config.menu_font.size = 100; else - customization_menu.menu_font_changed = customization_menu.menu_font_changed or changed; + this.menu_font_changed = this.menu_font_changed or changed; end end @@ -894,11 +894,11 @@ function customization_menu.draw_global_settings(apply_font_requested, language_ imgui.text(language.current_language.customization_menu.UI_font_notice); changed, index = imgui.combo(language.current_language.customization_menu.family, - utils.table.find_index(customization_menu.fonts, cached_config.UI_font.family), customization_menu.fonts); + utils.table.find_index(this.fonts, cached_config.UI_font.family), this.fonts); config_changed = config_changed or changed; if changed then - cached_config.UI_font.family = customization_menu.fonts[index]; + cached_config.UI_font.family = this.fonts[index]; end changed, cached_config.UI_font.size = imgui.slider_int(language.current_language.customization_menu.size, @@ -1071,7 +1071,7 @@ function customization_menu.draw_global_settings(apply_font_requested, language_ return config_changed, modifiers_changed, apply_font_requested, language_changed; end -function customization_menu.draw_small_monster_UI() +function this.draw_small_monster_UI() local changed = false; local config_changed = false; local index = 1; @@ -1092,13 +1092,13 @@ function customization_menu.draw_small_monster_UI() config_changed = config_changed or changed; changed, index = imgui.combo(language.current_language.customization_menu.static_orientation, - utils.table.find_index(customization_menu.orientation_types, cached_config.settings.orientation), - customization_menu.displayed_orientation_types); + utils.table.find_index(this.orientation_types, cached_config.settings.orientation), + this.displayed_orientation_types); config_changed = config_changed or changed; if changed then - cached_config.settings.orientation = customization_menu.orientation_types[index]; + cached_config.settings.orientation = this.orientation_types[index]; end imgui.tree_pop(); @@ -1175,12 +1175,12 @@ function customization_menu.draw_small_monster_UI() config_changed = config_changed or changed; 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); + this.anchor_types, cached_config.static_position.anchor), this.displayed_anchor_types); config_changed = config_changed or changed; if changed then - cached_config.static_position.anchor = customization_menu.anchor_types[index]; + cached_config.static_position.anchor = this.anchor_types[index]; end imgui.tree_pop(); @@ -1202,13 +1202,13 @@ function customization_menu.draw_small_monster_UI() if imgui.tree_node(language.current_language.customization_menu.static_sorting) then changed, index = imgui.combo(language.current_language.customization_menu.type, utils.table.find_index( - customization_menu.monster_UI_sorting_types, cached_config.static_sorting.type), - customization_menu.displayed_monster_UI_sorting_types); + this.monster_UI_sorting_types, cached_config.static_sorting.type), + this.displayed_monster_UI_sorting_types); config_changed = config_changed or changed; if changed then - cached_config.static_sorting.type = customization_menu.monster_UI_sorting_types[index]; + cached_config.static_sorting.type = this.monster_UI_sorting_types[index]; end changed, cached_config.static_sorting.reversed_order = imgui.checkbox( @@ -1240,7 +1240,7 @@ function customization_menu.draw_small_monster_UI() return config_changed; end -function customization_menu.draw_large_monster_dynamic_UI() +function this.draw_large_monster_dynamic_UI() local changed = false; local config_changed = false; local index = 1; @@ -1324,7 +1324,7 @@ function customization_menu.draw_large_monster_dynamic_UI() return config_changed; end -function customization_menu.draw_large_monster_static_UI() +function this.draw_large_monster_static_UI() local changed = false; local config_changed = false; local index = 1; @@ -1355,24 +1355,24 @@ function customization_menu.draw_large_monster_static_UI() changed, index = imgui.combo( language.current_language.customization_menu.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); + utils.table.find_index(this.damage_meter_UI_my_damage_bar_location_types, cached_config.settings.highlighted_monster_location), + this.displayed_damage_meter_UI_my_damage_bar_location_types); config_changed = config_changed or changed; if changed then - cached_config.settings.highlighted_monster_location = customization_menu.damage_meter_UI_my_damage_bar_location_types[index]; + cached_config.settings.highlighted_monster_location = this.damage_meter_UI_my_damage_bar_location_types[index]; end changed, index = imgui.combo( language.current_language.customization_menu.orientation, - utils.table.find_index( customization_menu.orientation_types, cached_config.settings.orientation), - customization_menu.displayed_orientation_types); + utils.table.find_index( this.orientation_types, cached_config.settings.orientation), + this.displayed_orientation_types); config_changed = config_changed or changed; if changed then - cached_config.settings.orientation = customization_menu.orientation_types[index]; + cached_config.settings.orientation = this.orientation_types[index]; end imgui.tree_pop(); @@ -1391,13 +1391,13 @@ function customization_menu.draw_large_monster_static_UI() changed, index = imgui.combo( language.current_language.customization_menu.anchor, - utils.table.find_index(customization_menu.anchor_types, cached_config.position.anchor), - customization_menu.displayed_anchor_types); + utils.table.find_index(this.anchor_types, cached_config.position.anchor), + this.displayed_anchor_types); config_changed = config_changed or changed; if changed then - cached_config.position.anchor = customization_menu.anchor_types[index]; + cached_config.position.anchor = this.anchor_types[index]; end imgui.tree_pop(); @@ -1420,13 +1420,13 @@ function customization_menu.draw_large_monster_static_UI() if imgui.tree_node(language.current_language.customization_menu.sorting) then changed, index = imgui.combo( language.current_language.customization_menu.type, - utils.table.find_index(customization_menu.monster_UI_sorting_types, cached_config.sorting.type), - customization_menu.displayed_monster_UI_sorting_types); + utils.table.find_index(this.monster_UI_sorting_types, cached_config.sorting.type), + this.displayed_monster_UI_sorting_types); config_changed = config_changed or changed; if changed then - cached_config.sorting.type = customization_menu.monster_UI_sorting_types[index]; + cached_config.sorting.type = this.monster_UI_sorting_types[index]; end changed, cached_config.sorting.reversed_order = imgui.checkbox( @@ -1446,7 +1446,7 @@ function customization_menu.draw_large_monster_static_UI() return config_changed; end -function customization_menu.draw_large_monster_highlighted_UI() +function this.draw_large_monster_highlighted_UI() local changed = false; local config_changed = false; local index = 1; @@ -1472,13 +1472,13 @@ function customization_menu.draw_large_monster_highlighted_UI() changed, index = imgui.combo( language.current_language.customization_menu.anchor, - utils.table.find_index(customization_menu.anchor_types, cached_config.position.anchor), - customization_menu.displayed_anchor_types); + utils.table.find_index(this.anchor_types, cached_config.position.anchor), + this.displayed_anchor_types); config_changed = config_changed or changed; if changed then - cached_config.position.anchor = customization_menu.anchor_types[index]; + cached_config.position.anchor = this.anchor_types[index]; end imgui.tree_pop(); @@ -1492,13 +1492,13 @@ function customization_menu.draw_large_monster_highlighted_UI() changed, index = imgui.combo( language.current_language.customization_menu.mode, - utils.table.find_index(customization_menu.auto_highlight_modes, cached_config.auto_highlight.mode), - customization_menu.displayed_auto_highlight_modes); + utils.table.find_index(this.auto_highlight_modes, cached_config.auto_highlight.mode), + this.displayed_auto_highlight_modes); config_changed = config_changed or changed; if changed then - cached_config.auto_highlight.mode = customization_menu.auto_highlight_modes[index]; + cached_config.auto_highlight.mode = this.auto_highlight_modes[index]; end imgui.tree_pop(); @@ -1513,7 +1513,7 @@ function customization_menu.draw_large_monster_highlighted_UI() return config_changed; end -function customization_menu.draw_time_UI() +function this.draw_time_UI() local changed = false; local config_changed = false; local index = 1; @@ -1539,13 +1539,13 @@ function customization_menu.draw_time_UI() changed, index = imgui.combo( language.current_language.customization_menu.anchor, - utils.table.find_index(customization_menu.anchor_types, cached_config.position.anchor), - customization_menu.displayed_anchor_types); + utils.table.find_index(this.anchor_types, cached_config.position.anchor), + this.displayed_anchor_types); config_changed = config_changed or changed; if changed then - cached_config.position.anchor = customization_menu.anchor_types[index]; + cached_config.position.anchor = this.anchor_types[index]; end imgui.tree_pop(); @@ -1560,7 +1560,7 @@ function customization_menu.draw_time_UI() return config_changed; end -function customization_menu.draw_damage_meter_UI() +function this.draw_damage_meter_UI() local changed = false; local config_changed = false; local damage_display_changed = false; @@ -1640,67 +1640,67 @@ function customization_menu.draw_damage_meter_UI() changed, index = imgui.combo( language.current_language.customization_menu.orientation, - utils.table.find_index(customization_menu.orientation_types, cached_config.settings.orientation), - customization_menu.displayed_orientation_types); + utils.table.find_index(this.orientation_types, cached_config.settings.orientation), + this.displayed_orientation_types); config_changed = config_changed or changed; if changed then - cached_config.settings.orientation = customization_menu.orientation_types[index]; + cached_config.settings.orientation = this.orientation_types[index]; end changed, index = imgui.combo( language.current_language.customization_menu.highlighted, - 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); + utils.table.find_index(this.damage_meter_UI_highlighted_entity_types, cached_config.settings.highlighted_bar), + this.displayed_damage_meter_UI_highlighted_entity_types); config_changed = config_changed or changed; if changed then - cached_config.settings.highlighted_bar = customization_menu.damage_meter_UI_highlighted_entity_types[index]; + cached_config.settings.highlighted_bar = this.damage_meter_UI_highlighted_entity_types[index]; end changed, index = imgui.combo( language.current_language.customization_menu.damage_bars_are_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); + utils.table.find_index(this.damage_meter_UI_damage_bar_relative_types, cached_config.settings.damage_bar_relative_to), + this.displayed_damage_meter_UI_damage_bar_relative_types); config_changed = config_changed or changed; if changed then - cached_config.settings.damage_bar_relative_to = customization_menu.damage_meter_UI_damage_bar_relative_types[index]; + cached_config.settings.damage_bar_relative_to = this.damage_meter_UI_damage_bar_relative_types[index]; end changed, index = imgui.combo( language.current_language.customization_menu.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); + utils.table.find_index(this.damage_meter_UI_my_damage_bar_location_types, cached_config.settings.my_damage_bar_location), + this.displayed_damage_meter_UI_my_damage_bar_location_types); config_changed = config_changed or changed; if changed then - cached_config.settings.my_damage_bar_location = customization_menu.damage_meter_UI_my_damage_bar_location_types[index]; + cached_config.settings.my_damage_bar_location = this.damage_meter_UI_my_damage_bar_location_types[index]; end changed, index = imgui.combo( language.current_language.customization_menu.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); + utils.table.find_index(this.damage_meter_UI_total_damage_location_types, cached_config.settings.total_damage_location), + this.displayed_damage_meter_UI_total_damage_location_types); config_changed = config_changed or changed; if changed then - cached_config.settings.total_damage_location = customization_menu.damage_meter_UI_total_damage_location_types[index]; + cached_config.settings.total_damage_location = this.damage_meter_UI_total_damage_location_types[index]; end changed, index = imgui.combo(language.current_language.customization_menu.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); + utils.table.find_index(this.damage_meter_UI_dps_modes, cached_config.settings.dps_mode), + this.displayed_damage_meter_UI_dps_modes); config_changed = config_changed or changed; if changed then - cached_config.settings.dps_mode = customization_menu.damage_meter_UI_dps_modes[index]; + cached_config.settings.dps_mode = this.damage_meter_UI_dps_modes[index]; end changed, cached_config.settings.player_name_size_limit = imgui.drag_float( @@ -1821,13 +1821,13 @@ function customization_menu.draw_damage_meter_UI() changed, index = imgui.combo( language.current_language.customization_menu.anchor, - utils.table.find_index(customization_menu.anchor_types, cached_config.position.anchor), - customization_menu.displayed_anchor_types); + utils.table.find_index(this.anchor_types, cached_config.position.anchor), + this.displayed_anchor_types); config_changed = config_changed or changed; if changed then - cached_config.position.anchor = customization_menu.anchor_types[index]; + cached_config.position.anchor = this.anchor_types[index]; end imgui.tree_pop(); @@ -1836,13 +1836,13 @@ function customization_menu.draw_damage_meter_UI() if imgui.tree_node(language.current_language.customization_menu.sorting) then changed, index = imgui.combo( language.current_language.customization_menu.type, - utils.table.find_index(customization_menu.damage_meter_UI_sorting_types, cached_config.sorting.type), - customization_menu.displayed_damage_meter_UI_sorting_types); + utils.table.find_index(this.damage_meter_UI_sorting_types, cached_config.sorting.type), + this.displayed_damage_meter_UI_sorting_types); config_changed = config_changed or changed; if changed then - cached_config.sorting.type = customization_menu.damage_meter_UI_sorting_types[index]; + cached_config.sorting.type = this.damage_meter_UI_sorting_types[index]; end changed, cached_config.sorting.reversed_order = imgui.checkbox( @@ -2062,7 +2062,7 @@ function customization_menu.draw_damage_meter_UI() return config_changed; end -function customization_menu.draw_endemic_life_UI() +function this.draw_endemic_life_UI() local changed = false; local config_changed = false; @@ -2137,7 +2137,7 @@ function customization_menu.draw_endemic_life_UI() return config_changed; end -function customization_menu.draw_buff_UI() +function this.draw_buff_UI() local changed = false; local config_changed = false; local index = 0; @@ -2163,13 +2163,13 @@ function customization_menu.draw_buff_UI() changed, index = imgui.combo( language.current_language.customization_menu.orientation, - utils.table.find_index(customization_menu.orientation_types, cached_config.settings.orientation), - customization_menu.displayed_orientation_types); + utils.table.find_index(this.orientation_types, cached_config.settings.orientation), + this.displayed_orientation_types); config_changed = config_changed or changed; if changed then - cached_config.settings.orientation = customization_menu.orientation_types[index]; + cached_config.settings.orientation = this.orientation_types[index]; end imgui.tree_pop(); @@ -2202,13 +2202,13 @@ function customization_menu.draw_buff_UI() changed, index = imgui.combo( language.current_language.customization_menu.anchor, - utils.table.find_index(customization_menu.anchor_types, cached_config.position.anchor), - customization_menu.displayed_anchor_types); + utils.table.find_index(this.anchor_types, cached_config.position.anchor), + this.displayed_anchor_types); config_changed = config_changed or changed; if changed then - cached_config.position.anchor = customization_menu.anchor_types[index]; + cached_config.position.anchor = this.anchor_types[index]; end imgui.tree_pop(); @@ -2217,13 +2217,13 @@ function customization_menu.draw_buff_UI() if imgui.tree_node(language.current_language.customization_menu.sorting) then changed, index = imgui.combo( language.current_language.customization_menu.type, - utils.table.find_index(customization_menu.buff_UI_sorting_types, cached_config.sorting.type), - customization_menu.displayed_buff_UI_sorting_types); + utils.table.find_index(this.buff_UI_sorting_types, cached_config.sorting.type), + this.displayed_buff_UI_sorting_types); config_changed = config_changed or changed; if changed then - cached_config.sorting.type = customization_menu.buff_UI_sorting_types[index]; + cached_config.sorting.type = this.buff_UI_sorting_types[index]; end changed, cached_config.sorting.reversed_order = imgui.checkbox( @@ -2249,7 +2249,7 @@ function customization_menu.draw_buff_UI() return config_changed; end -function customization_menu.init_module() +function this.init_module() utils = require("MHR_Overlay.Misc.utils"); language = require("MHR_Overlay.Misc.language"); config = require("MHR_Overlay.Misc.config"); @@ -2277,8 +2277,8 @@ function customization_menu.init_module() ailment_buildups_customization = require("MHR_Overlay.UI.Customizations.ailment_buildups_customization"); module_visibility_customization = require("MHR_Overlay.UI.Customizations.module_visibility_customization"); - customization_menu.init(); - customization_menu.reload_font(false); + this.init(); + this.reload_font(false); end -return customization_menu; \ No newline at end of file +return this; \ No newline at end of file diff --git a/reframework/autorun/MHR_Overlay/UI/drawing.lua b/reframework/autorun/MHR_Overlay/UI/drawing.lua index d8e5e3f..13db97a 100644 --- a/reframework/autorun/MHR_Overlay/UI/drawing.lua +++ b/reframework/autorun/MHR_Overlay/UI/drawing.lua @@ -1,4 +1,4 @@ -local drawing = {}; +local this = {}; local config; local utils; @@ -35,14 +35,14 @@ local os = os; local ValueType = ValueType; local package = package; -drawing.font = nil; +this.font = nil; -function drawing.init_font() +function this.init_font() local cached_config = config.current_config.global_settings.UI_font; - drawing.font = d2d.Font.new(cached_config.family, cached_config.size, cached_config.bold, cached_config.italic); + this.font = d2d.Font.new(cached_config.family, cached_config.size, cached_config.bold, cached_config.italic); end -function drawing.argb_color_to_abgr_color(argb_color) +function this.argb_color_to_abgr_color(argb_color) local alpha = (argb_color >> 24) & 0xFF; local red = (argb_color >> 16) & 0xFF; local green = (argb_color >> 8) & 0xFF; @@ -53,7 +53,7 @@ function drawing.argb_color_to_abgr_color(argb_color) return abgr_color; end -function drawing.color_to_argb(color) +function this.color_to_argb(color) local alpha = (color >> 24) & 0xFF; local red = (color >> 16) & 0xFF; local green = (color >> 8) & 0xFF; @@ -62,18 +62,18 @@ function drawing.color_to_argb(color) return alpha, red, green, blue; end -function drawing.argb_to_color(alpha, red, green, blue) +function this.argb_to_color(alpha, red, green, blue) return 0x1000000 * alpha + 0x10000 * red + 0x100 * green + blue; end -function drawing.limit_text_size(text, size_limit) +function this.limit_text_size(text, size_limit) if d2d == nil or not config.current_config.global_settings.renderer.use_d2d_if_available or size_limit <= 0 then return text; end local limited_text = text; while limited_text ~= "..." do - local text_width, text_height = drawing.font:measure(limited_text); + local text_width, text_height = this.font:measure(limited_text); if text_width < size_limit then break @@ -90,8 +90,8 @@ function drawing.limit_text_size(text, size_limit) return limited_text; end -function drawing.scale_color_opacity(color, scale) - local alpha, red, green, blue = drawing.color_to_argb(color); +function this.scale_color_opacity(color, scale) + local alpha, red, green, blue = this.color_to_argb(color); local new_alpha = math.floor(alpha * scale); if new_alpha < 0 then new_alpha = 0; @@ -100,28 +100,28 @@ function drawing.scale_color_opacity(color, scale) new_alpha = 255; end - return drawing.argb_to_color(new_alpha, red, green, blue); + return this.argb_to_color(new_alpha, red, green, blue); end -function drawing.scale_bar_opacity(bar, scale) +function this.scale_bar_opacity(bar, scale) if bar == nil or scale == nil or not bar.visibility then return; end - bar.colors.foreground = drawing.scale_color_opacity(bar.colors.foreground, scale); - bar.colors.background = drawing.scale_color_opacity(bar.colors.background, scale); + bar.colors.foreground = this.scale_color_opacity(bar.colors.foreground, scale); + bar.colors.background = this.scale_color_opacity(bar.colors.background, scale); end -function drawing.scale_label_opacity(label, scale) +function this.scale_label_opacity(label, scale) if label == nil or scale == nil or not label.visibility then return; end - label.color = drawing.scale_color_opacity(label.color, scale); - label.shadow.color = drawing.scale_color_opacity(label.shadow.color, scale); + label.color = this.scale_color_opacity(label.color, scale); + label.shadow.color = this.scale_color_opacity(label.shadow.color, scale); end -function drawing.draw_label(label, position, opacity_scale, ...) +function this.draw_label(label, position, opacity_scale, ...) if label == nil or not label.visibility then return; end @@ -141,32 +141,32 @@ function drawing.draw_label(label, position, opacity_scale, ...) local new_shadow_color = label.shadow.color; if opacity_scale < 1 then - new_shadow_color = drawing.scale_color_opacity(new_shadow_color, opacity_scale); + new_shadow_color = this.scale_color_opacity(new_shadow_color, opacity_scale); end if use_d2d then - d2d.text(drawing.font, text, position_x + label.shadow.offset.x, position_y + label.shadow.offset.y, new_shadow_color); + d2d.text(this.font, text, position_x + label.shadow.offset.x, position_y + label.shadow.offset.y, new_shadow_color); else - new_shadow_color = drawing.argb_color_to_abgr_color(new_shadow_color); + new_shadow_color = this.argb_color_to_abgr_color(new_shadow_color); draw.text(text, position_x + label.shadow.offset.x, position_y + label.shadow.offset.y, new_shadow_color); end end local new_color = label.color; if opacity_scale < 1 then - new_color = drawing.scale_color_opacity(new_color, opacity_scale); + new_color = this.scale_color_opacity(new_color, opacity_scale); end if use_d2d then - d2d.text(drawing.font, text, position_x, position_y, new_color); + d2d.text(this.font, text, position_x, position_y, new_color); else - new_color = drawing.argb_color_to_abgr_color(new_color); + new_color = this.argb_color_to_abgr_color(new_color); draw.text(text, position_x, position_y, new_color); end end -function drawing.draw_bar(bar, position, opacity_scale, percentage) +function this.draw_bar(bar, position, opacity_scale, percentage) if bar == nil or not bar.visibility then return; @@ -264,9 +264,9 @@ function drawing.draw_bar(bar, position, opacity_scale, percentage) local outline_color = bar.colors.outline; if opacity_scale < 1 then - foreground_color = drawing.scale_color_opacity(foreground_color, opacity_scale); - background_color = drawing.scale_color_opacity(background_color, opacity_scale); - outline_color = drawing.scale_color_opacity(outline_color, opacity_scale); + foreground_color = this.scale_color_opacity(foreground_color, opacity_scale); + background_color = this.scale_color_opacity(background_color, opacity_scale); + outline_color = this.scale_color_opacity(outline_color, opacity_scale); end local use_d2d = d2d ~= nil and config.current_config.global_settings.renderer.use_d2d_if_available; @@ -277,7 +277,7 @@ function drawing.draw_bar(bar, position, opacity_scale, percentage) d2d.outline_rect(outline_position_x, outline_position_y, outline_width, outline_height, outline_thickness, outline_color); else - outline_color = drawing.argb_color_to_abgr_color(outline_color); + outline_color = this.argb_color_to_abgr_color(outline_color); draw.outline_rect(outline_position_x, outline_position_y, outline_width, outline_height, outline_color); end end @@ -288,7 +288,7 @@ function drawing.draw_bar(bar, position, opacity_scale, percentage) d2d.fill_rect(position_x, position_y, foreground_width, height, foreground_color); else - foreground_color = drawing.argb_color_to_abgr_color(foreground_color); + foreground_color = this.argb_color_to_abgr_color(foreground_color); draw.filled_rect(position_x, position_y, foreground_width, height, foreground_color) end end @@ -298,13 +298,13 @@ function drawing.draw_bar(bar, position, opacity_scale, percentage) if use_d2d then d2d.fill_rect(position_x + foreground_width, position_y, background_width, height, background_color); else - background_color = drawing.argb_color_to_abgr_color(background_color); + background_color = this.argb_color_to_abgr_color(background_color); draw.filled_rect(position_x + foreground_width, position_y, background_width, height, background_color) end end end -function drawing.draw_capture_line(health_UI, position, opacity_scale, percentage) +function this.draw_capture_line(health_UI, position, opacity_scale, percentage) if health_UI == nil or not health_UI.visibility or health_UI.bar == nil or not health_UI.bar.visibility or health_UI.bar.capture_line == nil or not health_UI.bar.capture_line.visibility or percentage >= 1 or percentage <= 0 then return; @@ -317,7 +317,7 @@ function drawing.draw_capture_line(health_UI, position, opacity_scale, percentag local color = health_UI.bar.capture_line.color; if opacity_scale < 1 then - color = drawing.scale_color_opacity(color, opacity_scale); + color = this.scale_color_opacity(color, opacity_scale); end local use_d2d = d2d ~= nil and config.current_config.global_settings.renderer.use_d2d_if_available; @@ -326,15 +326,15 @@ function drawing.draw_capture_line(health_UI, position, opacity_scale, percentag d2d.fill_rect(position_x, position_y, health_UI.bar.capture_line.size.width, health_UI.bar.capture_line.size.height, color); else - color = drawing.argb_color_to_abgr_color(color); + color = this.argb_color_to_abgr_color(color); draw.filled_rect(position_x, position_y, health_UI.bar.capture_line.size.width, health_UI.bar.capture_line.size.height, color) end end -function drawing.init_module() +function this.init_module() config = require("MHR_Overlay.Misc.config"); utils = require("MHR_Overlay.Misc.utils"); end -return drawing; +return this;