h2-mod/src/client/component/lui.cpp

50 lines
923 B
C++
Raw Normal View History

2021-09-06 18:40:37 -04:00
#include <std_include.hpp>
2021-04-29 17:47:05 -04:00
#include "loader/component_loader.hpp"
#include "game/game.hpp"
#include "command.hpp"
2022-06-17 14:22:12 -04:00
#include "console.hpp"
2021-04-29 17:47:05 -04:00
#include <utils/hook.hpp>
namespace lui
{
class component final : public component_interface
{
public:
void post_unpack() override
{
command::add("lui_open", [](const command::params& params)
{
if (params.size() <= 1)
{
2022-06-17 14:22:12 -04:00
console::info("usage: lui_open <name>\n");
2021-04-29 17:47:05 -04:00
return;
}
game::LUI_OpenMenu(0, params[1], 0, 0, 0);
});
command::add("lui_open_popup", [](const command::params& params)
{
if (params.size() <= 1)
{
2022-06-17 14:22:12 -04:00
console::info("usage: lui_open_popup <name>\n");
2021-04-29 17:47:05 -04:00
return;
}
game::LUI_OpenMenu(0, params[1], 1, 0, 0);
});
2021-09-30 18:55:14 -04:00
command::add("lui_restart", []()
{
2022-03-18 17:02:44 -04:00
utils::hook::invoke<void>(0x1403203B0);
utils::hook::invoke<void>(0x14032D370);
2021-09-30 18:55:14 -04:00
});
2021-04-29 17:47:05 -04:00
}
};
}
REGISTER_COMPONENT(lui::component)