5 Commits

Author SHA1 Message Date
GreenComfyTea
e67fbf923f Refactoring 2023-08-21 17:29:57 +03:00
GreenComfyTea
1d31a86a3f Cache mValues of ValTypes (Single) 2023-08-21 17:29:16 +03:00
GreenComfyTea
e4108f7fa9 Add Weapon Skills (Great Sword, Switch Axe, Long Sword) 2023-08-21 17:28:36 +03:00
GreenComfyTea
4ede59c8c2 Cache mValue field of ValTypes (Int32 and Single) 2023-08-21 17:25:39 +03:00
GreenComfyTea
2db41e237f utils.type: Add is_boolean(), is_REField(), is_REMethodDefinition() 2023-08-21 17:25:07 +03:00
22 changed files with 826 additions and 1085 deletions

View File

@@ -52,6 +52,7 @@ local skills = require("MHR_Overlay.Buffs.skills");
local dangos = require("MHR_Overlay.Buffs.dangos"); local dangos = require("MHR_Overlay.Buffs.dangos");
local abnormal_statuses = require("MHR_Overlay.Buffs.abnormal_statuses"); local abnormal_statuses = require("MHR_Overlay.Buffs.abnormal_statuses");
local otomo_moves = require("MHR_Overlay.Buffs.otomo_moves"); local otomo_moves = require("MHR_Overlay.Buffs.otomo_moves");
local weapon_skills = require("MHR_Overlay.Buffs.weapon_skills");
local players = require("MHR_Overlay.Damage_Meter.players"); local players = require("MHR_Overlay.Damage_Meter.players");
local non_players = require("MHR_Overlay.Damage_Meter.non_players"); local non_players = require("MHR_Overlay.Damage_Meter.non_players");
@@ -133,6 +134,7 @@ skills.init_dependencies();
dangos.init_dependencies(); dangos.init_dependencies();
abnormal_statuses.init_dependencies(); abnormal_statuses.init_dependencies();
otomo_moves.init_dependencies(); otomo_moves.init_dependencies();
weapon_skills.init_dependencies();
damage_hook.init_dependencies(); damage_hook.init_dependencies();
players.init_dependencies(); players.init_dependencies();
@@ -209,6 +211,7 @@ skills.init_module();
dangos.init_module(); dangos.init_module();
abnormal_statuses.init_module(); abnormal_statuses.init_module();
otomo_moves.init_module(); otomo_moves.init_module();
weapon_skills.init_module();
damage_hook.init_module(); damage_hook.init_module();
players.init_module(); players.init_module();

View File

@@ -75,6 +75,8 @@ this.list = {
muck = nil muck = nil
}; };
local ailments_type_name = "ailments";
local frenzy_infected_duration = 121; local frenzy_infected_duration = 121;
local player_quest_base_type_def = sdk.find_type_definition("snow.player.PlayerQuestBase"); local player_quest_base_type_def = sdk.find_type_definition("snow.player.PlayerQuestBase");
@@ -140,17 +142,10 @@ local virus_timer_field = player_quest_base_type_def:get_field("_VirusTimer");
-- Frenzy -- Frenzy
local virus_onset_timer_field = player_quest_base_type_def:get_field("_VirusOnsetTimer"); local virus_onset_timer_field = player_quest_base_type_def:get_field("_VirusOnsetTimer");
local player_data_type_def = sdk.find_type_definition("snow.player.PlayerData"); local player_data_type_def = sdk.find_type_definition("snow.player.PlayerData");
-- Frenzy Overcome -- Frenzy Overcome
local virus_overcome_buff_timer_field = player_data_type_def:get_field("_VirusOvercomeBuffTimer"); local virus_overcome_buff_timer_field = player_data_type_def:get_field("_VirusOvercomeBuffTimer");
local cache = {};
function this.update(player, player_data) function this.update(player, player_data)
--local item_parameter = get_ref_item_parameter_method:call(singletons.player_manager); --local item_parameter = get_ref_item_parameter_method:call(singletons.player_manager);
--if item_parameter == nil then --if item_parameter == nil then
@@ -167,94 +162,36 @@ function this.update(player, player_data)
this.update_muck(player); this.update_muck(player);
this.update_frenzy_infection(player); this.update_frenzy_infection(player);
this.update_generic_timer("fireblight", player, fire_duration_timer); buffs.update_generic_buff(this.list, ailments_type_name, "fireblight", nil, nil, player, fire_duration_timer);
this.update_generic_timer("waterblight", player, water_duration_timer);
this.update_generic_timer("iceblight", player, ice_duration_timer);
this.update_generic_timer("thunderblight", player, thunder_duration_timer);
this.update_generic_timer("dragonblight", player, dragon_duration_timer);
this.update_generic_timer("blastblight", player, bomb_duration_timer); buffs.update_generic_buff(this.list, ailments_type_name, "fireblight", nil, nil, player, fire_duration_timer);
this.update_generic_timer("hellfireblight", player, oni_bomb_duration_timer); buffs.update_generic_buff(this.list, ailments_type_name, "waterblight", nil, nil, player, water_duration_timer);
this.update_generic_timer("bloodblight", player, mystery_debuff_timer); buffs.update_generic_buff(this.list, ailments_type_name, "iceblight", nil, nil, player, ice_duration_timer);
buffs.update_generic_buff(this.list, ailments_type_name, "thunderblight", nil, nil, player, thunder_duration_timer);
buffs.update_generic_buff(this.list, ailments_type_name, "dragonblight", nil, nil, player, dragon_duration_timer);
this.update_generic_timer("stun", player, stun_duration_timer); buffs.update_generic_buff(this.list, ailments_type_name, "blastblight", nil, nil, player, bomb_duration_timer);
this.update_generic_timer("paralysis", player, paralyze_duration_timer); buffs.update_generic_buff(this.list, ailments_type_name, "hellfireblight", nil, nil, player, oni_bomb_duration_timer);
this.update_generic_timer("sleep", player, sleep_duration_timer); buffs.update_generic_buff(this.list, ailments_type_name, "bloodblight", nil, nil, player, mystery_debuff_timer);
buffs.update_generic_buff(this.list, ailments_type_name, "stun", nil, nil, player, stun_duration_timer);
buffs.update_generic_buff(this.list, ailments_type_name, "paralysis", nil, nil, player, paralyze_duration_timer);
buffs.update_generic_buff(this.list, ailments_type_name, "sleep", nil, nil, player, sleep_duration_timer);
this.update_generic_timer("defense_down", player, defense_down_duration_timer); buffs.update_generic_buff(this.list, ailments_type_name, "defense_down", nil, nil, player, defense_down_duration_timer);
this.update_generic_timer("resistance_down", player, resistance_down_duration_timer); buffs.update_generic_buff(this.list, ailments_type_name, "resistance_down", nil, nil, player, resistance_down_duration_timer);
this.update_generic_timer("tremor", player, quake_duration_timer); buffs.update_generic_buff(this.list, ailments_type_name, "tremor", nil, nil, player, quake_duration_timer);
this.update_generic_timer("roar", player, ear_duration_timer); buffs.update_generic_buff(this.list, ailments_type_name, "roar", nil, nil, player, ear_duration_timer);
this.update_generic_timer("webbed", player, beto_duration_timer); buffs.update_generic_buff(this.list, ailments_type_name, "webbed", nil, nil, player, beto_duration_timer);
this.update_generic_timer("stench", player, stink_duration_timer); buffs.update_generic_buff(this.list, ailments_type_name, "stench", nil, nil, player, stink_duration_timer);
this.update_generic_timer("leeched", player, blooding_enemy_timer, true); buffs.update_generic_buff(this.list, ailments_type_name, "leeched", nil, nil, player, blooding_enemy_timer, nil, nil, true);
this.update_generic_timer("bleeding", player, bleeding_debuff_timer); buffs.update_generic_buff(this.list, ailments_type_name, "bleeding", nil, nil, player, bleeding_debuff_timer);
this.update_generic_timer("frenzy", player, virus_onset_timer_field); buffs.update_generic_buff(this.list, ailments_type_name, "frenzy", nil, nil, player, virus_onset_timer_field);
this.update_generic_timer("frenzy_overcome", player_data, virus_overcome_buff_timer_field); buffs.update_generic_buff(this.list, ailments_type_name, "frenzy_overcome", nil, nil, player_data, virus_overcome_buff_timer_field);
this.update_generic_boolean_value_method("engulfed", player, get_is_vacuum_damage_method); buffs.update_generic_buff(this.list, ailments_type_name, "engulfed", player, get_is_vacuum_damage_method);
this.update_generic_boolean_value_method("frostblight", player, get_is_frozen_damage_method); buffs.update_generic_buff(this.list, ailments_type_name, "frostblight", player, get_is_frozen_damage_method);
end
function this.update_generic_timer(debuff_key, timer_owner, timer_field, is_infinite)
if is_infinite == nil then is_infinite = false; end
local timer = timer_field:get_data(timer_owner);
if timer == nil then
error_handler.report("abnormal_statuses.update_generic_timer", string.format("Failed to access Data: %s_timer", debuff_key));
return;
end
if utils.number.is_equal(timer, 0) then
this.list[debuff_key] = nil;
return;
end
if is_infinite then
timer = nil;
else
timer = timer / 60;
end
this.update_generic(debuff_key, timer);
end
function this.update_generic_boolean_value_method(debuff_key, value_owner, value_method)
local value = value_method:call(value_owner);
if value == nil then
error_handler.report("abnormal_statuses.update_generic_boolean_value_method", string.format("Failed to access Data: %s_value", debuff_key));
return;
end
if not value then
this.list[debuff_key] = nil;
return;
end
this.update_generic(debuff_key, nil);
end
function this.update_bubbleblight(player)
local bubble_Type = bubble_type_field:get_data(player);
if bubble_Type == nil then
error_handler.report("abnormal_statuses.update_bubbleblight", "Failed to access Data: bubble_Type");
return;
end
if bubble_Type == 0 then
this.list.minor_bubbleblight = nil;
this.list.major_bubbleblight = nil;
return;
end
if bubble_Type == 1 then
this.update_generic_timer("minor_bubbleblight", player, bubble_damage_timer);
this.list.major_bubbleblight = nil;
else
this.update_generic_timer("major_bubbleblight", player, bubble_damage_timer);
this.list.minor_bubbleblight = nil;
end
end end
function this.update_poison(player) function this.update_poison(player)
@@ -271,14 +208,36 @@ function this.update_poison(player)
end end
if poison_level == 1 then if poison_level == 1 then
this.update_generic_timer("poison", player, poison_duration_timer); buffs.update_generic_buff(this.list, ailments_type_name, "poison", player, poison_duration_timer);
this.list.deadly_poison = nil; this.list.deadly_poison = nil;
else else
this.update_generic_timer("deadly_poison", player, poison_duration_timer); buffs.update_generic_buff(this.list, ailments_type_name, "deadly_poison", player, poison_duration_timer);
this.list.poison = nil; this.list.poison = nil;
end end
end end
function this.update_bubbleblight(player)
local bubble_type = bubble_type_field:get_data(player);
if bubble_type == nil then
error_handler.report("abnormal_statuses.update_bubbleblight", "Failed to access Data: bubble_Type");
return;
end
if bubble_type == 0 then
this.list.minor_bubbleblight = nil;
this.list.major_bubbleblight = nil;
return;
end
if bubble_type == 1 then
buffs.update_generic_buff(this.list, ailments_type_name, "minor_bubbleblight", player, bubble_damage_timer);
this.list.major_bubbleblight = nil;
else
buffs.update_generic_buff(this.list, ailments_type_name, "major_bubbleblight", player, bubble_damage_timer);
this.list.minor_bubbleblight = nil;
end
end
function this.update_muck(player) function this.update_muck(player)
local is_mud_damage = get_is_mud_damage_method:call(player); local is_mud_damage = get_is_mud_damage_method:call(player);
if is_mud_damage == nil then if is_mud_damage == nil then
@@ -297,7 +256,7 @@ function this.update_muck(player)
return; return;
end end
this.update_generic("muck", nil); buffs.update_generic(ailments_type_name, "muck");
end end
function this.update_frenzy_infection(player) function this.update_frenzy_infection(player)
@@ -313,31 +272,14 @@ function this.update_frenzy_infection(player)
return; return;
end end
if virus_accumulator_value == 0 and utils.number.is_equal(virus_timer, 0)then if virus_accumulator_value == 0 and utils.number.is_equal(virus_timer, 0) then
this.list.frenzy_infection = nil; this.list.frenzy_infection = nil;
return; return;
end end
local timer = frenzy_infected_duration - (virus_accumulator_value + virus_timer / 60); local timer = frenzy_infected_duration - (virus_accumulator_value + virus_timer / 60);
this.update_generic("frenzy_infection", timer, frenzy_infected_duration); buffs.update_generic(this.list, ailments_type_name, "frenzy_infection", 1, timer, frenzy_infected_duration);
end
function this.update_generic(debuff_key, timer, duration)
duration = duration or timer;
local debuff = this.list[debuff_key];
if debuff == nil then
local name = language.current_language.ailments[debuff_key];
if name == nil then
name = debuff_key;
end
debuff = buffs.new(buffs.types.debuff, debuff_key, name, 1, duration);
this.list[debuff_key] = debuff;
elseif timer ~= nil then
buffs.update_timer(debuff, timer);
end
end end
function this.init_names() function this.init_names()

