2022-11-27 01:29:14 +08:00
|
|
|
#pragma once
|
|
|
|
#include "common.hpp"
|
|
|
|
#include "rage/joaat.hpp"
|
2022-12-22 21:23:32 +00:00
|
|
|
#include "backend/command.hpp"
|
2022-11-27 01:29:14 +08:00
|
|
|
|
|
|
|
namespace big
|
|
|
|
{
|
|
|
|
using key_t = unsigned int;
|
|
|
|
|
|
|
|
class hotkey final
|
|
|
|
{
|
|
|
|
public:
|
2022-12-22 21:23:32 +00:00
|
|
|
hotkey(rage::joaat_t name_hash, key_t key, rage::joaat_t command_hash, std::optional<std::chrono::high_resolution_clock::duration> cooldown = std::nullopt);
|
2022-11-27 01:29:14 +08:00
|
|
|
virtual ~hotkey() = default;
|
|
|
|
|
|
|
|
bool can_exec() const;
|
|
|
|
void exec();
|
|
|
|
|
|
|
|
rage::joaat_t name_hash() const;
|
|
|
|
void set_key(key_t new_key);
|
|
|
|
|
|
|
|
private:
|
|
|
|
rage::joaat_t m_name_hash;
|
|
|
|
key_t m_key;
|
|
|
|
|
2022-12-22 21:23:32 +00:00
|
|
|
rage::joaat_t m_command_hash;
|
2022-11-27 01:29:14 +08:00
|
|
|
std::optional<std::chrono::high_resolution_clock::duration> m_cooldown;
|
|
|
|
std::chrono::high_resolution_clock::time_point m_wakeup;
|
|
|
|
|
|
|
|
};
|
|
|
|
}
|