Ark Server API (ASE) - Wiki
Loading...
Searching...
No Matches
AtlasApiUtils.h
Go to the documentation of this file.
1#pragma once
2
3#include <optional>
4
5#include <API/Atlas/Atlas.h>
6
7namespace ArkApi
8{
9 enum class ServerStatus { Loading, Ready };
10
12 {
13 public:
14 virtual ~IApiUtils() = default;
15
16 /**
17 * \brief Returns a pointer to UWorld
18 */
19 virtual UWorld* GetWorld() const = 0;
20
21 /**
22 * \brief Returns a pointer to AShooterGameMode
23 */
25
26 /**
27 * \brief Returns the current server status
28 */
29 virtual ServerStatus GetStatus() const = 0;
30
31 /**
32 * \brief Returns a point to URCON CheatManager
33 */
35 /**
36 * \brief Sends server message to the specific player. Using fmt::format.
37 * \tparam T Either a a char or wchar_t
38 * \tparam Args Optional arguments types
39 * \param player_controller Player
40 * \param msg_color Message color
41 * \param msg Message
42 * \param args Optional arguments
43 */
44 template <typename T, typename... Args>
45 void SendServerMessage(AShooterPlayerController* player_controller, FLinearColor msg_color, const T* msg,
46 Args&&... args)
47 {
49 {
52 }
53 }
54
55 /**
56 * \brief Sends notification (on-screen message) to the specific player. Using fmt::format.
57 * \tparam T Either a a char or wchar_t
58 * \tparam Args Optional arguments types
59 * \param player_controller Player
60 * \param color Message color
61 * \param display_scale Size of text
62 * \param display_time Display time
63 * \param icon Message icon (optional)
64 * \param msg Message
65 * \param args Optional arguments
66 */
67 template <typename T, typename... Args>
68 void SendNotification(AShooterPlayerController* player_controller, FLinearColor color, float display_scale,
69 float display_time, UTexture2D* icon, const T* msg, Args&&... args)
70 {
72 {
74
76 nullptr);
77 }
78 }
79
80 /**
81 * \brief Sends chat message to the specific player. Using fmt::format.
82 * \tparam T Either a a char or wchar_t
83 * \tparam Args Optional arguments types
84 * \param player_controller Player
85 * \param sender_name Name of the sender
86 * \param msg Message
87 * \param args Optional arguments
88 */
89 template <typename T, typename... Args>
90 void SendChatMessage(AShooterPlayerController* player_controller, const FString& sender_name, const T* msg,
91 Args&&... args)
92 {
94 {
96
100
102 }
103 }
104
105 /**
106 * \brief Sends server message to all players. Using fmt::format.
107 * \tparam T Either a a char or wchar_t
108 * \tparam Args Optional arguments types
109 * \param msg_color Message color
110 * \param msg Message
111 * \param args Optional arguments
112 */
113 template <typename T, typename... Args>
114 void SendServerMessageToAll(FLinearColor msg_color, const T* msg,
115 Args&&... args)
116 {
118
121 {
123 if (shooter_pc)
124 {
126 }
127 }
128 }
129
130 /**
131 * \brief Sends notification (on-screen message) to all players. Using fmt::format.
132 * \tparam T Either a a char or wchar_t
133 * \tparam Args Optional arguments types
134 * \param color Message color
135 * \param display_scale Size of text
136 * \param display_time Display time
137 * \param icon Message icon (optional)
138 * \param msg Message
139 * \param args Optional arguments
140 */
141 template <typename T, typename... Args>
142 void SendNotificationToAll(FLinearColor color, float display_scale,
143 float display_time, UTexture2D* icon, const T* msg, Args&&... args)
144 {
146
149 {
151 if (shooter_pc)
152 {
153 shooter_pc->
155 }
156 }
157 }
158
159 /**
160 * \brief Sends chat message to all players. Using fmt::format.
161 * \tparam T Either a a char or wchar_t
162 * \tparam Args Optional arguments types
163 * \param sender_name Name of the sender
164 * \param msg Message
165 * \param args Optional arguments
166 */
167 template <typename T, typename... Args>
168 void SendChatMessageToAll(const FString& sender_name, const T* msg, Args&&... args)
169 {
170 const FString text(FString::Format(msg, std::forward<Args>(args)...));
171
175
178 {
180 if (shooter_pc)
181 {
183 }
184 }
185 }
186
187 /**
188 * \brief Returns Steam ID from player controller
189 */
190 static uint64 GetSteamIdFromController(AController* controller)
191 {
192 uint64 steam_id = 0;
193
194 if (controller != nullptr)
195 {
196 APlayerState* player_state = controller->PlayerStateField();
197 if (player_state != nullptr)
198 {
199 auto* steam_net_id = static_cast<FUniqueNetIdString*>(player_state->UniqueIdField()
201
202 const FString steam_id_str = steam_net_id->UniqueNetIdStr;
203
204 try
205 {
206 steam_id = std::stoull(*steam_id_str);
207 }
208 catch (const std::exception&)
209 {
210 return 0;
211 }
212 }
213 }
214
215 return steam_id;
216 }
217
218 /**
219 * \brief Finds player from the given steam name
220 * \param steam_name Steam name
221 * \return Pointer to AShooterPlayerController
222 */
224 {
225 AShooterPlayerController* result = nullptr;
226
227 const auto& player_controllers = GetWorld()->PlayerControllerListField();
228 for (TWeakObjectPtr<APlayerController> player_controller : player_controllers)
229 {
230 const FString current_name = player_controller->PlayerStateField()->PlayerNameField();
231 if (current_name == steam_name)
232 {
233 auto* shooter_pc = static_cast<AShooterPlayerController*>(player_controller.Get());
234
235 result = shooter_pc;
236 break;
237 }
238 }
239
240 return result;
241 }
242
243 /**
244 * \brief Finds player controller from the given player character
245 * \param character Player character
246 * \return Pointer to AShooterPlayerController
247 */
249 {
250 AShooterPlayerController* result = nullptr;
251
252 const auto& player_controllers = GetWorld()->PlayerControllerListField();
253 for (TWeakObjectPtr<APlayerController> player_controller : player_controllers)
254 {
255 auto* shooter_pc = static_cast<AShooterPlayerController*>(player_controller.Get());
256
257 if (shooter_pc->GetPlayerCharacter() == character)
258 {
259 result = shooter_pc;
260 break;
261 }
262 }
263
264 return result;
265 }
266
267 /**
268 * \brief Finds all matching players from the given character name
269 * \param character_name Character name
270 * \param search Type Defaulted To ESearchCase::Type::IgnoreCase
271 * \param full_match Will match the full length of the string if true
272 * \return Array of AShooterPlayerController*
273 */
275 ESearchCase::Type search,
276 bool full_match) const
277 {
278 TArray<AShooterPlayerController*> found_players;
279
280 const auto& player_controllers = GetWorld()->PlayerControllerListField();
281 for (TWeakObjectPtr<APlayerController> player_controller : player_controllers)
282 {
283 auto* shooter_player = static_cast<AShooterPlayerController*>(player_controller.Get());
284 FString char_name = GetCharacterName(shooter_player);
285
286 if (!char_name.IsEmpty() && (full_match
287 ? char_name.Equals(character_name, search)
288 : char_name.StartsWith(character_name, search)))
289 {
290 found_players.Add(shooter_player);
291 }
292 }
293
294 return found_players;
295 }
296
297 /**
298 * \brief Returns the character name of player
299 * \param player_controller Player
300 */
301 static FString GetCharacterName(AShooterPlayerController* player_controller, bool include_first_name = true,
302 bool include_last_name = true)
303 {
304 auto* player_state = static_cast<AShooterPlayerState*>(player_controller->PlayerStateField());
305 if (player_state)
306 {
307 FString name;
308 player_state->GetPlayerName(&name);
309
310 if (include_first_name && include_last_name)
311 return name;
312
313 if (include_first_name)
314 {
315 int32 index = -1;
316 name.FindLastChar(' ', index);
317 return name.Mid(0, index - 1);
318 }
319
320 int32 index = -1;
321 name.FindLastChar(' ', index);
322 return name.Mid(index + 1, name.Len() - (index + 1));
323 }
324 return "";
325 }
326
327 /**
328 * \brief Returns the steam name of player
329 * \param player_controller Player
330 */
331 static FString GetSteamName(AController* player_controller)
332 {
333 return player_controller != nullptr ? player_controller->PlayerStateField()->PlayerNameField() : "";
334 }
335
336 /**
337 * \brief Finds player from the given steam id
338 * \param steam_id Steam id
339 * \return Pointer to AShooterPlayerController
340 */
342 {
344 }
345
346 /*bool SpawnDrop(const wchar_t* blueprint, FVector pos, int amount, float item_quality = 0.0f,
347 bool force_blueprint = false, float life_span = 0.0f) const
348 {
349 UObject* object = Globals::StaticLoadObject(UObject::StaticClass(), nullptr, blueprint, nullptr, 0, 0, true);
350 TSubclassOf<UPrimalItem> archetype;// (reinterpret_cast<UClass*>(object));
351 archetype.uClass = reinterpret_cast<UClass*>(object);
352 TSubclassOf<ADroppedItem> archetype_dropped;
353 archetype_dropped.uClass = reinterpret_cast<UClass*>(object);
354 APlayerController* player = GetWorld()->GetFirstPlayerController();
355 if (player)
356 {
357 FVector pos2{1, 1, 1};
358 FRotator rot{0, 0, 0};
359 UPrimalInventoryComponent::StaticDropNewItem(player, archetype, item_quality, false, amount, force_blueprint,
360 archetype_dropped, &rot,
361 true, &pos2, &rot, true, false, false, true, nullptr, pos2,
362 nullptr, life_span);
363 return true;
364 }
365 return false;
366 }*/
367
368 /**
369 * \brief Spawns a dino near player or at specific coordinates
370 * \param player Player. If null, random player will be chosen. At least one player should be on the map
371 * \param blueprint Blueprint path
372 * \param location Spawn position. If null, dino will be spawned near player
373 * \param lvl Level of the dino
374 * \param force_tame Force tame
375 * \param neutered Neuter dino
376 * \return Spawned dino or null
377 */
379 bool force_tame, bool neutered) const
380 {
381 if (player == nullptr)
382 {
384 if (player == nullptr)
385 {
386 return nullptr;
387 }
388 }
389
390 AActor* actor = player->SpawnActor(&blueprint, 100, 0, 0, true);
391 if (actor != nullptr && actor->IsA(APrimalDinoCharacter::GetPrivateStaticClass()))
392 {
393 auto* dino = static_cast<APrimalDinoCharacter*>(actor);
394
395 if (location != nullptr && !location->IsZero())
396 {
397 FRotator rotation{ 0, 0, 0 };
398 dino->TeleportTo(location, &rotation, true, false);
399 }
400
401 if (force_tame)
402 {
404
405 auto* state = static_cast<AShooterPlayerState*>(player->PlayerStateField());
406
407 FString player_name;
408 state->GetPlayerName(&player_name);
409
410 dino->TamerStringField() = player_name;
411
413
414 dino->TameDino(player, true, 0);
415 }
416
417 if (neutered)
418 {
420 }
421
423
424 dino->BeginPlay();
425
426 return dino;
427 }
428
429 return nullptr;
430 }
431
432 /**
433 * \brief Returns true if character is riding a dino, false otherwise
434 * \param player_controller Player
435 */
436 static bool IsRidingDino(AShooterPlayerController* player_controller)
437 {
438 return player_controller != nullptr && player_controller->GetPlayerCharacter() != nullptr
439 && player_controller->GetPlayerCharacter()->GetRidingDino() != nullptr;
440 }
441
442 /**
443 * \brief Returns the dino the character is riding
444 * \param player_controller Player
445 * \return APrimalDinoCharacter*
446 */
448 {
449 return player_controller != nullptr && player_controller->GetPlayerCharacter() != nullptr
451 : nullptr;
452 }
453
454 /**
455 * \brief Returns the position of a player
456 * \param player_controller Player
457 * \return FVector
458 */
459 static FVector GetPosition(APlayerController* player_controller)
460 {
461 FVector WorldPos{ 0, 0, 0 };
462 if (player_controller->RootComponentField())
463 player_controller
465 return WorldPos;
466 }
467
468 /**
469 * \brief Teleport one player to another
470 * \param me Player
471 * \param him Other Player
472 * \param check_for_dino If set true prevents players teleporting with dino's or teleporting to a player on a dino
473 * \param max_dist Is the max distance the characters can be away from each other -1 is disabled
474 */
476 bool check_for_dino, float max_dist)
477 {
478 if (!(me != nullptr && him != nullptr && me->GetPlayerCharacter() != nullptr && him->
480 != nullptr
482 )
483 {
484 return "One of players is dead";
485 }
486
487 if (check_for_dino && (IsRidingDino(me) || IsRidingDino(him)))
488 {
489 return "One of players is riding a dino";
490 }
491
492 if (max_dist != -1 && FVector::Distance(GetPosition(me), GetPosition(him)) > max_dist)
493 {
494 return "Person is too far away";
495 }
496
498
499 me->SetPlayerPos(pos.X, pos.Y, pos.Z);
500
501 return {};
502 }
503
504 /**
505 * \brief Teleports player to the given position
506 * \param player_controller Player
507 * \param pos New position
508 */
509 static bool TeleportToPos(AShooterPlayerController* player_controller, const FVector& pos)
510 {
511 if (player_controller != nullptr && !IsPlayerDead(player_controller))
512 {
513 player_controller->SetPlayerPos(pos.X, pos.Y, pos.Z);
514 return true;
515 }
516
517 return false;
518 }
519
520 /**
521 * \brief Counts a specific items quantity
522 * \param player_controller Player
523 * \param item_name The name of the item you want to count the quantity of
524 * \return On success, the function returns amount of items player has. Returns -1 if the function has failed.
525 */
526 static int GetInventoryItemCount(AShooterPlayerController* player_controller, const FString& item_name)
527 {
528 if (player_controller == nullptr)
529 {
530 return -1;
531 }
532
533 UPrimalInventoryComponent* inventory_component =
535 if (inventory_component == nullptr)
536 {
537 return -1;
538 }
539
540 FString name;
541 int item_count = 0;
542
543 for (UPrimalItem* item : inventory_component->InventoryItemsField())
544 {
545 item->GetItemName(&name, true, false, nullptr);
546
547 if (name.Equals(item_name, ESearchCase::IgnoreCase))
548 {
549 item_count += item->GetItemQuantity();
550 }
551 }
552
553 return item_count;
554 }
555
556 /**
557 * \brief Returns IP address of player
558 */
560 {
561 FString ip_address;
562 player_controller->GetPlayerNetworkAddress(&ip_address);
563 return ip_address;
564 }
565
566 /**
567 * \brief Returns blueprint from UPrimalItem
568 */
569 static FORCEINLINE FString GetItemBlueprint(UPrimalItem* item)
570 {
571 if (item != nullptr)
572 {
573 return GetBlueprint(item);
574 }
575
576 return FString("");
577 }
578
579 /**
580 * \brief Returns true if player is dead, false otherwise
581 */
583 {
584 if (player == nullptr || player->GetPlayerCharacter() == nullptr)
585 {
586 return true;
587 }
588
590 }
591
592 static uint64 GetPlayerID(APrimalCharacter* character)
593 {
594 auto* shooter_character = static_cast<AShooterCharacter*>(character);
595 return shooter_character != nullptr && shooter_character->GetPlayerData() != nullptr
597 : -1;
598 }
599
600 static uint64 GetPlayerID(AController* controller)
601 {
602 auto* player = static_cast<AShooterPlayerController*>(controller);
603 return player != nullptr ? player->LinkedPlayerIDField() : 0;
604 }
605
606 uint64 GetSteamIDForPlayerID(int player_id) const
607 {
608 uint64 steam_id = GetShooterGameMode()->GetSteamIDForPlayerID(player_id);
609 if (steam_id == 0)
610 {
611 const auto& player_controllers = GetWorld()->PlayerControllerListField();
612 for (TWeakObjectPtr<APlayerController> player_controller : player_controllers)
613 {
614 auto* shooter_pc = static_cast<AShooterPlayerController*>(player_controller.Get());
615
616 if (shooter_pc != nullptr && shooter_pc->LinkedPlayerIDField() == player_id)
617 {
618 steam_id = GetSteamIdFromController(shooter_pc);
619 break;
620 }
621 }
622
623 GetShooterGameMode()->AddPlayerID(player_id, steam_id);
624 }
625
626 return steam_id;
627 }
628
629 /**
630 * \brief Returns blueprint path from any UObject
631 */
632 static FORCEINLINE FString GetBlueprint(UObjectBase* object)
633 {
634 if (object != nullptr && object->ClassField() != nullptr)
635 {
637 }
638
639 return FString("");
640 }
641
642 /**
643 * \brief Returns blueprint path from any UClass
644 */
645 static FORCEINLINE FString GetClassBlueprint(UClass* the_class)
646 {
647 if (the_class != nullptr)
648 {
649 FString path_name;
650 the_class->GetDefaultObject(true)->GetFullName(&path_name, nullptr);
651
652 if (int find_index = 0; path_name.FindChar(' ', find_index))
653 {
654 path_name = "Blueprint'" + path_name.Mid(find_index + 1,
655 path_name.Len() - (find_index + (path_name.EndsWith(
656 "_C", ESearchCase::
658 ? 3
659 : 1))) + "'";
660 return path_name.Replace(L"Default__", L"", ESearchCase::CaseSensitive);
661 }
662 }
663
664 return FString("");
665 }
666
667 /**
668 * \brief Get Shooter Game State
669 */
671 {
673 }
674
675 /**
676 * \brief Get UShooterCheatManager* of player controller
677 */
679 {
680 if (!SPC) return nullptr;
681
683
684 if (cheat)
685 {
686 return static_cast<UShooterCheatManager*>(cheat);
687 }
688
689 return nullptr;
690 }
691
692 /**
693 * \brief Returns pointer to Primal Game Data
694 */
696 {
697 UPrimalGlobals* singleton = static_cast<UPrimalGlobals*>(Globals::GEngine()()->GameSingletonField());
698 return (singleton->PrimalGameDataOverrideField() != nullptr) ? singleton->PrimalGameDataOverrideField() : singleton->PrimalGameDataField();
699 }
700
701 /**
702 * \brief Gets all actors in radius at location
703 */
704 TArray<AActor*> GetAllActorsInRange(FVector location, float radius, EServerOctreeGroup::Type ActorType)
705 {
706 TArray<AActor*> out_actors;
707
708 UVictoryCore::ServerOctreeOverlapActors(&out_actors, GetWorld(), location, radius, ActorType, true);
709
710 return out_actors;
711 }
712
713 /**
714 * \brief Gets all actors in radius at location, with ignore actors
715 */
716 TArray<AActor*> GetAllActorsInRange(FVector location, float radius, EServerOctreeGroup::Type ActorType, TArray<AActor*> ignores)
717 {
718 TArray<AActor*> out_actors;
719
720 UVictoryCore::ServerOctreeOverlapActors(&out_actors, GetWorld(), location, radius, ActorType, true);
721
722 for (AActor* ignore : ignores)
723 out_actors.Remove(ignore);
724
725 return out_actors;
726 }
727 private:
728 virtual AShooterPlayerController* FindPlayerFromSteamId_Internal(uint64 steam_id) const = 0;
729 };
730
731 ARK_API IApiUtils& APIENTRY GetApiUtils();
732} // namespace ArkApi
#define ARK_API
Definition Base.h:9
ApiUtils & operator=(ApiUtils &&)=delete
ApiUtils()=default
void SetCheatManager(UShooterCheatManager *cheatmanager)
Definition ApiUtils.cpp:44
void SetWorld(UWorld *uworld)
Definition ApiUtils.cpp:9
ApiUtils & operator=(const ApiUtils &)=delete
void SetShooterGameMode(AShooterGameMode *shooter_game_mode)
Definition ApiUtils.cpp:21
std::unordered_map< uint64, AShooterPlayerController * > steam_id_map_
Definition ApiUtils.h:38
UShooterCheatManager * GetCheatManager() const override
Returns a point to URCON CheatManager.
Definition ApiUtils.cpp:93
UWorld * u_world_
Definition ApiUtils.h:34
ApiUtils(ApiUtils &&)=delete
AShooterGameMode * shooter_game_mode_
Definition ApiUtils.h:35
AShooterGameMode * GetShooterGameMode() const override
Returns a pointer to AShooterGameMode.
Definition ApiUtils.cpp:26
void RemovePlayerController(AShooterPlayerController *player_controller)
Definition ApiUtils.cpp:62
UShooterCheatManager * cheatmanager_
Definition ApiUtils.h:37
void SetPlayerController(AShooterPlayerController *player_controller)
Definition ApiUtils.cpp:49
ServerStatus GetStatus() const override
Returns the current server status.
Definition ApiUtils.cpp:38
ServerStatus status_
Definition ApiUtils.h:36
AShooterPlayerController * FindPlayerFromSteamId_Internal(uint64 steam_id) const override
Definition ApiUtils.cpp:75
~ApiUtils() override=default
void SetStatus(ServerStatus status)
Definition ApiUtils.cpp:33
UWorld * GetWorld() const override
Returns a pointer to UWorld.
Definition ApiUtils.cpp:14
ApiUtils(const ApiUtils &)=delete
static FString GetSteamName(AController *player_controller)
Returns the steam name of player.
static FORCEINLINE FString GetItemBlueprint(UPrimalItem *item)
Returns blueprint from UPrimalItem.
static FVector GetPosition(APlayerController *player_controller)
Returns the position of a player.
uint64 GetSteamIDForPlayerID(int player_id) const
static FORCEINLINE FString GetClassBlueprint(UClass *the_class)
Returns blueprint path from any UClass.
void SendServerMessageToAll(FLinearColor msg_color, const T *msg, Args &&... args)
Sends server message to all players. Using fmt::format.
virtual UShooterCheatManager * GetCheatManager() const =0
Returns a point to URCON CheatManager.
UPrimalGameData * GetGameData()
Returns pointer to Primal Game Data.
static bool IsRidingDino(AShooterPlayerController *player_controller)
Returns true if character is riding a dino, false otherwise.
AShooterGameState * GetGameState()
Get Shooter Game State.
virtual ~IApiUtils()=default
AShooterPlayerController * FindPlayerFromSteamName(const FString &steam_name) const
Finds player from the given steam name.
static UShooterCheatManager * GetCheatManagerByPC(AShooterPlayerController *SPC)
Get UShooterCheatManager* of player controller.
static uint64 GetPlayerID(AController *controller)
static bool IsPlayerDead(AShooterPlayerController *player)
Returns true if player is dead, false otherwise.
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.
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.
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 FString GetBlueprint(UObjectBase *object)
Returns blueprint path from any UObject.
static FString GetCharacterName(AShooterPlayerController *player_controller, bool include_first_name=true, bool include_last_name=true)
Returns the character name of player.
TArray< AActor * > GetAllActorsInRange(FVector location, float radius, EServerOctreeGroup::Type ActorType)
Gets all actors in radius at location.
void SendChatMessageToAll(const FString &sender_name, const T *msg, Args &&... args)
Sends chat message to all players. Using fmt::format.
TArray< AActor * > GetAllActorsInRange(FVector location, float radius, EServerOctreeGroup::Type ActorType, TArray< AActor * > ignores)
Gets all actors in radius at location, with ignore actors.
virtual AShooterGameMode * GetShooterGameMode() const =0
Returns a pointer to AShooterGameMode.
static uint64 GetSteamIdFromController(AController *controller)
Returns Steam ID from player controller.
virtual UWorld * GetWorld() const =0
Returns a pointer to UWorld.
static bool TeleportToPos(AShooterPlayerController *player_controller, const FVector &pos)
Teleports player to the given position.
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 uint64 GetPlayerID(APrimalCharacter *character)
virtual AShooterPlayerController * FindPlayerFromSteamId_Internal(uint64 steam_id) const =0
AShooterPlayerController * FindControllerFromCharacter(AShooterCharacter *character) const
Finds player controller from the given player character.
static APrimalDinoCharacter * GetRidingDino(AShooterPlayerController *player_controller)
Returns the dino the character is riding.
static FString GetIPAddress(AShooterPlayerController *player_controller)
Returns IP address of player.
AShooterPlayerController * FindPlayerFromSteamId(uint64 steam_id) const
Finds player from the given steam id.
virtual ServerStatus GetStatus() const =0
Returns the current server status.
void SendServerMessage(AShooterPlayerController *player_controller, FLinearColor msg_color, const T *msg, Args &&... args)
Sends server message to the specific player. Using fmt::format.
static std::optional< FString > TeleportToPlayer(AShooterPlayerController *me, AShooterPlayerController *him, bool check_for_dino, float max_dist)
Teleport one player to another.
static int GetInventoryItemCount(AShooterPlayerController *player_controller, const FString &item_name)
Counts a specific items quantity.
void SendChatMessage(AShooterPlayerController *player_controller, const FString &sender_name, const T *msg, Args &&... args)
Sends chat message to the specific player. Using fmt::format.
FString Replace(const TCHAR *From, const TCHAR *To, ESearchCase::Type SearchCase=ESearchCase::IgnoreCase) const
Definition FString.h:2766
FORCEINLINE bool FindChar(TCHAR InChar, int32 &Index) const
Definition FString.h:1169
FORCEINLINE FString Mid(int32 Start, int32 Count=INT_MAX) const
Definition FString.h:1099
FORCEINLINE friend bool operator==(const FString &Lhs, const FString &Rhs)
Definition FString.h:994
FORCEINLINE bool FindLastChar(TCHAR InChar, int32 &Index) const
Definition FString.h:1181
FORCEINLINE FString(const CharType *Src, typename TEnableIf< TIsCharType< CharType >::Value >::Type *Dummy=nullptr)
Definition FString.h:98
FORCEINLINE friend FString operator+(const TCHAR *Lhs, FString &&Rhs)
Definition FString.h:687
bool StartsWith(const FString &InPrefix, ESearchCase::Type SearchCase=ESearchCase::IgnoreCase) const
Definition FString.h:2143
FORCEINLINE bool Equals(const FString &Other, ESearchCase::Type SearchCase=ESearchCase::CaseSensitive) const
Definition FString.h:1221
bool EndsWith(const TCHAR *InSuffix, ESearchCase::Type SearchCase=ESearchCase::IgnoreCase) const
Definition FString.h:2155
FORCEINLINE bool IsEmpty() const
Definition FString.h:241
FORCEINLINE int32 Len() const
Definition FString.h:1069
FORCEINLINE friend FString operator+(FString &&Lhs, const TCHAR *Rhs)
Definition FString.h:713
FORCEINLINE int32 Add(const ElementType &Item)
Definition TArray.h:1564
int32 Remove(const ElementType &Item)
Definition TArray.h:1709
FORCEINLINE ObjectType * Get() const
IApiUtils & GetApiUtils()
Definition ApiUtils.cpp:99
@ CaseSensitive
Definition FString.h:28
Definition json.hpp:4518
FVector & DefaultActorLocationField()
Definition Actor.h:920
int & TargetingTeamField()
Definition Actor.h:902
USceneComponent * RootComponentField()
Definition Actor.h:911
APlayerState * PlayerStateField()
Definition Actor.h:2062
UCheatManager * CheatManagerField()
Definition Actor.h:2133
FString * GetPlayerNetworkAddress(FString *result)
Definition Actor.h:2292
FUniqueNetIdRepl & UniqueIdField()
Definition Actor.h:1782
FString & PlayerNameField()
Definition Actor.h:1776
bool TeleportTo(FVector *DestLocation, FRotator *DestRotation, bool bIsATest, bool bNoCheck)
Definition Actor.h:4554
UPrimalInventoryComponent * MyInventoryComponentField()
Definition Actor.h:3798
bool IsDead()
Definition Actor.h:4360
void DoNeuter_Implementation()
Definition Actor.h:7051
static UClass * GetPrivateStaticClass()
Definition Actor.h:6963
void TameDino(AShooterPlayerController *ForPC, bool bIgnoreMaxTameLimit, int OverrideTamingTeamID)
Definition Actor.h:7328
int & TamingTeamIDField()
Definition Actor.h:6194
FString & TamerStringField()
Definition Actor.h:6057
int & AbsoluteBaseLevelField()
Definition Actor.h:6324
UPrimalPlayerData * GetPlayerData()
Definition Actor.h:5166
APrimalDinoCharacter * GetRidingDino()
Definition Actor.h:5159
unsigned __int64 GetSteamIDForPlayerID(int playerDataID)
Definition GameMode.h:1620
void AddPlayerID(int playerDataID, unsigned __int64 netUniqueID)
Definition GameMode.h:1534
__int64 & LinkedPlayerIDField()
Definition Actor.h:2504
void SetPlayerPos(float X, float Y, float Z)
Definition Actor.h:3202
AActor * SpawnActor(FString *blueprintPath, float spawnDistance, float spawnYOffset, float ZOffset, bool bDoDeferBeginPlay)
Definition Actor.h:3222
AShooterCharacter * GetPlayerCharacter()
Definition Actor.h:2916
FString * GetPlayerName(FString *result)
Definition Actor.h:1902
void SetTribeTamingDinoSettings(APrimalDinoCharacter *aDinoChar)
Definition Actor.h:1986
unsigned __int64 & PlayerDataIDField()
Definition Actor.h:5466
FORCEINLINE FRotator(float InPitch, float InYaw, float InRoll)
Definition Rotator.h:375
TSharedPtr< FUniqueNetId > UniqueNetId
Definition Actor.h:190
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
FORCEINLINE CONSTEXPR FVector(float InX, float InY, float InZ)
Definition Vector.h:1067
static FORCEINLINE float Distance(const FVector &V1, const FVector &V2)
Definition Vector.h:741
T * Get(bool bEvenIfPendingKill=false)
Definition UE.h:172
FORCEINLINE T * operator->()
Definition UE.h:167
Definition UE.h:399
UObject * GetDefaultObject(bool bCreateIfNeeded)
Definition UE.h:415
UClass * ClassField()
Definition UE.h:277
FString * GetFullName(FString *result, UObject *StopOuter)
Definition UE.h:296
bool IsA(UClass *SomeBase)
Definition UE.h:299
UPrimalGameData * PrimalGameDataOverrideField()
Definition GameMode.h:878
UPrimalGameData * PrimalGameDataField()
Definition GameMode.h:877
FPrimalPlayerDataStruct * MyDataField()
Definition Actor.h:5507
FVector * GetWorldLocation(FVector *result)
Definition Actor.h:523
static TArray< AActor * > * ServerOctreeOverlapActors(TArray< AActor * > *result, UWorld *theWorld, FVector AtLoc, float Radius, EServerOctreeGroup::Type OctreeType, bool bForceActorLocationDistanceCheck)
Definition Other.h:410
TArray< TAutoWeakObjectPtr< APlayerController > > & PlayerControllerListField()
Definition GameMode.h:425
APlayerController * GetFirstPlayerController()
Definition GameMode.h:538
AGameState * GameStateField()
Definition GameMode.h:409