mirror of
https://github.com/GreenComfyTea/MHR-Overlay.git
synced 2026-01-24 20:38:03 -08:00
Utilize this keyword everywhere
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
return this;
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user