Ark Server API (ASA) - Wiki
Loading...
Searching...
No Matches
AsaApi::ApiUtils Class Reference

#include <ApiUtils.h>

+ Inheritance diagram for AsaApi::ApiUtils:
+ Collaboration diagram for AsaApi::ApiUtils:

Public Member Functions

 ApiUtils ()=default
 
 ApiUtils (const ApiUtils &)=delete
 
 ApiUtils (ApiUtils &&)=delete
 
ApiUtilsoperator= (const ApiUtils &)=delete
 
ApiUtilsoperator= (ApiUtils &&)=delete
 
 ~ApiUtils () override=default
 
UWorldGetWorld () const override
 Returns a pointer to UWorld.
 
AShooterGameModeGetShooterGameMode () const override
 Returns a pointer to AShooterGameMode.
 
ServerStatus GetStatus () const override
 Returns the current server status.
 
UShooterCheatManagerGetCheatManager () const override
 Returns a point to URCON CheatManager.
 
void SetWorld (UWorld *uworld)
 
void SetShooterGameMode (AShooterGameMode *shooter_game_mode)
 
void SetStatus (ServerStatus status)
 
void SetCheatManager (UShooterCheatManager *cheatmanager)
 
AShooterPlayerControllerFindPlayerFromEOSID_Internal (const FString &eos_id) const override
 
void SetPlayerController (AShooterPlayerController *player_controller)
 
void RemovePlayerController (AShooterPlayerController *player_controller)
 
std::shared_ptr< MessagingManagerGetMessagingManagerInternal (const FString &forPlugin) const override
 
void SetMessagingManagerInternal (const FString &forPlugin, std::shared_ptr< MessagingManager > manager) override
 
void RemoveMessagingManagerInternal (const FString &forPlugin)
 
void CheckMessagingManagersRequirements ()
 
- Public Member Functions inherited from AsaApi::IApiUtils
virtual ~IApiUtils ()=default
 
template<typename T , typename... Args>
FORCEINLINE void SendServerMessage (AShooterPlayerController *player_controller, FLinearColor msg_color, const T *msg, Args &&... args)
 Sends server message to the specific player. Using fmt::format.
 
template<typename T , typename... Args>
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.
 
template<typename T , typename... Args>
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.
 
template<typename T , typename... Args>
FORCEINLINE void SendServerMessageToAll (FLinearColor msg_color, const T *msg, Args &&... args)
 Sends server message to all players. Using fmt::format.
 
template<typename T , typename... Args>
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.
 
template<typename T , typename... Args>
FORCEINLINE void SendChatMessageToAll (const FString &sender_name, const T *msg, Args &&... args)
 Sends chat message to all players. Using fmt::format.
 
FORCEINLINE AShooterPlayerControllerFindPlayerFromPlatformName (const FString &steam_name) const
 Finds player from the given platform name (can be steam, Playstation, Xbox, etc...)
 
FORCEINLINE AShooterPlayerControllerFindControllerFromCharacter (AShooterCharacter *character) const
 Finds player controller from the given player character.
 
FORCEINLINE TArray< AShooterPlayerController * > FindPlayerFromCharacterName (const FString &character_name, ESearchCase::Type search, bool full_match) const
 Finds all matching players from the given character name.
 
FORCEINLINE AShooterPlayerControllerFindPlayerFromEOSID (const FString &eos_id) const
 Finds player from the given eos id.
 
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.
 
FORCEINLINE APrimalDinoCharacterSpawnDino (AShooterPlayerController *player, FString blueprint, FVector *location, int lvl, bool force_tame, bool neutered) const
 Spawns a dino near player or at specific coordinates.
 
FORCEINLINE const FString GetEOSIDForPlayerID (int player_id)
 
FORCEINLINE AShooterGameStateGetGameState ()
 Get Shooter Game State.
 
FORCEINLINE UPrimalGameDataGetGameData ()
 Returns pointer to Primal Game Data.
 
FORCEINLINE TArray< AActor * > GetAllActorsInRange (FVector location, float radius, EServerOctreeGroup::Type ActorType)
 Gets all actors in radius at location.
 
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 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
 
void RunHiddenCommand (AShooterPlayerController *_this, FString *Command)
 Runs a command that is not logged anywhere.
 
FORCEINLINE std::shared_ptr< MessagingManagerGetMessagingManager () const
 Gets the current messaging manager for the plugin, without casting.
 
template<class T >
FORCEINLINE std::shared_ptr< TGetMessagingManagerCasted () const
 Gets the current messaging manager for the plugin.
 
template<class T >
void SetMessagingManager ()
 Sets the messaging manager for the current plugin.
 