View File

@@ -16,6 +16,7 @@ local skills;
local dangos; local dangos;
local abnormal_statuses; local abnormal_statuses;
local otomo_moves; local otomo_moves;
local weapon_skills;
local sdk = sdk; local sdk = sdk;
local tostring = tostring; local tostring = tostring;
@@ -49,14 +50,6 @@ local os = os;
local ValueType = ValueType; local ValueType = ValueType;
local package = package; local package = package;
this.types = {
consumable = 0,
melody_effect = 1,
dango = 2,
skill = 4,
debuff = 8
};
local player_manager_type_def = sdk.find_type_definition("snow.player.PlayerManager"); local player_manager_type_def = sdk.find_type_definition("snow.player.PlayerManager");
local get_player_method = player_manager_type_def:get_method("getPlayer"); local get_player_method = player_manager_type_def:get_method("getPlayer");
local find_master_player_method = player_manager_type_def:get_method("findMasterPlayer"); local find_master_player_method = player_manager_type_def:get_method("findMasterPlayer");
@@ -66,6 +59,9 @@ local get_player_data_method = player_base_type_def:get_method("get_PlayerData")
local player_lobby_base_type_def = sdk.find_type_definition("snow.player.PlayerLobbyBase"); local player_lobby_base_type_def = sdk.find_type_definition("snow.player.PlayerLobbyBase");
local player_base_type_def = sdk.find_type_definition("snow.player.PlayerBase");
local player_weapon_type_field = player_base_type_def:get_field("_playerWeaponType");
function this.new(type, key, name, level, duration) function this.new(type, key, name, level, duration)
local is_infinite = false; local is_infinite = false;
@@ -149,33 +145,47 @@ function this.update()
return; return;
end end
local is_player_lobby_base = master_player:get_type_definition() == player_lobby_base_type_def; melody_effects.update(master_player);
local master_player_data = get_player_data_method:call(master_player); local master_player_data = get_player_data_method:call(master_player);
if master_player_data ~= nil then if master_player_data == nil then
consumables.update(master_player_data);
otomo_moves.update(master_player_data);
if not is_player_lobby_base then
skills.update(master_player, master_player_data);
dangos.update(master_player, master_player_data);
endemic_life_buffs.update(master_player, master_player_data);
abnormal_statuses.update(master_player, master_player_data);
end
else
error_handler.report("buffs.update", "Failed to access Data: master_player_data"); error_handler.report("buffs.update", "Failed to access Data: master_player_data");
return;
end end
melody_effects.update(master_player); local weapon_type = player_weapon_type_field:get_data(master_player);
if weapon_type == nil then
error_handler.report("skills.update", "Failed to access Data: weapon_type");
return;
end
local is_player_lobby_base = master_player:get_type_definition() == player_lobby_base_type_def;
consumables.update(master_player_data);
otomo_moves.update(master_player_data);
if not is_player_lobby_base then
skills.update(master_player, master_player_data, weapon_type);
dangos.update(master_player, master_player_data);
endemic_life_buffs.update(master_player, master_player_data);
abnormal_statuses.update(master_player, master_player_data);
weapon_skills.update(master_player, master_player_data, weapon_type);
end
end end
function this.update_timer(buff, timer) function this.update_timer(buff, timer, duration)
if timer == nil then
return;
end
if timer < 0 then if timer < 0 then
timer = 0; timer = 0;
end end
if timer > buff.duration then duration = duration or timer;
buff.duration = timer;
if duration > buff.duration then
buff.duration = duration;
end end
local minutes_left = math.floor(timer / 60); local minutes_left = math.floor(timer / 60);
@@ -189,11 +199,118 @@ function this.update_timer(buff, timer)
end end
end end
function this.update_generic_buff(buff_list, buff_type, buff_key,
value_owner, value_holder,
timer_owner, timer_holder,
duration_owner, duration_holder,
is_infinite, minimal_value, level_breakpoints)
if timer_owner == nil then timer_owner = value_owner; end
if duration_owner == nil then duration_owner = value_owner; end
if minimal_value == nil then minimal_value = 1; end
local level = 1;
if value_holder ~= nil then
local value;
if utils.type.is_REField(value_holder) then
value = value_holder:get_data(value_owner);
else
value = value_holder:call(value_owner);
end
if value == nil then
error_handler.report("buffs.update_generic_number", string.format("Failed to access Data: %s_value", buff_key));
return;
end
if utils.type.is_boolean(value) then
if not value then
buff_list[buff_key] = nil;
return;
end
else
if value < minimal_value then
buff_list[buff_key] = nil;
return;
end
if level_breakpoints ~= nil then
local level_breakpoints_count = #level_breakpoints;
for index, breakpoint in ipairs(level_breakpoints) do
if value >= breakpoint then
level = 2 + level_breakpoints_count - index;
break;
end
end
end
end
end
local timer = nil;
if timer_holder ~= nil then
if utils.type.is_REField(timer_holder) then
timer = timer_holder:get_data(timer_owner);
else
timer = timer_holder:call(timer_owner);
end
if timer == nil then
error_handler.report("buffs.update_generic_number", string.format("Failed to access Data: %s_timer", buff_key));
return;
end
if value_holder == nil and utils.number.is_equal(timer, 0) then
buff_list[buff_key] = nil;
return;
end
if is_infinite then
timer = nil;
else
timer = timer / 60;
end
end
local duration = nil;
if duration_holder ~= nil then
if utils.type.is_REField(duration_holder) then
duration = duration_holder:get_data(duration_owner);
else
duration = duration_holder:call(duration_owner);
end
if duration == nil then
error_handler.report("buffs.update_generic_number", string.format("Failed to access Data: %s_duration", buff_key));
return;
end
end
return this.update_generic(buff_list, buff_type, buff_key, level, timer, duration);
end
function this.update_generic(buff_list, buff_type, buff_key, level, timer, duration)
duration = duration or timer;
level = level or 1;
local buff = buff_list[buff_key];
if buff == nil then
local name = language.current_language[buff_type][buff_key];
buff = this.new(buff_type, buff_key, name, level, duration);
buff_list[buff_key] = buff;
else
buff.level = level;
this.update_timer(buff, timer, duration);
end
return buff;
end
function this.draw(buff, buff_UI, position_on_screen, opacity_scale) function this.draw(buff, buff_UI, position_on_screen, opacity_scale)
buff_UI_entity.draw(buff, buff_UI, position_on_screen, opacity_scale); buff_UI_entity.draw(buff, buff_UI, position_on_screen, opacity_scale);
end end
function this.init_dependencies() function this.init_dependencies()
config = require("MHR_Overlay.Misc.config"); config = require("MHR_Overlay.Misc.config");
buff_UI_entity = require("MHR_Overlay.UI.UI_Entities.buff_UI_entity"); buff_UI_entity = require("MHR_Overlay.UI.UI_Entities.buff_UI_entity");
@@ -211,6 +328,7 @@ function this.init_dependencies()
dangos = require("MHR_Overlay.Buffs.dangos"); dangos = require("MHR_Overlay.Buffs.dangos");
abnormal_statuses = require("MHR_Overlay.Buffs.abnormal_statuses"); abnormal_statuses = require("MHR_Overlay.Buffs.abnormal_statuses");
otomo_moves = require("MHR_Overlay.Buffs.otomo_moves"); otomo_moves = require("MHR_Overlay.Buffs.otomo_moves");
weapon_skills = require("MHR_Overlay.Buffs.weapon_skills");
end end
function this.init_module() function this.init_module()

View File

