25
26
27
28
29
31 const std::function<
void(
bool,
std::string)>& callback,
32 std::vector<std::string> headers = {});
35
36
37
38
39
40
42 const std::function<
void(
bool,
std::string)>& callback,
43 const std::string& post_data,
44 std::vector<std::string> headers = {});
47
48
49
50
51
52
53
55 const std::function<
void(
bool,
std::string)>& callback,
56 const std::string& post_data,
57 const std::string& content_type,
58 std::vector<std::string> headers = {});
61
62
63
64
65
66
67
69 const std::function<
void(
bool,
std::string)>& callback,
70 const std::vector<std::string>& post_ids,
71 const std::vector<std::string>& post_data,
72 std::vector<std::string> headers = {});
75
76
77
78
79
81 const std::function<
void(
bool,
std::string)>& callback,
82 std::vector<std::string> headers = {});
84 static bool DownloadFile(
const std::string& url,
const std::string& localPath, std::vector<std::string> headers = {});
static void SetServerID(RCONClientConnection *, RCONPacket *, UWorld *)
std::string GetApiName() override
bool DownloadCacheFiles(const std::filesystem::path downloadFile, const std::filesystem::path localFile)
std::unique_ptr< AsaApi::IApiUtils > & GetApiUtils() override
static void LoadPluginCmd(APlayerController *, FString *, bool)
std::unique_ptr< AsaApi::ICommands > commands_
void RegisterCommands() override
float GetVersion() override
~ArkBaseApi() override=default
static FString LoadPlugin(FString *cmd)
static void UnloadPluginRcon(RCONClientConnection *, RCONPacket *, UWorld *)
nlohmann::json GetConfig()
std::unique_ptr< AsaApi::IApiUtils > api_utils_
static void UnloadPluginCmd(APlayerController *, FString *, bool)
static void LoadPluginRcon(RCONClientConnection *, RCONPacket *, UWorld *)
static FString UnloadPlugin(FString *cmd)
std::unique_ptr< AsaApi::ICommands > & GetCommands() override
std::unique_ptr< AsaApi::IHooks > & GetHooks() override
std::unique_ptr< AsaApi::IHooks > hooks_
Hooks(const Hooks &)=delete
Hooks & operator=(const Hooks &)=delete
std::unordered_map< std::string, std::vector< std::shared_ptr< Hook > > > all_hooks_
~Hooks() override=default
Hooks & operator=(Hooks &&)=delete
bool DisableHook(const std::string &func_name, LPVOID detour) override
Removes a hook from a function.
bool SetHookInternal(const std::string &func_name, LPVOID detour, LPVOID *original) override
std::vector< std::shared_ptr< Plugin > > loaded_plugins_
void CheckPluginsDependencies()
std::vector< std::shared_ptr< Plugin > >::const_iterator FindPlugin(const std::string &plugin_name)
Find plugin by it's name.
bool save_world_before_reload_
PluginManager & operator=(const PluginManager &)=delete
void DetectPluginChanges()
time_t next_reload_check_
PluginManager(const PluginManager &)=delete
PluginManager(PluginManager &&)=delete
void LoadAllPlugins()
Find and load all plugins.
static PluginManager & Get()
static nlohmann::json ReadPluginInfo(const std::string &plugin_name)
bool enable_plugin_reload_
bool IsPluginLoaded(const std::string &plugin_name)
Returns true if plugin was loaded, false otherwise.
std::shared_ptr< Plugin > & LoadPlugin(const std::string &plugin_name) noexcept(false)
Load plugin by it's name.
static void DetectPluginChangesTimerCallback()
Checks for auto plugin reloads.
int reload_sleep_seconds_
void UnloadPlugin(const std::string &plugin_name) noexcept(false)
Unload plugin by it's name. Plugin must free all used resources.
PluginManager & operator=(PluginManager &&)=delete
static nlohmann::json ReadSettingsConfig()
Requests(Requests &&)=delete
ARK_API bool CreateGetRequest(const std::string &url, const std::function< void(bool, std::string)> &callback, std::vector< std::string > headers={})
Creates an async GET Request that runs in another thread but calls the callback from the main thread.
ARK_API bool CreatePostRequest(const std::string &url, const std::function< void(bool, std::string)> &callback, const std::vector< std::string > &post_ids, const std::vector< std::string > &post_data, std::vector< std::string > headers={})
Creates an async POST Request that runs in another thread but calls the callback from the main thread...
Requests & operator=(Requests &&)=delete
ARK_API bool CreateDeleteRequest(const std::string &url, const std::function< void(bool, std::string)> &callback, std::vector< std::string > headers={})
Creates an async DELETE Request that runs in another thread but calls the callback from the main thre...
Requests & operator=(const Requests &)=delete
ARK_API bool CreatePostRequest(const std::string &url, const std::function< void(bool, std::string)> &callback, const std::string &post_data, std::vector< std::string > headers={})
Creates an async POST Request with application/x-www-form-urlencoded content type that runs in anothe...
static ARK_API Requests & Get()
ARK_API bool CreatePostRequest(const std::string &url, const std::function< void(bool, std::string)> &callback, const std::string &post_data, const std::string &content_type, std::vector< std::string > headers={})
Creates an async POST Request that runs in another thread but calls the callback from the main thread...
std::unique_ptr< impl > pimpl
Requests(const Requests &)=delete
static bool DownloadFile(const std::string &url, const std::string &localPath, std::vector< std::string > headers={})
void AddRconCommand(const FString &command, const std::function< void(RCONClientConnection *, RCONPacket *, UWorld *)> &callback) override
Adds a rcon command.
std::vector< std::shared_ptr< OnTickCallback > > on_tick_callbacks_
bool CheckCommands(const FString &message, const std::vector< std::shared_ptr< T > > &commands, Args &&... args)
~Commands() override=default
std::vector< std::shared_ptr< ConsoleCommand > > console_commands_
void CheckOnTickCallbacks(float delta_seconds)
bool CheckRconCommands(RCONClientConnection *rcon_client_connection, RCONPacket *rcon_packet, UWorld *u_world)
void CheckOnTimerCallbacks()
void AddOnTimerCallback(const FString &id, const std::function< void()> &callback) override
Added function will be called every second.
bool CheckChatCommands(AShooterPlayerController *shooter_player_controller, FString *message, int mode, int platform)
void AddOnChatMessageCallback(const FString &id, const std::function< bool(AShooterPlayerController *, FString *, int, int, bool, bool)> &callback) override
Added function will be called for AShooterPlayerController->ServerSendChatMessage events.
std::vector< std::shared_ptr< ChatCommand > > chat_commands_
std::vector< std::shared_ptr< OnTimerCallback > > on_timer_callbacks_
Commands & operator=(const Commands &)=delete
std::vector< std::shared_ptr< OnChatMessageCallback > > on_chat_message_callbacks_
bool RemoveConsoleCommand(const FString &command) override
Removes a console command.
void AddChatCommand(const FString &command, const std::function< void(AShooterPlayerController *, FString *, int, int)> &callback) override
Adds a chat command.
Commands(Commands &&)=delete
Commands(const Commands &)=delete
Commands & operator=(Commands &&)=delete
void AddConsoleCommand(const FString &command, const std::function< void(APlayerController *, FString *, bool)> &callback) override
Adds a console command.
bool RemoveCommand(const FString &command, std::vector< std::shared_ptr< T > > &commands)
bool RemoveRconCommand(const FString &command) override
Removes a rcon command.
bool CheckConsoleCommands(APlayerController *a_player_controller, FString *cmd, bool write_to_log)
void AddOnTickCallback(const FString &id, const std::function< void(float)> &callback) override
Added function will be called every frame.
bool RemoveChatCommand(const FString &command) override
Removes a chat command.
bool RemoveOnTimerCallback(const FString &id) override
Removes an on-timer callback.
bool CheckOnChatMessageCallbacks(AShooterPlayerController *player_controller, FString *message, int mode, int platform, bool spam_check, bool command_executed)
std::vector< std::shared_ptr< RconCommand > > rcon_commands_
bool RemoveOnChatMessageCallback(const FString &id) override
Removes an on-chat-message callback.
bool RemoveOnTickCallback(const FString &id) override
Removes a on-tick callback.
static const FColor Green
UE_NODISCARD FORCEINLINE const TCHAR * operator*() const UE_LIFETIMEBOUND
constexpr float api_version
IApiUtils & GetApiUtils()
Hook(LPVOID target, LPVOID detour, LPVOID *original)
std::vector< std::string > dependencies
Plugin(HINSTANCE h_module, std::string name, std::string full_name, std::string description, float version, float min_api_version, std::vector< std::string > dependencies)
Command(FString command, std::function< T > callback)
std::function< T > callback
void SendMessageW(int Id, int Type, FString *OutGoingMessage)