mirror of
https://github.com/GreenComfyTea/MHR-Overlay.git
synced 2026-01-23 20:08:05 -08:00
Fixed player id issues, refactored monster update function, implemented blast, poison and wyvern riding damage
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
x = "";
|
||||
xy = "";
|
||||
|
||||
local keyboard = require("MHR_Overlay.Game_Handler.keyboard");
|
||||
local quest_status = require("MHR_Overlay.Game_Handler.quest_status");
|
||||
@@ -11,6 +11,7 @@ local language = require("MHR_Overlay.Misc.language");
|
||||
local table_helpers = require("MHR_Overlay.Misc.table_helpers");
|
||||
local part_names = require("MHR_Overlay.Misc.part_names");
|
||||
|
||||
local ailments = require("MHR_Overlay.Damage_Meter.ailments");
|
||||
local player = require("MHR_Overlay.Damage_Meter.player");
|
||||
local damage_hook = require("MHR_Overlay.Damage_Meter.damage_hook");
|
||||
|
||||
@@ -52,6 +53,7 @@ rage_UI_entity.init_module();
|
||||
|
||||
damage_hook.init_module();
|
||||
player.init_module();
|
||||
ailments.init_module();
|
||||
|
||||
body_part.init_module();
|
||||
large_monster.init_module();
|
||||
@@ -93,8 +95,8 @@ re.on_frame(function()
|
||||
end);
|
||||
|
||||
re.on_frame(function()
|
||||
--draw.text("x: " .. tostring(x), 451, 51, 0xFF000000);
|
||||
--draw.text("x: " .. tostring(x), 450, 50, 0xFFFFFFFF);
|
||||
draw.text("xy: " .. tostring(xy), 551, 11, 0xFF000000);
|
||||
draw.text("xy: " .. tostring(xy), 550, 10, 0xFFFFFFFF);
|
||||
end);
|
||||
-- #endregion
|
||||
--------------------------RE_IMGUI---------------------------
|
||||
@@ -118,11 +120,6 @@ end, function()
|
||||
else
|
||||
player.update_player_list_on_quest();
|
||||
end
|
||||
|
||||
--onQuestEnd()
|
||||
--onQuestErrorEnd()
|
||||
--onResultEnd()
|
||||
--resultEndSub()
|
||||
|
||||
if quest_status.index < 2 then
|
||||
quest_status.update_is_training_area();
|
||||
@@ -214,4 +211,219 @@ end, function()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--snow.player.PlayerManager ->
|
||||
-- <PlayerData>k_BackingField -> [0]
|
||||
|
||||
--Demondrug _AtkUpAlive = 5 1
|
||||
--Mega Demondrug _AtkUpAlive = 7 1
|
||||
--Armorskin _DefUpAlive = 15 1
|
||||
--Mega Armorskin _DefUpAlive = 25 1
|
||||
--Might Seed _AtkUpBuffSecond and _AtkUpBuffSecondTimer 1
|
||||
--Demon Powder _AtkUpItemSecond and _AtkUpItemSecondTimer 1
|
||||
--Adamant Seed _DefUpBuffSecond and _DefUpBuffSecondTimer 1
|
||||
--Hardshell Powder _DefUpItemSecond and _DefUpItemSecondTimer 1
|
||||
--Dash Juice _StaminaUpBuffSecondTimer 1
|
||||
--Immunizer _VitalizerTimer 1
|
||||
|
||||
-- Attack Up
|
||||
-- Defense Up
|
||||
-- Affinity Up _AtkUpEcSecond and _AtkUpEcSecondTimer
|
||||
-- Sharpness Loss Reduced
|
||||
-- Elemental Attack Boost
|
||||
-- Divine Protection
|
||||
-- Health Regeneration
|
||||
-- Natural Healing Up
|
||||
-- Blight Negated
|
||||
-- Immunity
|
||||
-- Stamina Recovery Up
|
||||
-- Stamina Use Reduced
|
||||
-- Knockbacks Negated _DefUpEcSecond and _DefUpEcSecondTimer
|
||||
-- Sonic Barrier
|
||||
-- Earplugs (S)
|
||||
-- Earplugs (L)
|
||||
-- Tremor Negated
|
||||
-- Enviroment Damage Negated
|
||||
-- Stun Negated
|
||||
-- Wind Pressure Negated
|
||||
-- Gourmet Fish Effect
|
||||
-- Self Improvement
|
||||
-- Infernal Melody
|
||||
|
||||
--[[
|
||||
local player_data_array = singletons.player_manager:get_field("<PlayerData>k__BackingField");
|
||||
local player_data = player_data_array:get_element(0);
|
||||
|
||||
local _AtkUpAlive = player_data:get_field("_AtkUpAlive");
|
||||
local _DefUpAlive = player_data:get_field("_DefUpAlive");
|
||||
|
||||
xy = "AtkUpAlive: " .. tostring(_AtkUpAlive);
|
||||
xy = xy .. "\n_DefUpAlive: " .. tostring(_DefUpAlive);
|
||||
|
||||
local _AtkUpBuffSecond = player_data:get_field("_AtkUpBuffSecond");
|
||||
local _DefUpBuffSecond = player_data:get_field("_DefUpBuffSecond");
|
||||
local _DefUpBuffSecondRate = player_data:get_field("_DefUpBuffSecondRate");
|
||||
|
||||
xy = xy .. "\n_AtkUpBuffSecond: " .. tostring(_AtkUpBuffSecond);
|
||||
xy = xy .. "\n_DefUpBuffSecond: " .. tostring(_DefUpBuffSecond);
|
||||
xy = xy .. "\n_DefUpBuffSecondRate: " .. tostring(_DefUpBuffSecondRate);
|
||||
|
||||
local _AtkUpBuffSecondTimer = player_data:get_field("_AtkUpBuffSecondTimer");
|
||||
local _DefUpBuffSecondTimer = player_data:get_field("_DefUpBuffSecondTimer");
|
||||
local _DefUpBuffSecondRateTimer = player_data:get_field("_DefUpBuffSecondRateTimer");
|
||||
|
||||
xy = xy .. "\n_AtkUpBuffSecondTimer: " .. tostring(_AtkUpBuffSecondTimer);
|
||||
xy = xy .. "\n_DefUpBuffSecondTimer: " .. tostring(_DefUpBuffSecondTimer);
|
||||
xy = xy .. "\n_DefUpBuffSecondRateTimer: " .. tostring(_DefUpBuffSecondRateTimer);
|
||||
|
||||
local _StaminaUpBuffSecondTimer = player_data:get_field("_StaminaUpBuffSecondTimer");
|
||||
|
||||
xy = xy .. "\n_StaminaUpBuffSecondTimer: " .. tostring(_StaminaUpBuffSecondTimer);
|
||||
|
||||
local _AtkUpItemSecond = player_data:get_field("_AtkUpItemSecond");
|
||||
local _DefUpItemSecond = player_data:get_field("_DefUpItemSecond");
|
||||
|
||||
xy = xy .. "\n_AtkUpItemSecond: " .. tostring(_AtkUpItemSecond);
|
||||
xy = xy .. "\n_DefUpItemSecond: " .. tostring(_DefUpItemSecond);
|
||||
|
||||
local _AtkUpItemSecondTimer = player_data:get_field("_AtkUpItemSecondTimer");
|
||||
local _DefUpItemSecondTimer = player_data:get_field("_DefUpItemSecondTimer");
|
||||
|
||||
xy = xy .. "\n_AtkUpItemSecondTimer: " .. tostring(_AtkUpItemSecondTimer);
|
||||
xy = xy .. "\n_DefUpItemSecondTimer: " .. tostring(_DefUpItemSecondTimer);
|
||||
|
||||
local _SuperArmorItemTimer = player_data:get_field("_SuperArmorItemTimer");
|
||||
|
||||
xy = xy .. "\n_SuperArmorItemTimer: " .. tostring(_SuperArmorItemTimer);
|
||||
|
||||
local _AtkUpEcSecondTimer = player_data:get_field("_AtkUpEcSecondTimer");
|
||||
local _AtkUpEcSecond = player_data:get_field("_AtkUpEcSecond");
|
||||
|
||||
xy = xy .. "\n_AtkUpEcSecondTimer: " .. tostring(_AtkUpEcSecondTimer);
|
||||
xy = xy .. "\n_AtkUpEcSecond: " .. tostring(_AtkUpEcSecond);
|
||||
|
||||
local _DefUpEcSecondTimer = player_data:get_field("_DefUpEcSecondTimer");
|
||||
local _DefUpEcSecond = player_data:get_field("_DefUpEcSecond");
|
||||
|
||||
xy = xy .. "\n_DefUpEcSecondTimer: " .. tostring(_DefUpEcSecondTimer);
|
||||
xy = xy .. "\n_DefUpEcSecond: " .. tostring(_DefUpEcSecond);
|
||||
|
||||
local _CritUpEcSecondTimer = player_data:get_field("_CritUpEcSecondTimer");
|
||||
local _CritChanceUpBowTimer = player_data:get_field("_CritChanceUpBowTimer");
|
||||
local _CritChanceUpBow = player_data:get_field("_CritChanceUpBow");
|
||||
|
||||
xy = xy .. "\n_CritUpEcSecondTimer: " .. tostring(_CritUpEcSecondTimer);
|
||||
xy = xy .. "\n_CritChanceUpBowTimer: " .. tostring(_CritChanceUpBowTimer);
|
||||
xy = xy .. "\n_CritChanceUpBow: " .. tostring(_CritChanceUpBow);
|
||||
|
||||
local _MusicRegeneTimer = player_data:get_field("_MusicRegeneTimer");
|
||||
|
||||
xy = xy .. "\n_MusicRegeneTimer: " .. tostring(_MusicRegeneTimer);
|
||||
|
||||
local _LeadEnemyTimer = player_data:get_field("_LeadEnemyTimer");
|
||||
local _IsLeadEnemy = player_data:get_field("_IsLeadEnemy");
|
||||
|
||||
xy = xy .. "\n_LeadEnemyTimer: " .. tostring(_LeadEnemyTimer);
|
||||
xy = xy .. "\n_IsLeadEnemy: " .. tostring(_IsLeadEnemy);
|
||||
|
||||
local _DebuffPreventionTimer = player_data:get_field("_DebuffPreventionTimer");
|
||||
|
||||
xy = xy .. "\n_DebuffPreventionTimer: " .. tostring(_DebuffPreventionTimer);
|
||||
|
||||
local _FishRegeneTimer = player_data:get_field("_FishRegeneTimer");
|
||||
local _FishRegeneEnableTimer = player_data:get_field("_FishRegeneEnableTimer");
|
||||
|
||||
xy = xy .. "\n_FishRegeneTimer: " .. tostring(_FishRegeneTimer);
|
||||
xy = xy .. "\n_FishRegeneEnableTimer: " .. tostring(_FishRegeneEnableTimer);
|
||||
|
||||
local _VitalizerTimer = player_data:get_field("_VitalizerTimer");
|
||||
|
||||
xy = xy .. "\n_VitalizerTimer: " .. tostring(_VitalizerTimer);
|
||||
|
||||
local _RunhighOtomoTimer = player_data:get_field("_RunhighOtomoTimer");
|
||||
local _KijinBulletTimer = player_data:get_field("_KijinBulletTimer");
|
||||
local _KoukaBulletTimer = player_data:get_field("_KoukaBulletTimer");
|
||||
local _EquipSkill_036_Timer = player_data:get_field("_EquipSkill_036_Timer");
|
||||
|
||||
xy = xy .. "\n_RunhighOtomoTimer: " .. tostring(_RunhighOtomoTimer);
|
||||
xy = xy .. "\n_KijinBulletTimer: " .. tostring(_KijinBulletTimer);
|
||||
xy = xy .. "\n_KoukaBulletTimer: " .. tostring(_KoukaBulletTimer);
|
||||
xy = xy .. "\n_EquipSkill_036_Timer: " .. tostring(_EquipSkill_036_Timer);
|
||||
|
||||
local _HyperArmorItemTimer = player_data:get_field("_HyperArmorItemTimer");
|
||||
|
||||
xy = xy .. "\n_HyperArmorItemTimer: " .. tostring(_HyperArmorItemTimer);
|
||||
|
||||
local _KijinOtomoTimer = player_data:get_field("_KijinOtomoTimer");
|
||||
local _BeastRoarOtomoTimer = player_data:get_field("_BeastRoarOtomoTimer");
|
||||
local _ChallengeTimer = player_data:get_field("_ChallengeTimer");
|
||||
local _WholeBodyTimer = player_data:get_field("_WholeBodyTimer");
|
||||
|
||||
xy = xy .. "\n_KijinOtomoTimer: " .. tostring(_KijinOtomoTimer);
|
||||
xy = xy .. "\n_BeastRoarOtomoTimer: " .. tostring(_BeastRoarOtomoTimer);
|
||||
xy = xy .. "\n_ChallengeTimer: " .. tostring(_ChallengeTimer);
|
||||
xy = xy .. "\n_WholeBodyTimer: " .. tostring(_WholeBodyTimer);
|
||||
|
||||
local _SlidingTimer = player_data:get_field("_SlidingTimer");
|
||||
local _SlidingPowerupTimer = player_data:get_field("_SlidingPowerupTimer");
|
||||
|
||||
xy = xy .. "\n_SlidingTimer: " .. tostring(_SlidingTimer);
|
||||
xy = xy .. "\n_SlidingPowerupTimer: " .. tostring(_SlidingPowerupTimer);
|
||||
|
||||
local _WallRunTimer = player_data:get_field("_WallRunTimer");
|
||||
local _WallRunPowerupTimer = player_data:get_field("_WallRunPowerupTimer");
|
||||
|
||||
xy = xy .. "\n_WallRunTimer: " .. tostring(_WallRunTimer);
|
||||
xy = xy .. "\n_WallRunPowerupTimer: " .. tostring(_WallRunPowerupTimer);
|
||||
|
||||
local _CounterattackPowerupTimer = player_data:get_field("_CounterattackPowerupTimer");
|
||||
|
||||
xy = xy .. "\n_CounterattackPowerupTimer: " .. tostring(_CounterattackPowerupTimer);
|
||||
|
||||
-- sic!
|
||||
local _OnibiPowerUpTiemr = player_data:get_field("_OnibiPowerUpTiemr");
|
||||
local _OnibiPowerUpInterval = player_data:get_field("_OnibiPowerUpInterval");
|
||||
|
||||
xy = xy .. "\n_OnibiPowerUpTiemr: " .. tostring(_OnibiPowerUpTiemr);
|
||||
xy = xy .. "\n_OnibiPowerUpInterval: " .. tostring(_OnibiPowerUpInterval);
|
||||
|
||||
local _HyakuryuDragonPowerUpTimer = player_data:get_field("_HyakuryuDragonPowerUpTimer");
|
||||
local _HyakuryuDragonPowerUpCnt = player_data:get_field("_HyakuryuDragonPowerUpCnt");
|
||||
local _HyakuryuHyakuryuOnazutiPowerUpInterval = player_data:get_field("_HyakuryuHyakuryuOnazutiPowerUpInterval");
|
||||
|
||||
xy = xy .. "\n_HyakuryuDragonPowerUpTimer: " .. tostring(_HyakuryuDragonPowerUpTimer);
|
||||
xy = xy .. "\n_HyakuryuDragonPowerUpCnt: " .. tostring(_HyakuryuDragonPowerUpCnt);
|
||||
xy = xy .. "\n_HyakuryuHyakuryuOnazutiPowerUpInterval: " .. tostring(_HyakuryuHyakuryuOnazutiPowerUpInterval);
|
||||
|
||||
local _KitchenSkill027Timer = player_data:get_field("_KitchenSkill027Timer");
|
||||
local _KitchenSkill045Timer = player_data:get_field("_KitchenSkill045Timer");
|
||||
|
||||
xy = xy .. "\n_KitchenSkill027Timer: " .. tostring(_KitchenSkill027Timer);
|
||||
xy = xy .. "\n_KitchenSkill045Timer: " .. tostring(_KitchenSkill045Timer);
|
||||
|
||||
-- sic!
|
||||
local _ReduseUseStaminaKichenSkillActive = player_data:get_field("_ReduseUseStaminaKichenSkillActive");
|
||||
|
||||
xy = xy .. "\n_ReduseUseStaminaKichenSkillActive: " .. tostring(_ReduseUseStaminaKichenSkillActive);
|
||||
|
||||
local _HeavyBowgunWyvernSnipeTimer = player_data:get_field("_HeavyBowgunWyvernSnipeTimer");
|
||||
local _HeavyBowgunWyvernMachineGunTimer = player_data:get_field("_HeavyBowgunWyvernMachineGunTimer");
|
||||
local _HeavyBowgunWyvernSnipeBullet = player_data:get_field("_HeavyBowgunWyvernSnipeBullet");
|
||||
local _HeavyBowgunWyvernMachineGunBullet = player_data:get_field("_HeavyBowgunWyvernMachineGunBullet");
|
||||
|
||||
xy = xy .. "\n_HeavyBowgunWyvernSnipeTimer: " .. tostring(_HeavyBowgunWyvernSnipeTimer);
|
||||
xy = xy .. "\n_HeavyBowgunWyvernMachineGunTimer: " .. tostring(_HeavyBowgunWyvernMachineGunTimer);
|
||||
xy = xy .. "\n_HeavyBowgunWyvernSnipeBullet: " .. tostring(_HeavyBowgunWyvernSnipeBullet);
|
||||
xy = xy .. "\n_HeavyBowgunWyvernMachineGunBullet: " .. tostring(_HeavyBowgunWyvernMachineGunBullet);
|
||||
|
||||
local _ChargeDragonSlayCannonTime = player_data:get_field("_ChargeDragonSlayCannonTime");
|
||||
|
||||
xy = xy .. "\n_ChargeDragonSlayCannonTime: " .. tostring(_ChargeDragonSlayCannonTime);
|
||||
|
||||
local _WyvernBlastGauge = player_data:get_field("_WyvernBlastGauge");
|
||||
local _WyvernBlastReloadTimer = player_data:get_field("_WyvernBlastReloadTimer");
|
||||
|
||||
xy = xy .. "\n_WyvernBlastGauge: " .. tostring(_WyvernBlastGauge);
|
||||
xy = xy .. "\n_WyvernBlastReloadTimer: " .. tostring(_WyvernBlastReloadTimer);
|
||||
--]]
|
||||
end);
|
||||
|
||||
101
reframework/autorun/MHR_Overlay/Damage_Meter/ailments.lua
Normal file
101
reframework/autorun/MHR_Overlay/Damage_Meter/ailments.lua
Normal file
@@ -0,0 +1,101 @@
|
||||
local ailments = {};
|
||||
local player;
|
||||
|
||||
--0 Paralyze
|
||||
--1 Sleep
|
||||
--2 Stun
|
||||
--3 Flash
|
||||
--4 Poison
|
||||
--5 Blast
|
||||
--6 Stamina
|
||||
--7 MarionetteStart
|
||||
--8 Water
|
||||
--9 Fire
|
||||
--10 Ice
|
||||
--11 Thunder
|
||||
--12 FallTrap
|
||||
--13 ShockTrap
|
||||
--14 Capture
|
||||
--15 Koyashi
|
||||
--16 SteelFang
|
||||
|
||||
ailments.poison_id = 4;
|
||||
ailments.blast_id = 5;
|
||||
|
||||
function ailments.apply_ailment_buildup(monster, attacker_id, ailment_type, ailment_buildup)
|
||||
if monster == nil or player == nil or (ailment_type ~= ailments.poison_id and ailment_type ~= ailments.blast_id) then
|
||||
return;
|
||||
end
|
||||
|
||||
-- get the buildup accumulator for this type
|
||||
if monster.ailment[ailment_type].buildup == nil then
|
||||
monster.ailment[ailment_type].buildup = {};
|
||||
end
|
||||
|
||||
-- accumulate this buildup for this attacker
|
||||
monster.ailment[ailment_type].buildup[attacker_id] = (monster.ailment[ailment_type].buildup[attacker_id] or 0) + ailment_buildup;
|
||||
end
|
||||
|
||||
-- Code by coavins
|
||||
function ailments.calculate_ailment_contribution(monster, ailment_type)
|
||||
-- get total
|
||||
local total = 0;
|
||||
for attacker_id, player_buildup in pairs(monster.ailment[ailment_type].buildup) do
|
||||
total = total + player_buildup;
|
||||
end
|
||||
|
||||
for attacker_id, player_buildup in pairs(monster.ailment[ailment_type].buildup) do
|
||||
-- update ratio for this attacker
|
||||
monster.ailment[ailment_type].share[attacker_id] = player_buildup / total;
|
||||
-- clear accumulated buildup for this attacker
|
||||
-- they have to start over to earn a share of next ailment trigger
|
||||
monster.ailment[ailment_type].buildup[attacker_id] = 0;
|
||||
end
|
||||
end
|
||||
|
||||
-- Code by coavins
|
||||
function ailments.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;
|
||||
end
|
||||
|
||||
local damage_source_type = "";
|
||||
if ailment_type == ailments.poison_id then
|
||||
damage_source_type = "poison";
|
||||
elseif ailment_type == ailments.blast_id then
|
||||
damage_source_type = "blast";
|
||||
else
|
||||
return;
|
||||
end
|
||||
|
||||
local damage = ailment_damage;
|
||||
|
||||
|
||||
-- split up damage according to ratio of buildup on boss for this type
|
||||
for attacker_id, percentage in pairs(monster.ailment[ailment_type].share) do
|
||||
local damage_portion = damage * percentage;
|
||||
|
||||
local damage_object = {};
|
||||
damage_object.total_damage = damage_portion;
|
||||
damage_object.physical_damage = 0;
|
||||
damage_object.elemental_damage = 0;
|
||||
damage_object.ailment_damage = damage_portion;
|
||||
|
||||
local attacking_player = player.get_player(attacker_id);
|
||||
|
||||
if attacking_player ~= nil then
|
||||
player.update_damage(attacking_player, damage_source_type, true, damage_object);
|
||||
end
|
||||
|
||||
player.update_damage(player.total, damage_source_type, true, damage_object);
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
function ailments.init_module()
|
||||
player = require("MHR_Overlay.Damage_Meter.player");
|
||||
end
|
||||
|
||||
return ailments;
|
||||
@@ -1,6 +1,9 @@
|
||||
local damage_hook = {};
|
||||
local quest_status;
|
||||
local player;
|
||||
local small_monster;
|
||||
local large_monster;
|
||||
local ailments;
|
||||
|
||||
local enemy_character_base_type_def = sdk.find_type_definition("snow.enemy.EnemyCharacterBase");
|
||||
local enemy_character_base_after_calc_damage_damage_side = enemy_character_base_type_def:get_method("afterCalcDamage_DamageSide");
|
||||
@@ -11,11 +14,13 @@ local check_die_method = enemy_character_base_type_def:get_method("checkDie");
|
||||
local enemy_calc_damage_info_type_def = sdk.find_type_definition("snow.hit.EnemyCalcDamageInfo.AfterCalcInfo_DamageSide");
|
||||
local get_attacker_id_method = enemy_calc_damage_info_type_def:get_method("get_AttackerID");
|
||||
local get_damage_attacker_type_method = enemy_calc_damage_info_type_def:get_method("get_DamageAttackerType");
|
||||
local is_marionette_attack_method = enemy_calc_damage_info_type_def:get_method("get_IsMarionetteAttack");
|
||||
|
||||
local get_total_damage_method = enemy_calc_damage_info_type_def:get_method("get_TotalDamage");
|
||||
local get_physical_damage_method = enemy_calc_damage_info_type_def:get_method("get_PhysicalDamage");
|
||||
local get_elemental_damage_method = enemy_calc_damage_info_type_def:get_method("get_ElementDamage");
|
||||
local get_condition_damage_method = enemy_calc_damage_info_type_def:get_method("get_ConditionDamage");
|
||||
local get_condition_type_method = enemy_calc_damage_info_type_def:get_method("get_ConditionDamageType");
|
||||
|
||||
sdk.hook(enemy_character_base_after_calc_damage_damage_side, function(args)
|
||||
pcall(damage_hook.update_damage, args);
|
||||
@@ -47,21 +52,31 @@ function damage_hook.update_damage(args)
|
||||
local enemy_calc_damage_info = sdk.to_managed_object(args[3]); -- snow.hit.EnemyCalcDamageInfo.AfterCalcInfo_DamageSide
|
||||
local attacker_id = get_attacker_id_method:call(enemy_calc_damage_info);
|
||||
local attacker_type = get_damage_attacker_type_method:call(enemy_calc_damage_info);
|
||||
|
||||
if attacker_id >= 100 then
|
||||
return;
|
||||
end
|
||||
|
||||
local is_marionette_attack = is_marionette_attack_method:call(enemy_calc_damage_info)
|
||||
|
||||
-- 4 is virtual player in singleplayer that 'owns' 2nd otomo
|
||||
if not quest_status.is_online and attacker_id == 4 then
|
||||
attacker_id = player.myself.player_id;
|
||||
end
|
||||
|
||||
if is_marionette_attack then
|
||||
large_monster.update_all_riders();
|
||||
for enemy, monster in pairs(large_monster.list) do
|
||||
if monster.unique_id == attacker_id then
|
||||
attacker_id = monster.rider_id;
|
||||
break;
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local damage_object = {}
|
||||
damage_object.total_damage = get_total_damage_method:call(enemy_calc_damage_info);
|
||||
damage_object.physical_damage = get_physical_damage_method:call(enemy_calc_damage_info);
|
||||
damage_object.elemental_damage = get_elemental_damage_method:call(enemy_calc_damage_info);
|
||||
damage_object.ailment_damage = get_condition_damage_method:call(enemy_calc_damage_info);
|
||||
damage_object.ailment_damage = 0;
|
||||
|
||||
local condition_damage = get_condition_damage_method:call(enemy_calc_damage_info);
|
||||
local condition_type = tonumber(get_condition_type_method:call(enemy_calc_damage_info));
|
||||
|
||||
-- -1 - bombs
|
||||
-- 0 - player
|
||||
@@ -95,9 +110,28 @@ function damage_hook.update_damage(args)
|
||||
|
||||
local attacking_player = player.get_player(attacker_id);
|
||||
if attacking_player == nil then
|
||||
return;
|
||||
--return;
|
||||
end
|
||||
|
||||
local monster;
|
||||
if is_large_monster then
|
||||
monster = large_monster.get_monster(enemy);
|
||||
else
|
||||
monster = small_monster.get_monster(enemy);
|
||||
end
|
||||
|
||||
--xy =
|
||||
-- "type: " .. tostring(damage_source_type) .. "\n" ..
|
||||
-- "total damage: " .. tostring(damage_object.total_damage) .. "\n" ..
|
||||
-- "physical damage: " .. tostring(damage_object.physical_damage) .. "\n" ..
|
||||
-- "elemental damage: " .. tostring(damage_object.elemental_damage) .. "\n" ..
|
||||
-- "condition damage: " .. tostring(condition_damage) .. "\n" ..
|
||||
-- "condition type: " .. tostring(condition_type) .. "\n" ..
|
||||
-- "is mario attack: " .. tostring(is_marionette_attack) .. "\n" ..
|
||||
-- "attacker id: " .. tostring(attacker_id) .. "\n";
|
||||
|
||||
ailments.apply_ailment_buildup(monster, attacker_id, condition_type, condition_damage);
|
||||
|
||||
player.update_damage(player.total, damage_source_type, is_large_monster, damage_object);
|
||||
player.update_damage(attacking_player, damage_source_type, is_large_monster, damage_object);
|
||||
end
|
||||
@@ -105,6 +139,9 @@ end
|
||||
function damage_hook.init_module()
|
||||
quest_status = require("MHR_Overlay.Game_Handler.quest_status");
|
||||
player = require("MHR_Overlay.Damage_Meter.player");
|
||||
small_monster = require("MHR_Overlay.Monsters.small_monster");
|
||||
large_monster = require("MHR_Overlay.Monsters.large_monster");
|
||||
ailments = require("MHR_Overlay.Damage_Meter.ailments");
|
||||
end
|
||||
|
||||
return damage_hook;
|
||||
@@ -61,6 +61,18 @@ function player.new(player_id, player_name, player_hunter_rank)
|
||||
new_player.small_monsters.monster.elemental_damage = 0;
|
||||
new_player.small_monsters.monster.ailment_damage = 0;
|
||||
|
||||
new_player.small_monsters.poison = {};
|
||||
new_player.small_monsters.poison.total_damage = 0;
|
||||
new_player.small_monsters.poison.physical_damage = 0;
|
||||
new_player.small_monsters.poison.elemental_damage = 0;
|
||||
new_player.small_monsters.poison.ailment_damage = 0;
|
||||
|
||||
new_player.small_monsters.blast = {};
|
||||
new_player.small_monsters.blast.total_damage = 0;
|
||||
new_player.small_monsters.blast.physical_damage = 0;
|
||||
new_player.small_monsters.blast.elemental_damage = 0;
|
||||
new_player.small_monsters.blast.ailment_damage = 0;
|
||||
|
||||
new_player.large_monsters = {};
|
||||
|
||||
new_player.large_monsters.total_damage = 0;
|
||||
@@ -98,6 +110,18 @@ function player.new(player_id, player_name, player_hunter_rank)
|
||||
new_player.large_monsters.monster.elemental_damage = 0;
|
||||
new_player.large_monsters.monster.ailment_damage = 0;
|
||||
|
||||
new_player.large_monsters.poison = {};
|
||||
new_player.large_monsters.poison.total_damage = 0;
|
||||
new_player.large_monsters.poison.physical_damage = 0;
|
||||
new_player.large_monsters.poison.elemental_damage = 0;
|
||||
new_player.large_monsters.poison.ailment_damage = 0;
|
||||
|
||||
new_player.large_monsters.blast = {};
|
||||
new_player.large_monsters.blast.total_damage = 0;
|
||||
new_player.large_monsters.blast.physical_damage = 0;
|
||||
new_player.large_monsters.blast.elemental_damage = 0;
|
||||
new_player.large_monsters.blast.ailment_damage = 0;
|
||||
|
||||
new_player.display = {};
|
||||
new_player.display.total_damage = 0;
|
||||
new_player.display.physical_damage = 0;
|
||||
@@ -146,8 +170,12 @@ function player.update_damage(_player, damage_source_type, is_large_monster, dam
|
||||
player.merge_damage(player_monster_type.otomo, damage_object);
|
||||
elseif damage_source_type == "monster" then
|
||||
player.merge_damage(player_monster_type.monster, damage_object);
|
||||
elseif damage_source_type == "poison" then
|
||||
player.merge_damage(player_monster_type.poison, damage_object);
|
||||
elseif damage_source_type == "blast" then
|
||||
player.merge_damage(player_monster_type.blast, damage_object);
|
||||
else
|
||||
player.merge_damage(_player, damage_object);
|
||||
player.merge_damage(player_monster_type, damage_object);
|
||||
end
|
||||
|
||||
player.update_display(_player);
|
||||
@@ -187,6 +215,14 @@ function player.update_display(_player)
|
||||
if config.current_config.damage_meter_UI.tracked_damage_types.monster_damage then
|
||||
player.merge_damage(_player.display, _player.small_monsters.monster);
|
||||
end
|
||||
|
||||
if config.current_config.damage_meter_UI.tracked_damage_types.poison_damage then
|
||||
player.merge_damage(_player.display, _player.small_monsters.poison);
|
||||
end
|
||||
|
||||
if config.current_config.damage_meter_UI.tracked_damage_types.blast_damage then
|
||||
player.merge_damage(_player.display, _player.small_monsters.blast);
|
||||
end
|
||||
end
|
||||
|
||||
if config.current_config.damage_meter_UI.tracked_monster_types.large_monsters then
|
||||
@@ -213,6 +249,14 @@ function player.update_display(_player)
|
||||
if config.current_config.damage_meter_UI.tracked_damage_types.monster_damage then
|
||||
player.merge_damage(_player.display, _player.large_monsters.monster);
|
||||
end
|
||||
|
||||
if config.current_config.damage_meter_UI.tracked_damage_types.poison_damage then
|
||||
player.merge_damage(_player.display, _player.large_monsters.poison);
|
||||
end
|
||||
|
||||
if config.current_config.damage_meter_UI.tracked_damage_types.blast_damage then
|
||||
player.merge_damage(_player.display, _player.large_monsters.blast);
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -273,8 +317,6 @@ end
|
||||
|
||||
local lobby_manager_type_def = sdk.find_type_definition("snow.LobbyManager");
|
||||
local my_hunter_info_field = lobby_manager_type_def:get_field("_myHunterInfo");
|
||||
local myself_index_field = lobby_manager_type_def:get_field("_myselfIndex");
|
||||
local myself_quest_index_field = lobby_manager_type_def:get_field("_myselfQuestIndex");
|
||||
|
||||
local quest_hunter_info_field = lobby_manager_type_def:get_field("_questHunterInfo");
|
||||
local hunter_info_field = lobby_manager_type_def:get_field("_hunterInfo");
|
||||
@@ -291,6 +333,9 @@ local get_item_method = hunter_info_type_def:get_method("get_Item");
|
||||
local progress_manager_type_def = sdk.find_type_definition("snow.progress.ProgressManager");
|
||||
local get_hunter_rank_method = progress_manager_type_def:get_method("get_HunterRank");
|
||||
|
||||
local player_manager_type_def = sdk.find_type_definition("snow.player.PlayerManager");
|
||||
local get_master_player_id_method = player_manager_type_def:get_method("getMasterPlayerID");
|
||||
|
||||
function player.update_player_list_in_village()
|
||||
if singletons.lobby_manager == nil then
|
||||
return;
|
||||
@@ -318,12 +363,12 @@ function player.update_player_list_in_village()
|
||||
customization_menu.status = "No myself hunter rank";
|
||||
myself_hunter_rank = 0;
|
||||
end
|
||||
|
||||
local myself_id = myself_index_field:get_data(singletons.lobby_manager);
|
||||
|
||||
local myself_id = get_master_player_id_method:call(singletons.player_manager);
|
||||
if myself_id == nil then
|
||||
customization_menu.status = "No myself player id";
|
||||
elseif player.myself == nil or myself_id ~= player.myself.id then
|
||||
player.myself = player.new(myself_id, myself_player_name, myself_hunter_rank);
|
||||
player.myself = player.new(myself_id, myself_player_name, myself_hunter_rank);
|
||||
player.list[myself_id] = player.myself;
|
||||
end
|
||||
|
||||
@@ -399,14 +444,13 @@ function player.update_player_list_on_quest()
|
||||
myself_hunter_rank = 0;
|
||||
end
|
||||
|
||||
local myself_id = myself_quest_index_field:get_data(singletons.lobby_manager);
|
||||
local myself_id = get_master_player_id_method:call(singletons.player_manager);
|
||||
if myself_id == nil then
|
||||
customization_menu.status = "No myself player quest id";
|
||||
customization_menu.status = "No myself player id";
|
||||
elseif player.myself == nil or myself_id ~= player.myself.id then
|
||||
player.myself = player.new(myself_id, myself_player_name, myself_hunter_rank);
|
||||
player.list[myself_id] = player.myself;
|
||||
end
|
||||
|
||||
|
||||
-- other players
|
||||
local player_info_list = quest_hunter_info_field:get_data(singletons.lobby_manager);
|
||||
@@ -427,7 +471,6 @@ function player.update_player_list_on_quest()
|
||||
goto continue
|
||||
end
|
||||
|
||||
|
||||
local player_id = member_index_field:get_data(player_info);
|
||||
|
||||
if player_id == nil then
|
||||
|
||||
@@ -87,6 +87,10 @@ function quest_status.update_is_training_area()
|
||||
return;
|
||||
end
|
||||
|
||||
if quest_status.is_training_area == true and _is_training_area == false then
|
||||
player.init();
|
||||
end
|
||||
|
||||
quest_status.is_training_area = _is_training_area;
|
||||
end
|
||||
|
||||
|
||||
2
reframework/autorun/MHR_Overlay/Misc/Buffs.txt
Normal file
2
reframework/autorun/MHR_Overlay/Misc/Buffs.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
Buffs location:
|
||||
snow.player.PlayerManager -> <PlayerData> k_BackingField -> [0]
|
||||
@@ -1796,7 +1796,9 @@ function config.init()
|
||||
kunai_damage = true,
|
||||
installation_damage = true, -- hunting_installations like ballista, cannon, etc.
|
||||
otomo_damage = true,
|
||||
monster_damage = true -- note that installations during narwa fight are counted as monster damage
|
||||
monster_damage = true, -- note that installations during narwa fight are counted as monster damage
|
||||
poison_damage = true,
|
||||
blast_damage = true,
|
||||
},
|
||||
|
||||
spacing = {
|
||||
@@ -2073,7 +2075,7 @@ function config.init_module()
|
||||
|
||||
config.init();
|
||||
config.load();
|
||||
config.current_config.version = "v1.9.1";
|
||||
config.current_config.version = "v1.10";
|
||||
|
||||
language.update(table_helpers.find_index(language.language_names, config.current_config.global_settings.language, false));
|
||||
|
||||
|
||||
@@ -228,6 +228,8 @@ language.default_language = {
|
||||
installation_damage = "Installation Damage",
|
||||
otomo_damage = "Otomo Damage",
|
||||
monster_damage = "Monster Damage",
|
||||
poison_damage = "Poison Damage",
|
||||
blast_damage = "Blast Damage",
|
||||
|
||||
damage = "Damage",
|
||||
|
||||
@@ -253,7 +255,7 @@ language.default_language = {
|
||||
hotkeys = "Hotkeys",
|
||||
all_UI = "All UI",
|
||||
assign_new_key = "Assign new key",
|
||||
press_any_key = "Press any key..."
|
||||
press_any_key = "Press any key...",
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -9,6 +9,8 @@ local stamina_UI_entity;
|
||||
local rage_UI_entity;
|
||||
local screen;
|
||||
local drawing;
|
||||
local ailments;
|
||||
local player;
|
||||
|
||||
local body_part;
|
||||
local part_names;
|
||||
@@ -18,7 +20,9 @@ large_monster.list = {};
|
||||
function large_monster.new(enemy)
|
||||
local monster = {};
|
||||
monster.is_large = true;
|
||||
|
||||
monster.id = 0;
|
||||
monster.unique_id = 0;
|
||||
|
||||
monster.health = 0;
|
||||
monster.max_health = 999999;
|
||||
@@ -61,7 +65,20 @@ function large_monster.new(enemy)
|
||||
monster.crown = "";
|
||||
|
||||
monster.parts = {};
|
||||
|
||||
|
||||
monster.ailment = {};
|
||||
monster.ailment[ailments.poison_id] = {};
|
||||
monster.ailment[ailments.poison_id].buildup = {};
|
||||
monster.ailment[ailments.poison_id].share = {};
|
||||
monster.ailment[ailments.poison_id].activate_count = 0;
|
||||
|
||||
monster.ailment[ailments.blast_id] = {};
|
||||
monster.ailment[ailments.blast_id].buildup = {};
|
||||
monster.ailment[ailments.blast_id].share = {};
|
||||
monster.ailment[ailments.blast_id].activate_count = 0;
|
||||
|
||||
monster.rider_id = -1;
|
||||
|
||||
large_monster.init(monster, enemy);
|
||||
large_monster.init_static_UI(monster);
|
||||
large_monster.init_dynamic_UI(monster);
|
||||
@@ -76,7 +93,6 @@ end
|
||||
function large_monster.get_monster(enemy)
|
||||
if large_monster.list[enemy] == nil then
|
||||
return large_monster.new(enemy);
|
||||
|
||||
end
|
||||
return large_monster.list[enemy];
|
||||
end
|
||||
@@ -96,6 +112,11 @@ local get_small_border_method = size_info_type:get_method("get_SmallBorder");
|
||||
local get_big_border_method = size_info_type:get_method("get_BigBorder");
|
||||
local get_king_border_method = size_info_type:get_method("get_KingBorder");
|
||||
|
||||
local get_set_info_method = enemy_character_base_type_def:get_method("get_SetInfo");
|
||||
|
||||
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)
|
||||
local enemy_type = enemy_type_field:get_data(enemy);
|
||||
if enemy_type == nil then
|
||||
@@ -110,6 +131,14 @@ function large_monster.init(monster, enemy)
|
||||
monster.name = enemy_name;
|
||||
end
|
||||
|
||||
local set_info = get_set_info_method:call(enemy);
|
||||
if set_info ~= nil then
|
||||
local unique_id = get_unique_id_method:call(set_info);
|
||||
if unique_id ~= nil then
|
||||
monster.unique_id = unique_id;
|
||||
end
|
||||
end
|
||||
|
||||
local size_info = find_enemy_size_info_method:call(singletons.enemy_manager, enemy_type);
|
||||
if size_info ~= nil then
|
||||
local small_border = get_small_border_method:call(size_info);
|
||||
@@ -268,37 +297,58 @@ function large_monster.init_highlighted_UI(monster)
|
||||
end
|
||||
|
||||
local physical_param_field = enemy_character_base_type_def:get_field("<PhysicalParam>k__BackingField");
|
||||
local status_param_field = enemy_character_base_type_def:get_field("<StatusParam>k__BackingField")
|
||||
local stamina_param_field = enemy_character_base_type_def:get_field("<StaminaParam>k__BackingField")
|
||||
local anger_param_field = enemy_character_base_type_def:get_field("<AngerParam>k__BackingField")
|
||||
local stamina_param_field = enemy_character_base_type_def:get_field("<StaminaParam>k__BackingField");
|
||||
local anger_param_field = enemy_character_base_type_def:get_field("<AngerParam>k__BackingField");
|
||||
local damage_param_field = enemy_character_base_type_def:get_field("<DamageParam>k__BackingField");
|
||||
local check_die_method = enemy_character_base_type_def:get_method("checkDie");
|
||||
|
||||
local physical_param_type = physical_param_field:get_type();
|
||||
local get_vital_method = physical_param_type:get_method("getVital")
|
||||
local get_capture_hp_vital_method = physical_param_type:get_method("get_CaptureHpVital")
|
||||
local vital_list_field = physical_param_type:get_field("_VitalList")
|
||||
local get_vital_method = physical_param_type:get_method("getVital");
|
||||
local get_capture_hp_vital_method = physical_param_type:get_method("get_CaptureHpVital");
|
||||
local vital_list_field = physical_param_type:get_field("_VitalList");
|
||||
|
||||
local vital_param_type = get_vital_method:get_return_type();
|
||||
local get_current_method = vital_param_type:get_method("get_Current")
|
||||
local get_max_method = vital_param_type:get_method("get_Max")
|
||||
local get_current_method = vital_param_type:get_method("get_Current");
|
||||
local get_max_method = vital_param_type:get_method("get_Max");
|
||||
|
||||
local stamina_param_type = stamina_param_field:get_type();
|
||||
local get_stamina_method = stamina_param_type:get_method("getStamina")
|
||||
local get_max_stamina_method = stamina_param_type:get_method("getMaxStamina")
|
||||
local get_stamina_method = stamina_param_type:get_method("getStamina");
|
||||
local get_max_stamina_method = stamina_param_type:get_method("getMaxStamina");
|
||||
|
||||
local anger_param_type = anger_param_field:get_type();
|
||||
local is_anger_method = anger_param_type:get_method("isAnger")
|
||||
local get_anger_point_method = anger_param_type:get_method("get_AngerPoint")
|
||||
local get_limit_anger_method = anger_param_type:get_method("get_LimitAnger")
|
||||
local anger_param_get_timer_method = anger_param_type:get_method("get_Timer")
|
||||
local get_timer_anger_method = anger_param_type:get_method("get_TimerAnger")
|
||||
local get_count_anger_method = anger_param_type:get_method("get_CountAnger")
|
||||
local is_anger_method = anger_param_type:get_method("isAnger");
|
||||
local get_anger_point_method = anger_param_type:get_method("get_AngerPoint");
|
||||
local get_limit_anger_method = anger_param_type:get_method("get_LimitAnger");
|
||||
local anger_param_get_timer_method = anger_param_type:get_method("get_Timer");
|
||||
local get_timer_anger_method = anger_param_type:get_method("get_TimerAnger");
|
||||
local get_count_anger_method = anger_param_type:get_method("get_CountAnger");
|
||||
|
||||
local get_game_object_method = sdk.find_type_definition("via.Component"):get_method("get_GameObject")
|
||||
local get_transform_method = sdk.find_type_definition("via.GameObject"):get_method("get_Transform")
|
||||
local get_position_method = sdk.find_type_definition("via.Transform"):get_method("get_Position")
|
||||
local damage_param_type = damage_param_field:get_type();
|
||||
local poison_param_field = damage_param_type:get_field("_PoisonParam");
|
||||
local blast_param_field = damage_param_type:get_field("_BlastParam");
|
||||
|
||||
local poison_param_type = poison_param_field:get_type();
|
||||
local poison_get_activate_count_method = poison_param_type:get_method("get_ActivateCount");
|
||||
local poison_damage_field = poison_param_type:get_field("<Damage>k__BackingField");
|
||||
local poison_get_is_damage_method = poison_param_type:get_method("get_IsDamage");
|
||||
|
||||
local blast_param_type = blast_param_field:get_type();
|
||||
local blast_get_activate_count_method = blast_param_type:get_method("get_ActivateCount");
|
||||
local blast_damage_method = blast_param_type:get_method("get_BlastDamage");
|
||||
local blast_adjust_rate_method = blast_param_type:get_method("get_BlastDamageAdjustRateByEnemyLv");
|
||||
|
||||
local mario_param_field = enemy_character_base_type_def:get_field("<MarioParam>k__BackingField");
|
||||
|
||||
local mario_param_type = mario_param_field:get_type();
|
||||
local get_is_marionette_method = mario_param_type:get_method("get_IsMarionette");
|
||||
local get_mario_player_index_method = mario_param_type:get_method("get_MarioPlayerIndex");
|
||||
|
||||
local get_game_object_method = sdk.find_type_definition("via.Component"):get_method("get_GameObject");
|
||||
local get_transform_method = sdk.find_type_definition("via.GameObject"):get_method("get_Transform");
|
||||
local get_position_method = sdk.find_type_definition("via.Transform"):get_method("get_Position");
|
||||
|
||||
function large_monster.update_position(enemy)
|
||||
|
||||
if not config.current_config.large_monster_UI.dynamic.enabled
|
||||
and not config.current_config.large_monster_UI.static.enabled
|
||||
and not config.current_config.large_monster_UI.highlighted.enabled then
|
||||
@@ -340,8 +390,71 @@ function large_monster.update_position(enemy)
|
||||
end
|
||||
end
|
||||
|
||||
-- Code by coavins
|
||||
function large_monster.update_all_riders()
|
||||
for enemy, monster in pairs(large_monster.list) do
|
||||
-- get marionette rider
|
||||
local mario_param = enemy:get_field("<MarioParam>k__BackingField");
|
||||
if mario_param ~= nil then
|
||||
local is_marionette = get_is_marionette_method:call(mario_param);
|
||||
if is_marionette then
|
||||
local player_id = get_mario_player_index_method:call(mario_param);
|
||||
if monster.rider_id ~= player_id then
|
||||
monster.rider_id = player_id;
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
-- Code by coavins
|
||||
function large_monster.update_ailments(enemy)
|
||||
if enemy == nil then
|
||||
return;
|
||||
end
|
||||
|
||||
local monster = large_monster.get_monster(enemy);
|
||||
|
||||
local damage_param = damage_param_field:get_data(enemy);
|
||||
if damage_param ~= nil then
|
||||
|
||||
local poison_param = poison_param_field:get_data(damage_param);
|
||||
if poison_param ~= nil then
|
||||
-- if applied, then calculate share for poison
|
||||
local activate_count = poison_get_activate_count_method:call(poison_param):get_element(0):get_field("mValue");
|
||||
if activate_count > monster.ailment[ailments.poison_id].activate_count then
|
||||
monster.ailment[ailments.poison_id].activate_count = activate_count;
|
||||
ailments.calculate_ailment_contribution(monster, ailments.poison_id);
|
||||
end
|
||||
-- if poison tick, apply damage
|
||||
local poison_damage = poison_damage_field:get_data(poison_param);
|
||||
local is_damage = poison_get_is_damage_method:call(poison_param);
|
||||
|
||||
if is_damage then
|
||||
ailments.apply_ailment_damage(monster, ailments.poison_id, poison_damage);
|
||||
end
|
||||
end
|
||||
|
||||
local blast_param = blast_param_field:get_data(damage_param);
|
||||
if blast_param ~= nil then
|
||||
-- if applied, then calculate share for blast and apply damage
|
||||
local activate_count = blast_get_activate_count_method:call(blast_param):get_element(0):get_field("mValue");
|
||||
|
||||
if activate_count > monster.ailment[ailments.blast_id].activate_count then
|
||||
monster.ailment[ailments.blast_id].activate_count = activate_count;
|
||||
ailments.calculate_ailment_contribution(monster, ailments.blast_id);
|
||||
|
||||
local blast_damage = blast_damage_method:call(blast_param);
|
||||
local blast_adjust_rate = blast_adjust_rate_method:call(blast_param);
|
||||
|
||||
ailments.apply_ailment_damage(monster, ailments.blast_id, blast_damage * blast_adjust_rate);
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function large_monster.update(enemy)
|
||||
-- maybe more checks are needed here i'm not fully aware of how the code flows here
|
||||
if not config.current_config.large_monster_UI.dynamic.enabled
|
||||
and not config.current_config.large_monster_UI.static.enabled
|
||||
and not config.current_config.large_monster_UI.highlighted.enabled then
|
||||
@@ -464,7 +577,7 @@ function large_monster.update(enemy)
|
||||
::continue::
|
||||
end
|
||||
|
||||
large_monster.update_position(enemy);
|
||||
--large_monster.update_position(enemy);
|
||||
|
||||
if health ~= nil then
|
||||
monster.health = health;
|
||||
@@ -710,7 +823,7 @@ function large_monster.draw_static(monster, position_on_screen, opacity_scale)
|
||||
|
||||
stamina_UI_entity.draw(monster, monster.stamina_static_UI, stamina_position_on_screen, opacity_scale);
|
||||
rage_UI_entity.draw(monster, monster.rage_static_UI, rage_position_on_screen, opacity_scale);
|
||||
|
||||
|
||||
--sort parts here
|
||||
local displayed_parts = {};
|
||||
for REpart, part in pairs(monster.parts) do
|
||||
@@ -886,6 +999,8 @@ function large_monster.init_module()
|
||||
screen = require("MHR_Overlay.Game_Handler.screen");
|
||||
drawing = require("MHR_Overlay.UI.drawing");
|
||||
part_names = require("MHR_Overlay.Misc.part_names");
|
||||
ailments = require("MHR_Overlay.Damage_Meter.ailments");
|
||||
player = require("MHR_Overlay.Damage_Meter.player");
|
||||
end
|
||||
|
||||
return large_monster;
|
||||
@@ -67,42 +67,33 @@ function monster.update_monster(enemy)
|
||||
return;
|
||||
end
|
||||
|
||||
-- this is the VERY LEAST thing we should do all the time
|
||||
-- so the position doesn't lag all over the place
|
||||
-- due to how infrequently we update the monster(s).
|
||||
if is_large then
|
||||
large_monster.update_position(enemy);
|
||||
large_monster.update_ailments(enemy);
|
||||
else
|
||||
small_monster.update_position(enemy);
|
||||
small_monster.update_ailments(enemy);
|
||||
end
|
||||
|
||||
if updated_monsters[enemy] then
|
||||
-- this is the VERY LEAST thing we should do all the time
|
||||
-- so the position doesn't lag all over the place
|
||||
-- due to how infrequently we update the monster(s).
|
||||
if is_large then
|
||||
large_monster.update_position(enemy);
|
||||
if not config.current_config.global_settings.performance.prioritize_large_monsters then
|
||||
return;
|
||||
end
|
||||
else
|
||||
small_monster.update_position(enemy);
|
||||
else
|
||||
return;
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
-- only updates N monsters per tick to increase performance
|
||||
if tick_count == last_update_tick then
|
||||
if updates_this_tick >= config.current_config.global_settings.performance.max_monster_updates_per_tick then
|
||||
-- this is the VERY LEAST thing we should do all the time
|
||||
-- so the position doesn't lag all over the place
|
||||
-- due to how infrequently we update the monster(s).
|
||||
if is_large then
|
||||
large_monster.update_position(enemy);
|
||||
if not config.current_config.global_settings.performance.prioritize_large_monsters then
|
||||
return
|
||||
end
|
||||
else
|
||||
small_monster.update_position(enemy);
|
||||
return;
|
||||
end
|
||||
end
|
||||
end
|
||||
-- is it old tick?
|
||||
-- is update limit reached?
|
||||
if tick_count == last_update_tick and updates_this_tick >= config.current_config.global_settings.performance.max_monster_updates_per_tick then
|
||||
return;
|
||||
end
|
||||
|
||||
|
||||
|
||||
-- actually update the enemy now. we don't do this very often
|
||||
-- due to how much CPU time it takes to update each monster.
|
||||
if is_large then
|
||||
|
||||
@@ -7,6 +7,7 @@ local health_UI_entity;
|
||||
local stamina_UI_entity;
|
||||
local screen;
|
||||
local drawing;
|
||||
local ailments;
|
||||
|
||||
small_monster.list = {};
|
||||
|
||||
@@ -31,6 +32,17 @@ function small_monster.new(enemy)
|
||||
monster.distance = 0;
|
||||
|
||||
monster.name = "Small Monster";
|
||||
|
||||
monster.ailment = {};
|
||||
monster.ailment[ailments.poison_id] = {};
|
||||
monster.ailment[ailments.poison_id].buildup = {};
|
||||
monster.ailment[ailments.poison_id].share = {};
|
||||
monster.ailment[ailments.poison_id].activate_count = 0;
|
||||
|
||||
monster.ailment[ailments.blast_id] = {};
|
||||
monster.ailment[ailments.blast_id].buildup = {};
|
||||
monster.ailment[ailments.blast_id].share = {};
|
||||
monster.ailment[ailments.blast_id].activate_count = 0;
|
||||
|
||||
small_monster.init(monster, enemy);
|
||||
small_monster.init_UI(monster);
|
||||
@@ -86,27 +98,42 @@ function small_monster.init_UI(monster)
|
||||
);
|
||||
end
|
||||
|
||||
local enemy_character_base_type_def = sdk.find_type_definition("snow.enemy.EnemyCharacterBase")
|
||||
local enemy_character_base_type_def = sdk.find_type_definition("snow.enemy.EnemyCharacterBase");
|
||||
local physical_param_field = enemy_character_base_type_def:get_field("<PhysicalParam>k__BackingField");
|
||||
local status_param_field = enemy_character_base_type_def:get_field("<StatusParam>k__BackingField")
|
||||
local stamina_param_field = enemy_character_base_type_def:get_field("<StaminaParam>k__BackingField")
|
||||
local status_param_field = enemy_character_base_type_def:get_field("<StatusParam>k__BackingField");
|
||||
local stamina_param_field = enemy_character_base_type_def:get_field("<StaminaParam>k__BackingField");
|
||||
local damage_param_field = enemy_character_base_type_def:get_field("<DamageParam>k__BackingField");
|
||||
local check_die_method = enemy_character_base_type_def:get_method("checkDie");
|
||||
|
||||
local physical_param_type = physical_param_field:get_type()
|
||||
local get_vital_method = physical_param_type:get_method("getVital")
|
||||
local get_capture_hp_vital_method = physical_param_type:get_method("get_CaptureHpVital")
|
||||
local physical_param_type = physical_param_field:get_type();
|
||||
local get_vital_method = physical_param_type:get_method("getVital");
|
||||
local get_capture_hp_vital_method = physical_param_type:get_method("get_CaptureHpVital");
|
||||
|
||||
local vital_param_type = get_vital_method:get_return_type()
|
||||
local get_current_method = vital_param_type:get_method("get_Current")
|
||||
local get_max_method = vital_param_type:get_method("get_Max")
|
||||
local vital_param_type = get_vital_method:get_return_type();
|
||||
local get_current_method = vital_param_type:get_method("get_Current");
|
||||
local get_max_method = vital_param_type:get_method("get_Max");
|
||||
|
||||
local stamina_param_type = stamina_param_field:get_type()
|
||||
local get_stamina_method = stamina_param_type:get_method("getStamina")
|
||||
local get_max_stamina_method = stamina_param_type:get_method("getMaxStamina")
|
||||
local stamina_param_type = stamina_param_field:get_type();
|
||||
local get_stamina_method = stamina_param_type:get_method("getStamina");
|
||||
local get_max_stamina_method = stamina_param_type:get_method("getMaxStamina");
|
||||
|
||||
local get_gameobject_method = sdk.find_type_definition("via.Component"):get_method("get_GameObject")
|
||||
local get_transform_method = sdk.find_type_definition("via.GameObject"):get_method("get_Transform")
|
||||
local get_position_method = sdk.find_type_definition("via.Transform"):get_method("get_Position")
|
||||
local damage_param_type = damage_param_field:get_type();
|
||||
local poison_param_field = damage_param_type:get_field("_PoisonParam");
|
||||
local blast_param_field = damage_param_type:get_field("_BlastParam");
|
||||
|
||||
local poison_param_type = poison_param_field:get_type();
|
||||
local poison_get_activate_count_method = poison_param_type:get_method("get_ActivateCount");
|
||||
local poison_damage_field = poison_param_type:get_field("<Damage>k__BackingField");
|
||||
local poison_get_is_damage_method = poison_param_type:get_method("get_IsDamage");
|
||||
|
||||
local blast_param_type = blast_param_field:get_type();
|
||||
local blast_get_activate_count_method = blast_param_type:get_method("get_ActivateCount");
|
||||
local blast_damage_method = blast_param_type:get_method("get_BlastDamage");
|
||||
local blast_adjust_rate_method = blast_param_type:get_method("get_BlastDamageAdjustRateByEnemyLv");
|
||||
|
||||
local get_gameobject_method = sdk.find_type_definition("via.Component"):get_method("get_GameObject");
|
||||
local get_transform_method = sdk.find_type_definition("via.GameObject"):get_method("get_Transform");
|
||||
local get_position_method = sdk.find_type_definition("via.Transform"):get_method("get_Position");
|
||||
|
||||
function small_monster.update_position(enemy)
|
||||
if not config.current_config.small_monster_UI.enabled then
|
||||
@@ -146,6 +173,53 @@ function small_monster.update_position(enemy)
|
||||
end
|
||||
end
|
||||
|
||||
-- Code by coavins
|
||||
function small_monster.update_ailments(enemy)
|
||||
if enemy == nil then
|
||||
return;
|
||||
end
|
||||
|
||||
local monster = small_monster.get_monster(enemy);
|
||||
|
||||
local damage_param = damage_param_field:get_data(enemy);
|
||||
if damage_param ~= nil then
|
||||
|
||||
local poison_param = poison_param_field:get_data(damage_param);
|
||||
if poison_param ~= nil then
|
||||
-- if applied, then calculate share for poison
|
||||
local activate_count = poison_get_activate_count_method:call(poison_param):get_element(0):get_field("mValue");
|
||||
if activate_count > monster.ailment[ailments.poison_id].activate_count then
|
||||
monster.ailment[ailments.poison_id].activate_count = activate_count;
|
||||
ailments.calculate_ailment_contribution(monster, ailments.poison_id);
|
||||
end
|
||||
-- if poison tick, apply damage
|
||||
local poison_damage = poison_damage_field:get_data(poison_param);
|
||||
local is_damage = poison_get_is_damage_method:call(poison_param);
|
||||
|
||||
if is_damage then
|
||||
ailments.apply_ailment_damage(monster, ailments.poison_id, poison_damage);
|
||||
end
|
||||
end
|
||||
|
||||
--xy = "test"
|
||||
local blast_param = blast_param_field:get_data(damage_param);
|
||||
if blast_param ~= nil then
|
||||
-- if applied, then calculate share for blast and apply damage
|
||||
local activate_count = blast_get_activate_count_method:call(blast_param):get_element(0):get_field("mValue");
|
||||
|
||||
if activate_count > monster.ailment[ailments.blast_id].activate_count then
|
||||
monster.ailment[ailments.blast_id].activate_count = activate_count;
|
||||
ailments.calculate_ailment_contribution(monster, ailments.blast_id);
|
||||
|
||||
local blast_damage = blast_damage_method:call(blast_param);
|
||||
local blast_adjust_rate = blast_adjust_rate_method:call(blast_param);
|
||||
|
||||
ailments.apply_ailment_damage(monster, ailments.blast_id, blast_damage * blast_adjust_rate);
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function small_monster.update(enemy)
|
||||
if enemy == nil then
|
||||
return;
|
||||
@@ -264,6 +338,7 @@ function small_monster.init_module()
|
||||
stamina_UI_entity = require("MHR_Overlay.UI.UI_Entities.stamina_UI_entity");
|
||||
screen = require("MHR_Overlay.Game_Handler.screen");
|
||||
drawing = require("MHR_Overlay.UI.drawing");
|
||||
ailments = require("MHR_Overlay.Damage_Meter.ailments");
|
||||
end
|
||||
|
||||
return small_monster;
|
||||
@@ -6341,6 +6341,18 @@ function customization_menu.draw()
|
||||
damage_meter_UI_changed = damage_meter_UI_changed or changed;
|
||||
tracked_damage_types_changed = tracked_damage_types_changed or changed;
|
||||
|
||||
changed, config.current_config.damage_meter_UI.tracked_damage_types.poison_damage =
|
||||
imgui.checkbox(language.current_language.customization_menu.poison_damage, config.current_config.damage_meter_UI.tracked_damage_types.poison_damage);
|
||||
config_changed = config_changed or changed;
|
||||
damage_meter_UI_changed = damage_meter_UI_changed or changed;
|
||||
tracked_damage_types_changed = tracked_damage_types_changed or changed;
|
||||
|
||||
changed, config.current_config.damage_meter_UI.tracked_damage_types.blast_damage =
|
||||
imgui.checkbox(language.current_language.customization_menu.blast_damage, config.current_config.damage_meter_UI.tracked_damage_types.blast_damage);
|
||||
config_changed = config_changed or changed;
|
||||
damage_meter_UI_changed = damage_meter_UI_changed or changed;
|
||||
tracked_damage_types_changed = tracked_damage_types_changed or changed;
|
||||
|
||||
if tracked_damage_types_changed then
|
||||
for player_id, _player in pairs(player.list) do
|
||||
player.update_display(_player);
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
"assign_new_key": "Assign new key",
|
||||
"background": "Background",
|
||||
"bar": "Bar",
|
||||
"blast_damage": "Blast Damage",
|
||||
"body_parts": "Body Parts",
|
||||
"bold": "Bold",
|
||||
"bomb_damage": "Bomb Damage",
|
||||
@@ -106,6 +107,7 @@
|
||||
"player_id": "Player ID",
|
||||
"player_name": "Player Name",
|
||||
"player_name_label": "Player Name Label",
|
||||
"poison_damage": "Poison Damage",
|
||||
"position": "Position",
|
||||
"press_any_key": "Press any key...",
|
||||
"prioritize_large_monsters": "Large Monsters on High Priority",
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
"assign_new_key": "새 키를 할당",
|
||||
"background": "배경색",
|
||||
"bar": "막대",
|
||||
"blast_damage": "Blast Damage",
|
||||
"body_parts": "부위",
|
||||
"bold": "굵게",
|
||||
"bomb_damage": "폭탄 대미지",
|
||||
@@ -110,6 +111,7 @@
|
||||
"player_id": "헌터 ID",
|
||||
"player_name": "헌터명",
|
||||
"player_name_label": "헌터명 라벨",
|
||||
"poison_damage": "Poison Damage",
|
||||
"position": "위치",
|
||||
"press_any_key": "설정할 키를 누르세요...",
|
||||
"prioritize_large_monsters": "대형 몬스터를 우선적으로",
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
"assign_new_key": "Привязать клавишу",
|
||||
"background": "Фон",
|
||||
"bar": "Шкала",
|
||||
"blast_damage": "Blast Damage",
|
||||
"body_parts": "Части тела",
|
||||
"bold": "Жирный",
|
||||
"bomb_damage": "Урон от бомб",
|
||||
@@ -107,6 +108,7 @@
|
||||
"player_id": "ИД игрока",
|
||||
"player_name": "Имя игрока",
|
||||
"player_name_label": "Метка имени игрока",
|
||||
"poison_damage": "Poison Damage",
|
||||
"position": "Расположение",
|
||||
"press_any_key": "Нажмите любую клавишу...",
|
||||
"prioritize_large_monsters": "Большие монстры в приоритете",
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
"assign_new_key": "Assign new key",
|
||||
"background": "圖形化顯示條的背景底色",
|
||||
"bar": "圖形化顯示條",
|
||||
"blast_damage": "Blast Damage",
|
||||
"body_parts": "身體部位",
|
||||
"bold": "粗體",
|
||||
"bomb_damage": "爆破傷害",
|
||||
@@ -108,6 +109,7 @@
|
||||
"player_id": "玩家ID",
|
||||
"player_name": "玩家名稱",
|
||||
"player_name_label": "玩家名稱",
|
||||
"poison_damage": "Poison Damage",
|
||||
"position": "位置",
|
||||
"press_any_key": "Press any key...",
|
||||
"prioritize_large_monsters": "大型魔物優先",
|
||||
|
||||
Reference in New Issue
Block a user