@@ -55,6 +55,8 @@ this.list = {
gourmet_fish = nil, gourmet_fish = nil,
}; };
local consumables_type_name = "consumables";
local player_manager_type_def = sdk.find_type_definition("snow.player.PlayerManager"); local player_manager_type_def = sdk.find_type_definition("snow.player.PlayerManager");
local get_player_data_method = player_manager_type_def:get_method("get_PlayerData"); local get_player_data_method = player_manager_type_def:get_method("get_PlayerData");
local get_ref_item_parameter_method = player_manager_type_def:get_method("get_RefItemParameter"); local get_ref_item_parameter_method = player_manager_type_def:get_method("get_RefItemParameter");
@@ -106,69 +108,42 @@ function this.update(player_data)
this.update_demondrug(player_data, item_parameter); this.update_demondrug(player_data, item_parameter);
this.update_armorskin(player_data, item_parameter); this.update_armorskin(player_data, item_parameter);
this.update_gourmet_fish(player_data, item_parameter);
this.update_generic("might_seed", player_data, item_parameter, buffs.update_generic_buff(this.list, consumables_type_name, "might_seed",
atk_up_buff_second_field, atk_up_buff_second_timer_field, might_seed_timer_field); player_data, atk_up_buff_second_field,
player_data, atk_up_buff_second_timer_field,
item_parameter, might_seed_timer_field);
this.update_generic("adamant_seed", player_data, item_parameter, buffs.update_generic_buff(this.list, consumables_type_name, "adamant_seed",
def_up_buff_second_field, def_up_buff_second_timer_field, adamant_seed_timer_field); player_data, def_up_buff_second_field,
player_data, def_up_buff_second_timer_field,
item_parameter, adamant_seed_timer_field);
this.update_generic("demon_powder", player_data, item_parameter, buffs.update_generic_buff(this.list, consumables_type_name, "demon_powder",
atk_up_item_second_field, atk_up_item_second_timer_field, demondrug_powder_timer_field); player_data, atk_up_item_second_field,
player_data, atk_up_item_second_timer_field,
item_parameter, demondrug_powder_timer_field);
this.update_generic("hardshell_powder", player_data, item_parameter, buffs.update_generic_buff(this.list, consumables_type_name, "hardshell_powder",
def_up_item_second_field, def_up_item_second_timer_field, armorskin_powder_timer_field); player_data, def_up_item_second_field,
player_data, def_up_item_second_timer_field,
item_parameter, armorskin_powder_timer_field);
buffs.update_generic_buff(this.list, consumables_type_name, "immunizer",
nil, nil,
player_data, vitalizer_timer_field,
item_parameter, vitalizer_timer_const_field);
this.update_generic("immunizer", player_data, item_parameter, buffs.update_generic_buff(this.list, consumables_type_name, "immunizer",
nil, vitalizer_timer_field, vitalizer_timer_const_field); nil, nil,
player_data, stamina_up_buff_second_timer_field,
item_parameter, stamina_up_buff_second_field);
this.update_generic("dash_juice", player_data, item_parameter, buffs.update_generic_buff(this.list, consumables_type_name, "gourmet_fish",
nil, stamina_up_buff_second_timer_field, stamina_up_buff_second_field); nil, nil,
player_data, fish_regene_enable_field,
end nil, nil);
function this.update_generic(consumable_key, player_data, item_parameter, value_field, timer_field, timer_const_value_field)
if value_field ~= nil then
local value = value_field:get_data(player_data);
if value == nil then
error_handler.report("consumables.update_generic", string.format("Failed to access Data: %s_value", consumable_key));
return;
end
if value == 0 then
this.list[consumable_key] = nil;
return;
end
end
local timer = timer_field:get_data(player_data);
if timer == nil then
error_handler.report("consumables.update_generic", string.format("Failed to access Data: %s_timer", consumable_key));
return;
end
if value_field == nil and utils.number.is_equal(timer, 0)then
this.list[consumable_key] = nil;
return;
end
local consumable = this.list[consumable_key];
if consumable == nil then
local timer_const_value = timer_const_value_field:get_data(item_parameter);
if timer_const_value == nil then
error_handler.report("consumables.update_generic", string.format("Failed to access Data: %s_timer_const_value", consumable_key));
return;
end
local name = language.current_language.consumables[consumable_key];
consumable = buffs.new(buffs.types.consumable, consumable_key, name, 1, timer_const_value);
this.list[consumable_key] = consumable;
else
buffs.update_timer(consumable, timer / 60);
end
end end
function this.update_demondrug(player_data, item_parameter) function this.update_demondrug(player_data, item_parameter)
@@ -195,27 +170,14 @@ function this.update_demondrug(player_data, item_parameter)
error_handler.report("consumables.update_demondrug", "Failed to access Data: mega_demondrug_const_value"); error_handler.report("consumables.update_demondrug", "Failed to access Data: mega_demondrug_const_value");
return; return;
end end
if demondrug_value == demondrug_const_value then if demondrug_value == demondrug_const_value then
local buff = this.list.demondrug; buffs.update_generic(this.list, consumables_type_name, "demondrug");
if buff ~= nil and buff.value == demondrug_value then
return;
end
local name = language.current_language.consumables.demondrug;
this.list.demondrug = buffs.new(buffs.types.consumable, "demondrug", name);
this.list.mega_demondrug = nil; this.list.mega_demondrug = nil;
elseif demondrug_value == mega_demondrug_const_value then elseif demondrug_value == mega_demondrug_const_value then
local buff = this.list.mega_demondrug; buffs.update_generic(this.list, consumables_type_name, "mega_demondrug");
if buff ~= nil and buff.value == demondrug_value then
return;
end
local name = language.current_language.consumables.mega_demondrug;
this.list.demondrug = nil; this.list.demondrug = nil;
this.list.mega_demondrug = buffs.new(buffs.types.consumable, "mega_demondrug", name);
end end
end end
@@ -245,56 +207,12 @@ function this.update_armorskin(player_data, item_parameter)
end end
if armorskin_value == armorskin_const_value then if armorskin_value == armorskin_const_value then
local buff = this.list.armorskin; buffs.update_generic(this.list, consumables_type_name, "armorskin");
if buff ~= nil and buff.value == armorskin_value then
return;
end
local name = language.current_language.consumables.armorskin;
this.list.armorskin = buffs.new(buffs.types.consumable, "armorskin", name);
this.list.mega_armorskin = nil; this.list.mega_armorskin = nil;
elseif armorskin_value == mega_armorskin_const_value then elseif armorskin_value == mega_armorskin_const_value then
local buff = this.list.mega_armorskin; buffs.update_generic(this.list, consumables_type_name, "mega_armorskin");
if buff ~= nil and buff.value == armorskin_value then
return;
end
local name = language.current_language.consumables.mega_armorskin;
this.list.armorskin = nil; this.list.armorskin = nil;
this.list.mega_armorskin = buffs.new(buffs.types.consumable, "mega_armorskin", name);
end
end
function this.update_gourmet_fish(player_data, item_parameter)
local gourmet_fish_timer = fish_regene_enable_field:get_data(player_data);
if gourmet_fish_timer == nil then
error_handler.report("consumables.update_gourmet_fish", "Failed to access Data: gourmet_fish_timer");
return;
end
if utils.number.is_equal(gourmet_fish_timer, 0) then
this.list.gourmet_fish = nil;
return;
end
local buff = this.list.gourmet_fish;
if buff == nil then
--local gourmet_fish_timer_const_value = stamina_up_buff_second_field:get_data(item_parameter);
--if gourmet_fish_timer_const_value == nil then
-- error_handler.report("consumables.update_gourmet_fish", "Failed to access Data: gourmet_fish_timer_const_value");
-- return;
--end
local name = language.current_language.consumables.gourmet_fish;
buff = buffs.new(buffs.types.consumable, "gourmet_fish", name, 1, gourmet_fish_timer);
this.list.gourmet_fish = buff;
else
buffs.update_timer(buff, gourmet_fish_timer / 60);
end end
end end

View File

@@ -47,6 +47,8 @@ this.list = {
}; };
this.is_dango_adrenaline_active = false; this.is_dango_adrenaline_active = false;
local dangos_type_name = "dangos";
local dango_defender_minimal_value = 200; local dango_defender_minimal_value = 200;
local player_manager_type_def = sdk.find_type_definition("snow.player.PlayerManager"); local player_manager_type_def = sdk.find_type_definition("snow.player.PlayerManager");
@@ -72,229 +74,18 @@ function this.update(player, player_data)
return; return;
end end
this.update_generic_number_value_field("dango_defender", player_data, kitchen_skill_048_field, nil, true, dango_defender_minimal_value); buffs.update_generic_buff(this.list, dangos_type_name, "dango_defender", player_data, kitchen_skill_048_field, nil, nil, nil, nil, true, dango_defender_minimal_value);
this.update_dango_adrenaline(); this.update_dango_adrenaline();
end end
function this.update_generic_timer(dango_key, timer_owner, timer_field, is_infinite)
if is_infinite == nil then is_infinite = false; end
local timer = nil;
if timer_field ~= nil then
timer = timer_field:get_data(timer_owner);
if timer == nil then
error_handler.report("dangos.update_generic_timer", string.format("Failed to access Data: %s_timer", dango_key));
return;
end
if utils.number.is_equal(timer, 0) then
this.list[dango_key] = nil;
return;
end
if is_infinite then
timer = nil;
else
timer = timer / 60;
end
end
this.update_generic(dango_key, 1, timer);
end
function this.update_generic_number_value_field(dango_key, timer_owner, value_field, timer_field, is_infinite, minimal_value)
if minimal_value == nil then minimal_value = 1; end
if is_infinite == nil then is_infinite = false; end
local level = 1;
if value_field ~= nil then
local value = value_field:get_data(timer_owner);
if value == nil then
error_handler.report("dangos.update_generic_number_value_field", string.format("Failed to access Data: %s_value", dango_key));
return;
end
if value < minimal_value then
this.list[dango_key] = nil;
return;
end
end
local timer = nil;
if timer_field ~= nil then
timer = timer_field:get_data(timer_owner);
if timer == nil then
error_handler.report("dangos.update_generic_number_value_field", string.format("Failed to access Data: %s_timer", dango_key));
return;
end
if value_field == nil and utils.number.is_equal(timer, 0) then
this.list[dango_key] = nil;
return;
end
if is_infinite then
timer = nil;
else
timer = timer / 60;
end
end
this.update_generic(dango_key, level, timer);
end
function this.update_generic_boolean_value_field(dango_key, timer_owner, value_field, timer_field, is_infinite, minimal_value)
if minimal_value == nil then minimal_value = true; end
if is_infinite == nil then is_infinite = false; end
if value_field ~= nil then
local value = value_field:get_data(timer_owner);
if value == nil then
error_handler.report("dangos.update_generic_boolean_value_field", string.format("Failed to access Data: %s_value", dango_key));
return;
end
if value < minimal_value then
this.list[dango_key] = nil;
return;
end
end
local timer = nil;
if timer_field ~= nil then
timer = timer_field:get_data(timer_owner);
if timer == nil then
error_handler.report("dangos.update_generic_boolean_value_field", string.format("Failed to access Data: %s_timer", dango_key));
return;
end
if value_field == nil and utils.number.is_equal(timer, 0) then
this.list[dango_key] = nil;
return;
end
if is_infinite then
timer = nil;
else
timer = timer / 60;
end
end
this.update_generic(dango_key, 1, timer);
end
function this.update_generic_number_value_method(dango_key, timer_owner, value_method, timer_field, is_infinite, minimal_value)
if minimal_value == nil then minimal_value = 1; end
if is_infinite == nil then is_infinite = false; end
local level = 1;
if value_method ~= nil then
local value = value_method:call(timer_owner);
if value == nil then
error_handler.report("dangos.update_generic_number_value_method", string.format("Failed to access Data: %s_value", dango_key));
return;
end
if value < minimal_value then
this.list[dango_key] = nil;
return;
end
end
local timer = nil;
if timer_field ~= nil then
timer = timer_field:get_data(timer_owner);
if timer == nil then
error_handler.report("dangos.update_generic_number_value_method", string.format("Failed to access Data: %s_timer", dango_key));
return;
end
if value_method == nil and utils.number.is_equal(timer, 0) then
this.list[dango_key] = nil;
return;
end
if is_infinite then
timer = nil;
else
timer = timer / 60;
end
end
this.update_generic(dango_key, level, timer);
end
function this.update_generic_boolean_value_method(dango_key, timer_owner, value_method, timer_field, is_infinite, minimal_value)
if minimal_value == nil then minimal_value = true; end
if is_infinite == nil then is_infinite = false; end
if value_method ~= nil then
local value = value_method:call(timer_owner);
if value == nil then
error_handler.report("dangos.update_generic_boolean_value_method", string.format("Failed to access Data: %s_value", dango_key));
return;
end
if value ~= minimal_value then
this.list[dango_key] = nil;
return;
end
end
local timer = nil;
if timer_field ~= nil then
timer = timer_field:get_data(timer_owner);
if timer == nil then
error_handler.report("dangos.update_generic_boolean_value_method", string.format("Failed to access Data: %s_timer", dango_key));
return;
end
if value_method == nil and utils.number.is_equal(timer, 0) then
this.list[dango_key] = nil;
return;
end
if is_infinite then
timer = nil;
else
timer = timer / 60;
end
end
this.update_generic(dango_key, 1, timer);
end
function this.update_generic(dango_key, level, timer, duration)
duration = duration or timer;
local dango = this.list[dango_key];
if dango == nil then
local name = language.current_language.dangos[dango_key];
dango = buffs.new(buffs.types.dango, dango_key, name, level, duration);
this.list[dango_key] = dango;
else
dango.level = level;
if timer ~= nil then
buffs.update_timer(dango, timer);
end
end
end
function this.update_dango_adrenaline() function this.update_dango_adrenaline()
if not this.is_dango_adrenaline_active then if not this.is_dango_adrenaline_active then
this.list.dango_adrenaline = nil; this.list.dango_adrenaline = nil;
return; return;
end end
this.update_generic("dango_adrenaline", 1); buffs.update_generic(this.list, dangos_type_name, "dango_adrenaline");
end end
function this.init_names() function this.init_names()

