mirror of
https://github.com/GreenComfyTea/MHR-Overlay.git
synced 2026-01-24 04:18:11 -08:00
Buff UI: Add Otomo Moves
This commit is contained in:
@@ -15,6 +15,7 @@ local endemic_life_buffs;
|
||||
local skills;
|
||||
local dangos;
|
||||
local abnormal_statuses;
|
||||
local otomo_moves;
|
||||
|
||||
local sdk = sdk;
|
||||
local tostring = tostring;
|
||||
@@ -148,7 +149,6 @@ function this.update()
|
||||
return;
|
||||
end
|
||||
|
||||
|
||||
local is_player_lobby_base = master_player:get_type_definition() == player_lobby_base_type_def;
|
||||
|
||||
local master_player_data = get_player_data_method:call(master_player);
|
||||
@@ -156,7 +156,8 @@ function this.update()
|
||||
consumables.update(master_player_data);
|
||||
endemic_life_buffs.update(master_player_data);
|
||||
skills.update(master_player, master_player_data);
|
||||
dangos.update(master_player_data);
|
||||
dangos.update(master_player, master_player_data);
|
||||
otomo_moves.update(master_player_data);
|
||||
|
||||
if not is_player_lobby_base then
|
||||
abnormal_statuses.update(master_player, master_player_data);
|
||||
@@ -209,6 +210,7 @@ function this.init_dependencies()
|
||||
skills = require("MHR_Overlay.Buffs.skills");
|
||||
dangos = require("MHR_Overlay.Buffs.dangos");
|
||||
abnormal_statuses = require("MHR_Overlay.Buffs.abnormal_statuses");
|
||||
otomo_moves = require("MHR_Overlay.Buffs.otomo_moves");
|
||||
end
|
||||
|
||||
function this.init_module()
|
||||
|
||||
309
reframework/autorun/MHR_Overlay/Buffs/otomo_moves.lua
Normal file
309
reframework/autorun/MHR_Overlay/Buffs/otomo_moves.lua
Normal file
@@ -0,0 +1,309 @@
|
||||
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 = {
|
||||
rousing_roar = nil
|
||||
};
|
||||
|
||||
|
||||
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");
|
||||
-- Palico: Rousing Roar
|
||||
local beast_roar_otomo_timer_field = player_data_type_def:get_field("_BeastRoarOtomoTimer");
|
||||
|
||||
function this.update(player_data)
|
||||
xy = player_data._BeastRoarOtomoTimer;
|
||||
|
||||
this.update_generic_timer("rousing_roar", player_data, beast_roar_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
|
||||
|
||||
function this.init_names()
|
||||
for otomo_move_key, otomo_move in pairs(this.list) do
|
||||
local name = language.current_language.otomo_moves[otomo_move_key];
|
||||
|
||||
if name == nil then
|
||||
name = otomo_move_key;
|
||||
end
|
||||
|
||||
otomo_move.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;
|
||||
@@ -12,6 +12,7 @@ local error_handler;
|
||||
local skills;
|
||||
local dangos;
|
||||
local abnormal_statuses;
|
||||
local otomo_moves;
|
||||
|
||||
local sdk = sdk;
|
||||
local tostring = tostring;
|
||||
@@ -114,6 +115,16 @@ function this.update()
|
||||
::continue6::
|
||||
end
|
||||
|
||||
for key, otomo_move in pairs(otomo_moves.list) do
|
||||
if not otomo_move.is_active then
|
||||
goto continue6;
|
||||
end
|
||||
|
||||
table.insert(_displayed_buffs, otomo_move);
|
||||
|
||||
::continue6::
|
||||
end
|
||||
|
||||
displayed_buffs = this.sort_buffs(_displayed_buffs, cached_config);
|
||||
end
|
||||
|
||||
@@ -196,6 +207,7 @@ function this.init_dependencies()
|
||||
skills = require("MHR_Overlay.Buffs.skills");
|
||||
dangos = require("MHR_Overlay.Buffs.dangos");
|
||||
abnormal_statuses = require("MHR_Overlay.Buffs.abnormal_statuses");
|
||||
otomo_moves = require("MHR_Overlay.Buffs.otomo_moves");
|
||||
end
|
||||
|
||||
function this.init_module()
|
||||
|
||||
Reference in New Issue
Block a user