Ark Server API 3.54
Serverside plugin support for Ark Survival Evolved.
Loading...
Searching...
No Matches
ArkApiUtils.h
Go to the documentation of this file.
1#pragma once
2
3#include <optional>
4
5#include <API/ARK/Ark.h>
6#include <../Private/Ark/Globals.h>
7
8namespace ArkApi
9{
10 enum class ServerStatus { Loading, Ready };
11
12 struct MapCoords
13 {
14 float x = 0.f;
15 float y = 0.f;
16 };
17
19 {
20 public:
21 virtual ~IApiUtils() = default;
22 //bool HideCommand = false;
26 virtual UWorld* GetWorld() const = 0;
27
32
36 virtual ServerStatus GetStatus() const = 0;
37
51 template <typename T, typename... Args>
52 FORCEINLINE void SendServerMessage(AShooterPlayerController* player_controller, FLinearColor msg_color, const T* msg,
53 Args&&... args)
54 {
55 if (player_controller)
56 {
57 FString text(FString::Format(msg, std::forward<Args>(args)...));
58 player_controller->ClientServerChatDirectMessage(&text, msg_color, false);
59 }
60 }
61
74 template <typename T, typename... Args>
75 FORCEINLINE void SendNotification(AShooterPlayerController* player_controller, FLinearColor color, float display_scale,
76 float display_time, UTexture2D* icon, const T* msg, Args&&... args)
77 {
78 if (player_controller)
79 {
80 FString text(FString::Format(msg, std::forward<Args>(args)...));
81
82 player_controller->ClientServerSOTFNotificationCustom(&text, color, display_scale, display_time, icon,
83 nullptr);
84 }
85 }
86
96 template <typename T, typename... Args>
97 FORCEINLINE void SendChatMessage(AShooterPlayerController* player_controller, const FString& sender_name, const T* msg,
98 Args&&... args)
99 {
100 if (player_controller)
101 {
102 const FString text(FString::Format(msg, std::forward<Args>(args)...));
103
104 FChatMessage chat_message = FChatMessage();
105 chat_message.SenderName = sender_name;
106 chat_message.Message = text;
107
108 player_controller->ClientChatMessage(chat_message);
109 }
110 }
111
120 template <typename T, typename... Args>
121 FORCEINLINE void SendServerMessageToAll(FLinearColor msg_color, const T* msg,
122 Args&&... args)
123 {
124 FString text(FString::Format(msg, std::forward<Args>(args)...));
125
126 const auto& player_controllers = GetWorld()->PlayerControllerListField();
127 for (TWeakObjectPtr<APlayerController> player_controller : player_controllers)
128 {
129 AShooterPlayerController* shooter_pc = static_cast<AShooterPlayerController*>(player_controller.Get());
130 if (shooter_pc)
131 {
132 shooter_pc->ClientServerChatDirectMessage(&text, msg_color, false);
133 }
134 }
135 }
136
148 template <typename T, typename... Args>
149 FORCEINLINE void SendNotificationToAll(FLinearColor color, float display_scale,
150 float display_time, UTexture2D* icon, const T* msg, Args&&... args)
151 {
152 FString text(FString::Format(msg, std::forward<Args>(args)...));
153
154 const auto& player_controllers = GetWorld()->PlayerControllerListField();
155 for (TWeakObjectPtr<APlayerController> player_controller : player_controllers)
156 {
157 AShooterPlayerController* shooter_pc = static_cast<AShooterPlayerController*>(player_controller.Get());
158 if (shooter_pc)
159 {
160 shooter_pc->
161 ClientServerSOTFNotificationCustom(&text, color, display_scale, display_time, icon, nullptr);
162 }
163 }
164 }
165
174 template <typename T, typename... Args>
175 FORCEINLINE void SendChatMessageToAll(const FString& sender_name, const T* msg, Args&&... args)
176 {
177 const FString text(FString::Format(msg, std::forward<Args>(args)...));
178
179 FChatMessage chat_message = FChatMessage();
180 chat_message.SenderName = sender_name;
181 chat_message.Message = text;
182
183 const auto& player_controllers = GetWorld()->PlayerControllerListField();
184 for (TWeakObjectPtr<APlayerController> player_controller : player_controllers)
185 {
186 AShooterPlayerController* shooter_pc = static_cast<AShooterPlayerController*>(player_controller.Get());
187 if (shooter_pc)
188 {
189 shooter_pc->ClientChatMessage(chat_message);
190 }
191 }
192 }
193
197 static FORCEINLINE uint64 GetSteamIdFromController(AController* controller)
198 {
199 uint64 steam_id = 0;
200
201 AShooterPlayerController* playerController = static_cast<AShooterPlayerController*>(controller);
202 if (playerController != nullptr)
203 {
204 steam_id = playerController->GetUniqueNetIdAsUINT64();
205 }
206
207 return steam_id;
208 }
209
215 FORCEINLINE AShooterPlayerController* FindPlayerFromSteamName(const FString& steam_name) const
216 {
217 AShooterPlayerController* result = nullptr;
218
219 const auto& player_controllers = GetWorld()->PlayerControllerListField();
220 for (TWeakObjectPtr<APlayerController> player_controller : player_controllers)
221 {
222 const FString current_name = player_controller->PlayerStateField()->PlayerNameField();
223 if (current_name == steam_name)
224 {
225 auto* shooter_pc = static_cast<AShooterPlayerController*>(player_controller.Get());
226
227 result = shooter_pc;
228 break;
229 }
230 }
231
232 return result;
233 }
234
241 {
242 AShooterPlayerController* result = nullptr;
243
244 if (character != nullptr
245 && !character->IsDead())
246 {
247 result = (character->GetOwnerController()) ?
248 static_cast<AShooterPlayerController*>(character->GetOwnerController())
249 :
250 static_cast<AShooterPlayerController*>(character->GetInstigatorController());
251 }
252
253 return result;
254 }
255
264 ESearchCase::Type search,
265 bool full_match) const
266 {
268
269 const auto& player_controllers = GetWorld()->PlayerControllerListField();
270 for (TWeakObjectPtr<APlayerController> player_controller : player_controllers)
271 {
272 auto* shooter_player = static_cast<AShooterPlayerController*>(player_controller.Get());
273 FString char_name = GetCharacterName(shooter_player);
274
275 if (!char_name.IsEmpty() && (full_match
276 ? char_name.Equals(character_name, search)
277 : char_name.StartsWith(character_name, search)))
278 {
279 found_players.Add(shooter_player);
280 }
281 }
282
283 return found_players;
284 }
285
290 static FORCEINLINE FString GetCharacterName(AShooterPlayerController* player_controller)
291 {
292 if (player_controller != nullptr)
293 {
294 FString player_name("");
295 player_controller->GetPlayerCharacterName(&player_name);
296 return player_name;
297 }
298
299 return FString("");
300 }
301
306 static FORCEINLINE FString GetSteamName(AController* player_controller)
307 {
308 return player_controller != nullptr ? player_controller->PlayerStateField()->PlayerNameField() : "";
309 }
310
317 {
318 return FindPlayerFromSteamId_Internal(steam_id);
319 }
320
332 FORCEINLINE bool SpawnDrop(const wchar_t* blueprint, FVector pos, int amount, float item_quality = 0.0f,
333 bool force_blueprint = false, float life_span = 0.0f) const
334 {
335 APlayerController* player = GetWorld()->GetFirstPlayerController();
336 if (!player)
337 {
338 return false;
339 }
340
341 UObject* object = Globals::
342 StaticLoadObject(UObject::StaticClass(), nullptr, blueprint, nullptr, 0, 0, true);
343 if (!object)
344 {
345 return false;
346 }
347
348 TSubclassOf<UPrimalItem> archetype;
349 archetype.uClass = reinterpret_cast<UClass*>(object);
350
351 UPrimalItem* item = UPrimalItem::AddNewItem(archetype, nullptr, false, false, item_quality, false, amount,
352 force_blueprint, 0, false, nullptr, 0, 0, 0);
353 if (!item)
354 {
355 return false;
356 }
357
358 FItemNetInfo* info = static_cast<FItemNetInfo*>(FMemory::Malloc(0x400));
359 RtlSecureZeroMemory(info, 0x400);
360
361 item->GetItemNetInfo(info, false);
362
363 TSubclassOf<ADroppedItem> archetype_dropped;
364 archetype_dropped.uClass = reinterpret_cast<UClass*>(object);
365
366 FVector zero_vector{ 0, 0, 0 };
367 FRotator rot{ 0, 0, 0 };
368
369 UPrimalInventoryComponent::StaticDropItem(player, info, archetype_dropped, &rot, true, &pos, &rot, true,
370 false, false, true, nullptr, &zero_vector, nullptr, life_span);
371
372 FMemory::Free(info);
373
374 return true;
375 }
376
387 FORCEINLINE APrimalDinoCharacter* SpawnDino(AShooterPlayerController* player, FString blueprint, FVector* location, int lvl,
388 bool force_tame, bool neutered) const
389 {
390 if (player == nullptr)
391 {
392 player = static_cast<AShooterPlayerController*>(GetWorld()->GetFirstPlayerController());
393 if (player == nullptr)
394 {
395 return nullptr;
396 }
397 }
398
399 AActor* actor = player->SpawnActor(&blueprint, 100, 0, 0, true);
400 if (actor != nullptr && actor->IsA(APrimalDinoCharacter::GetPrivateStaticClass()))
401 {
402 auto* dino = static_cast<APrimalDinoCharacter*>(actor);
403
404 if (location != nullptr && !location->IsZero())
405 {
406 FRotator rotation{ 0, 0, 0 };
407 dino->TeleportTo(location, &rotation, true, false);
408 }
409
410 if (force_tame)
411 {
412 dino->TamingTeamIDField() = player->TargetingTeamField();
413
414 auto* state = static_cast<AShooterPlayerState*>(player->PlayerStateField());
415
416 FString player_name;
417 state->GetPlayerName(&player_name);
418
419 dino->TamerStringField() = player_name;
420
421 state->SetTribeTamingDinoSettings(dino);
422
423 dino->TameDino(player, true, 0, true, true, false);
424 }
425
426 if (neutered)
427 {
428 dino->DoNeuter_Implementation();
429 }
430
431 dino->AbsoluteBaseLevelField() = lvl;
432
433 dino->BeginPlay();
434
435 return dino;
436 }
437
438 return nullptr;
439 }
440
445 static FORCEINLINE bool IsRidingDino(AShooterPlayerController* player_controller)
446 {
447 return player_controller != nullptr && player_controller->GetPlayerCharacter() != nullptr
448 && player_controller->GetPlayerCharacter()->GetRidingDino() != nullptr;
449 }
450
456 static FORCEINLINE APrimalDinoCharacter* GetRidingDino(AShooterPlayerController* player_controller)
457 {
458 return player_controller != nullptr && player_controller->GetPlayerCharacter() != nullptr
459 ? player_controller->GetPlayerCharacter()->GetRidingDino()
460 : nullptr;
461 }
462
468 static FORCEINLINE FVector GetPosition(APlayerController* player_controller)
469 {
470 return player_controller != nullptr ? player_controller->DefaultActorLocationField() : FVector{ 0, 0, 0 };
471 }
472
480 static FORCEINLINE std::optional<FString> TeleportToPlayer(AShooterPlayerController* me, AShooterPlayerController* him,
481 bool check_for_dino, float max_dist)
482 {
483 if (!(me != nullptr && him != nullptr && me->GetPlayerCharacter() != nullptr && him->
484 GetPlayerCharacter()
485 != nullptr
486 && !me->GetPlayerCharacter()->IsDead() && !him->GetPlayerCharacter()->IsDead())
487 )
488 {
489 return "One of players is dead";
490 }
491
492 if (check_for_dino && (IsRidingDino(me) || IsRidingDino(him)))
493 {
494 return "One of players is riding a dino";
495 }
496
497 if (max_dist != -1 && FVector::Distance(GetPosition(me), GetPosition(him)) > max_dist)
498 {
499 return "Person is too far away";
500 }
501
502 const FVector pos = him->DefaultActorLocationField();
503
504 me->SetPlayerPos(pos.X, pos.Y, pos.Z);
505
506 return {};
507 }
508
514 static FORCEINLINE bool TeleportToPos(AShooterPlayerController* player_controller, const FVector& pos)
515 {
516 if (player_controller != nullptr && !IsPlayerDead(player_controller))
517 {
518 player_controller->SetPlayerPos(pos.X, pos.Y, pos.Z);
519 return true;
520 }
521
522 return false;
523 }
524
531 static FORCEINLINE int GetInventoryItemCount(AShooterPlayerController* player_controller, const FString& item_name)
532 {
533 if (player_controller == nullptr)
534 {
535 return -1;
536 }
537
538 UPrimalInventoryComponent* inventory_component =
539 player_controller->GetPlayerCharacter()->MyInventoryComponentField();
540 if (inventory_component == nullptr)
541 {
542 return -1;
543 }
544
545 FString name;
546 int item_count = 0;
547
548 for (UPrimalItem* item : inventory_component->InventoryItemsField())
549 {
550 item->GetItemName(&name, true, false, nullptr);
551
552 if (name.Equals(item_name, ESearchCase::IgnoreCase))
553 {
554 item_count += item->GetItemQuantity();
555 }
556 }
557
558 return item_count;
559 }
560
565 {
566 return player && player->GetNetConnection() && !player->GetNetConnection()->ClientGivenIPField().IsEmpty() ? player->GetNetConnection()->ClientGivenIPField() : "";
567 }
568
572 static FORCEINLINE FString GetItemBlueprint(UPrimalItem* item)
573 {
574 return GetBlueprint(item);
575 }
576
580 static FORCEINLINE bool IsPlayerDead(AShooterPlayerController* player)
581 {
582 if (player == nullptr || player->GetPlayerCharacter() == nullptr)
583 {
584 return true;
585 }
586
587 return player->GetPlayerCharacter()->IsDead();
588 }
589
590 static FORCEINLINE uint64 GetPlayerID(APrimalCharacter* character)
591 {
592 auto* shooter_character = static_cast<AShooterCharacter*>(character);
593 return shooter_character != nullptr && shooter_character->GetPlayerData() != nullptr
594 ? shooter_character->GetPlayerData()->MyDataField()->PlayerDataIDField()
595 : -1;
596 }
597
598 static FORCEINLINE uint64 GetPlayerID(AController* controller)
599 {
600 auto* player = static_cast<AShooterPlayerController*>(controller);
601 return player != nullptr ? player->LinkedPlayerIDField() : 0;
602 }
603
604 FORCEINLINE uint64 GetSteamIDForPlayerID(int player_id) const
605 {
606 uint64 steam_id = GetShooterGameMode()->GetSteamIDForPlayerID(player_id);
607 if (steam_id == 0)
608 {
609 const auto& player_controllers = GetWorld()->PlayerControllerListField();
610 for (TWeakObjectPtr<APlayerController> player_controller : player_controllers)
611 {
612 auto* shooter_pc = static_cast<AShooterPlayerController*>(player_controller.Get());
613 if (shooter_pc != nullptr && shooter_pc->LinkedPlayerIDField() == player_id)
614 {
615 steam_id = shooter_pc->GetUniqueNetIdAsUINT64();
616 break;
617 }
618 }
619
620 GetShooterGameMode()->AddPlayerID(player_id, steam_id);
621 }
622
623 return steam_id;
624 }
625
629 static FORCEINLINE FString GetBlueprint(UObjectBase* object)
630 {
631 if (object != nullptr && object->ClassField() != nullptr)
632 {
633 return GetClassBlueprint(object->ClassField());
634 }
635
636 return FString("");
637 }
638
642 static FORCEINLINE FString GetClassBlueprint(UClass* the_class)
643 {
644 if (the_class != nullptr)
645 {
646 FString path;
648 return "Blueprint'" + path.LeftChop(2) + "'";
649 }
650
651 return FString("");
652 }
653
658 {
659 return static_cast<AShooterGameState*>(GetWorld()->GameStateField());
660 }
661
666 {
667 if (!SPC) return nullptr;
668
669 UCheatManager* cheat = SPC->CheatManagerField();
670
671 if (cheat)
672 {
673 return static_cast<UShooterCheatManager*>(cheat);
674 }
675
676 return nullptr;
677 }
678
682 static FORCEINLINE int GetTribeID(AShooterPlayerController* player_controller)
683 {
684 int team = 0;
685
686 if (player_controller)
687 {
688 team = player_controller->TargetingTeamField();
689 }
690
691 return team;
692 }
693
697 static FORCEINLINE int GetTribeID(AShooterCharacter* player_character)
698 {
699 int team = 0;
700
701 if (player_character)
702 {
703 team = player_character->TargetingTeamField();
704 }
705
706 return team;
707 }
708
713 {
714 UPrimalGlobals* singleton = static_cast<UPrimalGlobals*>(Globals::GEngine()()->GameSingletonField());
715 return (singleton->PrimalGameDataOverrideField() != nullptr) ? singleton->PrimalGameDataOverrideField() : singleton->PrimalGameDataField();
716 }
717
721 FORCEINLINE TArray<AActor*> GetAllActorsInRange(FVector location, float radius, EServerOctreeGroup::Type ActorType)
722 {
723 TArray<AActor*> out_actors;
724
725 UVictoryCore::ServerOctreeOverlapActors(&out_actors, GetWorld(), location, radius, ActorType, true);
726
727 return out_actors;
728 }
729
733 FORCEINLINE TArray<AActor*> GetAllActorsInRange(FVector location, float radius, EServerOctreeGroup::Type ActorType, TArray<AActor*> ignores)
734 {
735 TArray<AActor*> out_actors;
736
737 UVictoryCore::ServerOctreeOverlapActors(&out_actors, GetWorld(), location, radius, ActorType, true);
738
739 for (AActor* ignore : ignores)
740 out_actors.Remove(ignore);
741
742 return out_actors;
743 }
744
748 FORCEINLINE MapCoords FVectorToCoords(FVector actor_position)
749 {
750 AWorldSettings* world_settings = GetWorld()->GetWorldSettings(false, true);
751 APrimalWorldSettings* p_world_settings = static_cast<APrimalWorldSettings*>(world_settings);
752 MapCoords coords;
753
754 float lat_scale = p_world_settings->LatitudeScaleField() != 0 ? p_world_settings->LatitudeScaleField() : 800.0f;
755 float lon_scale = p_world_settings->LongitudeScaleField() != 0 ? p_world_settings->LongitudeScaleField() : 800.0f;
756
757 float lat_origin = p_world_settings->LatitudeOriginField() != 0 ? p_world_settings->LatitudeOriginField() : -400000.0f;
758 float lon_origin = p_world_settings->LongitudeOriginField() != 0 ? p_world_settings->LongitudeOriginField() : -400000.0f;
759
760 float lat_div = 100.f / lat_scale;
761 float lat = (lat_div * actor_position.Y + lat_div * abs(lat_origin)) / 1000.f;
762
763 float lon_div = 100.f / lon_scale;
764 float lon = (lon_div * actor_position.X + lon_div * abs(lon_origin)) / 1000.f;
765
766 coords.x = std::floor(lon * 10.0f) / 10.0f;
767 coords.y = std::floor(lat * 10.0f) / 10.0f;
768
769 return coords;
770 }
771
776 FORCEINLINE uint64 GetAttackerSteamID(AActor* target, AController* killer, AActor* damage_causer, bool tribe_check = true)
777 {
778 uint64 steam_id = NULL;
779
780 if (target)
781 {
782 if (killer && !killer->IsLocalController() && killer->IsA(AShooterPlayerController::GetPrivateStaticClass())
783 && (!tribe_check || (tribe_check && target->TargetingTeamField() != killer->TargetingTeamField())))
784 steam_id = GetSteamIdFromController(static_cast<AShooterPlayerController*>(killer));
785 else if (damage_causer && (!tribe_check || (tribe_check && target->TargetingTeamField() != damage_causer->TargetingTeamField()))
786 && damage_causer->IsA(APrimalStructureExplosive::StaticClass()))
787 {
788 APrimalStructureExplosive* explosive = static_cast<APrimalStructureExplosive*>(damage_causer);
789 steam_id = GetSteamIDForPlayerID(explosive->ConstructorPlayerDataIDField());
790 }
791 }
792
793 return steam_id;
794 }
795
797 {
798 FString result;
799 HideCommand = true;
800 _this->ConsoleCommand(&result, Command, false);
801 HideCommand = false;
802 }
803 private:
805 };
806
807 ARK_API IApiUtils& APIENTRY GetApiUtils();
808} // namespace ArkApi
#define ARK_API
Definition: Base.h:9
FPlatformTypes::uint64 uint64
A 64-bit unsigned integer.
Definition: BasicTypes.h:102
bool HideCommand
Definition: Globals.h:3
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:52
static FORCEINLINE uint64 GetSteamIdFromController(AController *controller)
Returns Steam ID from player controller.
Definition: ArkApiUtils.h:197
static FORCEINLINE FString GetItemBlueprint(UPrimalItem *item)
Returns blueprint from UPrimalItem.
Definition: ArkApiUtils.h:572
static FORCEINLINE FString GetClassBlueprint(UClass *the_class)
Returns blueprint path from any UClass.
Definition: ArkApiUtils.h:642
FORCEINLINE TArray< AShooterPlayerController * > FindPlayerFromCharacterName(const FString &character_name, ESearchCase::Type search, bool full_match) const
Finds all matching players from the given character name.
Definition: ArkApiUtils.h:263
static FORCEINLINE int GetInventoryItemCount(AShooterPlayerController *player_controller, const FString &item_name)
Counts a specific items quantity.
Definition: ArkApiUtils.h:531
static FORCEINLINE uint64 GetPlayerID(APrimalCharacter *character)
Definition: ArkApiUtils.h:590
virtual UShooterCheatManager * GetCheatManager() const =0
Returns a point to URCON CheatManager.
static FORCEINLINE int GetTribeID(AShooterCharacter *player_character)
Get Tribe ID of character.
Definition: ArkApiUtils.h:697
void RunHiddenCommand(AShooterPlayerController *_this, FString *Command)
Definition: ArkApiUtils.h:796
static FORCEINLINE uint64 GetPlayerID(AController *controller)
Definition: ArkApiUtils.h:598
static FORCEINLINE bool IsPlayerDead(AShooterPlayerController *player)
Returns true if player is dead, false otherwise.
Definition: ArkApiUtils.h:580
virtual ~IApiUtils()=default
FORCEINLINE uint64 GetAttackerSteamID(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
Definition: ArkApiUtils.h:776
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:97
static FORCEINLINE std::optional< FString > TeleportToPlayer(AShooterPlayerController *me, AShooterPlayerController *him, bool check_for_dino, float max_dist)
Teleport one player to another.
Definition: ArkApiUtils.h:480
FORCEINLINE MapCoords FVectorToCoords(FVector actor_position)
Converts FVector into coords that are displayed when you view the ingame map.
Definition: ArkApiUtils.h:748
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.
Definition: ArkApiUtils.h:387
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.
Definition: ArkApiUtils.h:332
FORCEINLINE void SendChatMessageToAll(const FString &sender_name, const T *msg, Args &&... args)
Sends chat message to all players. Using fmt::format.
Definition: ArkApiUtils.h:175
static FORCEINLINE APrimalDinoCharacter * GetRidingDino(AShooterPlayerController *player_controller)
Returns the dino the character is riding.
Definition: ArkApiUtils.h:456
static FORCEINLINE FString GetSteamName(AController *player_controller)
Returns the steam name of player.
Definition: ArkApiUtils.h:306
static FORCEINLINE FVector GetPosition(APlayerController *player_controller)
Returns the position of a player.
Definition: ArkApiUtils.h:468
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.
Definition: ArkApiUtils.h:149
static FORCEINLINE FString GetBlueprint(UObjectBase *object)
Returns blueprint path from any UObject.
Definition: ArkApiUtils.h:629
FORCEINLINE TArray< AActor * > GetAllActorsInRange(FVector location, float radius, EServerOctreeGroup::Type ActorType)
Gets all actors in radius at location.
Definition: ArkApiUtils.h:721
FORCEINLINE AShooterPlayerController * FindControllerFromCharacter(AShooterCharacter *character) const
Finds player controller from the given player character.
Definition: ArkApiUtils.h:240
static FORCEINLINE int GetTribeID(AShooterPlayerController *player_controller)
Get Tribe ID of player controller.
Definition: ArkApiUtils.h:682
static FORCEINLINE bool IsRidingDino(AShooterPlayerController *player_controller)
Returns true if character is riding a dino, false otherwise.
Definition: ArkApiUtils.h:445
FORCEINLINE uint64 GetSteamIDForPlayerID(int player_id) const
Definition: ArkApiUtils.h:604
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:75
static FORCEINLINE FString GetIPAddress(AShooterPlayerController *player)
Returns IP address of player.
Definition: ArkApiUtils.h:564
FORCEINLINE UPrimalGameData * GetGameData()
Returns pointer to Primal Game Data.
Definition: ArkApiUtils.h:712
virtual AShooterGameMode * GetShooterGameMode() const =0
Returns a pointer to AShooterGameMode.
virtual UWorld * GetWorld() const =0
Returns a pointer to UWorld.
static FORCEINLINE FString GetCharacterName(AShooterPlayerController *player_controller)
Returns the character name of player.
Definition: ArkApiUtils.h:290
FORCEINLINE AShooterPlayerController * FindPlayerFromSteamName(const FString &steam_name) const
Finds player from the given steam name.
Definition: ArkApiUtils.h:215
static FORCEINLINE bool TeleportToPos(AShooterPlayerController *player_controller, const FVector &pos)
Teleports player to the given position.
Definition: ArkApiUtils.h:514
virtual AShooterPlayerController * FindPlayerFromSteamId_Internal(uint64 steam_id) const =0
FORCEINLINE void SendServerMessageToAll(FLinearColor msg_color, const T *msg, Args &&... args)
Sends server message to all players. Using fmt::format.
Definition: ArkApiUtils.h:121
FORCEINLINE TArray< AActor * > GetAllActorsInRange(FVector location, float radius, EServerOctreeGroup::Type ActorType, TArray< AActor * > ignores)
Gets all actors in radius at location, with ignore actors.
Definition: ArkApiUtils.h:733
FORCEINLINE AShooterPlayerController * FindPlayerFromSteamId(uint64 steam_id) const
Finds player from the given steam id.
Definition: ArkApiUtils.h:316
static FORCEINLINE UShooterCheatManager * GetCheatManagerByPC(AShooterPlayerController *SPC)
Get UShooterCheatManager* of player controller.
Definition: ArkApiUtils.h:665
virtual ServerStatus GetStatus() const =0
Returns the current server status.
FORCEINLINE AShooterGameState * GetGameState()
Get Shooter Game State.
Definition: ArkApiUtils.h:657
FORCEINLINE FString LeftChop(int32 Count) const
Definition: FString.h:1081
bool StartsWith(const TCHAR *InSuffix, ESearchCase::Type SearchCase=ESearchCase::IgnoreCase) const
Definition: FString.h:2131
FORCEINLINE bool Equals(const FString &Other, ESearchCase::Type SearchCase=ESearchCase::CaseSensitive) const
Definition: FString.h:1221
FORCEINLINE bool IsEmpty() const
Definition: FString.h:241
static FString Format(const T *format, Args &&... args)
Formats text using fmt::format.
Definition: FString.h:1633
Definition: TArray.h:268
int32 Remove(const ElementType &Item)
Definition: TArray.h:1709
FORCEINLINE int32 Add(ElementType &&Item)
Definition: TArray.h:1555
ServerStatus
Definition: ArkApiUtils.h:10
IApiUtils & GetApiUtils()
Definition: ApiUtils.cpp:99
@ IgnoreCase
Definition: FString.h:31
Definition: Actor.h:784
AController * GetInstigatorController()
Definition: Actor.h:1031
AWorldSettings * GetWorldSettings()
Definition: Actor.h:1083
FVector & DefaultActorLocationField()
Definition: Actor.h:840
int & TargetingTeamField()
Definition: Actor.h:822
APlayerState * PlayerStateField()
Definition: Actor.h:1927
bool IsLocalController()
Definition: Actor.h:1940
APlayerController * GetOwnerController()
Definition: Actor.h:1322
UCheatManager * CheatManagerField()
Definition: Actor.h:1994
UNetConnection * GetNetConnection()
Definition: Actor.h:2065
FString & PlayerNameField()
Definition: Actor.h:1686
UPrimalInventoryComponent * MyInventoryComponentField()
Definition: Actor.h:3621
bool IsDead()
Definition: Actor.h:3952
static UClass * GetPrivateStaticClass()
Definition: Actor.h:6470
unsigned int & ConstructorPlayerDataIDField()
static UClass * StaticClass()
float & LongitudeOriginField()
Definition: Actor.h:8506
float & LatitudeOriginField()
Definition: Actor.h:8507
float & LongitudeScaleField()
Definition: Actor.h:8504
float & LatitudeScaleField()
Definition: Actor.h:8505
UPrimalPlayerData * GetPlayerData()
Definition: Actor.h:4855
APrimalDinoCharacter * GetRidingDino()
Definition: Actor.h:4969
FString * ConsoleCommand(FString *result, FString *Command, bool bWriteToLog)
Definition: Actor.h:2976
__int64 & LinkedPlayerIDField()
Definition: Actor.h:2379
unsigned __int64 GetUniqueNetIdAsUINT64()
Definition: Actor.h:2777
void ClientServerChatDirectMessage(FString *MessageText, FLinearColor MessageColor, bool bIsBold)
Definition: Actor.h:3207
FString * GetPlayerCharacterName(FString *result)
Definition: Actor.h:3019
static UClass * GetPrivateStaticClass()
Definition: Actor.h:2528
void SetPlayerPos(float X, float Y, float Z)
Definition: Actor.h:2865
void ClientChatMessage(FChatMessage Chat)
Definition: Actor.h:3147
AActor * SpawnActor(FString *blueprintPath, float spawnDistance, float spawnYOffset, float ZOffset, bool bDoDeferBeginPlay)
Definition: Actor.h:2770
AShooterCharacter * GetPlayerCharacter()
Definition: Actor.h:2729
void ClientServerSOTFNotificationCustom(FString *MessageText, FLinearColor MessageColor, float DisplayScale, float DisplayTime, UTexture2D *MessageIcon, USoundBase *SoundToPlay)
Definition: Actor.h:3211
FString SenderName
Definition: Actor.h:10
FString Message
Definition: Actor.h:14
static void Free(void *Original)
Definition: UnrealMemory.h:112
static void * Malloc(SIZE_T Count, uint32 Alignment=DEFAULT_ALIGNMENT)
Definition: UnrealMemory.h:105
unsigned __int64 & PlayerDataIDField()
Definition: Actor.h:5171
Definition: Vector.h:23
float X
Definition: Vector.h:27
float Y
Definition: Vector.h:30
bool IsZero() const
Definition: Vector.h:1339
float Z
Definition: Vector.h:33
static FORCEINLINE float Distance(const FVector &V1, const FVector &V2)
Definition: Vector.h:741
static UObject * StaticLoadObject(UClass *ObjectClass, UObject *InOuter, const wchar_t *InName, const wchar_t *Filename, unsigned int LoadFlags, DWORD64 Sandbox, bool bAllowObjectReconciliation)
Definition: UE.h:631
static DataValue< UEngine * > GEngine()
Definition: UE.h:676
UClass * uClass
Definition: UE.h:226
Definition: UE.h:399
FString & ClientGivenIPField()
Definition: Actor.h:1678
bool IsA(UClass *SomeBase)
Definition: UE.h:299
Definition: UE.h:306
static UClass * StaticClass()
Definition: UE.h:308
UPrimalGameData * PrimalGameDataOverrideField()
Definition: GameMode.h:512
UPrimalGameData * PrimalGameDataField()
Definition: GameMode.h:511
TArray< UPrimalItem * > InventoryItemsField()
Definition: Inventory.h:208
static ADroppedItem * StaticDropItem(AActor *forActor, FItemNetInfo *theInfo, TSubclassOf< ADroppedItem > TheDroppedTemplateOverride, FRotator *DroppedRotationOffset, bool bOverrideSpawnTransform, FVector *LocationOverride, FRotator *RotationOverride, bool bPreventDropImpulse, bool bThrow, bool bSecondryAction, bool bSetItemDropLocation, UStaticMesh *DroppedMeshOverride, FVector *DroppedScaleOverride, UMaterialInterface *DroppedMaterialOverride, float DroppedLifeSpanOverride)
Definition: Inventory.h:415
static UPrimalItem * AddNewItem(TSubclassOf< UPrimalItem > ItemArchetype, UPrimalInventoryComponent *GiveToInventory, bool bEquipItem, bool bDontStack, float ItemQuality, bool bForceNoBlueprint, int quantityOverride, bool bForceBlueprint, float MaxItemDifficultyClamp, bool CreateOnClient, TSubclassOf< UPrimalItem > ApplyItemSkin, float MinRandomQuality, bool clampStats, bool bIgnoreAbsolueMaxInventory)
Definition: Inventory.h:1082
FItemNetInfo * GetItemNetInfo(FItemNetInfo *result, bool bIsForSendingToClient)
Definition: Inventory.h:1067
FPrimalPlayerDataStruct * MyDataField()
Definition: Actor.h:5206
Definition: UE.h:822
static TArray< AActor * > * ServerOctreeOverlapActors(TArray< AActor * > *result, UWorld *theWorld, FVector AtLoc, float Radius, EServerOctreeGroup::Type OctreeType, bool bForceActorLocationDistanceCheck)
Definition: Other.h:432
static FString * ClassToStringReference(FString *result, TSubclassOf< UObject > obj)
Definition: Other.h:527