View File

@@ -81,12 +81,15 @@ function this.update(player, player_data)
this.update_ruby_and_gold_wirebugs(player, player_data); this.update_ruby_and_gold_wirebugs(player, player_data);
end end
function this.update_generic_timer(endemic_life_buff_key, timer_owner, timer_field, is_infinite) function this.update_generic_timer(endemic_life_buff_key, timer_owner, timer_holder, is_infinite)
if is_infinite == nil then is_infinite = false; end
local timer = nil; local timer = nil;
if timer_field ~= nil then if timer_holder ~= nil then
timer = timer_field:get_data(timer_owner); if utils.type.is_REField then
timer = timer_holder:get_data(timer_owner);
else
timer = timer_holder:call(timer_owner);
end
if timer == nil then if timer == nil then
error_handler.report("endemic_life_buffs.update_generic_timer", string.format("Failed to access Data: %s_timer", endemic_life_buff_key)); error_handler.report("endemic_life_buffs.update_generic_timer", string.format("Failed to access Data: %s_timer", endemic_life_buff_key));
return; return;
@@ -123,7 +126,7 @@ function this.update_generic(endemic_life_buff_key, level, timer, duration)
return; return;
end end
endemic_life_buff = buffs.new(buffs.types.endemic_life_buff, endemic_life_buff_key, name, level, duration); endemic_life_buff = buffs.new("endemic_life_buffs", endemic_life_buff_key, name, level, duration);
this.list[endemic_life_buff_key] = endemic_life_buff; this.list[endemic_life_buff_key] = endemic_life_buff;
else else
endemic_life_buff.level = level; endemic_life_buff.level = level;

View File

@@ -138,7 +138,7 @@ function this.update(master_player)
goto continue; goto continue;
end end
this.update_melody_effect(i+1, music_data); this.update_melody_effect(i + 1, music_data);
::continue:: ::continue::
end end
end end
@@ -160,7 +160,7 @@ function this.update_melody_effect(lua_index, melody_data)
local melody_effect_key = melody_effect_keys[lua_index]; local melody_effect_key = melody_effect_keys[lua_index];
local name = language.current_language.melody_effects[melody_effect_key]; local name = language.current_language.melody_effects[melody_effect_key];
melody_effect = buffs.new(buffs.types.melody_effect, melody_effect_key, name, 1, melody_timer / 60); melody_effect = buffs.new("melody_effects", melody_effect_key, name, 1, melody_timer / 60);
this.list[lua_index] = melody_effect; this.list[lua_index] = melody_effect;
else else
buffs.update_timer(melody_effect, melody_timer / 60); buffs.update_timer(melody_effect, melody_timer / 60);

View File

