3#define _CRT_SECURE_NO_WARNINGS
5#ifndef _SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING
6#define _SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING
14#define ARK_API __declspec(dllexport)
16#define ARK_API __declspec(dllimport)
21#include "../UE/GenericPlatform/GenericPlatformStricmp.h"
22#include "../UE/Math/Vector.h"
23#include "../UE/Math/Rotator.h"
25#include "../UE/Math/ColorList.h"
39#include "../../IApiUtils.h"
40#include "../../ICommands.h"
std::unordered_map< const FString, AShooterPlayerController *, FStringHash, FStringEqual > eos_id_map_
void SetStatus(ServerStatus status)
std::shared_ptr< MessagingManager > GetMessagingManagerInternal(const FString &forPlugin) const override
void SetCheatManager(UShooterCheatManager *cheatmanager)
ApiUtils(const ApiUtils &)=delete
std::shared_ptr< MessagingManager > ReadApiMessagingManager()
UShooterCheatManager * GetCheatManager() const override
Returns a point to URCON CheatManager.
ApiUtils(ApiUtils &&)=delete
void CheckMessagingManagersRequirements()
AShooterPlayerController * FindPlayerFromEOSID_Internal(const FString &eos_id) const override
AShooterGameMode * GetShooterGameMode() const override
Returns a pointer to AShooterGameMode.
ApiUtils & operator=(const ApiUtils &)=delete
void SetShooterGameMode(AShooterGameMode *shooter_game_mode)
void RemoveMessagingManagerInternal(const FString &forPlugin)
ApiUtils & operator=(ApiUtils &&)=delete
AShooterGameMode * shooter_game_mode_
UWorld * GetWorld() const override
Returns a pointer to UWorld.
void SetMessagingManagerInternal(const FString &forPlugin, std::shared_ptr< MessagingManager > manager) override
ServerStatus GetStatus() const override
Returns the current server status.
void SetPlayerController(AShooterPlayerController *player_controller)
void RemovePlayerController(AShooterPlayerController *player_controller)
~ApiUtils() override=default
void SetWorld(UWorld *uworld)
UShooterCheatManager * cheatmanager_
FORCEINLINE AShooterGameState * GetGameState()
Get Shooter Game State.
virtual UShooterCheatManager * GetCheatManager() const =0
Returns a point to URCON CheatManager.
FORCEINLINE void SendNotificationToAll(FLinearColor color, float display_scale, float display_time, UTexture2D *icon, const T *msg, Args &&... args)
Sends notification (on-screen message) to all players. Using fmt::format.
FORCEINLINE TArray< AActor * > GetAllActorsInRange(FVector location, float radius, EServerOctreeGroup::Type ActorType)
Gets all actors in radius at location.
FORCEINLINE std::shared_ptr< T > GetMessagingManagerCasted() const
Gets the current messaging manager for the plugin.
FORCEINLINE MapCoords FVectorToCoords(FVector actor_position)
Converts FVector into coords that are displayed when you view the ingame map.
FORCEINLINE const FString GetAttackerEOSID(AActor *target, AController *killer, AActor *damage_causer, bool tribe_check=true)
obtains the steam ID of an attacker, meant to be used in hooks such as TakeDamage
static FORCEINLINE FString GetClassBlueprint(UClass *the_class)
Returns blueprint path from any UClass.
FORCEINLINE AShooterPlayerController * FindPlayerFromEOSID(const FString &eos_id) const
Finds player from the given eos id.
virtual ~IApiUtils()=default
FORCEINLINE void SendNotification(AShooterPlayerController *player_controller, FLinearColor color, float display_scale, float display_time, UTexture2D *icon, const T *msg, Args &&... args)
Sends notification (on-screen message) to the specific player. Using fmt::format.
static FORCEINLINE APrimalDinoCharacter * GetRidingDino(AShooterPlayerController *player_controller)
Returns the dino the character is riding.
FORCEINLINE void SendServerMessageToAll(FLinearColor msg_color, const T *msg, Args &&... args)
Sends server message to all players. Using fmt::format.
static FORCEINLINE int GetTribeID(AShooterCharacter *player_character)
Get Tribe ID of character.
static FORCEINLINE int GetTribeID(AShooterPlayerController *player_controller)
Get Tribe ID of player controller.
static FORCEINLINE uint64 GetPlayerID(AController *controller)
FORCEINLINE TArray< AActor * > GetAllActorsInRange(FVector location, float radius, EServerOctreeGroup::Type ActorType, TArray< AActor * > ignores)
Gets all actors in radius at location, with ignore actors.
FORCEINLINE std::shared_ptr< MessagingManager > GetMessagingManager() const
Gets the current messaging manager for the plugin, without casting.
static FORCEINLINE FVector GetPosition(APlayerController *player_controller)
Returns the position of a player.
FORCEINLINE void SendServerMessage(AShooterPlayerController *player_controller, FLinearColor msg_color, const T *msg, Args &&... args)
Sends server message to the specific player. Using fmt::format.
FORCEINLINE TArray< AShooterPlayerController * > FindPlayerFromCharacterName(const FString &character_name, ESearchCase::Type search, bool full_match) const
Finds all matching players from the given character name.
static FORCEINLINE bool IsRidingDino(AShooterPlayerController *player_controller)
Returns true if character is riding a dino, false otherwise.
static FORCEINLINE uint64 GetPlayerID(APrimalCharacter *character)
FORCEINLINE UPrimalGameData * GetGameData()
Returns pointer to Primal Game Data.
virtual std::shared_ptr< MessagingManager > GetMessagingManagerInternal(const FString &forPlugin) const =0
static FORCEINLINE void FreeStruct(void *obj)
Free a struct allocated.
static FORCEINLINE UShooterCheatManager * GetCheatManagerByPC(AShooterPlayerController *SPC)
Get UShooterCheatManager* of player controller.
FORCEINLINE AShooterPlayerController * FindControllerFromCharacter(AShooterCharacter *character) const
Finds player controller from the given player character.
static FORCEINLINE FString GetIPAddress(AShooterPlayerController *player)
Returns IP address of player.
static FORCEINLINE std::optional< FString > TeleportToPlayer(AShooterPlayerController *me, AShooterPlayerController *him, bool check_for_dino, float max_dist)
Teleport one player to another.
FORCEINLINE bool SpawnDrop(const wchar_t *blueprint, FVector pos, int amount, float item_quality=0.0f, bool force_blueprint=false, float life_span=0.0f) const
Spawns an item drop.
void SetMessagingManager()
Sets the messaging manager for the current plugin.
static FORCEINLINE bool TeleportToPos(AShooterPlayerController *player_controller, const FVector &pos)
Teleports player to the given position.
virtual void SetMessagingManagerInternal(const FString &forPlugin, std::shared_ptr< MessagingManager > manager)=0
static FORCEINLINE bool IsPlayerDead(AShooterPlayerController *player)
Returns true if player is dead, false otherwise.
virtual AShooterGameMode * GetShooterGameMode() const =0
Returns a pointer to AShooterGameMode.
static FORCEINLINE FString GetSteamName(AController *player_controller)
Returns the steam name of player.
static FORCEINLINE FString GetCharacterName(AShooterPlayerController *player_controller)
Returns the character name of player.
FORCEINLINE void SendChatMessage(AShooterPlayerController *player_controller, const FString &sender_name, const T *msg, Args &&... args)
Sends chat message to the specific player. Using fmt::format.
FORCEINLINE AShooterPlayerController * FindPlayerFromPlatformName(const FString &steam_name) const
Finds player from the given platform name (can be steam, Playstation, Xbox, etc......
virtual ServerStatus GetStatus() const =0
Returns the current server status.
FORCEINLINE const FString GetEOSIDForPlayerID(int player_id)
FORCEINLINE APrimalDinoCharacter * SpawnDino(AShooterPlayerController *player, FString blueprint, FVector *location, int lvl, bool force_tame, bool neutered) const
Spawns a dino near player or at specific coordinates.
static FORCEINLINE FString GetItemBlueprint(UPrimalItem *item)
Returns blueprint from UPrimalItem.
FORCEINLINE void SendChatMessageToAll(const FString &sender_name, const T *msg, Args &&... args)
Sends chat message to all players. Using fmt::format.
static FORCEINLINE FString GetEOSIDFromController(AController *controller)
Returns EOS ID from player controller.
static FORCEINLINE int GetInventoryItemCount(AShooterPlayerController *player_controller, const FString &item_name)
Counts a specific items quantity.
static FORCEINLINE T * AllocateStruct()
Create a new object of T, with the correct size.
void RunHiddenCommand(AShooterPlayerController *_this, FString *Command)
Runs a command that is not logged anywhere.
static FORCEINLINE FString GetBlueprint(UObjectBase *object)
Returns blueprint path from any UObject.
virtual UWorld * GetWorld() const =0
Returns a pointer to UWorld.
virtual AShooterPlayerController * FindPlayerFromEOSID_Internal(const FString &eos_id) const =0
UE_NODISCARD bool EndsWith(const TCHAR *InSuffix, ESearchCase::Type SearchCase=ESearchCase::IgnoreCase) const
UE_NODISCARD FORCEINLINE friend FString operator+(const TCHAR *Lhs, FString &&Rhs)
UE_NODISCARD FORCEINLINE friend FString operator+(FString &&Lhs, const TCHAR *Rhs)
FString & operator=(FString &&)=default
UE_NODISCARD FORCEINLINE bool IsEmpty() const
ARK_API FString(const WIDECHAR *Str)
ARK_API FString(const ANSICHAR *Str)
UE_NODISCARD FORCEINLINE friend FString operator+(const TCHAR *Lhs, const FString &Rhs)
UE_NODISCARD FORCEINLINE FString LeftChop(int32 Count) const &
FString & operator=(const FString &)=default
Messaging manager. Allows to send server messages, notifications and chat messages.
IApiUtils & GetApiUtils()
static UClass * GetPrivateStaticClass()
FString * ConsoleCommand(FString *result, const FString *Cmd, bool bWriteToLog)
FString * GetPlayerNetworkAddress(FString *result)
void DoNeuter_Implementation()
void TameDino(AShooterPlayerController *ForPC, bool bIgnoreMaxTameLimit, int OverrideTamingTeamID, bool bPreventNameDialog, bool bSkipAddingTamedLevels, bool bSuppressNotifications)
static UClass * GetPrivateStaticClass()
int & TamingTeamIDField()
FString & TamerStringField()
int & AbsoluteBaseLevelField()
APlayerController * GetOwnerController()
unsigned int & ConstructorPlayerDataIDField()
static UClass * StaticClass()
float & LongitudeOriginField()
float & LatitudeOriginField()
float & LongitudeScaleField()
float & LatitudeScaleField()
UPrimalPlayerData * GetPlayerData()
void AddPlayerID(int playerDataID, FString *netUniqueString, bool bForce)
FString * GetSteamIDStringForPlayerID(FString *result, int playerDataID)
__int64 & LinkedPlayerIDField()
bool IsA(UClass *SomeBase)
Returns if the actor is from SomeBase or a subclass of SomeBase.
static void Free(void *Original)
unsigned __int64 & PlayerDataIDField()
UClass *& ClassPrivateField()
void GetPathName(const UObject *StopOuter, FString *ResultString)
int & TargetingTeamField()
UPrimalGameData *& PrimalGameDataField()
UPrimalGameData *& PrimalGameDataOverrideField()
FItemNetInfo * GetItemNetInfo(FItemNetInfo *result, bool bIsForSendingToClient)
FPrimalPlayerDataStruct * MyDataField()
static UObject * GetClassDefaultObject(UClass *FromClass)
TArray< TWeakObjectPtr< APlayerController >, TSizedDefaultAllocator< 32 > > & PlayerControllerListField()
APlayerController * GetFirstPlayerController()
AWorldSettings * GetWorldSettings(bool bCheckStreamingPersistent, bool bChecked)