Ark Server API (ASA) - Wiki
Loading...
Searching...
No Matches
ArkBaseApi.h
Go to the documentation of this file.
1#pragma once
2
3#include "../IBaseApi.h"
4#include <IApiUtils.h>
5#include "Containers/UnrealString.h"
6#include <filesystem>
7#include <json.hpp>
8
9namespace API
10{
11 class ArkBaseApi : public IBaseApi
12 {
13 public:
14 ArkBaseApi();
15 ~ArkBaseApi() override = default;
16
17 bool Init() override;
18 float GetVersion() override;
19 std::string GetApiName() override;
20 void RegisterCommands() override;
21
23 std::unique_ptr<AsaApi::IHooks>& GetHooks() override;
25
26 private:
28 bool DownloadCacheFiles(const std::filesystem::path downloadFile, const std::filesystem::path localFile);
29
30 // Callbacks
31 static FString LoadPlugin(FString* cmd);
32 static FString UnloadPlugin(FString* cmd);
33
34 static void LoadPluginCmd(APlayerController* /*player_controller*/, FString* /*cmd*/, bool /*unused*/);
35 static void UnloadPluginCmd(APlayerController* /*player_controller*/, FString* /*cmd*/, bool /*unused*/);
36
37 static void LoadPluginRcon(RCONClientConnection* /*rcon_connection*/, RCONPacket* /*rcon_packet*/,
38 UWorld* /*unused*/);
39 static void UnloadPluginRcon(RCONClientConnection* /*rcon_connection*/, RCONPacket* /*rcon_packet*/,
40 UWorld* /*unused*/);
41
42 static void SetServerID(RCONClientConnection* /*rcon_connection*/, RCONPacket* /*rcon_packet*/,
43 UWorld* /*unused*/);
44
48 };
49} // namespace API
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_
Definition ArkBaseApi.h:45
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_
Definition ArkBaseApi.h:47
bool Init() override
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_
Definition ArkBaseApi.h:46
static PluginManager & Get()
std::shared_ptr< Plugin > & LoadPlugin(const std::string &plugin_name) noexcept(false)
Load plugin by it's name.
void UnloadPlugin(const std::string &plugin_name) noexcept(false)
Unload plugin by it's name. Plugin must free all used resources.
static const FColor Green
Definition ColorList.h:24
UE_NODISCARD FORCEINLINE const TCHAR * operator*() const UE_LIFETIMEBOUND
Definition IBaseApi.h:9
constexpr float api_version
ARK_API std::string GetCurrentDir()
Definition Tools.cpp:8
IApiUtils & GetApiUtils()
Definition ApiUtils.cpp:206
void InitHooks()
Definition HooksImpl.cpp:43
Definition json.hpp:4518
void SendMessageW(int Id, int Type, FString *OutGoingMessage)
Definition Other.h:38
int Id
Definition Other.h:13