8#include "../PDBReader/PDBReader.h"
9#include "../PluginManager/PluginManager.h"
11#include "../Commands.h"
21 : commands_(
std::make_unique<
ArkApi::Commands>()),
29 Log::GetLog()->info(
"-----------------------------------------------");
35 std::unordered_map<std::string, intptr_t> offsets_dump;
36 std::unordered_map<std::string, BitField> bitfields_dump;
43 pdb_reader.
Read(dir + L
"/ShooterGameServer.pdb", &offsets_dump, &bitfields_dump);
45 catch (
const std::exception& error)
47 Log::GetLog()->critical(
"Failed to read pdb - {}", error.what());
56 Log::GetLog()->info(
"-----------------------------------------------\n");
101 const std::string plugin_name = parsed[1].ToString();
107 catch (
const std::exception& error)
109 Log::GetLog()->warn(
"({}) {}", __FUNCTION__, error.what());
113 Log::GetLog()->info(
"Loaded plugin - {}", plugin_name.c_str());
115 return "Successfully loaded plugin";
118 return "Plugin not found";
128 const std::string plugin_name = parsed[1].ToString();
134 catch (
const std::exception& error)
136 Log::GetLog()->warn(
"({}) {}", __FUNCTION__, error.what());
140 Log::GetLog()->info(
"Unloaded plugin - {}", plugin_name.c_str());
142 return L
"Successfully unloaded plugin";
145 return L
"Plugin not found";
static void UnloadPluginCmd(APlayerController *, FString *, bool)
std::unique_ptr< ArkApi::ICommands > commands_
static FString LoadPlugin(FString *cmd)
std::unique_ptr< ArkApi::IApiUtils > api_utils_
std::unique_ptr< ArkApi::ICommands > & GetCommands() override
std::unique_ptr< ArkApi::IHooks > & GetHooks() override
static void LoadPluginRcon(RCONClientConnection *, RCONPacket *, UWorld *)
void RegisterCommands() override
std::unique_ptr< ArkApi::IApiUtils > & GetApiUtils() override
std::unique_ptr< ArkApi::IHooks > hooks_
static void LoadPluginCmd(APlayerController *, FString *, bool)
static FString UnloadPlugin(FString *cmd)
float GetVersion() override
static void UnloadPluginRcon(RCONClientConnection *, RCONPacket *, UWorld *)
std::string GetApiName() override
void Init(std::unordered_map< std::string, intptr_t > &&offsets_dump, std::unordered_map< std::string, BitField > &&bitfields_dump)
void Read(const std::wstring &path, std::unordered_map< std::string, intptr_t > *offsets_dump, std::unordered_map< std::string, BitField > *bitfields_dump)
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.
FORCEINLINE void SendServerMessage(AShooterPlayerController *player_controller, FLinearColor msg_color, const T *msg, Args &&... args)
Sends server message to the specific player. Using fmt::format.
static const FColor Green
int32 ParseIntoArray(TArray< FString > &OutArray, const TCHAR *pchDelim, bool InCullEmpty=true) const
static FString Format(const T *format, Args &&... args)
Formats text using fmt::format.
static std::shared_ptr< spdlog::logger > & GetLog()
FORCEINLINE bool IsValidIndex(int32 Index) const
constexpr float api_version
IApiUtils & GetApiUtils()
void SendMessageW(int Id, int Type, FString *OutGoingMessage)