h2-mod/src/client/component/lui.cpp
2022-06-17 20:22:12 +02:00

50 lines
923 B
C++

#include <std_include.hpp>
#include "loader/component_loader.hpp"
#include "game/game.hpp"
#include "command.hpp"
#include "console.hpp"
#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)
{
console::info("usage: lui_open <name>\n");
return;
}
game::LUI_OpenMenu(0, params[1], 0, 0, 0);
});
command::add("lui_open_popup", [](const command::params& params)
{
if (params.size() <= 1)
{
console::info("usage: lui_open_popup <name>\n");
return;
}
game::LUI_OpenMenu(0, params[1], 1, 0, 0);
});
command::add("lui_restart", []()
{
utils::hook::invoke<void>(0x1403203B0);
utils::hook::invoke<void>(0x14032D370);
});
}
};
}
REGISTER_COMPONENT(lui::component)