Ark Server API (ASA) - Wiki
Loading...
Searching...
No Matches
Ark.h
Go to the documentation of this file.
1#pragma once
2
3#define _CRT_SECURE_NO_WARNINGS
4
5#ifndef _SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING
6#define _SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING
7#endif
8
9#ifndef ARK_GAME
10#define ARK_GAME
11#endif
12
13#ifdef ARK_EXPORTS
14#define ARK_API __declspec(dllexport)
15#else
16#define ARK_API __declspec(dllimport)
17#endif
18
19#include "../Base.h"
20#include "../Enums.h"
21#include "../UE/GenericPlatform/GenericPlatformStricmp.h"
22#include "../UE/Math/Vector.h"
23#include "../UE/Math/Rotator.h"
24//#include "../UE/NetSerialization.h"
25#include "../UE/Math/ColorList.h"
26#include "UE.h"
27
29//#include "Tribe.h"
30#include "Actor.h"
31#include "Other.h"
32#include "Inventory.h"
33#include "GameMode.h"
34//#include "GameState.h"
36#include "Buff.h"
38
39#include "../../IApiUtils.h"
40#include "../../ICommands.h"
41#include "IHooks.h"
42#include "Tools.h"
#define ARK_API
Definition Ark.h:16
bool HideCommand
Definition Globals.h:3
#define FORCEINLINE
Definition Platform.h:644
std::unordered_map< const FString, AShooterPlayerController *, FStringHash, FStringEqual > eos_id_map_
Definition ApiUtils.h:46
void SetStatus(ServerStatus status)
Definition ApiUtils.cpp:41
std::shared_ptr< MessagingManager > GetMessagingManagerInternal(const FString &forPlugin) const override
Definition ApiUtils.cpp:124
void SetCheatManager(UShooterCheatManager *cheatmanager)
Definition ApiUtils.cpp:52
ApiUtils(const ApiUtils &)=delete
std::shared_ptr< MessagingManager > ReadApiMessagingManager()
Definition ApiUtils.cpp:185
UShooterCheatManager * GetCheatManager() const override
Returns a point to URCON CheatManager.
Definition ApiUtils.cpp:119
ApiUtils(ApiUtils &&)=delete
ApiUtils()=default
void CheckMessagingManagersRequirements()
Definition ApiUtils.cpp:155
AShooterPlayerController * FindPlayerFromEOSID_Internal(const FString &eos_id) const override
Definition ApiUtils.cpp:83
AShooterGameMode * GetShooterGameMode() const override
Returns a pointer to AShooterGameMode.
Definition ApiUtils.cpp:34
ApiUtils & operator=(const ApiUtils &)=delete
void SetShooterGameMode(AShooterGameMode *shooter_game_mode)
Definition ApiUtils.cpp:29
void RemoveMessagingManagerInternal(const FString &forPlugin)
Definition ApiUtils.cpp:147
ApiUtils & operator=(ApiUtils &&)=delete
AShooterGameMode * shooter_game_mode_
Definition ApiUtils.h:43
UWorld * GetWorld() const override
Returns a pointer to UWorld.
Definition ApiUtils.cpp:22
void SetMessagingManagerInternal(const FString &forPlugin, std::shared_ptr< MessagingManager > manager) override
Definition ApiUtils.cpp:135
ServerStatus GetStatus() const override
Returns the current server status.
Definition ApiUtils.cpp:46
ServerStatus status_
Definition ApiUtils.h:44
void SetPlayerController(AShooterPlayerController *player_controller)
Definition ApiUtils.cpp:57
UWorld * u_world_
Definition ApiUtils.h:42
void RemovePlayerController(AShooterPlayerController *player_controller)
Definition ApiUtils.cpp:70
~ApiUtils() override=default
void SetWorld(UWorld *uworld)
Definition ApiUtils.cpp:13
UShooterCheatManager * cheatmanager_
Definition ApiUtils.h:45
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.
Definition ArkApiUtils.h:71
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.
Definition ArkApiUtils.h:53
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.
Definition ArkApiUtils.h:87
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)
Definition String.cpp:250
ARK_API FString(const ANSICHAR *Str)
Definition String.cpp:249
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()
Definition ApiUtils.cpp:206
@ CaseSensitive
Definition CString.h:25
Definition json.hpp:4518
static UClass * GetPrivateStaticClass()
Definition Actor.h:2753
bool IsLocalController()
Definition Actor.h:2237
FString * ConsoleCommand(FString *result, const FString *Cmd, bool bWriteToLog)
Definition Actor.h:2464
FString * GetPlayerNetworkAddress(FString *result)
Definition Actor.h:2656
bool IsDead()
Definition Actor.h:5005
void DoNeuter_Implementation()
Definition Actor.h:7823
void TameDino(AShooterPlayerController *ForPC, bool bIgnoreMaxTameLimit, int OverrideTamingTeamID, bool bPreventNameDialog, bool bSkipAddingTamedLevels, bool bSuppressNotifications)
Definition Actor.h:7631
static UClass * GetPrivateStaticClass()
Definition Actor.h:7399
int & TamingTeamIDField()
Definition Actor.h:6417
FString & TamerStringField()
Definition Actor.h:6258
int & AbsoluteBaseLevelField()
Definition Actor.h:6556
APlayerController * GetOwnerController()
Definition Actor.h:4188
unsigned int & ConstructorPlayerDataIDField()
static UClass * StaticClass()
float & LongitudeOriginField()
Definition GameMode.h:1402
float & LatitudeOriginField()
Definition GameMode.h:1403
float & LongitudeScaleField()
Definition GameMode.h:1397
float & LatitudeScaleField()
Definition GameMode.h:1401
UPrimalPlayerData * GetPlayerData()
Definition Actor.h:5978
void AddPlayerID(int playerDataID, FString *netUniqueString, bool bForce)
Definition GameMode.h:2396
FString * GetSteamIDStringForPlayerID(FString *result, int playerDataID)
Definition GameMode.h:2398
__int64 & LinkedPlayerIDField()
Definition Actor.h:2860
bool IsA(UClass *SomeBase)
Returns if the actor is from SomeBase or a subclass of SomeBase.
static void Free(void *Original)
unsigned __int64 & PlayerDataIDField()
Definition Other.h:2291
Definition UE.h:589
UClass *& ClassPrivateField()
Definition UE.h:191
void GetPathName(const UObject *StopOuter, FString *ResultString)
Definition UE.h:394
Definition UE.h:432
int & TargetingTeamField()
Definition Actor.h:120
UPrimalGameData *& PrimalGameDataField()
Definition GameMode.h:1158
UPrimalGameData *& PrimalGameDataOverrideField()
Definition GameMode.h:1159
FItemNetInfo * GetItemNetInfo(FItemNetInfo *result, bool bIsForSendingToClient)
Definition Inventory.h:529
FPrimalPlayerDataStruct * MyDataField()
Definition Actor.h:6226
static UObject * GetClassDefaultObject(UClass *FromClass)
Definition Other.h:74
TArray< TWeakObjectPtr< APlayerController >, TSizedDefaultAllocator< 32 > > & PlayerControllerListField()
Definition GameMode.h:516
APlayerController * GetFirstPlayerController()
Definition GameMode.h:743
AWorldSettings * GetWorldSettings(bool bCheckStreamingPersistent, bool bChecked)
Definition GameMode.h:750