@@ -51,6 +51,7 @@ this.list = {
go_fight_win = nil go_fight_win = nil
}; };
local otomo_moves_type_name = "otomo_moves";
local player_manager_type_def = sdk.find_type_definition("snow.player.PlayerManager"); local player_manager_type_def = sdk.find_type_definition("snow.player.PlayerManager");
local get_player_data_method = player_manager_type_def:get_method("get_PlayerData"); local get_player_data_method = player_manager_type_def:get_method("get_PlayerData");
@@ -64,222 +65,9 @@ local kijin_otomo_timer_field = player_data_type_def:get_field("_KijinOtomoTimer
local runhigh_otomo_timer_field = player_data_type_def:get_field("_RunhighOtomoTimer"); local runhigh_otomo_timer_field = player_data_type_def:get_field("_RunhighOtomoTimer");
function this.update(player_data) function this.update(player_data)
this.update_generic_timer("rousing_roar", player_data, beast_roar_otomo_timer_field); buffs.update_generic_buff(this.list, otomo_moves_type_name, "rousing_roar", nil, nil, player_data, beast_roar_otomo_timer_field);
this.update_generic_timer("power_drum", player_data, kijin_otomo_timer_field); buffs.update_generic_buff(this.list, otomo_moves_type_name, "power_drum", nil, nil, player_data, kijin_otomo_timer_field);
this.update_generic_timer("go_fight_win", player_data, runhigh_otomo_timer_field); buffs.update_generic_buff(this.list, otomo_moves_type_name, "go_fight_win", nil, nil, player_data, runhigh_otomo_timer_field);
end
function this.update_generic_timer(otomo_move_key, timer_owner, timer_field, is_infinite)
if is_infinite == nil then is_infinite = false; end
local timer = nil;
if timer_field ~= nil then
timer = timer_field:get_data(timer_owner);
if timer == nil then
error_handler.report("otomo_moves.update_generic_timer", string.format("Failed to access Data: %s_timer", otomo_move_key));
return;
end
if utils.number.is_equal(timer, 0) then
this.list[otomo_move_key] = nil;
return;
end
if is_infinite then
timer = nil;
else
timer = timer / 60;
end
end
this.update_generic(otomo_move_key, 1, timer);
end
function this.update_generic_number_value_field(otomo_move_key, timer_owner, value_field, timer_field, is_infinite, minimal_value)
if minimal_value == nil then minimal_value = 1; end
if is_infinite == nil then is_infinite = false; end
local level = 1;
if value_field ~= nil then
local value = value_field:get_data(timer_owner);
if value == nil then
error_handler.report("otomo_moves.update_generic_number_value_field", string.format("Failed to access Data: %s_value", otomo_move_key));
return;
end
if value < minimal_value then
this.list[otomo_move_key] = nil;
return;
end
end
local timer = nil;
if timer_field ~= nil then
timer = timer_field:get_data(timer_owner);
if timer == nil then
error_handler.report("otomo_moves.update_generic_number_value_field", string.format("Failed to access Data: %s_timer", otomo_move_key));
return;
end
if value_field == nil and utils.number.is_equal(timer, 0) then
this.list[otomo_move_key] = nil;
return;
end
if is_infinite then
timer = nil;
else
timer = timer / 60;
end
end
this.update_generic(otomo_move_key, level, timer);
end
function this.update_generic_boolean_value_field(otomo_move_key, timer_owner, value_field, timer_field, is_infinite, minimal_value)
if minimal_value == nil then minimal_value = true; end
if is_infinite == nil then is_infinite = false; end
if value_field ~= nil then
local value = value_field:get_data(timer_owner);
if value == nil then
error_handler.report("otomo_moves.update_generic_boolean_value_field", string.format("Failed to access Data: %s_value", otomo_move_key));
return;
end
if value < minimal_value then
this.list[otomo_move_key] = nil;
return;
end
end
local timer = nil;
if timer_field ~= nil then
timer = timer_field:get_data(timer_owner);
if timer == nil then
error_handler.report("otomo_moves.update_generic_boolean_value_field", string.format("Failed to access Data: %s_timer", otomo_move_key));
return;
end
if value_field == nil and utils.number.is_equal(timer, 0) then
this.list[otomo_move_key] = nil;
return;
end
if is_infinite then
timer = nil;
else
timer = timer / 60;
end
end
this.update_generic(otomo_move_key, 1, timer);
end
function this.update_generic_number_value_method(otomo_move_key, timer_owner, value_method, timer_field, is_infinite, minimal_value)
if minimal_value == nil then minimal_value = 1; end
if is_infinite == nil then is_infinite = false; end
local level = 1;
if value_method ~= nil then
local value = value_method:call(timer_owner);
if value == nil then
error_handler.report("otomo_moves.update_generic_number_value_method", string.format("Failed to access Data: %s_value", otomo_move_key));
return;
end
if value < minimal_value then
this.list[otomo_move_key] = nil;
return;
end
end
local timer = nil;
if timer_field ~= nil then
timer = timer_field:get_data(timer_owner);
if timer == nil then
error_handler.report("otomo_moves.update_generic_number_value_method", string.format("Failed to access Data: %s_timer", otomo_move_key));
return;
end
if value_method == nil and utils.number.is_equal(timer, 0) then
this.list[otomo_move_key] = nil;
return;
end
if is_infinite then
timer = nil;
else
timer = timer / 60;
end
end
this.update_generic(otomo_move_key, level, timer);
end
function this.update_generic_boolean_value_method(otomo_move_key, timer_owner, value_method, timer_field, is_infinite, minimal_value)
if minimal_value == nil then minimal_value = true; end
if is_infinite == nil then is_infinite = false; end
if value_method ~= nil then
local value = value_method:call(timer_owner);
if value == nil then
error_handler.report("otomo_moves.update_generic_boolean_value_method", string.format("Failed to access Data: %s_value", otomo_move_key));
return;
end
if value ~= minimal_value then
this.list[otomo_move_key] = nil;
return;
end
end
local timer = nil;
if timer_field ~= nil then
timer = timer_field:get_data(timer_owner);
if timer == nil then
error_handler.report("otomo_moves.update_generic_boolean_value_method", string.format("Failed to access Data: %s_timer", otomo_move_key));
return;
end
if value_method == nil and utils.number.is_equal(timer, 0) then
this.list[otomo_move_key] = nil;
return;
end
if is_infinite then
timer = nil;
else
timer = timer / 60;
end
end
this.update_generic(otomo_move_key, 1, timer);
end
function this.update_generic(otomo_move_key, level, timer, duration)
duration = duration or timer;
local otomo_move = this.list[otomo_move_key];
if otomo_move == nil then
local name = language.current_language.otomo_moves[otomo_move_key];
otomo_move = buffs.new(buffs.types.otomo_move, otomo_move_key, name, level, duration);
this.list[otomo_move_key] = otomo_move;
else
otomo_move.level = level;
if timer ~= nil then
buffs.update_timer(otomo_move, timer);
end
end
end end
function this.init_names() function this.init_names()

View File

@@ -29,7 +29,7 @@ local json = json;
local log = log; local log = log;
local fs = fs; local fs = fs;
local next = next; local next = next;
local type = type; local skills_type_name = type;
local setmetatable = setmetatable; local setmetatable = setmetatable;
local getmetatable = getmetatable; local getmetatable = getmetatable;
local assert = assert; local assert = assert;
@@ -73,6 +73,8 @@ this.list = {
resentment = nil resentment = nil
}; };
local skills_type_name = "skills";
local skill_data_list = { local skill_data_list = {
-- 1 Pl_EquipSkill_000 Attack Boost -- 1 Pl_EquipSkill_000 Attack Boost
-- 2 Pl_EquipSkill_001 Agitator -- 2 Pl_EquipSkill_001 Agitator
@@ -231,7 +233,7 @@ local skill_data_list = {
-- 147 Pl_EquipSkill_235 Inspiration -- 147 Pl_EquipSkill_235 Inspiration
} }
local burst_breakpoint = 5; local burst_breakpoints = {5};
local kushara_daora_soul_breakpoint = 5; local kushara_daora_soul_breakpoint = 5;
local intrepid_heart_minimal_value = 400; local intrepid_heart_minimal_value = 400;
local dereliction_breakpoints = {100, 50}; local dereliction_breakpoints = {100, 50};
@@ -336,7 +338,7 @@ local get_hunter_wire_skill_231_num_method = player_quest_base_type_def:get_meth
local qeree = {}; local qeree = {};
function this.update(player, player_data) function this.update(player, player_data, weapon_type)
--local item_parameter = get_ref_item_parameter_method:call(singletons.player_manager); --local item_parameter = get_ref_item_parameter_method:call(singletons.player_manager);
--if item_parameter == nil then --if item_parameter == nil then
-- error_handler.report("skills.update", "Failed to access Data: item_parameter"); -- error_handler.report("skills.update", "Failed to access Data: item_parameter");
@@ -385,8 +387,7 @@ function this.update(player, player_data)
this.update_equipped_skill_data(player); this.update_equipped_skill_data(player);
this.update_dereliction(player_data); this.update_wind_mantle(player, weapon_type);
this.update_wind_mantle(player);
this.update_maximum_might(player_data); this.update_maximum_might(player_data);
this.update_bloodlust(); this.update_bloodlust();
this.update_frenzied_bloodlust(player, player_data); this.update_frenzied_bloodlust(player, player_data);
@@ -394,30 +395,49 @@ function this.update(player, player_data)
this.update_dragonheart(); this.update_dragonheart();
this.update_resentment(player_data); this.update_resentment(player_data);
this.update_generic_number_value_field("burst", player_data, this.update_generic_skill("dereliction", player_data, symbiosis_skill_lost_vital_field,
rengeki_power_up_count_field, rengeki_power_up_timer_field, false, nil, burst_breakpoint); nil, nil, nil, nil, true, nil, dereliction_breakpoints);
this.update_generic_number_value_field("kushala_daora_soul", player_data, this.update_generic_skill("burst", player_data, rengeki_power_up_count_field,
hyakuryu_dragon_power_up_count_field, hyakuryu_dragon_power_up_timer_field, false, nil, kushara_daora_soul_breakpoint); player_data, rengeki_power_up_timer_field, nil, nil, false, nil, burst_breakpoints);
this.update_generic_number_value_field("intrepid_heart", player_data, equip_skill_223_accumulator_field, nil, true, intrepid_heart_minimal_value); this.update_generic_skill("kushala_daora_soul", player_data, hyakuryu_dragon_power_up_count_field,
this.update_generic_timer("latent_power", player, power_freedom_timer_field); player_data, hyakuryu_dragon_power_up_timer_field, nil, nil, false, nil, {kushara_daora_soul_breakpoint});
this.update_generic_timer("protective_polish", player, sharpness_gauge_boost_timer_field);
this.update_generic_timer("grinder_s", player_data, brand_new_sharpness_adjust_up_timer_field);
this.update_generic_timer("counterstrike", player_data, counterattack_powerup_timer_field);
this.update_generic_timer("affinity_sliding", player_data, sliding_powerup_timer_field);
this.update_generic_timer("coalescence", player_data, disaster_turn_powerup_timer_field);
this.update_generic_timer("adrenaline_rush", player_data, equip_skill_208_atk_up_field);
this.update_generic_timer("wall_runner", player_data, wall_run_powerup_timer_field);
this.update_generic_timer("offensive_guard", player_data, equip_skill_036_timer_field);
this.update_generic_timer("hellfire_cloak", player_data, onibi_powerup_timer_field);
this.update_generic_timer("agitator", player_data, challenge_timer_field, true);
this.update_generic_timer("furious", player_data, furious_skill_stamina_buff_second_timer_field);
this.update_generic_timer("status_trigger", player_data, equip_skill_222_timer_field);
this.update_generic_boolean_value_method("heaven_sent", player, is_active_equip_skill_230_method); this.update_generic_skill("intrepid_heart", player_data, equip_skill_223_accumulator_field,
this.update_generic_boolean_value_method("heroics", player, is_predicament_power_up_method); nil, nil, nil, nil, true, intrepid_heart_minimal_value);
this.update_generic_boolean_value_method("resuscitate", player, is_debuff_state_method);
this.update_generic_skill("latent_power", nil, nil, player, power_freedom_timer_field);
this.update_generic_skill("protective_polish", nil, nil, player, sharpness_gauge_boost_timer_field);
this.update_generic_skill("grinder_s", nil, nil, player_data, brand_new_sharpness_adjust_up_timer_field);
this.update_generic_skill("counterstrike", nil, nil, player_data, counterattack_powerup_timer_field);
this.update_generic_skill("affinity_sliding", nil, nil, player_data, sliding_powerup_timer_field);
this.update_generic_skill("coalescence", nil, nil, player_data, disaster_turn_powerup_timer_field);
this.update_generic_skill("adrenaline_rush", nil, nil, player_data, equip_skill_208_atk_up_field);
this.update_generic_skill("wall_runner", nil, nil, player_data, wall_run_powerup_timer_field);
this.update_generic_skill("offensive_guard", nil, nil, player_data, equip_skill_036_timer_field);
this.update_generic_skill("hellfire_cloak", nil, nil, player_data, onibi_powerup_timer_field);
this.update_generic_skill("agitator", nil, nil, player_data, challenge_timer_field, true);
this.update_generic_skill("furious", nil, nil, player_data, furious_skill_stamina_buff_second_timer_field);
this.update_generic_skill("status_trigger", nil, nil, player_data, equip_skill_222_timer_field);
this.update_generic_skill("heaven_sent", player, is_active_equip_skill_230_method);
this.update_generic_skill("heroics", player, is_predicament_power_up_method);
this.update_generic_skill("resuscitate", player, is_debuff_state_method);
end
function this.update_generic_skill(skill_key, value_owner, value_holder, timer_owner, timer_holder, duration_owner, duration_holder,
is_infinite, minimal_value, level_breakpoints)
local skill_data = skill_data_list[skill_key];
if skill_data ~= nil and not skill_data.is_equipped then
this.list[skill_key] = nil;
return;
end
buffs.update_generic_buff(this.list, skills_type_name, skill_key,
value_owner, value_holder, timer_owner, timer_holder, duration_owner, duration_holder,
is_infinite, minimal_value, level_breakpoints);
end end
function this.update_equipped_skill_data(player) function this.update_equipped_skill_data(player)
@@ -461,295 +481,7 @@ function this.update_equipped_skill_data(player)
end end
end end
function this.update_generic_timer(skill_key, timer_owner, timer_field, is_infinite) function this.update_wind_mantle(player, weapon_type)
if is_infinite == nil then is_infinite = false; end
local skill_data = skill_data_list[skill_key];
if skill_data ~= nil and not skill_data.is_equipped then
this.list[skill_key] = nil;
return;
end
local timer = nil;
if timer_field ~= nil then
timer = timer_field:get_data(timer_owner);
if timer == nil then
error_handler.report("skills.update_generic_timer", string.format("Failed to access Data: %s_timer", skill_key));
return;
end
if utils.number.is_equal(timer, 0) then
this.list[skill_key] = nil;
return;
end
if is_infinite then
timer = nil;
else
timer = timer / 60;
end
end
this.update_generic(skill_key, 1, timer);
end
function this.update_generic_number_value_field(skill_key, timer_owner, value_field, timer_field, is_infinite, minimal_value, level_breakpoint)
if minimal_value == nil then minimal_value = 1; end
level_breakpoint = level_breakpoint or 1000000;
if is_infinite == nil then is_infinite = false; end
local skill_data = skill_data_list[skill_key];
if skill_data ~= nil and not skill_data.is_equipped then
this.list[skill_key] = nil;
return;
end
local level = 1;
if value_field ~= nil then
local value = value_field:get_data(timer_owner);
if value == nil then
error_handler.report("skills.update_generic_number_value_field", string.format("Failed to access Data: %s_value", skill_key));
return;
end
if value < minimal_value then
this.list[skill_key] = nil;
return;
end
if value >= level_breakpoint then
level = 2;
end
end
local timer = nil;
if timer_field ~= nil then
timer = timer_field:get_data(timer_owner);
if timer == nil then
error_handler.report("skills.update_generic_number_value_field", string.format("Failed to access Data: %s_timer", skill_key));
return;
end
if value_field == nil and utils.number.is_equal(timer, 0) then
this.list[skill_key] = nil;
return;
end
if is_infinite then
timer = nil;
else
timer = timer / 60;
end
end
this.update_generic(skill_key, level, timer);
end
function this.update_generic_boolean_value_field(skill_key, timer_owner, value_field, timer_field, is_infinite, minimal_value)
if minimal_value == nil then minimal_value = true; end
if is_infinite == nil then is_infinite = false; end
local skill_data = skill_data_list[skill_key];
if skill_data ~= nil and not skill_data.is_equipped then
this.list[skill_key] = nil;
return;
end
if value_field ~= nil then
local value = value_field:get_data(timer_owner);
if value == nil then
error_handler.report("skills.update_generic_boolean_value_field", string.format("Failed to access Data: %s_value", skill_key));
return;
end
if value < minimal_value then
this.list[skill_key] = nil;
return;
end
end
local timer = nil;
if timer_field ~= nil then
timer = timer_field:get_data(timer_owner);
if timer == nil then
error_handler.report("skills.update_generic_boolean_value_field", string.format("Failed to access Data: %s_timer", skill_key));
return;
end
if value_field == nil and utils.number.is_equal(timer, 0) then
this.list[skill_key] = nil;
return;
end
if is_infinite then
timer = nil;
else
timer = timer / 60;
end
end
this.update_generic(skill_key, 1, timer);
end
function this.update_generic_number_value_method(skill_key, timer_owner, value_method, timer_field, is_infinite, minimal_value, level_breakpoint)
if minimal_value == nil then minimal_value = 1; end
level_breakpoint = level_breakpoint or 1000000;
if is_infinite == nil then is_infinite = false; end
local skill_data = skill_data_list[skill_key];
if skill_data ~= nil and not skill_data.is_equipped then
this.list[skill_key] = nil;
return;
end
local level = 1;
if value_method ~= nil then
local value = value_method:call(timer_owner);
if value == nil then
error_handler.report("skills.update_generic_number_value_method", string.format("Failed to access Data: %s_value", skill_key));
return;
end
if value < minimal_value then
this.list[skill_key] = nil;
return;
end
if value >= level_breakpoint then
level = 2;
end
end
local timer = nil;
if timer_field ~= nil then
timer = timer_field:get_data(timer_owner);
if timer == nil then
error_handler.report("skills.update_generic_number_value_method", string.format("Failed to access Data: %s_timer", skill_key));
return;
end
if value_method == nil and utils.number.is_equal(timer, 0) then
this.list[skill_key] = nil;
return;
end
if is_infinite then
timer = nil;
else
timer = timer / 60;
end
end
this.update_generic(skill_key, level, timer);
end
function this.update_generic_boolean_value_method(skill_key, timer_owner, value_method, timer_field, is_infinite, minimal_value)
if minimal_value == nil then minimal_value = true; end
if is_infinite == nil then is_infinite = false; end
local skill_data = skill_data_list[skill_key];
if skill_data ~= nil and not skill_data.is_equipped then
this.list[skill_key] = nil;
return;
end
if value_method ~= nil then
local value = value_method:call(timer_owner);
if value == nil then
error_handler.report("skills.update_generic_boolean_value_method", string.format("Failed to access Data: %s_value", skill_key));
return;
end
if value ~= minimal_value then
this.list[skill_key] = nil;
return;
end
end
local timer = nil;
if timer_field ~= nil then
timer = timer_field:get_data(timer_owner);
if timer == nil then
error_handler.report("skills.update_generic_boolean_value_method", string.format("Failed to access Data: %s_timer", skill_key));
return;
end
if value_method == nil and utils.number.is_equal(timer, 0) then
this.list[skill_key] = nil;
return;
end
if is_infinite then
timer = nil;
else
timer = timer / 60;
end
end
this.update_generic(skill_key, 1, timer);
end
function this.update_generic(skill_key, level, timer, duration)
duration = duration or timer;
local skill = this.list[skill_key];
if skill == nil then
local name = language.current_language.skills[skill_key];
skill = buffs.new(buffs.types.skill, skill_key, name, level, duration);
this.list[skill_key] = skill;
else
skill.level = level;
if timer ~= nil then
buffs.update_timer(skill, timer);
end
end
end
function this.update_dereliction(player_data)
if not skill_data_list.dereliction.is_equipped then
this.list.dereliction = nil;
return;
end
local dereliction_value = symbiosis_skill_lost_vital_field:get_data(player_data);
if dereliction_value == nil then
error_handler.report("skills.update_derelection", "Failed to access Data: dereliction_value");
return;
end
if dereliction_value == 0 then
this.list.dereliction = nil;
return;
end
local level = 1;
for index, breakpoint in ipairs(dereliction_breakpoints) do
if dereliction_value >= breakpoint then
level = 4 - index;
break;
end
end
local skill = this.list.dereliction;
if skill == nil then
local name = language.current_language.skills.dereliction;
skill = buffs.new(buffs.types.skill, "dereliction", name, level);
this.list.dereliction = skill;
else
skill.level = level;
end
end
function this.update_wind_mantle(player)
local wind_mantle_timer = equip_skill_226_attack_off_timer_field:get_data(player); local wind_mantle_timer = equip_skill_226_attack_off_timer_field:get_data(player);
if wind_mantle_timer == nil then if wind_mantle_timer == nil then
error_handler.report("skills.update_wind_mantle", "Failed to access Data: wind_mantle_timer"); error_handler.report("skills.update_wind_mantle", "Failed to access Data: wind_mantle_timer");
@@ -767,38 +499,19 @@ function this.update_wind_mantle(player)
return; return;
end end
local weapon_type = player_weapon_type_field:get_data(player);
if player == nil then
error_handler.report("skills.update_wind_mantle", "Failed to access Data: weapon_type");
return;
end
local breakpoints = wind_mantle_breakpoints;
for weapon_type_index, special_breakpoints in pairs(wind_mantle_special_breakpoints) do
if weapon_type == weapon_type_index then
breakpoints = special_breakpoints;
break;
end
end
local level = 1; local level = 1;
local breakpoints = wind_mantle_special_breakpoints[weapon_type] or wind_mantle_breakpoints;
local breakpoint_count = #breakpoints;
for index, breakpoint in ipairs(breakpoints) do for index, breakpoint in ipairs(breakpoints) do
if wind_mantle_value >= breakpoint then if wind_mantle_value >= breakpoint then
level = 4 - index; level = 2 + breakpoint_count - index;
break; break;
end end
end end
local skill = this.list.wind_mantle; buffs.update_generic(this.list, skills_type_name, "wind_mantle", level, wind_mantle_duration - (wind_mantle_timer / 60), wind_mantle_duration);
if skill == nil then
local name = language.current_language.skills.wind_mantle;
skill = buffs.new(buffs.types.skill, "wind_mantle", name, level, wind_mantle_duration);
this.list.wind_mantle = skill;
else
skill.level = level;
buffs.update_timer(skill, wind_mantle_duration - (wind_mantle_timer / 60));
end
end end
function this.update_maximum_might(player_data) function this.update_maximum_might(player_data)
@@ -829,16 +542,14 @@ function this.update_maximum_might(player_data)
local name = language.current_language.skills.maximum_might; local name = language.current_language.skills.maximum_might;
if whole_body_timer < maximum_might_previous_timer_value then if whole_body_timer < maximum_might_previous_timer_value then
skill = buffs.new(type, "maximum_might", name, 1); this.list.maximum_might = buffs.new(skills_type_name, "maximum_might", name, 1);
this.list.maximum_might = skill;
elseif is_timer_zero then elseif is_timer_zero then
if maximum_might_delay_timer == nil then if maximum_might_delay_timer == nil then
maximum_might_delay_timer = time.new_delay_timer(function() maximum_might_delay_timer = time.new_delay_timer(function()
maximum_might_delay_timer = nil; maximum_might_delay_timer = nil;
skill = buffs.new(type, "maximum_might", name, 1); this.list.maximum_might = buffs.new(skills_type_name, "maximum_might", name, 1);
this.list.maximum_might = skill;
end, 3.5); end, 3.5);
end end
@@ -864,7 +575,7 @@ function this.update_bloodlust()
if this.list.bloodlust == nil then if this.list.bloodlust == nil then
local name = language.current_language.skills.bloodlust; local name = language.current_language.skills.bloodlust;
this.list.bloodlust = buffs.new(buffs.types.skill, "bloodlust", name, 0); this.list.bloodlust = buffs.new(skills_type_name, "bloodlust", name);
end end
end end
@@ -915,9 +626,8 @@ function this.update_frenzied_bloodlust(player, player_data)
timer = equip_skill_231_wp_off_timer; timer = equip_skill_231_wp_off_timer;
end end
this.update_generic("frenzied_bloodlust", 1, timer / 60); local skill = buffs.update_generic(this.list, skills_type_name, "frenzied_bloodlust", 1, timer / 60);
local skill = this.list.frenzied_bloodlust;
if is_wp_off_timer_max then if is_wp_off_timer_max then
skill.duration = frenzied_bloodlust_duration / 60; skill.duration = frenzied_bloodlust_duration / 60;
else else
@@ -936,7 +646,7 @@ function this.update_peak_performance()
return; return;
end end
this.update_generic("peak_performance", 1); buffs.update_generic(this.list, skills_type_name, "peak_performance");
end end
function this.update_dragonheart() function this.update_dragonheart()
@@ -959,7 +669,7 @@ function this.update_dragonheart()
return; return;
end end
this.update_generic("dragonheart", 1); buffs.update_generic(this.list, skills_type_name, "dragonheart");
end end
function this.update_resentment(player_data) function this.update_resentment(player_data)
@@ -979,7 +689,7 @@ function this.update_resentment(player_data)
return; return;
end end
this.update_generic("resentment", 1); buffs.update_generic(this.list, skills_type_name, "resentment");
end end
function this.init_names() function this.init_names()

View File

@@ -0,0 +1,345 @@
local this = {};
local buffs;
local buff_UI_entity;
local config;
local singletons;
local players;
local utils;
local language;
local error_handler;
local env_creature;
local player_info;
local time;
local abnormal_statuses;
local sdk = sdk;
local tostring = tostring;
local pairs = pairs;
local ipairs = ipairs;
local tonumber = tonumber;
local require = require;
local pcall = pcall;
local table = table;
local string = string;
local Vector3f = Vector3f;
local d2d = d2d;
local math = math;
local json = json;
local log = log;
local fs = fs;
local next = next;
local type = type;
local setmetatable = setmetatable;
local getmetatable = getmetatable;
local assert = assert;
local select = select;
local coroutine = coroutine;
local utf8 = utf8;
local re = re;
local imgui = imgui;
local draw = draw;
local Vector2f = Vector2f;
local reframework = reframework;
local os = os;
local ValueType = ValueType;
local package = package;
this.list = {
};
this.weapon_types = {
nil, -- 0 Great Sword
nil, -- 1 Switch Axe
nil, -- 2 Long Sword
nil, -- 3 Light Bowgun
nil, -- 4 Heavy Bowgun
nil, -- 5 Hammer
nil, -- 6 Gunlance
nil, -- 7 Lance
nil, -- 8 Sword and Shield
nil, -- 9 Dual Blades
nil, -- 10 Hunting Horn
nil, -- 11 Charge Blade
nil, -- 12 Insect Glaive
nil, -- 13 Bow
};
local weapon_skills_type_name = "weapon_skills";
local previous_weapon_type = -1;
local spirit_gauge_breakpoints = {3, 2};
local player_manager_type_def = sdk.find_type_definition("snow.player.PlayerManager");
local get_player_data_method = player_manager_type_def:get_method("get_PlayerData");
local player_data_type_def = sdk.find_type_definition("snow.player.PlayerData");
-- Great Sword
local great_sword_type_def = sdk.find_type_definition("snow.player.GreatSword");
-- Power Sheathe
local move_wp_off_buff_great_sword_timer_field = great_sword_type_def:get_field("MoveWpOffBuffGreatSwordTimer");
local move_wp_off_buff_set_time_field = great_sword_type_def:get_field("_MoveWpOffBuffSetTime");
-- Switch Axe
local slash_axe_type_def = sdk.find_type_definition("snow.player.SlashAxe");
-- Amped State
local get_bottle_awake_duration_timer_method = slash_axe_type_def:get_method("get_BottleAwakeDurationTimer");
local bottle_awake_duration_time_field = slash_axe_type_def:get_field("_BottleAwakeDurationTime");
-- Switch Charger
local no_use_slash_gauge_timer_field = slash_axe_type_def:get_field("_NoUseSlashGaugeTimer");
-- Axe: Heavy Slam
local bottle_awake_assist_timer_field = slash_axe_type_def:get_field("_BottleAwakeAssistTimer");
-- Long Sword
local long_sword_type_def = sdk.find_type_definition("snow.player.LongSword");
-- Spirit Gauge Autofill (Soaring Kick, Iai Slash)
local get_long_sword_gauge_powerup_time_method = long_sword_type_def:get_method("get_LongSwordGaugePowerUpTime");
-- Spirit Gauge
local get_long_sword_gauge_lv_method = long_sword_type_def:get_method("get_LongSwordGaugeLv");
local long_sword_gauge_lv_time_field = long_sword_type_def:get_field("_LongSwordGaugeLvTime");
local get_long_sword_gauge_lv_timer_method = long_sword_type_def:get_method("get_LongSwordGaugeLvTimer");
-- Harvest Moon
local long_sword_shell_manager_type_def = sdk.find_type_definition("snow.shell.LongSwordShellManager");
local get_master_long_sword_shell_010s_method = long_sword_shell_manager_type_def:get_method("getMaseterLongSwordShell010s");
local system_array_type_def = sdk.find_type_definition("System.Array");
local get_length_method = system_array_type_def:get_method("get_Length");
local get_value_method = system_array_type_def:get_method("GetValue(System.Int32)");
local long_sword_shell_010_list_type_def = sdk.find_type_definition("System.Collections.Generic.List`1<snow.shell.LongSwordShell010>");
local get_count_method = long_sword_shell_010_list_type_def:get_method("get_Count");
local get_item_method = long_sword_shell_010_list_type_def:get_method("get_Item");
local long_sword_shell_010_type_def = sdk.find_type_definition("snow.shell.LongSwordShell010");
local life_timer_field = long_sword_shell_010_type_def:get_field("_lifeTimer");
local single_type_def = sdk.find_type_definition("System.Single");
local mvalue_field = single_type_def:get_field("mValue");
function this.update(player, player_data, weapon_type)
if weapon_type ~= previous_weapon_type then
this.list = {};
end
previous_weapon_type = weapon_type;
if weapon_type == 0 then
this.update_great_sword_skills(player);
elseif weapon_type == 1 then
this.update_switch_axe_skills(player);
elseif weapon_type == 2 then
this.update_long_sword_skills(player);
elseif weapon_type == 3 then
this.update_light_bowgun_skills(player);
elseif weapon_type == 4 then
this.update_heavy_bowgun_skills(player);
elseif weapon_type == 5 then
this.update_hammer_skills(player);
elseif weapon_type == 6 then
this.update_gunlance_skills(player);
elseif weapon_type == 7 then
this.update_lance_skills(player);
elseif weapon_type == 8 then
this.update_sword_and_shield_skills(player);
elseif weapon_type == 9 then
this.update_dual_blades_skills(player);
elseif weapon_type == 10 then
this.update_hunting_horn_skills(player);
elseif weapon_type == 11 then
this.update_charge_blade_skills(player);
elseif weapon_type == 12 then
this.update_insect_glaive_skills(player);
else
this.update_bow_skills(player);
end
end
function this.update_great_sword_skills(player)
buffs.update_generic_buff(this.list, weapon_skills_type_name, "power_sheathe", nil, nil,
player, move_wp_off_buff_set_time_field, player, move_wp_off_buff_set_time_field);
end
function this.update_switch_axe_skills(player)
buffs.update_generic_buff(this.list, weapon_skills_type_name, "amped_state", nil, nil,
player, get_bottle_awake_duration_timer_method, player, bottle_awake_duration_time_field);
buffs.update_generic_buff(this.list, weapon_skills_type_name, "switch_charger", nil, nil,
player, no_use_slash_gauge_timer_field);
buffs.update_generic_buff(this.list, weapon_skills_type_name, "axe_heavy_slam", nil, nil,
player, bottle_awake_assist_timer_field);
end
function this.update_long_sword_skills(player)
buffs.update_generic_buff(this.list, weapon_skills_type_name, "spirit_gauge_autofill", nil, nil,
player, get_long_sword_gauge_powerup_time_method);
this.update_spirit_gauge(player);
this.update_harvest_moon();
end
function this.update_spirit_gauge(player)
local weapon_skill = buffs.update_generic_buff(this.list, weapon_skills_type_name, "spirit_gauge",
player, get_long_sword_gauge_lv_method, player, get_long_sword_gauge_lv_timer_method, nil, nil, false, nil, spirit_gauge_breakpoints);
if weapon_skill == nil then
return;
end
local long_sword_gauge_lv_time_array = long_sword_gauge_lv_time_field:get_data(player);
if long_sword_gauge_lv_time_array == nil then
error_handler.report("weapon_skills.update_spirit_gauge", "Failed to access Data: long_sword_gauge_lv_time_array");
return;
end
local long_sword_gauge_lv_time_array_length = get_length_method:call(long_sword_gauge_lv_time_array);
if long_sword_gauge_lv_time_array_length == nil then
error_handler.report("weapon_skills.update_spirit_gauge", "Failed to access Data: long_sword_gauge_lv_time_array_length");
return;
end
if weapon_skill.level >= long_sword_gauge_lv_time_array_length then
return;
end
local long_sword_gauge_lv_time_single_valtype = get_value_method:call(long_sword_gauge_lv_time_array, weapon_skill.level);
if long_sword_gauge_lv_time_single_valtype == nil then
error_handler.report("weapon_skills.update_spirit_gauge", "Failed to access Data: long_sword_gauge_lv_time_single_valtype");
return;
end
local long_sword_gauge_lv_time = mvalue_field:get_data(long_sword_gauge_lv_time_single_valtype);
if long_sword_gauge_lv_time == nil then
error_handler.report("weapon_skills.update_spirit_gauge", "Failed to access Data: long_sword_gauge_lv_time");
return;
end
weapon_skill.duration = long_sword_gauge_lv_time / 60;
end
function this.update_harvest_moon()
if singletons.long_sword_shell_manager == nil then
error_handler.report("weapon_skills.update_harvest_moon", "Failed to access Data: long_sword_shell_manager");
return;
end
local master_long_sword_shell_010_list = get_master_long_sword_shell_010s_method:call(singletons.long_sword_shell_manager, players.myself.id);
if master_long_sword_shell_010_list == nil then
error_handler.report("weapon_skills.update_harvest_moon", "Failed to access Data: master_long_sword_shell_010_list");
return;
end
local master_long_sword_shell_010_list_count = get_count_method:call(master_long_sword_shell_010_list);
if master_long_sword_shell_010_list_count == nil then
error_handler.report("weapon_skills.update_harvest_moon", "Failed to access Data: master_long_sword_shell_010_list_count");
return;
end
if master_long_sword_shell_010_list_count == 0 then
return;
end
local master_long_sword_shell_010 = get_item_method:call(master_long_sword_shell_010_list, 0);
if master_long_sword_shell_010 == nil then
error_handler.report("weapon_skills.update_harvest_moon", "Failed to access Data: master_long_sword_shell_010");
return;
end
local life_timer = life_timer_field:get_data(master_long_sword_shell_010);
if life_timer == nil then
error_handler.report("weapon_skills.update_harvest_moon", "Failed to access Data: life_timer");
return;
end
if utils.number.is_equal(life_timer, 0) then
this.list.harvest_moon = nil;
return;
end
buffs.update_generic(this.list, weapon_skills_type_name, "harvest_moon", 1, life_timer);
end
function this.update_light_bowgun_skills(player)
end
function this.update_heavy_bowgun_skills(player)
end
function this.update_hammer_skills(player)
end
function this.update_gunlance_skills(player)
end
function this.update_lance_skills(player)
end
function this.update_sword_and_shield_skills(player)
end
function this.update_dual_blades_skills(player)
end
function this.update_hunting_horn_skills(player)
end
function this.update_charge_blade_skills(player)
end
function this.update_insect_glaive_skills(player)
end
function this.update_bow_skills(player)
end
function this.init_names()
for weapon_skill_key, weapon_skill in pairs(this.list) do
local name = language.current_language.weapon_skills[weapon_skill_key];
if name == nil then
name = weapon_skill_key;
end
weapon_skill.name = name;
end
end
function this.init_dependencies()
buffs = require("MHR_Overlay.Buffs.buffs");
config = require("MHR_Overlay.Misc.config");
utils = require("MHR_Overlay.Misc.utils");
buff_UI_entity = require("MHR_Overlay.UI.UI_Entities.buff_UI_entity");
singletons = require("MHR_Overlay.Game_Handler.singletons");
players = require("MHR_Overlay.Damage_Meter.players");
language = require("MHR_Overlay.Misc.language");
error_handler = require("MHR_Overlay.Misc.error_handler");
env_creature = require("MHR_Overlay.Endemic_Life.env_creature");
player_info = require("MHR_Overlay.Misc.player_info");
time = require("MHR_Overlay.Game_Handler.time");
abnormal_statuses = require("MHR_Overlay.Buffs.abnormal_statuses");
end
function this.init_module()
end
return this;

View File

@@ -62,6 +62,7 @@ function this.init()
this.init_game_manager(); this.init_game_manager();
this.init_servant_manager(); this.init_servant_manager();
this.init_otomo_manager(); this.init_otomo_manager();
this.init_long_sword_shell_manager();
end end
function this.init_message_manager() function this.init_message_manager()
@@ -183,6 +184,17 @@ function this.init_otomo_manager()
return this.otomo_manager; return this.otomo_manager;
end end
function this.init_long_sword_shell_manager()
this.long_sword_shell_manager = sdk.get_managed_singleton("snow.shell.LongSwordShellManager");
if this.long_sword_shell_manager == nil then
error_handler.report("singletons.init_long_sword_shell_manager", "Failed to access Data: long_sword_shell_manager");
end
return this.long_sword_shell_manager;
end
function this.init_dependencies() function this.init_dependencies()
time = require("MHR_Overlay.Game_Handler.time"); time = require("MHR_Overlay.Game_Handler.time");
utils = require("MHR_Overlay.Misc.utils"); utils = require("MHR_Overlay.Misc.utils");

View File

@@ -469,6 +469,19 @@ this.default_language = {
go_fight_win = "Go, Fight, Win" go_fight_win = "Go, Fight, Win"
}, },
weapon_skills = {
-- Great Sword
power_sheathe = "Power Sheathe",
-- Switch Axe
amped_state = "Amped State",
switch_charger = "Switch Charger",
axe_heavy_slam = "Axe: Heavy Slam",
-- Long Sword
spirit_gauge_autofill = "Spirit Gauge Autofill", -- Soaring Kick, Iai Slash
spirit_gauge = "Spirit Gauge",
harvest_moon = "Harvest Moon"
},
UI = { UI = {
HP = "HP:", HP = "HP:",
stamina = "Stamina:", stamina = "Stamina:",

View File

@@ -107,6 +107,9 @@ local player_base_type_def = sdk.find_type_definition("snow.player.PlayerBase");
-- Dango Adrenaline -- Dango Adrenaline
local is_kitchen_skill_predicament_powerup_method = player_base_type_def:get_method("isKitchenSkillPredicamentPowerUp"); local is_kitchen_skill_predicament_powerup_method = player_base_type_def:get_method("isKitchenSkillPredicamentPowerUp");
local single_type_def = sdk.find_type_definition("System.Single");
local mvalue_field = single_type_def:get_field("mValue");
local master_player_ref = nil; local master_player_ref = nil;
local master_player_data_ref = nil; local master_player_data_ref = nil;
@@ -185,13 +188,13 @@ function this.update_resistances(player_data)
end end
-- Fire Resistance -- Fire Resistance
local fire_resistance_valtype = get_value_method:call(resistance_element_array, 0); local fire_resistance_single_valtype = get_value_method:call(resistance_element_array, 0);
if fire_resistance_valtype == nil then if fire_resistance_single_valtype == nil then
error_handler.report("player_info.update_resistances", "Failed to access Data: fire_resistance_valtype"); error_handler.report("player_info.update_resistances", "Failed to access Data: fire_resistance_single_valtype");
return; return;
end end
local fire_resistance = fire_resistance_valtype:get_field("mValue"); local fire_resistance = mvalue_field:get_data(fire_resistance_single_valtype);
if fire_resistance ~= nil then if fire_resistance ~= nil then
this.list.fire_resistance = math.floor(fire_resistance); this.list.fire_resistance = math.floor(fire_resistance);
else else
@@ -200,13 +203,13 @@ function this.update_resistances(player_data)
end end
-- Water Resistance -- Water Resistance
local water_resistance_valtype = get_value_method:call(resistance_element_array, 1); local water_resistance_single_valtype = get_value_method:call(resistance_element_array, 1);
if water_resistance_valtype == nil then if water_resistance_single_valtype == nil then
error_handler.report("player_info.update_resistances", "Failed to access Data: water_resistance_valtype"); error_handler.report("player_info.update_resistances", "Failed to access Data: water_resistance_single_valtype");
return; return;
end end
local water_resistance = water_resistance_valtype:get_field("mValue"); local water_resistance = mvalue_field:get_data(water_resistance_single_valtype);
if water_resistance ~= nil then if water_resistance ~= nil then
this.list.water_resistance = math.floor(water_resistance); this.list.water_resistance = math.floor(water_resistance);
else else
@@ -215,13 +218,13 @@ function this.update_resistances(player_data)
end end
-- Thunder Resistance -- Thunder Resistance
local thunder_resistance_valtype = get_value_method:call(resistance_element_array, 2); local thunder_resistance_single_valtype = get_value_method:call(resistance_element_array, 2);
if thunder_resistance_valtype == nil then if thunder_resistance_single_valtype == nil then
error_handler.report("player_info.update_resistances", "Failed to access Data: thunder_resistance_valtype"); error_handler.report("player_info.update_resistances", "Failed to access Data: thunder_resistance_single_valtype");
return; return;
end end
local thunder_resistance = thunder_resistance_valtype:get_field("mValue"); local thunder_resistance = mvalue_field:get_data(thunder_resistance_single_valtype);
if thunder_resistance ~= nil then if thunder_resistance ~= nil then
this.list.thunder_resistance = math.floor(thunder_resistance); this.list.thunder_resistance = math.floor(thunder_resistance);
else else
@@ -230,13 +233,13 @@ function this.update_resistances(player_data)
end end
-- Ice Resistance -- Ice Resistance
local ice_resistance_valtype = get_value_method:call(resistance_element_array, 3); local ice_resistance_single_valtype = get_value_method:call(resistance_element_array, 3);
if ice_resistance_valtype == nil then if ice_resistance_single_valtype == nil then
error_handler.report("player_info.update_resistances", "Failed to access Data: ice_resistance_valtype"); error_handler.report("player_info.update_resistances", "Failed to access Data: ice_resistance_single_valtype");
return; return;
end end
local ice_resistance = ice_resistance_valtype:get_field("mValue"); local ice_resistance = mvalue_field:get_data(ice_resistance_single_valtype);
if ice_resistance ~= nil then if ice_resistance ~= nil then
this.list.ice_resistance = math.floor(ice_resistance); this.list.ice_resistance = math.floor(ice_resistance);
else else
@@ -245,13 +248,13 @@ function this.update_resistances(player_data)
end end
-- Dragon Resistance -- Dragon Resistance
local dragon_resistance_valtype = get_value_method:call(resistance_element_array, 4); local dragon_resistance_single_valtype = get_value_method:call(resistance_element_array, 4);
if dragon_resistance_valtype == nil then if dragon_resistance_single_valtype == nil then
error_handler.report("player_info.update_resistances", "Failed to access Data: dragon_resistance_valtype"); error_handler.report("player_info.update_resistances", "Failed to access Data: dragon_resistance_single_valtype");
return; return;
end end
local dragon_resistance = dragon_resistance_valtype:get_field("mValue"); local dragon_resistance = mvalue_field:get_data(dragon_resistance_single_valtype);
if dragon_resistance ~= nil then if dragon_resistance ~= nil then
this.list.dragon_resistance = math.floor(dragon_resistance); this.list.dragon_resistance = math.floor(dragon_resistance);
else else

View File

@@ -44,6 +44,7 @@ local unicode_chars;
local epsilon = 0.000001; local epsilon = 0.000001;
this.table = {}; this.table = {};
this.type = {};
this.number = {}; this.number = {};
this.string = {}; this.string = {};
this.vec2 = {}; this.vec2 = {};
@@ -215,6 +216,18 @@ function this.table.merge(...)
return result; return result;
end end
function this.type.is_boolean(value)
return value == true or value == false;
end
function this.type.is_REField(value)
return value.get_return_type == nil;
end
function this.type.is_REMethodDefinition(value)
return value.get_return_type ~= nil;
end
function this.number.is_NaN(value) function this.number.is_NaN(value)
return tostring(value) == tostring(0/0); return tostring(value) == tostring(0/0);
end end

View File

@@ -275,6 +275,12 @@ local system_array_type_def = sdk.find_type_definition("System.Array");
local get_length_method = system_array_type_def:get_method("get_Length"); local get_length_method = system_array_type_def:get_method("get_Length");
local get_value_method = system_array_type_def:get_method("GetValue(System.Int32)"); local get_value_method = system_array_type_def:get_method("GetValue(System.Int32)");
local int32_type_def = sdk.find_type_definition("System.Int32");
local int32_mvalue_field = int32_type_def:get_field("mValue");
local single_type_def = sdk.find_type_definition("System.Single");
local single_mvalue_field = single_type_def:get_field("mValue");
function this.update_ailments(enemy, monster) function this.update_ailments(enemy, monster)
if enemy == nil then if enemy == nil then
error_handler.report("ailments.update_ailments", "Missing Parameter: enemy"); error_handler.report("ailments.update_ailments", "Missing Parameter: enemy");
@@ -369,12 +375,12 @@ function this.update_ailment(monster, ailment_param, id)
if activate_count_array_length ~= nil then if activate_count_array_length ~= nil then
if activate_count_array_length > 0 then if activate_count_array_length > 0 then
local activate_count_valuetype = get_value_method:call(activate_count_array, 0); local activate_count_valtype = get_value_method:call(activate_count_array, 0);
if activate_count_valuetype ~= nil then if activate_count_valtype ~= nil then
activate_count = activate_count_valuetype:get_field("mValue"); activate_count = int32_mvalue_field:get_data(activate_count_valtype);
else else
error_handler.report("ailments.update_ailment", "Failed to access Data: activate_count_valuetype"); error_handler.report("ailments.update_ailment", "Failed to access Data: activate_count_valtype");
end end
end end
else else
@@ -390,12 +396,12 @@ function this.update_ailment(monster, ailment_param, id)
if buildup_array_length ~= nil then if buildup_array_length ~= nil then
if buildup_array_length > 0 then if buildup_array_length > 0 then
local buildup_valuetype = get_value_method:call(buildup_array, 0); local buildup_valtype = get_value_method:call(buildup_array, 0);
if buildup_valuetype ~= nil then if buildup_valtype ~= nil then
buildup = buildup_valuetype:get_field("mValue"); buildup = single_mvalue_field:get_data(buildup_valtype);
else else
error_handler.report("ailments.update_ailment", "Failed to access Data: buildup_valuetype"); error_handler.report("ailments.update_ailment", "Failed to access Data: buildup_valtype");
end end
end end
else else
@@ -411,12 +417,12 @@ function this.update_ailment(monster, ailment_param, id)
if buildup_limit_array_length ~= nil then if buildup_limit_array_length ~= nil then
if buildup_limit_array_length > 0 then if buildup_limit_array_length > 0 then
local buildup_limit_valuetype = get_value_method:call(buildup_limit_array, 0); local buildup_limit_valtype = get_value_method:call(buildup_limit_array, 0);
if buildup_limit_valuetype ~= nil then if buildup_limit_valtype ~= nil then
buildup_limit = buildup_limit_valuetype:get_field("mValue"); buildup_limit = single_mvalue_field:get_data(buildup_limit_valtype);
else else
error_handler.report("ailments.update_ailment", "Failed to access Data: buildup_limit_valuetype"); error_handler.report("ailments.update_ailment", "Failed to access Data: buildup_limit_valtype");
end end
end end
else else

View File

@@ -13,6 +13,7 @@ local skills;
local dangos; local dangos;
local abnormal_statuses; local abnormal_statuses;
local otomo_moves; local otomo_moves;
local weapon_skills;
local sdk = sdk; local sdk = sdk;
local tostring = tostring; local tostring = tostring;
@@ -117,12 +118,22 @@ function this.update()
for key, otomo_move in pairs(otomo_moves.list) do for key, otomo_move in pairs(otomo_moves.list) do
if not otomo_move.is_active then if not otomo_move.is_active then
goto continue6; goto continue7;
end end
table.insert(_displayed_buffs, otomo_move); table.insert(_displayed_buffs, otomo_move);
::continue6:: ::continue7::
end
for key, weapon_skill in pairs(weapon_skills.list) do
if not weapon_skill.is_active then
goto continue8;
end
table.insert(_displayed_buffs, weapon_skill);
::continue8::
end end
displayed_buffs = this.sort_buffs(_displayed_buffs, cached_config); displayed_buffs = this.sort_buffs(_displayed_buffs, cached_config);
@@ -208,6 +219,7 @@ function this.init_dependencies()
dangos = require("MHR_Overlay.Buffs.dangos"); dangos = require("MHR_Overlay.Buffs.dangos");
abnormal_statuses = require("MHR_Overlay.Buffs.abnormal_statuses"); abnormal_statuses = require("MHR_Overlay.Buffs.abnormal_statuses");
otomo_moves = require("MHR_Overlay.Buffs.otomo_moves"); otomo_moves = require("MHR_Overlay.Buffs.otomo_moves");
weapon_skills = require("MHR_Overlay.Buffs.weapon_skills");
end end
function this.init_module() function this.init_module()

View File

@@ -572,5 +572,14 @@
}, },
"unicode_glyph_ranges": [ "unicode_glyph_ranges": [
0 0
] ],
"weapon_skills": {
"amped_state": "Amped State",
"axe_heavy_slam": "Axe: Heavy Slam",
"harvest_moon": "Harvest Moon",
"power_sheathe": "Power Sheathe",
"spirit_gauge": "Spirit Gauge",
"spirit_gauge_autofill": "Spirit Gauge Autofill",
"switch_charger": "Switch Charger"
}
} }

