mirror of
https://github.com/GreenComfyTea/MHR-Overlay.git
synced 2026-01-24 12:28:03 -08:00
Utilize this keyword everywhere
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
local keyboard = {};
|
||||
local this = {};
|
||||
|
||||
local config;
|
||||
local singletons;
|
||||
@@ -49,13 +49,13 @@ local get_down_method = hard_keyboard_field_type_def:get_method("getDown");
|
||||
local get_trigger_method = hard_keyboard_field_type_def:get_method("getTrg");
|
||||
local get_release_method = hard_keyboard_field_type_def:get_method("getRelease");
|
||||
|
||||
keyboard.hotkey_modifiers_down = {
|
||||
this.hotkey_modifiers_down = {
|
||||
ctrl = false,
|
||||
shift = false,
|
||||
alt = false
|
||||
};
|
||||
|
||||
keyboard.keys = {
|
||||
this.keys = {
|
||||
[0] = "None",
|
||||
[1] = "Left Mouse Button",
|
||||
[2] = "Right Mouse Button",
|
||||
@@ -334,7 +334,7 @@ keyboard.keys = {
|
||||
};
|
||||
|
||||
|
||||
function keyboard.update()
|
||||
function this.update()
|
||||
if singletons.game_keyboard == nil then
|
||||
customization_menu.status = "No game keyboard";
|
||||
return;
|
||||
@@ -346,137 +346,137 @@ function keyboard.update()
|
||||
return;
|
||||
end
|
||||
|
||||
keyboard.check_modifiers(hard_keyboard);
|
||||
this.check_modifiers(hard_keyboard);
|
||||
|
||||
local new_hotkey_registered = keyboard.register_hotkey(hard_keyboard);
|
||||
local new_hotkey_registered = this.register_hotkey(hard_keyboard);
|
||||
|
||||
|
||||
|
||||
if new_hotkey_registered then
|
||||
config.save();
|
||||
else
|
||||
keyboard.check_hotkeys(hard_keyboard);
|
||||
this.check_hotkeys(hard_keyboard);
|
||||
end
|
||||
|
||||
keyboard.hotkey_modifiers_down.ctrl = false;
|
||||
keyboard.hotkey_modifiers_down.shift = false;
|
||||
keyboard.hotkey_modifiers_down.alt = false
|
||||
this.hotkey_modifiers_down.ctrl = false;
|
||||
this.hotkey_modifiers_down.shift = false;
|
||||
this.hotkey_modifiers_down.alt = false
|
||||
end
|
||||
|
||||
function keyboard.check_modifiers(hard_keyboard)
|
||||
function this.check_modifiers(hard_keyboard)
|
||||
local is_ctrl_down = get_down_method:call(hard_keyboard, 17);
|
||||
if is_ctrl_down ~= nil then
|
||||
keyboard.hotkey_modifiers_down.ctrl = is_ctrl_down;
|
||||
this.hotkey_modifiers_down.ctrl = is_ctrl_down;
|
||||
end
|
||||
|
||||
local is_shift_down = get_down_method:call(hard_keyboard, 16);
|
||||
if is_shift_down ~= nil then
|
||||
keyboard.hotkey_modifiers_down.shift = is_shift_down;
|
||||
this.hotkey_modifiers_down.shift = is_shift_down;
|
||||
end
|
||||
|
||||
local is_alt_down = get_down_method:call(hard_keyboard, 18);
|
||||
if is_alt_down ~= nil then
|
||||
keyboard.hotkey_modifiers_down.alt = is_alt_down;
|
||||
this.hotkey_modifiers_down.alt = is_alt_down;
|
||||
end
|
||||
end
|
||||
|
||||
function keyboard.register_hotkey(hard_keyboard)
|
||||
function this.register_hotkey(hard_keyboard)
|
||||
local cached_config = config.current_config.global_settings.hotkeys_with_modifiers;
|
||||
|
||||
if customization_menu.all_UI_waiting_for_key then
|
||||
for key, key_name in pairs(keyboard.keys) do
|
||||
for key, key_name in pairs(this.keys) do
|
||||
if get_release_method:call(hard_keyboard, key) then
|
||||
cached_config.all_UI.ctrl = keyboard.hotkey_modifiers_down.ctrl;
|
||||
cached_config.all_UI.shift = keyboard.hotkey_modifiers_down.shift;
|
||||
cached_config.all_UI.alt = keyboard.hotkey_modifiers_down.alt;
|
||||
cached_config.all_UI.ctrl = this.hotkey_modifiers_down.ctrl;
|
||||
cached_config.all_UI.shift = this.hotkey_modifiers_down.shift;
|
||||
cached_config.all_UI.alt = this.hotkey_modifiers_down.alt;
|
||||
cached_config.all_UI.key = key;
|
||||
customization_menu.all_UI_waiting_for_key = false;
|
||||
return true;
|
||||
end
|
||||
end
|
||||
elseif customization_menu.small_monster_UI_waiting_for_key then
|
||||
for key, key_name in pairs(keyboard.keys) do
|
||||
for key, key_name in pairs(this.keys) do
|
||||
if get_release_method:call(hard_keyboard, key) then
|
||||
cached_config.small_monster_UI.ctrl = keyboard.hotkey_modifiers_down.ctrl;
|
||||
cached_config.small_monster_UI.shift = keyboard.hotkey_modifiers_down.shift;
|
||||
cached_config.small_monster_UI.alt = keyboard.hotkey_modifiers_down.alt;
|
||||
cached_config.small_monster_UI.ctrl = this.hotkey_modifiers_down.ctrl;
|
||||
cached_config.small_monster_UI.shift = this.hotkey_modifiers_down.shift;
|
||||
cached_config.small_monster_UI.alt = this.hotkey_modifiers_down.alt;
|
||||
cached_config.small_monster_UI.key = key;
|
||||
customization_menu.small_monster_UI_waiting_for_key = false;
|
||||
return true;
|
||||
end
|
||||
end
|
||||
elseif customization_menu.large_monster_UI_waiting_for_key then
|
||||
for key, key_name in pairs(keyboard.keys) do
|
||||
for key, key_name in pairs(this.keys) do
|
||||
if get_release_method:call(hard_keyboard, key) then
|
||||
cached_config.large_monster_UI.ctrl = keyboard.hotkey_modifiers_down.ctrl;
|
||||
cached_config.large_monster_UI.shift = keyboard.hotkey_modifiers_down.shift;
|
||||
cached_config.large_monster_UI.alt = keyboard.hotkey_modifiers_down.alt;
|
||||
cached_config.large_monster_UI.ctrl = this.hotkey_modifiers_down.ctrl;
|
||||
cached_config.large_monster_UI.shift = this.hotkey_modifiers_down.shift;
|
||||
cached_config.large_monster_UI.alt = this.hotkey_modifiers_down.alt;
|
||||
cached_config.large_monster_UI.key = key;
|
||||
customization_menu.large_monster_UI_waiting_for_key = false;
|
||||
return true;
|
||||
end
|
||||
end
|
||||
elseif customization_menu.large_monster_dynamic_UI_waiting_for_key then
|
||||
for key, key_name in pairs(keyboard.keys) do
|
||||
for key, key_name in pairs(this.keys) do
|
||||
if get_release_method:call(hard_keyboard, key) then
|
||||
cached_config.large_monster_dynamic_UI.ctrl = keyboard.hotkey_modifiers_down.ctrl;
|
||||
cached_config.large_monster_dynamic_UI.shift = keyboard.hotkey_modifiers_down.shift;
|
||||
cached_config.large_monster_dynamic_UI.alt = keyboard.hotkey_modifiers_down.alt;
|
||||
cached_config.large_monster_dynamic_UI.ctrl = this.hotkey_modifiers_down.ctrl;
|
||||
cached_config.large_monster_dynamic_UI.shift = this.hotkey_modifiers_down.shift;
|
||||
cached_config.large_monster_dynamic_UI.alt = this.hotkey_modifiers_down.alt;
|
||||
cached_config.large_monster_dynamic_UI.key = key;
|
||||
customization_menu.large_monster_dynamic_UI_waiting_for_key = false;
|
||||
return true;
|
||||
end
|
||||
end
|
||||
elseif customization_menu.large_monster_static_UI_waiting_for_key then
|
||||
for key, key_name in pairs(keyboard.keys) do
|
||||
for key, key_name in pairs(this.keys) do
|
||||
if get_release_method:call(hard_keyboard, key) then
|
||||
cached_config.large_monster_static_UI.ctrl = keyboard.hotkey_modifiers_down.ctrl;
|
||||
cached_config.large_monster_static_UI.shift = keyboard.hotkey_modifiers_down.shift;
|
||||
cached_config.large_monster_static_UI.alt = keyboard.hotkey_modifiers_down.alt;
|
||||
cached_config.large_monster_static_UI.ctrl = this.hotkey_modifiers_down.ctrl;
|
||||
cached_config.large_monster_static_UI.shift = this.hotkey_modifiers_down.shift;
|
||||
cached_config.large_monster_static_UI.alt = this.hotkey_modifiers_down.alt;
|
||||
cached_config.large_monster_static_UI.key = key;
|
||||
customization_menu.large_monster_static_UI_waiting_for_key = false;
|
||||
return true;
|
||||
end
|
||||
end
|
||||
elseif customization_menu.large_monster_highlighted_UI_waiting_for_key then
|
||||
for key, key_name in pairs(keyboard.keys) do
|
||||
for key, key_name in pairs(this.keys) do
|
||||
if get_release_method:call(hard_keyboard, key) then
|
||||
cached_config.large_monster_highlighted_UI.ctrl = keyboard.hotkey_modifiers_down.ctrl;
|
||||
cached_config.large_monster_highlighted_UI.shift = keyboard.hotkey_modifiers_down.shift;
|
||||
cached_config.large_monster_highlighted_UI.alt = keyboard.hotkey_modifiers_down.alt;
|
||||
cached_config.large_monster_highlighted_UI.ctrl = this.hotkey_modifiers_down.ctrl;
|
||||
cached_config.large_monster_highlighted_UI.shift = this.hotkey_modifiers_down.shift;
|
||||
cached_config.large_monster_highlighted_UI.alt = this.hotkey_modifiers_down.alt;
|
||||
cached_config.large_monster_highlighted_UI.key = key;
|
||||
customization_menu.large_monster_highlighted_UI_waiting_for_key = false;
|
||||
return true;
|
||||
end
|
||||
end
|
||||
elseif customization_menu.time_UI_waiting_for_key then
|
||||
for key, key_name in pairs(keyboard.keys) do
|
||||
for key, key_name in pairs(this.keys) do
|
||||
if get_release_method:call(hard_keyboard, key) then
|
||||
cached_config.time_UI.ctrl = keyboard.hotkey_modifiers_down.ctrl;
|
||||
cached_config.time_UI.shift = keyboard.hotkey_modifiers_down.shift;
|
||||
cached_config.time_UI.alt = keyboard.hotkey_modifiers_down.alt;
|
||||
cached_config.time_UI.ctrl = this.hotkey_modifiers_down.ctrl;
|
||||
cached_config.time_UI.shift = this.hotkey_modifiers_down.shift;
|
||||
cached_config.time_UI.alt = this.hotkey_modifiers_down.alt;
|
||||
cached_config.time_UI.key = key;
|
||||
customization_menu.time_UI_waiting_for_key = false;
|
||||
return true;
|
||||
end
|
||||
end
|
||||
elseif customization_menu.damage_meter_UI_waiting_for_key then
|
||||
for key, key_name in pairs(keyboard.keys) do
|
||||
for key, key_name in pairs(this.keys) do
|
||||
if get_release_method:call(hard_keyboard, key) then
|
||||
cached_config.damage_meter_UI.ctrl = keyboard.hotkey_modifiers_down.ctrl;
|
||||
cached_config.damage_meter_UI.shift = keyboard.hotkey_modifiers_down.shift;
|
||||
cached_config.damage_meter_UI.alt = keyboard.hotkey_modifiers_down.alt;
|
||||
cached_config.damage_meter_UI.ctrl = this.hotkey_modifiers_down.ctrl;
|
||||
cached_config.damage_meter_UI.shift = this.hotkey_modifiers_down.shift;
|
||||
cached_config.damage_meter_UI.alt = this.hotkey_modifiers_down.alt;
|
||||
cached_config.damage_meter_UI.key = key;
|
||||
customization_menu.damage_meter_UI_waiting_for_key = false;
|
||||
return true;
|
||||
end
|
||||
end
|
||||
elseif customization_menu.endemic_life_UI_waiting_for_key then
|
||||
for key, key_name in pairs(keyboard.keys) do
|
||||
for key, key_name in pairs(this.keys) do
|
||||
if get_release_method:call(hard_keyboard, key) then
|
||||
cached_config.endemic_life_UI.ctrl = keyboard.hotkey_modifiers_down.ctrl;
|
||||
cached_config.endemic_life_UI.shift = keyboard.hotkey_modifiers_down.shift;
|
||||
cached_config.endemic_life_UI.alt = keyboard.hotkey_modifiers_down.alt;
|
||||
cached_config.endemic_life_UI.ctrl = this.hotkey_modifiers_down.ctrl;
|
||||
cached_config.endemic_life_UI.shift = this.hotkey_modifiers_down.shift;
|
||||
cached_config.endemic_life_UI.alt = this.hotkey_modifiers_down.alt;
|
||||
cached_config.endemic_life_UI.key = key;
|
||||
customization_menu.endemic_life_UI_waiting_for_key = false;
|
||||
return true;
|
||||
@@ -487,12 +487,12 @@ function keyboard.register_hotkey(hard_keyboard)
|
||||
return false;
|
||||
end
|
||||
|
||||
function keyboard.check_hotkeys(hard_keyboard)
|
||||
function this.check_hotkeys(hard_keyboard)
|
||||
local cached_config = config.current_config.global_settings.hotkeys_with_modifiers;
|
||||
|
||||
if not (cached_config.all_UI.ctrl and not keyboard.hotkey_modifiers_down.ctrl)
|
||||
and not (cached_config.all_UI.shift and not keyboard.hotkey_modifiers_down.shift)
|
||||
and not (cached_config.all_UI.alt and not keyboard.hotkey_modifiers_down.alt) then
|
||||
if not (cached_config.all_UI.ctrl and not this.hotkey_modifiers_down.ctrl)
|
||||
and not (cached_config.all_UI.shift and not this.hotkey_modifiers_down.shift)
|
||||
and not (cached_config.all_UI.alt and not this.hotkey_modifiers_down.alt) then
|
||||
if get_release_method:call(hard_keyboard, math.tointeger(cached_config.all_UI.key)) then
|
||||
|
||||
local is_any_enabled = config.current_config.time_UI.enabled
|
||||
@@ -511,17 +511,17 @@ function keyboard.check_hotkeys(hard_keyboard)
|
||||
end
|
||||
end
|
||||
|
||||
if not (cached_config.small_monster_UI.ctrl and not keyboard.hotkey_modifiers_down.ctrl)
|
||||
and not (cached_config.small_monster_UI.shift and not keyboard.hotkey_modifiers_down.shift)
|
||||
and not (cached_config.small_monster_UI.alt and not keyboard.hotkey_modifiers_down.alt) then
|
||||
if not (cached_config.small_monster_UI.ctrl and not this.hotkey_modifiers_down.ctrl)
|
||||
and not (cached_config.small_monster_UI.shift and not this.hotkey_modifiers_down.shift)
|
||||
and not (cached_config.small_monster_UI.alt and not this.hotkey_modifiers_down.alt) then
|
||||
if get_release_method:call(hard_keyboard, math.tointeger(cached_config.small_monster_UI.key)) then
|
||||
config.current_config.small_monster_UI.enabled = not config.current_config.small_monster_UI.enabled;
|
||||
end
|
||||
end
|
||||
|
||||
if not (cached_config.large_monster_UI.ctrl and not keyboard.hotkey_modifiers_down.ctrl)
|
||||
and not (cached_config.large_monster_UI.shift and not keyboard.hotkey_modifiers_down.shift)
|
||||
and not (cached_config.large_monster_UI.alt and not keyboard.hotkey_modifiers_down.alt) then
|
||||
if not (cached_config.large_monster_UI.ctrl and not this.hotkey_modifiers_down.ctrl)
|
||||
and not (cached_config.large_monster_UI.shift and not this.hotkey_modifiers_down.shift)
|
||||
and not (cached_config.large_monster_UI.alt and not this.hotkey_modifiers_down.alt) then
|
||||
if get_release_method:call(hard_keyboard, math.tointeger(cached_config.large_monster_UI.key)) then
|
||||
local is_any_enabled = config.current_config.large_monster_UI.dynamic.enabled
|
||||
or config.current_config.large_monster_UI.static.enabled
|
||||
@@ -533,27 +533,27 @@ function keyboard.check_hotkeys(hard_keyboard)
|
||||
end
|
||||
end
|
||||
|
||||
if not (cached_config.large_monster_dynamic_UI.ctrl and not keyboard.hotkey_modifiers_down.ctrl)
|
||||
and not (cached_config.large_monster_dynamic_UI.shift and not keyboard.hotkey_modifiers_down.shift)
|
||||
and not (cached_config.large_monster_dynamic_UI.alt and not keyboard.hotkey_modifiers_down.alt) then
|
||||
if not (cached_config.large_monster_dynamic_UI.ctrl and not this.hotkey_modifiers_down.ctrl)
|
||||
and not (cached_config.large_monster_dynamic_UI.shift and not this.hotkey_modifiers_down.shift)
|
||||
and not (cached_config.large_monster_dynamic_UI.alt and not this.hotkey_modifiers_down.alt) then
|
||||
if get_release_method:call(hard_keyboard,
|
||||
math.tointeger(cached_config.large_monster_dynamic_UI.key)) then
|
||||
config.current_config.large_monster_UI.dynamic.enabled = not config.current_config.large_monster_UI.dynamic.enabled;
|
||||
end
|
||||
end
|
||||
|
||||
if not (cached_config.large_monster_static_UI.ctrl and not keyboard.hotkey_modifiers_down.ctrl)
|
||||
and not (cached_config.large_monster_static_UI.shift and not keyboard.hotkey_modifiers_down.shift)
|
||||
and not (cached_config.large_monster_static_UI.alt and not keyboard.hotkey_modifiers_down.alt) then
|
||||
if not (cached_config.large_monster_static_UI.ctrl and not this.hotkey_modifiers_down.ctrl)
|
||||
and not (cached_config.large_monster_static_UI.shift and not this.hotkey_modifiers_down.shift)
|
||||
and not (cached_config.large_monster_static_UI.alt and not this.hotkey_modifiers_down.alt) then
|
||||
if get_release_method:call(hard_keyboard,
|
||||
math.tointeger(cached_config.large_monster_static_UI.key)) then
|
||||
config.current_config.large_monster_UI.static.enabled = not config.current_config.large_monster_UI.static.enabled;
|
||||
end
|
||||
end
|
||||
|
||||
if not (cached_config.large_monster_highlighted_UI.ctrl and not keyboard.hotkey_modifiers_down.ctrl)
|
||||
and not (cached_config.large_monster_highlighted_UI.shift and not keyboard.hotkey_modifiers_down.shift)
|
||||
and not (cached_config.large_monster_highlighted_UI.alt and not keyboard.hotkey_modifiers_down.alt) then
|
||||
if not (cached_config.large_monster_highlighted_UI.ctrl and not this.hotkey_modifiers_down.ctrl)
|
||||
and not (cached_config.large_monster_highlighted_UI.shift and not this.hotkey_modifiers_down.shift)
|
||||
and not (cached_config.large_monster_highlighted_UI.alt and not this.hotkey_modifiers_down.alt) then
|
||||
if get_release_method:call(hard_keyboard,
|
||||
math.tointeger(cached_config.large_monster_highlighted_UI.key)) then
|
||||
config.current_config.large_monster_UI.highlighted.enabled = not
|
||||
@@ -561,32 +561,32 @@ function keyboard.check_hotkeys(hard_keyboard)
|
||||
end
|
||||
end
|
||||
|
||||
if not (cached_config.time_UI.ctrl and not keyboard.hotkey_modifiers_down.ctrl)
|
||||
and not (cached_config.time_UI.shift and not keyboard.hotkey_modifiers_down.shift)
|
||||
and not (cached_config.time_UI.alt and not keyboard.hotkey_modifiers_down.alt) then
|
||||
if not (cached_config.time_UI.ctrl and not this.hotkey_modifiers_down.ctrl)
|
||||
and not (cached_config.time_UI.shift and not this.hotkey_modifiers_down.shift)
|
||||
and not (cached_config.time_UI.alt and not this.hotkey_modifiers_down.alt) then
|
||||
if get_release_method:call(hard_keyboard, math.tointeger(cached_config.time_UI.key)) then
|
||||
config.current_config.time_UI.enabled = not config.current_config.time_UI.enabled;
|
||||
end
|
||||
end
|
||||
|
||||
if not (cached_config.damage_meter_UI.ctrl and not keyboard.hotkey_modifiers_down.ctrl)
|
||||
and not (cached_config.damage_meter_UI.shift and not keyboard.hotkey_modifiers_down.shift)
|
||||
and not (cached_config.damage_meter_UI.alt and not keyboard.hotkey_modifiers_down.alt) then
|
||||
if not (cached_config.damage_meter_UI.ctrl and not this.hotkey_modifiers_down.ctrl)
|
||||
and not (cached_config.damage_meter_UI.shift and not this.hotkey_modifiers_down.shift)
|
||||
and not (cached_config.damage_meter_UI.alt and not this.hotkey_modifiers_down.alt) then
|
||||
if get_release_method:call(hard_keyboard, math.tointeger(cached_config.damage_meter_UI.key)) then
|
||||
config.current_config.damage_meter_UI.enabled = not config.current_config.damage_meter_UI.enabled;
|
||||
end
|
||||
end
|
||||
|
||||
if not (cached_config.endemic_life_UI.ctrl and not keyboard.hotkey_modifiers_down.ctrl)
|
||||
and not (cached_config.endemic_life_UI.shift and not keyboard.hotkey_modifiers_down.shift)
|
||||
and not (cached_config.endemic_life_UI.alt and not keyboard.hotkey_modifiers_down.alt) then
|
||||
if not (cached_config.endemic_life_UI.ctrl and not this.hotkey_modifiers_down.ctrl)
|
||||
and not (cached_config.endemic_life_UI.shift and not this.hotkey_modifiers_down.shift)
|
||||
and not (cached_config.endemic_life_UI.alt and not this.hotkey_modifiers_down.alt) then
|
||||
if get_release_method:call(hard_keyboard, math.tointeger(cached_config.endemic_life_UI.key)) then
|
||||
config.current_config.endemic_life_UI.enabled = not config.current_config.endemic_life_UI.enabled;
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function keyboard.get_hotkey_name(hotkey)
|
||||
function this.get_hotkey_name(hotkey)
|
||||
local hotkey_name = "";
|
||||
|
||||
if hotkey.ctrl then
|
||||
@@ -601,10 +601,10 @@ function keyboard.get_hotkey_name(hotkey)
|
||||
hotkey_name = hotkey_name .. "Alt + ";
|
||||
end
|
||||
|
||||
return hotkey_name .. tostring(keyboard.keys[hotkey.key]);
|
||||
return hotkey_name .. tostring(this.keys[hotkey.key]);
|
||||
end
|
||||
|
||||
function keyboard.init_module()
|
||||
function this.init_module()
|
||||
config = require "MHR_Overlay.Misc.config"
|
||||
singletons = require("MHR_Overlay.Game_Handler.singletons");
|
||||
customization_menu = require("MHR_Overlay.UI.customization_menu");
|
||||
@@ -615,4 +615,4 @@ function keyboard.init_module()
|
||||
time = require("MHR_Overlay.Game_Handler.time");
|
||||
end
|
||||
|
||||
return keyboard;
|
||||
return this;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
local quest_status = {};
|
||||
local this = {};
|
||||
|
||||
local singletons;
|
||||
local customization_menu;
|
||||
@@ -42,7 +42,7 @@ local os = os;
|
||||
local ValueType = ValueType;
|
||||
local package = package;
|
||||
|
||||
quest_status.flow_states = {
|
||||
this.flow_states = {
|
||||
NONE = 0,
|
||||
IN_LOBBY = 1,
|
||||
IN_TRAINING_AREA = 2,
|
||||
@@ -64,15 +64,15 @@ quest_status.flow_states = {
|
||||
SUMMARY_SCREEN = 32768,
|
||||
};
|
||||
|
||||
quest_status.previous_flow_state = quest_status.flow_states.NONE;
|
||||
quest_status.flow_state = quest_status.flow_states.NONE;
|
||||
this.previous_flow_state = this.flow_states.NONE;
|
||||
this.flow_state = this.flow_states.NONE;
|
||||
|
||||
quest_status.index = 0;
|
||||
quest_status.is_online = false;
|
||||
this.index = 0;
|
||||
this.is_online = false;
|
||||
--quest_status.is_quest_host = false;
|
||||
|
||||
quest_status.cart_count = 0;
|
||||
quest_status.max_cart_count = 3;
|
||||
this.cart_count = 0;
|
||||
this.max_cart_count = 3;
|
||||
|
||||
local quest_manager_type_def = sdk.find_type_definition("snow.QuestManager");
|
||||
local on_changed_game_status_method = quest_manager_type_def:get_method("onChangedGameStatus");
|
||||
@@ -116,8 +116,8 @@ local unique_event_manager_type_def = sdk.find_type_definition("snow.eventcut.Un
|
||||
local play_event_common_method = unique_event_manager_type_def:get_method("playEventCommon");
|
||||
local event_manager_dispose_method = unique_event_manager_type_def:get_method("dispose");
|
||||
|
||||
function quest_status.get_flow_state_name(flow_state, new_line)
|
||||
for key, value in pairs(quest_status.flow_states) do
|
||||
function this.get_flow_state_name(flow_state, new_line)
|
||||
for key, value in pairs(this.flow_states) do
|
||||
if value == flow_state then
|
||||
if new_line then
|
||||
return "\n" .. tostring(key);
|
||||
@@ -128,52 +128,52 @@ function quest_status.get_flow_state_name(flow_state, new_line)
|
||||
end
|
||||
end
|
||||
|
||||
function quest_status.set_flow_state(new_flow_state)
|
||||
quest_status.previous_flow_state = quest_status.flow_state;
|
||||
quest_status.flow_state = new_flow_state;
|
||||
function this.set_flow_state(new_flow_state)
|
||||
this.previous_flow_state = this.flow_state;
|
||||
this.flow_state = new_flow_state;
|
||||
|
||||
if quest_status.flow_state >= quest_status.flow_states.KILLCAM then
|
||||
if this.flow_state >= this.flow_states.KILLCAM then
|
||||
damage_meter_UI.freeze_displayed_players = true;
|
||||
else
|
||||
damage_meter_UI.freeze_displayed_players = false;
|
||||
end
|
||||
|
||||
if quest_status.flow_state == quest_status.flow_states.IN_LOBBY or quest_status.flow_state == quest_status.flow_states.IN_TRAINING_AREA then
|
||||
if this.flow_state == this.flow_states.IN_LOBBY or this.flow_state == this.flow_states.IN_TRAINING_AREA then
|
||||
players.init();
|
||||
non_players.init();
|
||||
small_monster.init_list();
|
||||
large_monster.init_list();
|
||||
env_creature.init_list();
|
||||
damage_meter_UI.last_displayed_players = {};
|
||||
elseif quest_status.flow_state >= quest_status.flow_states.LOADING_QUEST then
|
||||
quest_status.get_cart_count();
|
||||
quest_status.get_max_cart_count();
|
||||
elseif this.flow_state >= this.flow_states.LOADING_QUEST then
|
||||
this.get_cart_count();
|
||||
this.get_max_cart_count();
|
||||
end
|
||||
end
|
||||
|
||||
function quest_status.get_cart_count()
|
||||
function this.get_cart_count()
|
||||
local death_num = get_death_num_method:call(singletons.quest_manager);
|
||||
if death_num ~= nil then
|
||||
quest_status.cart_count = death_num;
|
||||
this.cart_count = death_num;
|
||||
end
|
||||
end
|
||||
|
||||
function quest_status.get_max_cart_count()
|
||||
function this.get_max_cart_count()
|
||||
local quest_life = get_quest_life_method:call(singletons.quest_manager);
|
||||
if quest_life ~= nil then
|
||||
quest_status.max_cart_count = quest_life;
|
||||
this.max_cart_count = quest_life;
|
||||
end
|
||||
end
|
||||
|
||||
--type 2 = quest start
|
||||
--type 3 = monster killcam
|
||||
--type 5 = end screen
|
||||
function quest_status.on_demo_request_activation(request_data_base)
|
||||
function this.on_demo_request_activation(request_data_base)
|
||||
if request_data_base == nil then
|
||||
return;
|
||||
end
|
||||
|
||||
if quest_status.index ~= 2 then
|
||||
if this.index ~= 2 then
|
||||
return;
|
||||
end
|
||||
|
||||
@@ -184,125 +184,125 @@ function quest_status.on_demo_request_activation(request_data_base)
|
||||
|
||||
-- QUEST_START_ANIMATION
|
||||
if request_data_type == 2 then
|
||||
quest_status.set_flow_state(quest_status.flow_states.QUEST_START_ANIMATION);
|
||||
this.set_flow_state(this.flow_states.QUEST_START_ANIMATION);
|
||||
|
||||
-- KILLCAM
|
||||
elseif request_data_type == 3 then
|
||||
quest_status.set_flow_state(quest_status.flow_states.KILLCAM);
|
||||
this.set_flow_state(this.flow_states.KILLCAM);
|
||||
|
||||
-- QUEST_END_ANIMATION
|
||||
elseif request_data_type == 5 or request_data_type == 6 or request_data_type == 7 then
|
||||
quest_status.set_flow_state(quest_status.flow_states.QUEST_END_ANIMATION);
|
||||
this.set_flow_state(this.flow_states.QUEST_END_ANIMATION);
|
||||
|
||||
-- PLAYER_DEATH_ANIMATION
|
||||
elseif request_data_type == 8 then
|
||||
quest_status.set_flow_state(quest_status.flow_states.PLAYER_DEATH_ANIMATION);
|
||||
this.set_flow_state(this.flow_states.PLAYER_DEATH_ANIMATION);
|
||||
|
||||
-- PLAYER_CART_ANIMATION
|
||||
elseif request_data_type == 9 then
|
||||
quest_status.set_flow_state(quest_status.flow_states.PLAYER_CART_ANIMATION);
|
||||
this.set_flow_state(this.flow_states.PLAYER_CART_ANIMATION);
|
||||
|
||||
-- FAST_TRAVEL_ANIMATION
|
||||
elseif request_data_type == 10 then
|
||||
quest_status.set_flow_state(quest_status.flow_states.FAST_TRAVEL_ANIMATION);
|
||||
this.set_flow_state(this.flow_states.FAST_TRAVEL_ANIMATION);
|
||||
|
||||
-- WYVERN_RIDING_START_ANIMATION
|
||||
elseif request_data_type == 11 then
|
||||
quest_status.set_flow_state(quest_status.flow_states.WYVERN_RIDING_START_ANIMATION);
|
||||
this.set_flow_state(this.flow_states.WYVERN_RIDING_START_ANIMATION);
|
||||
end
|
||||
end
|
||||
|
||||
function quest_status.on_demo_end()
|
||||
if quest_status.index == 2 then
|
||||
if quest_status.flow_state == quest_status.flow_states.PLAYER_DEATH_ANIMATION
|
||||
or quest_status.flow_state == quest_status.flow_states.PLAYER_CART_ANIMATION
|
||||
or quest_status.flow_state == quest_status.flow_states.FAST_TRAVEL_ANIMATION
|
||||
or quest_status.flow_state == quest_status.flow_states.WYVERN_RIDING_START_ANIMATION then
|
||||
function this.on_demo_end()
|
||||
if this.index == 2 then
|
||||
if this.flow_state == this.flow_states.PLAYER_DEATH_ANIMATION
|
||||
or this.flow_state == this.flow_states.PLAYER_CART_ANIMATION
|
||||
or this.flow_state == this.flow_states.FAST_TRAVEL_ANIMATION
|
||||
or this.flow_state == this.flow_states.WYVERN_RIDING_START_ANIMATION then
|
||||
|
||||
quest_status.set_flow_state(quest_status.previous_flow_state);
|
||||
this.set_flow_state(this.previous_flow_state);
|
||||
|
||||
elseif quest_status.flow_state == quest_status.flow_states.QUEST_START_ANIMATION then
|
||||
elseif this.flow_state == this.flow_states.QUEST_START_ANIMATION then
|
||||
|
||||
quest_status.set_flow_state(quest_status.flow_states.PLAYING_QUEST);
|
||||
this.set_flow_state(this.flow_states.PLAYING_QUEST);
|
||||
|
||||
elseif quest_status.flow_state == quest_status.flow_states.KILLCAM then
|
||||
elseif this.flow_state == this.flow_states.KILLCAM then
|
||||
|
||||
quest_status.set_flow_state(quest_status.flow_states.QUEST_END_TIMER);
|
||||
this.set_flow_state(this.flow_states.QUEST_END_TIMER);
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function quest_status.on_set_quest_clear()
|
||||
if quest_status.index == 2 and quest_status.flow_state ~= quest_status.flow_states.KILLCAM then
|
||||
quest_status.set_flow_state(quest_status.flow_states.QUEST_END_TIMER);
|
||||
function this.on_set_quest_clear()
|
||||
if this.index == 2 and this.flow_state ~= this.flow_states.KILLCAM then
|
||||
this.set_flow_state(this.flow_states.QUEST_END_TIMER);
|
||||
end
|
||||
end
|
||||
|
||||
function quest_status.on_quest_end_set_state()
|
||||
if quest_status.index == 2 then
|
||||
quest_status.set_flow_state(quest_status.flow_states.QUEST_END_SCREEN);
|
||||
function this.on_quest_end_set_state()
|
||||
if this.index == 2 then
|
||||
this.set_flow_state(this.flow_states.QUEST_END_SCREEN);
|
||||
end
|
||||
end
|
||||
|
||||
function quest_status.on_gui_result_reward_do_open()
|
||||
if quest_status.index == 3 then
|
||||
quest_status.set_flow_state(quest_status.flow_states.REWARD_SCREEN);
|
||||
function this.on_gui_result_reward_do_open()
|
||||
if this.index == 3 then
|
||||
this.set_flow_state(this.flow_states.REWARD_SCREEN);
|
||||
end
|
||||
end
|
||||
|
||||
function quest_status.on_gui_result_pay_off_do_open()
|
||||
if quest_status.index == 3 then
|
||||
quest_status.set_flow_state(quest_status.flow_states.SUMMARY_SCREEN);
|
||||
function this.on_gui_result_pay_off_do_open()
|
||||
if this.index == 3 then
|
||||
this.set_flow_state(this.flow_states.SUMMARY_SCREEN);
|
||||
end
|
||||
end
|
||||
|
||||
function quest_status.on_play_event_common()
|
||||
quest_status.set_flow_state(quest_status.flow_states.CUTSCENE);
|
||||
function this.on_play_event_common()
|
||||
this.set_flow_state(this.flow_states.CUTSCENE);
|
||||
end
|
||||
|
||||
function quest_status.on_event_manager_dispose()
|
||||
if quest_status.flow_state == quest_status.flow_states.CUTSCENE then
|
||||
quest_status.set_flow_state(quest_status.previous_flow_state);
|
||||
function this.on_event_manager_dispose()
|
||||
if this.flow_state == this.flow_states.CUTSCENE then
|
||||
this.set_flow_state(this.previous_flow_state);
|
||||
end
|
||||
end
|
||||
|
||||
function quest_status.on_set_quest_fail()
|
||||
if quest_status.flow_state == quest_status.flow_states.PLAYER_DEATH_ANIMATION or
|
||||
quest_status.flow_state == quest_status.flow_states.PLAYER_CART_ANIMATION or
|
||||
quest_status.flow_state == quest_status.flow_states.FAST_TRAVEL_ANIMATION or
|
||||
quest_status.flow_state == quest_status.flow_states.WYVERN_RIDING_START_ANIMATION then
|
||||
function this.on_set_quest_fail()
|
||||
if this.flow_state == this.flow_states.PLAYER_DEATH_ANIMATION or
|
||||
this.flow_state == this.flow_states.PLAYER_CART_ANIMATION or
|
||||
this.flow_state == this.flow_states.FAST_TRAVEL_ANIMATION or
|
||||
this.flow_state == this.flow_states.WYVERN_RIDING_START_ANIMATION then
|
||||
|
||||
quest_status.set_flow_state(quest_status.flow_states.QUEST_END_ANIMATION);
|
||||
this.set_flow_state(this.flow_states.QUEST_END_ANIMATION);
|
||||
end
|
||||
end
|
||||
|
||||
function quest_status.on_village_fast_travel(area)
|
||||
function this.on_village_fast_travel(area)
|
||||
if area == nil then
|
||||
return;
|
||||
end
|
||||
|
||||
if area == 7 then
|
||||
quest_status.set_flow_state(quest_status.flow_states.IN_TRAINING_AREA);
|
||||
this.set_flow_state(this.flow_states.IN_TRAINING_AREA);
|
||||
else
|
||||
quest_status.set_flow_state(quest_status.flow_states.IN_LOBBY);
|
||||
this.set_flow_state(this.flow_states.IN_LOBBY);
|
||||
end
|
||||
end
|
||||
|
||||
function quest_status.on_changed_game_status(new_quest_status)
|
||||
quest_status.index = new_quest_status;
|
||||
function this.on_changed_game_status(new_quest_status)
|
||||
this.index = new_quest_status;
|
||||
|
||||
if quest_status.index == 0 then
|
||||
quest_status.set_flow_state(quest_status.flow_states.NONE);
|
||||
elseif quest_status.index == 1 then
|
||||
quest_status.set_flow_state(quest_status.flow_states.IN_LOBBY);
|
||||
elseif quest_status.index == 2 then
|
||||
quest_status.set_flow_state(quest_status.flow_states.LOADING_QUEST);
|
||||
elseif quest_status.index == 3 then
|
||||
quest_status.set_flow_state(quest_status.flow_states.SUMMARY_SCREEN);
|
||||
if this.index == 0 then
|
||||
this.set_flow_state(this.flow_states.NONE);
|
||||
elseif this.index == 1 then
|
||||
this.set_flow_state(this.flow_states.IN_LOBBY);
|
||||
elseif this.index == 2 then
|
||||
this.set_flow_state(this.flow_states.LOADING_QUEST);
|
||||
elseif this.index == 3 then
|
||||
this.set_flow_state(this.flow_states.SUMMARY_SCREEN);
|
||||
end
|
||||
end
|
||||
|
||||
function quest_status.init()
|
||||
function this.init()
|
||||
if singletons.quest_manager == nil then
|
||||
return;
|
||||
end
|
||||
@@ -313,22 +313,22 @@ function quest_status.init()
|
||||
return;
|
||||
end
|
||||
|
||||
quest_status.index = new_quest_status;
|
||||
this.index = new_quest_status;
|
||||
|
||||
if quest_status.index == 0 then
|
||||
quest_status.set_flow_state(quest_status.flow_states.NONE);
|
||||
elseif quest_status.index == 1 then
|
||||
quest_status.set_flow_state(quest_status.flow_states.IN_LOBBY);
|
||||
elseif quest_status.index == 2 then
|
||||
quest_status.set_flow_state(quest_status.flow_states.PLAYING_QUEST);
|
||||
elseif quest_status.index == 3 then
|
||||
quest_status.set_flow_state(quest_status.flow_states.SUMMARY_SCREEN);
|
||||
if this.index == 0 then
|
||||
this.set_flow_state(this.flow_states.NONE);
|
||||
elseif this.index == 1 then
|
||||
this.set_flow_state(this.flow_states.IN_LOBBY);
|
||||
elseif this.index == 2 then
|
||||
this.set_flow_state(this.flow_states.PLAYING_QUEST);
|
||||
elseif this.index == 3 then
|
||||
this.set_flow_state(this.flow_states.SUMMARY_SCREEN);
|
||||
end
|
||||
|
||||
quest_status.update_is_training_area();
|
||||
this.update_is_training_area();
|
||||
end
|
||||
|
||||
function quest_status.update_is_online()
|
||||
function this.update_is_online()
|
||||
if singletons.lobby_manager == nil then
|
||||
return;
|
||||
end
|
||||
@@ -338,7 +338,7 @@ function quest_status.update_is_online()
|
||||
return;
|
||||
end
|
||||
|
||||
quest_status.is_online = is_quest_online;
|
||||
this.is_online = is_quest_online;
|
||||
end
|
||||
|
||||
--[[function quest_status.update_is_quest_host()
|
||||
@@ -354,7 +354,7 @@ end
|
||||
quest_status.is_quest_host = is_quest_host;
|
||||
end--]]
|
||||
|
||||
function quest_status.update_is_training_area()
|
||||
function this.update_is_training_area()
|
||||
if singletons.village_area_manager == nil then
|
||||
customization_menu.status = "No village area manager";
|
||||
return;
|
||||
@@ -366,11 +366,11 @@ function quest_status.update_is_training_area()
|
||||
end
|
||||
|
||||
if _is_training_area then
|
||||
quest_status.set_flow_state(quest_status.flow_states.IN_TRAINING_AREA);
|
||||
this.set_flow_state(this.flow_states.IN_TRAINING_AREA);
|
||||
end
|
||||
end
|
||||
|
||||
function quest_status.init_module()
|
||||
function this.init_module()
|
||||
singletons = require("MHR_Overlay.Game_Handler.singletons");
|
||||
customization_menu = require("MHR_Overlay.UI.customization_menu");
|
||||
players = require("MHR_Overlay.Damage_Meter.players");
|
||||
@@ -381,63 +381,63 @@ function quest_status.init_module()
|
||||
env_creature = require("MHR_Overlay.Endemic_Life.env_creature");
|
||||
non_players = require("MHR_Overlay.Damage_Meter.non_players");
|
||||
|
||||
quest_status.init();
|
||||
this.init();
|
||||
|
||||
sdk.hook(on_changed_game_status_method, function(args)
|
||||
quest_status.on_changed_game_status(sdk.to_int64(args[3]));
|
||||
this.on_changed_game_status(sdk.to_int64(args[3]));
|
||||
end, function(retval) return retval; end);
|
||||
|
||||
sdk.hook(set_quest_clear_method, function(args)
|
||||
quest_status.on_set_quest_clear();
|
||||
this.on_set_quest_clear();
|
||||
end, function(retval) return retval; end);
|
||||
|
||||
sdk.hook(set_quest_clear_sub_method, function(args)
|
||||
quest_status.on_set_quest_clear();
|
||||
this.on_set_quest_clear();
|
||||
end, function(retval) return retval; end);
|
||||
|
||||
sdk.hook(set_quest_clear_sub_hyakurui_method, function(args)
|
||||
quest_status.on_set_quest_clear();
|
||||
this.on_set_quest_clear();
|
||||
end, function(retval) return retval; end);
|
||||
|
||||
sdk.hook(demo_request_activation_method, function(args)
|
||||
quest_status.on_demo_request_activation(sdk.to_managed_object(args[3]));
|
||||
this.on_demo_request_activation(sdk.to_managed_object(args[3]));
|
||||
end, function(retval) return retval; end);
|
||||
|
||||
sdk.hook(demo_end_method, function(args)
|
||||
quest_status.on_demo_end();
|
||||
this.on_demo_end();
|
||||
end, function(retval) return retval; end);
|
||||
|
||||
sdk.hook(set_quest_clear_method, function(args)
|
||||
quest_status.on_set_quest_clear();
|
||||
this.on_set_quest_clear();
|
||||
end, function(retval) return retval; end);
|
||||
|
||||
sdk.hook(quest_end_set_state_method, function(args)
|
||||
quest_status.on_quest_end_set_state();
|
||||
this.on_quest_end_set_state();
|
||||
end, function(retval) return retval; end);
|
||||
|
||||
sdk.hook(gui_result_reward_do_open_method, function(args)
|
||||
quest_status.on_gui_result_reward_do_open();
|
||||
this.on_gui_result_reward_do_open();
|
||||
end, function(retval) return retval; end);
|
||||
|
||||
sdk.hook(gui_result_pay_off_do_open_method, function(args)
|
||||
quest_status.on_gui_result_pay_off_do_open();
|
||||
this.on_gui_result_pay_off_do_open();
|
||||
end, function(retval) return retval; end);
|
||||
|
||||
sdk.hook(play_event_common_method, function(args)
|
||||
quest_status.on_play_event_common();
|
||||
this.on_play_event_common();
|
||||
end, function(retval) return retval; end);
|
||||
|
||||
sdk.hook(event_manager_dispose_method, function(args)
|
||||
quest_status.on_event_manager_dispose();
|
||||
this.on_event_manager_dispose();
|
||||
end, function(retval) return retval; end);
|
||||
|
||||
sdk.hook(set_quest_fail_method, function(args)
|
||||
quest_status.on_set_quest_fail();
|
||||
this.on_set_quest_fail();
|
||||
end, function(retval) return retval; end);
|
||||
|
||||
sdk.hook(fast_travel_method, function(args)
|
||||
quest_status.on_village_fast_travel(sdk.to_int64(args[3]));
|
||||
this.on_village_fast_travel(sdk.to_int64(args[3]));
|
||||
end, function(retval) return retval; end);
|
||||
end
|
||||
|
||||
return quest_status;
|
||||
return this;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
local screen = {};
|
||||
local this = {};
|
||||
|
||||
local config;
|
||||
local singletons;
|
||||
@@ -35,25 +35,25 @@ local os = os;
|
||||
local ValueType = ValueType;
|
||||
local package = package;
|
||||
|
||||
screen.width = 1920;
|
||||
screen.height = 1080;
|
||||
this.width = 1920;
|
||||
this.height = 1080;
|
||||
|
||||
function screen.update_window_size()
|
||||
function this.update_window_size()
|
||||
local width;
|
||||
local height;
|
||||
|
||||
if d2d ~= nil and config.current_config.global_settings.renderer.use_d2d_if_available then
|
||||
width, height = d2d.surface_size();
|
||||
else
|
||||
width, height = screen.get_game_window_size();
|
||||
width, height = this.get_game_window_size();
|
||||
end
|
||||
|
||||
if width ~= nil then
|
||||
screen.width = width;
|
||||
this.width = width;
|
||||
end
|
||||
|
||||
if height ~= nil then
|
||||
screen.height = height;
|
||||
this.height = height;
|
||||
end
|
||||
end
|
||||
|
||||
@@ -65,7 +65,7 @@ local size_type = get_size_method:get_return_type();
|
||||
local width_field = size_type:get_field("w");
|
||||
local height_field = size_type:get_field("h");
|
||||
|
||||
function screen.get_game_window_size()
|
||||
function this.get_game_window_size()
|
||||
if scene_view == nil then
|
||||
scene_view = sdk.call_native_func(singletons.scene_manager, sdk.find_type_definition("via.SceneManager") , "get_MainView");
|
||||
|
||||
@@ -96,7 +96,7 @@ function screen.get_game_window_size()
|
||||
return screen_width, screen_height;
|
||||
end
|
||||
|
||||
function screen.calculate_absolute_coordinates(position)
|
||||
function this.calculate_absolute_coordinates(position)
|
||||
local global_position_modifier = config.current_config.global_settings.modifiers.global_position_modifier;
|
||||
|
||||
local _position = {
|
||||
@@ -111,29 +111,29 @@ function screen.calculate_absolute_coordinates(position)
|
||||
|
||||
-- top right
|
||||
if position.anchor == "Top-Right" then
|
||||
local screen_x = screen.width - _position.x;
|
||||
local screen_x = this.width - _position.x;
|
||||
return { x = screen_x, y = _position.y };
|
||||
end
|
||||
|
||||
-- bottom left
|
||||
if position.anchor == "Bottom-Left" then
|
||||
local screen_y = screen.height - _position.y;
|
||||
local screen_y = this.height - _position.y;
|
||||
return { x = _position.x, y = screen_y };
|
||||
end
|
||||
|
||||
-- bottom right
|
||||
if position.anchor == "Bottom-Right" then
|
||||
local screen_x = screen.width - _position.x;
|
||||
local screen_y = screen.height - _position.y;
|
||||
local screen_x = this.width - _position.x;
|
||||
local screen_y = this.height - _position.y;
|
||||
return { x = screen_x, y = screen_y };
|
||||
end
|
||||
|
||||
return { x = _position.x, y = _position.y };
|
||||
end
|
||||
|
||||
function screen.init_module()
|
||||
function this.init_module()
|
||||
config = require("MHR_Overlay.Misc.config");
|
||||
singletons = require("MHR_Overlay.Game_Handler.singletons");
|
||||
end
|
||||
|
||||
return screen;
|
||||
return this;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
local singletons = {};
|
||||
local this = {};
|
||||
|
||||
local sdk = sdk;
|
||||
local tostring = tostring;
|
||||
@@ -32,207 +32,207 @@ local os = os;
|
||||
local ValueType = ValueType;
|
||||
local package = package;
|
||||
|
||||
singletons.message_manager = nil;
|
||||
singletons.enemy_manager = nil;
|
||||
singletons.lobby_manager = nil;
|
||||
singletons.progress_manager = nil;
|
||||
singletons.quest_manager = nil;
|
||||
singletons.player_manager = nil;
|
||||
singletons.village_area_manager = nil;
|
||||
singletons.gui_manager = nil;
|
||||
singletons.game_keyboard = nil;
|
||||
singletons.scene_manager = nil;
|
||||
singletons.game_manager = nil;
|
||||
this.message_manager = nil;
|
||||
this.enemy_manager = nil;
|
||||
this.lobby_manager = nil;
|
||||
this.progress_manager = nil;
|
||||
this.quest_manager = nil;
|
||||
this.player_manager = nil;
|
||||
this.village_area_manager = nil;
|
||||
this.gui_manager = nil;
|
||||
this.game_keyboard = nil;
|
||||
this.scene_manager = nil;
|
||||
this.game_manager = nil;
|
||||
|
||||
function singletons.init()
|
||||
singletons.init_message_manager();
|
||||
singletons.init_enemy_manager();
|
||||
singletons.init_lobby_manager()
|
||||
singletons.init_progress_manager();
|
||||
singletons.init_quest_manager();
|
||||
singletons.init_player_manager();
|
||||
singletons.init_village_area_manager();
|
||||
singletons.init_gui_manager();
|
||||
singletons.init_game_keyboard();
|
||||
singletons.init_scene_manager();
|
||||
singletons.init_game_manager();
|
||||
singletons.init_servant_manager();
|
||||
singletons.init_otomo_manager();
|
||||
function this.init()
|
||||
this.init_message_manager();
|
||||
this.init_enemy_manager();
|
||||
this.init_lobby_manager()
|
||||
this.init_progress_manager();
|
||||
this.init_quest_manager();
|
||||
this.init_player_manager();
|
||||
this.init_village_area_manager();
|
||||
this.init_gui_manager();
|
||||
this.init_game_keyboard();
|
||||
this.init_scene_manager();
|
||||
this.init_game_manager();
|
||||
this.init_servant_manager();
|
||||
this.init_otomo_manager();
|
||||
end
|
||||
|
||||
function singletons.init_message_manager()
|
||||
if singletons.message_manager ~= nil then
|
||||
function this.init_message_manager()
|
||||
if this.message_manager ~= nil then
|
||||
return;
|
||||
end
|
||||
|
||||
singletons.message_manager = sdk.get_managed_singleton("snow.gui.MessageManager");
|
||||
if singletons.message_manager == nil then
|
||||
this.message_manager = sdk.get_managed_singleton("snow.gui.MessageManager");
|
||||
if this.message_manager == nil then
|
||||
--log.error("[MHR Overlay] No message manager");
|
||||
end
|
||||
|
||||
return singletons.message_manager;
|
||||
return this.message_manager;
|
||||
end
|
||||
|
||||
function singletons.init_enemy_manager()
|
||||
if singletons.enemy_manager ~= nil then
|
||||
function this.init_enemy_manager()
|
||||
if this.enemy_manager ~= nil then
|
||||
return;
|
||||
end
|
||||
|
||||
singletons.enemy_manager = sdk.get_managed_singleton("snow.enemy.EnemyManager");
|
||||
if singletons.enemy_manager == nil then
|
||||
this.enemy_manager = sdk.get_managed_singleton("snow.enemy.EnemyManager");
|
||||
if this.enemy_manager == nil then
|
||||
--log.error("[MHR Overlay] No enemy manager");
|
||||
end
|
||||
|
||||
return singletons.enemy_manager;
|
||||
return this.enemy_manager;
|
||||
end
|
||||
|
||||
function singletons.init_lobby_manager()
|
||||
if singletons.lobby_manager ~= nil then
|
||||
function this.init_lobby_manager()
|
||||
if this.lobby_manager ~= nil then
|
||||
return;
|
||||
end
|
||||
|
||||
singletons.lobby_manager = sdk.get_managed_singleton("snow.LobbyManager");
|
||||
if singletons.lobby_manager == nil then
|
||||
this.lobby_manager = sdk.get_managed_singleton("snow.LobbyManager");
|
||||
if this.lobby_manager == nil then
|
||||
--log.error("[MHR Overlay] No lobby manager");
|
||||
return false;
|
||||
end
|
||||
|
||||
return singletons.lobby_manager;
|
||||
return this.lobby_manager;
|
||||
end
|
||||
|
||||
function singletons.init_progress_manager()
|
||||
if singletons.progress_manager ~= nil then
|
||||
function this.init_progress_manager()
|
||||
if this.progress_manager ~= nil then
|
||||
return;
|
||||
end
|
||||
|
||||
singletons.progress_manager = sdk.get_managed_singleton("snow.progress.ProgressManager");
|
||||
if singletons.progress_manager == nil then
|
||||
this.progress_manager = sdk.get_managed_singleton("snow.progress.ProgressManager");
|
||||
if this.progress_manager == nil then
|
||||
--log.error("[MHR Overlay] No progress manager");
|
||||
return false;
|
||||
end
|
||||
|
||||
return singletons.progress_manager;
|
||||
return this.progress_manager;
|
||||
end
|
||||
|
||||
function singletons.init_quest_manager()
|
||||
if singletons.quest_manager ~= nil then
|
||||
function this.init_quest_manager()
|
||||
if this.quest_manager ~= nil then
|
||||
return;
|
||||
end
|
||||
|
||||
singletons.quest_manager = sdk.get_managed_singleton("snow.QuestManager");
|
||||
if singletons.quest_manager == nil then
|
||||
this.quest_manager = sdk.get_managed_singleton("snow.QuestManager");
|
||||
if this.quest_manager == nil then
|
||||
--log.error("[MHR Overlay] No quest manager");
|
||||
end
|
||||
|
||||
return singletons.quest_manager;
|
||||
return this.quest_manager;
|
||||
end
|
||||
|
||||
function singletons.init_player_manager()
|
||||
if singletons.player_manager ~= nil then
|
||||
function this.init_player_manager()
|
||||
if this.player_manager ~= nil then
|
||||
return;
|
||||
end
|
||||
|
||||
singletons.player_manager = sdk.get_managed_singleton("snow.player.PlayerManager");
|
||||
if singletons.player_manager == nil then
|
||||
this.player_manager = sdk.get_managed_singleton("snow.player.PlayerManager");
|
||||
if this.player_manager == nil then
|
||||
--log.error("[MHR Overlay] No player manager");
|
||||
end
|
||||
|
||||
return singletons.player_manager;
|
||||
return this.player_manager;
|
||||
end
|
||||
|
||||
function singletons.init_village_area_manager()
|
||||
if singletons.village_area_manager ~= nil then
|
||||
function this.init_village_area_manager()
|
||||
if this.village_area_manager ~= nil then
|
||||
return;
|
||||
end
|
||||
|
||||
singletons.village_area_manager = sdk.get_managed_singleton("snow.VillageAreaManager");
|
||||
if singletons.village_area_manager == nil then
|
||||
this.village_area_manager = sdk.get_managed_singleton("snow.VillageAreaManager");
|
||||
if this.village_area_manager == nil then
|
||||
--log.error("[MHR Overlay] No village area manager");
|
||||
end
|
||||
|
||||
return singletons.village_area_manager;
|
||||
return this.village_area_manager;
|
||||
end
|
||||
|
||||
function singletons.init_gui_manager()
|
||||
if singletons.gui_manager ~= nil then
|
||||
function this.init_gui_manager()
|
||||
if this.gui_manager ~= nil then
|
||||
return;
|
||||
end
|
||||
|
||||
singletons.gui_manager = sdk.get_managed_singleton("snow.gui.GuiManager");
|
||||
if singletons.gui_manager == nil then
|
||||
this.gui_manager = sdk.get_managed_singleton("snow.gui.GuiManager");
|
||||
if this.gui_manager == nil then
|
||||
--log.error("[MHR Overlay] No gui manager");
|
||||
end
|
||||
|
||||
return singletons.gui_manager;
|
||||
return this.gui_manager;
|
||||
end
|
||||
|
||||
function singletons.init_game_keyboard()
|
||||
if singletons.game_keyboard ~= nil then
|
||||
function this.init_game_keyboard()
|
||||
if this.game_keyboard ~= nil then
|
||||
return;
|
||||
end
|
||||
|
||||
singletons.game_keyboard = sdk.get_managed_singleton("snow.GameKeyboard");
|
||||
if singletons.game_keyboard == nil then
|
||||
this.game_keyboard = sdk.get_managed_singleton("snow.GameKeyboard");
|
||||
if this.game_keyboard == nil then
|
||||
--log.error("[MHR Overlay] No game keyboard");
|
||||
end
|
||||
|
||||
return singletons.game_keyboard;
|
||||
return this.game_keyboard;
|
||||
end
|
||||
|
||||
function singletons.init_scene_manager()
|
||||
if singletons.scene_manager ~= nil then
|
||||
function this.init_scene_manager()
|
||||
if this.scene_manager ~= nil then
|
||||
return;
|
||||
end
|
||||
|
||||
singletons.scene_manager = sdk.get_native_singleton("via.SceneManager");
|
||||
if singletons.scene_manager == nil then
|
||||
this.scene_manager = sdk.get_native_singleton("via.SceneManager");
|
||||
if this.scene_manager == nil then
|
||||
--log.error("[MHR Overlay] No enemy manager");
|
||||
end
|
||||
|
||||
return singletons.scene_manager;
|
||||
return this.scene_manager;
|
||||
end
|
||||
|
||||
function singletons.init_game_manager()
|
||||
if singletons.game_manager ~= nil then
|
||||
function this.init_game_manager()
|
||||
if this.game_manager ~= nil then
|
||||
return;
|
||||
end
|
||||
|
||||
singletons.game_manager = sdk.get_managed_singleton("snow.SnowGameManager");
|
||||
if singletons.game_manager == nil then
|
||||
this.game_manager = sdk.get_managed_singleton("snow.SnowGameManager");
|
||||
if this.game_manager == nil then
|
||||
--log.error("[MHR Overlay] No enemy manager");
|
||||
end
|
||||
|
||||
return singletons.game_manager;
|
||||
return this.game_manager;
|
||||
end
|
||||
|
||||
function singletons.init_servant_manager()
|
||||
if singletons.servant_manager ~= nil then
|
||||
function this.init_servant_manager()
|
||||
if this.servant_manager ~= nil then
|
||||
return;
|
||||
end
|
||||
|
||||
singletons.servant_manager = sdk.get_managed_singleton("snow.ai.ServantManager");
|
||||
if singletons.servant_manager == nil then
|
||||
this.servant_manager = sdk.get_managed_singleton("snow.ai.ServantManager");
|
||||
if this.servant_manager == nil then
|
||||
--log.error("[MHR Overlay] No enemy manager");
|
||||
end
|
||||
|
||||
return singletons.servant_manager;
|
||||
return this.servant_manager;
|
||||
end
|
||||
|
||||
function singletons.init_otomo_manager()
|
||||
if singletons.otomo_manager ~= nil then
|
||||
function this.init_otomo_manager()
|
||||
if this.otomo_manager ~= nil then
|
||||
return;
|
||||
end
|
||||
|
||||
singletons.otomo_manager = sdk.get_managed_singleton("snow.otomo.OtomoManager");
|
||||
if singletons.otomo_manager == nil then
|
||||
this.otomo_manager = sdk.get_managed_singleton("snow.otomo.OtomoManager");
|
||||
if this.otomo_manager == nil then
|
||||
--log.error("[MHR Overlay] No enemy manager");
|
||||
end
|
||||
|
||||
return singletons.otomo_manager;
|
||||
return this.otomo_manager;
|
||||
end
|
||||
|
||||
function singletons.init_module()
|
||||
singletons.init();
|
||||
function this.init_module()
|
||||
this.init();
|
||||
end
|
||||
|
||||
return singletons;
|
||||
return this;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
local time = {};
|
||||
local this = {};
|
||||
|
||||
local singletons;
|
||||
local customization_menu;
|
||||
@@ -44,19 +44,19 @@ local quest_manager_type_def = sdk.find_type_definition("snow.QuestManager");
|
||||
local get_quest_elapsed_time_min_method = quest_manager_type_def:get_method("getQuestElapsedTimeMin");
|
||||
local get_quest_elapsed_time_sec_method = quest_manager_type_def:get_method("getQuestElapsedTimeSec");
|
||||
|
||||
time.total_elapsed_seconds = 0;
|
||||
time.elapsed_minutes = 0;
|
||||
time.elapsed_seconds = 0;
|
||||
this.total_elapsed_seconds = 0;
|
||||
this.elapsed_minutes = 0;
|
||||
this.elapsed_seconds = 0;
|
||||
|
||||
time.total_elapsed_script_seconds = 0;
|
||||
time.last_elapsed_script_seconds = 0;
|
||||
this.total_elapsed_script_seconds = 0;
|
||||
this.last_elapsed_script_seconds = 0;
|
||||
|
||||
function time.update_script_time()
|
||||
time.total_elapsed_script_seconds = os.clock();
|
||||
function this.update_script_time()
|
||||
this.total_elapsed_script_seconds = os.clock();
|
||||
end
|
||||
|
||||
function time.tick()
|
||||
time.update_script_time();
|
||||
function this.tick()
|
||||
this.update_script_time();
|
||||
|
||||
if singletons.quest_manager == nil then
|
||||
return;
|
||||
@@ -66,20 +66,20 @@ function time.tick()
|
||||
if quest_time_elapsed_minutes == nil then
|
||||
customization_menu.status = "No quest time elapsed minutes";
|
||||
else
|
||||
time.elapsed_minutes = quest_time_elapsed_minutes;
|
||||
this.elapsed_minutes = quest_time_elapsed_minutes;
|
||||
end
|
||||
|
||||
local quest_time_total_elapsed_seconds = get_quest_elapsed_time_sec_method:call(singletons.quest_manager);
|
||||
if quest_time_total_elapsed_seconds == nil then
|
||||
customization_menu.status = "No quest time total elapsed seconds";
|
||||
else
|
||||
time.total_elapsed_seconds = quest_time_total_elapsed_seconds;
|
||||
this.total_elapsed_seconds = quest_time_total_elapsed_seconds;
|
||||
end
|
||||
|
||||
time.elapsed_seconds = quest_time_total_elapsed_seconds - quest_time_elapsed_minutes * 60;
|
||||
this.elapsed_seconds = quest_time_total_elapsed_seconds - quest_time_elapsed_minutes * 60;
|
||||
|
||||
if time.total_elapsed_script_seconds - time.last_elapsed_script_seconds > 0.5 then
|
||||
time.last_elapsed_script_seconds = time.total_elapsed_script_seconds;
|
||||
if this.total_elapsed_script_seconds - this.last_elapsed_script_seconds > 0.5 then
|
||||
this.last_elapsed_script_seconds = this.total_elapsed_script_seconds;
|
||||
|
||||
local is_on_quest = quest_status.flow_state ~= quest_status.flow_states.IN_LOBBY and quest_status.flow_state ~= quest_status.flow_states.IN_TRAINING_AREA;
|
||||
|
||||
@@ -93,7 +93,7 @@ function time.tick()
|
||||
end
|
||||
end
|
||||
|
||||
function time.init_module()
|
||||
function this.init_module()
|
||||
players = require("MHR_Overlay.Damage_Meter.players");
|
||||
singletons = require("MHR_Overlay.Game_Handler.singletons");
|
||||
customization_menu = require("MHR_Overlay.UI.customization_menu");
|
||||
@@ -103,4 +103,4 @@ function time.init_module()
|
||||
non_players = require("MHR_Overlay.Damage_Meter.non_players");
|
||||
end
|
||||
|
||||
return time;
|
||||
return this;
|
||||
|
||||
Reference in New Issue
Block a user