Private Member Functions

std::shared_ptr< MessagingManagerReadApiMessagingManager ()
 

Private Attributes

UWorldu_world_ { nullptr }
 
AShooterGameModeshooter_game_mode_ { nullptr }
 
ServerStatus status_ { 0 }
 
UShooterCheatManagercheatmanager_ { nullptr }
 
std::unordered_map< const FString, AShooterPlayerController *, FStringHash, FStringEqualeos_id_map_
 
std::unordered_map< const FString, std::shared_ptr< MessagingManager >, FStringHash, FStringEqualmessaging_managers_
 

Additional Inherited Members

- Static Public Member Functions inherited from AsaApi::IApiUtils
static FORCEINLINE FString GetEOSIDFromController (AController *controller)
 Returns EOS ID from player controller.
 
static FORCEINLINE FString GetCharacterName (AShooterPlayerController *player_controller)
 Returns the character name of player.
 
static FORCEINLINE FString GetSteamName (AController *player_controller)
 Returns the steam name of player.
 
static FORCEINLINE bool IsRidingDino (AShooterPlayerController *player_controller)
 Returns true if character is riding a dino, false otherwise.
 
static FORCEINLINE APrimalDinoCharacterGetRidingDino (AShooterPlayerController *player_controller)
 Returns the dino the character is riding.
 
static FORCEINLINE FVector GetPosition (APlayerController *player_controller)
 Returns the position of a player.
 
static FORCEINLINE std::optional< FStringTeleportToPlayer (AShooterPlayerController *me, AShooterPlayerController *him, bool check_for_dino, float max_dist)
 Teleport one player to another.
 
static FORCEINLINE bool TeleportToPos (AShooterPlayerController *player_controller, const FVector &pos)
 Teleports player to the given position.
 
static FORCEINLINE int GetInventoryItemCount (AShooterPlayerController *player_controller, const FString &item_name)
 Counts a specific items quantity.
 
static FORCEINLINE FString GetIPAddress (AShooterPlayerController *player)
 Returns IP address of player.
 
static FORCEINLINE FString GetItemBlueprint (UPrimalItem *item)
 Returns blueprint from UPrimalItem.
 
static FORCEINLINE bool IsPlayerDead (AShooterPlayerController *player)
 Returns true if player is dead, false otherwise.
 
static FORCEINLINE uint64 GetPlayerID (APrimalCharacter *character)
 
static FORCEINLINE uint64 GetPlayerID (AController *controller)
 
static FORCEINLINE FString GetBlueprint (UObjectBase *object)
 Returns blueprint path from any UObject.
 
static FORCEINLINE FString GetClassBlueprint (UClass *the_class)
 Returns blueprint path from any UClass.
 
static FORCEINLINE UShooterCheatManagerGetCheatManagerByPC (AShooterPlayerController *SPC)
 Get UShooterCheatManager* of player controller.
 
static FORCEINLINE int GetTribeID (AShooterPlayerController *player_controller)
 Get Tribe ID of player controller.
 
static FORCEINLINE int GetTribeID (AShooterCharacter *player_character)
 Get Tribe ID of character.
 
template<class T >
static FORCEINLINE TAllocateStruct ()
 Create a new object of T, with the correct size.
 
static FORCEINLINE void FreeStruct (void *obj)
 Free a struct allocated.
 

Detailed Description

Definition at line 7 of file ApiUtils.h.

Constructor & Destructor Documentation

◆ ApiUtils() [1/3]

AsaApi::ApiUtils::ApiUtils ( )
default

◆ ApiUtils() [2/3]

AsaApi::ApiUtils::ApiUtils ( const ApiUtils & )
delete

◆ ApiUtils() [3/3]

AsaApi::ApiUtils::ApiUtils ( ApiUtils && )
delete

◆ ~ApiUtils()

AsaApi::ApiUtils::~ApiUtils ( )
overridedefault

Member Function Documentation

◆ CheckMessagingManagersRequirements()

void AsaApi::ApiUtils::CheckMessagingManagersRequirements ( )

Definition at line 155 of file ApiUtils.cpp.

+ Here is the caller graph for this function:

◆ FindPlayerFromEOSID_Internal()

AShooterPlayerController * AsaApi::ApiUtils::FindPlayerFromEOSID_Internal ( const FString & eos_id) const
overridevirtual

Implements AsaApi::IApiUtils.

Definition at line 83 of file ApiUtils.cpp.

+ Here is the call graph for this function:

◆ GetCheatManager()

UShooterCheatManager * AsaApi::ApiUtils::GetCheatManager ( ) const
overridevirtual

Returns a point to URCON CheatManager.

