mirror of
https://github.com/GreenComfyTea/MHR-Overlay.git
synced 2026-01-24 04:18:11 -08:00
Part Break/Sever implemented. Fallback to default renderer if d2d is not available.
This commit is contained in:
@@ -23,12 +23,6 @@ local check_current_area_training_area_method = village_area_manager_type_def:ge
|
||||
local lobby_manager_type_definition = sdk.find_type_definition("snow.LobbyManager");
|
||||
local is_quest_online_method = lobby_manager_type_definition:get_method("IsQuestOnline");
|
||||
|
||||
sdk.hook(on_changed_game_status, function(args)
|
||||
pcall(quest_status.update(args));
|
||||
end, function(retval)
|
||||
return retval;
|
||||
end);
|
||||
|
||||
function quest_status.update(args)
|
||||
local new_quest_status = sdk.to_int64(args[3]);
|
||||
if new_quest_status ~= nil then
|
||||
@@ -47,6 +41,10 @@ function quest_status.update(args)
|
||||
end
|
||||
end
|
||||
|
||||
sdk.hook(on_changed_game_status, function(args)
|
||||
pcall(quest_status.update, args);
|
||||
end, function(retval) return retval; end);
|
||||
|
||||
function quest_status.init()
|
||||
if singletons.quest_manager == nil then
|
||||
return;
|
||||
|
||||
@@ -1,12 +1,20 @@
|
||||
local config = require "MHR_Overlay.Misc.config"
|
||||
local screen = {};
|
||||
|
||||
local config;
|
||||
local singletons;
|
||||
|
||||
screen.width = 1920;
|
||||
screen.height = 1080;
|
||||
|
||||
function screen.update_window_size()
|
||||
local width, height = d2d.surface_size();
|
||||
local width;
|
||||
local height;
|
||||
|
||||
if d2d ~= nil then
|
||||
width, height = d2d.surface_size();
|
||||
else
|
||||
width, height = screen.get_game_window_size();
|
||||
end
|
||||
|
||||
if width ~= nil then
|
||||
screen.width = width;
|
||||
@@ -17,6 +25,45 @@ function screen.update_window_size()
|
||||
end
|
||||
end
|
||||
|
||||
local scene_view;
|
||||
local scene_view_type = sdk.find_type_definition("via.SceneView");
|
||||
local get_size_method = scene_view_type:get_method("get_Size");
|
||||
|
||||
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()
|
||||
if scene_view == nil then
|
||||
scene_view = sdk.call_native_func(singletons.scene_manager, sdk.find_type_definition("via.SceneManager"), "get_MainView");
|
||||
|
||||
if scene_view == nil then
|
||||
--log.error("[MHR_Overlay.lua] No scene view");
|
||||
return;
|
||||
end
|
||||
end
|
||||
|
||||
local size = get_size_method:call(scene_view);
|
||||
if size == nil then
|
||||
--log.error("[MHR_Overlay.lua] No scene view size");
|
||||
return;
|
||||
end
|
||||
|
||||
local screen_width = width_field:get_data(size);
|
||||
if screen_width == nil then
|
||||
--log.error("[MHR_Overlay.lua] No screen width");
|
||||
return;
|
||||
end
|
||||
|
||||
local screen_height = height_field:get_data(size);
|
||||
if screen_height == nil then
|
||||
--log.error("[MHR_Overlay.lua] No screen height");
|
||||
return;
|
||||
end
|
||||
|
||||
return screen_width, screen_height;
|
||||
end
|
||||
|
||||
function screen.calculate_absolute_coordinates(position)
|
||||
local _position = {
|
||||
x = position.x * config.current_config.global_settings.modifiers.global_position_modifier;
|
||||
@@ -52,6 +99,7 @@ end
|
||||
|
||||
function screen.init_module()
|
||||
config = require("MHR_Overlay.Misc.config");
|
||||
singletons = require("MHR_Overlay.Game_Handler.singletons");
|
||||
end
|
||||
|
||||
return screen;
|
||||
|
||||
@@ -9,6 +9,7 @@ singletons.player_manager = nil;
|
||||
singletons.village_area_manager = nil;
|
||||
singletons.gui_manager = nil;
|
||||
singletons.game_keyboard = nil;
|
||||
singletons.scene_manager = nil;
|
||||
|
||||
function singletons.init()
|
||||
singletons.init_message_manager();
|
||||
@@ -19,7 +20,8 @@ function singletons.init()
|
||||
singletons.init_player_manager();
|
||||
singletons.init_village_area_manager();
|
||||
singletons.init_gui_manager();
|
||||
singletons.init_game_keyboard()
|
||||
singletons.init_game_keyboard();
|
||||
singletons.init_scene_manager();
|
||||
end
|
||||
|
||||
function singletons.init_message_manager()
|
||||
@@ -141,6 +143,19 @@ function singletons.init_game_keyboard()
|
||||
return singletons.ggame_keyboard;
|
||||
end
|
||||
|
||||
function singletons.init_scene_manager()
|
||||
if singletons.scene_manager ~= nil then
|
||||
return;
|
||||
end
|
||||
|
||||
singletons.scene_manager = sdk.get_native_singleton("via.SceneManager");
|
||||
if singletons.scene_manager == nil then
|
||||
--log.error("[MHR Overlay] No enemy manager");
|
||||
end
|
||||
|
||||
return singletons.scene_manager;
|
||||
end
|
||||
|
||||
function singletons.init_module()
|
||||
singletons.init();
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user