View File

@@ -585,5 +585,16 @@
65280, 65280,
65519, 65519,
0 0
] ],
"weapon_skills": {
"amped_state": "Amped State",
"axe_heavy_slam": "Axe: Heavy Slam",
"harvest_moon": "Harvest Moon",
"iai_slash": "Iai Slash",
"power_sheathe": "Power Sheathe",
"soaring_kick": "Soaring Kick",
"spirit_gauge": "Spirit Gauge",
"spirit_gauge_autofill": "Spirit Gauge Autofill",
"switch_charger": "Switch Charger"
}
} }

View File

@@ -586,5 +586,16 @@
65280, 65280,
65519, 65519,
0 0
] ],
"weapon_skills": {
"amped_state": "Amped State",
"axe_heavy_slam": "Axe: Heavy Slam",
"harvest_moon": "Harvest Moon",
"iai_slash": "Iai Slash",
"power_sheathe": "Power Sheathe",
"soaring_kick": "Soaring Kick",
"spirit_gauge": "Spirit Gauge",
"spirit_gauge_autofill": "Spirit Gauge Autofill",
"switch_charger": "Switch Charger"
}
} }

View File

@@ -582,5 +582,16 @@
65280, 65280,
65519, 65519,
0 0
] ],
"weapon_skills": {
"amped_state": "Amped State",
"axe_heavy_slam": "Axe: Heavy Slam",
"harvest_moon": "Harvest Moon",
"iai_slash": "Iai Slash",
"power_sheathe": "Power Sheathe",
"soaring_kick": "Soaring Kick",
"spirit_gauge": "Spirit Gauge",
"spirit_gauge_autofill": "Spirit Gauge Autofill",
"switch_charger": "Switch Charger"
}
} }

View File

@@ -586,5 +586,16 @@
65280, 65280,
65519, 65519,
0 0
] ],
"weapon_skills": {
"amped_state": "Amped State",
"axe_heavy_slam": "Axe: Heavy Slam",
"harvest_moon": "Harvest Moon",
"iai_slash": "Iai Slash",
"power_sheathe": "Power Sheathe",
"soaring_kick": "Soaring Kick",
"spirit_gauge": "Spirit Gauge",
"spirit_gauge_autofill": "Spirit Gauge Autofill",
"switch_charger": "Switch Charger"
}
} }

View File

@@ -586,5 +586,16 @@
65280, 65280,
65519, 65519,
0 0
] ],
"weapon_skills": {
"amped_state": "Amped State",
"axe_heavy_slam": "Axe: Heavy Slam",
"harvest_moon": "Harvest Moon",
"iai_slash": "Iai Slash",
"power_sheathe": "Power Sheathe",
"soaring_kick": "Soaring Kick",
"spirit_gauge": "Spirit Gauge",
"spirit_gauge_autofill": "Spirit Gauge Autofill",
"switch_charger": "Switch Charger"
}
} }