Implements AsaApi::IApiUtils.

Definition at line 119 of file ApiUtils.cpp.

◆ GetMessagingManagerInternal()

std::shared_ptr< MessagingManager > AsaApi::ApiUtils::GetMessagingManagerInternal ( const FString & forPlugin) const
overridevirtual

Implements AsaApi::IApiUtils.

Definition at line 124 of file ApiUtils.cpp.

◆ GetShooterGameMode()

AShooterGameMode * AsaApi::ApiUtils::GetShooterGameMode ( ) const
overridevirtual

Returns a pointer to AShooterGameMode.

Implements AsaApi::IApiUtils.

Definition at line 34 of file ApiUtils.cpp.

◆ GetStatus()

ServerStatus AsaApi::ApiUtils::GetStatus ( ) const
overridevirtual

Returns the current server status.

Implements AsaApi::IApiUtils.

Definition at line 46 of file ApiUtils.cpp.

+ Here is the caller graph for this function:

◆ GetWorld()

UWorld * AsaApi::ApiUtils::GetWorld ( ) const
overridevirtual

Returns a pointer to UWorld.

Implements AsaApi::IApiUtils.

Definition at line 22 of file ApiUtils.cpp.

+ Here is the caller graph for this function:

◆ operator=() [1/2]

ApiUtils & AsaApi::ApiUtils::operator= ( ApiUtils && )
delete

◆ operator=() [2/2]

ApiUtils & AsaApi::ApiUtils::operator= ( const ApiUtils & )
delete

◆ ReadApiMessagingManager()

std::shared_ptr< MessagingManager > AsaApi::ApiUtils::ReadApiMessagingManager ( )
private

Definition at line 185 of file ApiUtils.cpp.

◆ RemoveMessagingManagerInternal()

void AsaApi::ApiUtils::RemoveMessagingManagerInternal ( const FString & forPlugin)

Definition at line 147 of file ApiUtils.cpp.

+ Here is the call graph for this function:

◆ RemovePlayerController()

void AsaApi::ApiUtils::RemovePlayerController ( AShooterPlayerController * player_controller)

Definition at line 70 of file ApiUtils.cpp.

+ Here is the call graph for this function:

◆ SetCheatManager()

void AsaApi::ApiUtils::SetCheatManager ( UShooterCheatManager * cheatmanager)

Definition at line 52 of file ApiUtils.cpp.

◆ SetMessagingManagerInternal()

void AsaApi::ApiUtils::SetMessagingManagerInternal ( const FString & forPlugin,
std::shared_ptr< MessagingManager > manager )
overridevirtual

Implements AsaApi::IApiUtils.

Definition at line 135 of file ApiUtils.cpp.

+ Here is the call graph for this function:

◆ SetPlayerController()

void AsaApi::ApiUtils::SetPlayerController ( AShooterPlayerController * player_controller)

Definition at line 57 of file ApiUtils.cpp.

+ Here is the call graph for this function:

◆ SetShooterGameMode()

void AsaApi::ApiUtils::SetShooterGameMode ( AShooterGameMode * shooter_game_mode)

Definition at line 29 of file ApiUtils.cpp.

◆ SetStatus()

void AsaApi::ApiUtils::SetStatus ( ServerStatus status)

Definition at line 41 of file ApiUtils.cpp.

◆ SetWorld()

void AsaApi::ApiUtils::SetWorld ( UWorld * uworld)

Definition at line 13 of file ApiUtils.cpp.

Member Data Documentation

◆ cheatmanager_

UShooterCheatManager* AsaApi::ApiUtils::cheatmanager_ { nullptr }
private

Definition at line 45 of file ApiUtils.h.

◆ eos_id_map_

std::unordered_map<const FString, AShooterPlayerController*, FStringHash, FStringEqual> AsaApi::ApiUtils::eos_id_map_
private

Definition at line 46 of file ApiUtils.h.

◆ messaging_managers_

std::unordered_map<const FString, std::shared_ptr<MessagingManager>, FStringHash, FStringEqual> AsaApi::ApiUtils::messaging_managers_
private

Definition at line 47 of file ApiUtils.h.

◆ shooter_game_mode_

AShooterGameMode* AsaApi::ApiUtils::shooter_game_mode_ { nullptr }
private

Definition at line 43 of file ApiUtils.h.

◆ status_

ServerStatus AsaApi::ApiUtils::status_ { 0 }
private

Definition at line 44 of file ApiUtils.h.

◆ u_world_

UWorld* AsaApi::ApiUtils::u_world_ { nullptr }
private

Definition at line 42 of file ApiUtils.h.


The documentation for this class was generated from the following files: