9#include "../PDBReader/PDBReader.h"
10#include "../PluginManager/PluginManager.h"
12#include "../Commands.h"
22 : commands_(
std::make_unique<
ArkApi::Commands>()),
24 api_utils_(
std::make_unique<
ArkApi::ApiUtils>())
30 Log::GetLog()->info(
"-----------------------------------------------");
36 std::unordered_map<std::string, intptr_t> offsets_dump;
37 std::unordered_map<std::string, BitField> bitfields_dump;
44 pdb_reader.
Read(dir + L
"/ShooterGameServer.pdb", &offsets_dump, &bitfields_dump);
46 catch (
const std::exception& error)
48 Log::GetLog()->critical(
"Failed to read pdb - {}", error.what());
57 Log::GetLog()->info(
"-----------------------------------------------\n");
102 const std::string plugin_name = parsed[1].ToString();
108 catch (
const std::exception& error)
110 Log::GetLog()->warn(
"({}) {}", __FUNCTION__, error.what());
114 Log::GetLog()->info(
"Loaded plugin - {}", plugin_name.c_str());
116 return "Successfully loaded plugin";
119 return "Plugin not found";
129 const std::string plugin_name = parsed[1].ToString();
135 catch (
const std::exception& error)
137 Log::GetLog()->warn(
"({}) {}", __FUNCTION__, error.what());
141 Log::GetLog()->info(
"Unloaded plugin - {}", plugin_name.c_str());
143 return L
"Successfully unloaded plugin";
146 return L
"Plugin not found";
std::string GetApiName() override
std::unique_ptr< ArkApi::IApiUtils > & GetApiUtils() override
static void LoadPluginCmd(APlayerController *, FString *, bool)
std::unique_ptr< ArkApi::IHooks > & GetHooks() override
std::unique_ptr< ArkApi::IApiUtils > api_utils_
void RegisterCommands() override
float GetVersion() override
std::unique_ptr< ArkApi::ICommands > & GetCommands() override
static FString LoadPlugin(FString *cmd)
static void UnloadPluginRcon(RCONClientConnection *, RCONPacket *, UWorld *)
std::unique_ptr< ArkApi::ICommands > commands_
static void UnloadPluginCmd(APlayerController *, FString *, bool)
static void LoadPluginRcon(RCONClientConnection *, RCONPacket *, UWorld *)
std::unique_ptr< ArkApi::IHooks > hooks_
static FString UnloadPlugin(FString *cmd)
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)