Ark Server API (ASE) - Wiki
Loading...
Searching...
No Matches
ApiUtils.cpp
Go to the documentation of this file.
1#include "ApiUtils.h"
2
3#include "../IBaseApi.h"
4
5namespace AtlasApi
6{
7 // UWorld
8
9 void ApiUtils::SetWorld(UWorld* uworld)
10 {
11 u_world_ = uworld;
12 }
13
15 {
16 return u_world_;
17 }
18
19 // AShooterGameMode
20
22 {
23 shooter_game_mode_ = shooter_game_mode;
24 }
25
27 {
28 return shooter_game_mode_;
29 }
30
31 // Status
32
34 {
35 status_ = status;
36 }
37
39 {
40 return status_;
41 }
42
44 {
45 cheatmanager_ = cheatmanager;
46 }
47
49 {
50 return cheatmanager_;
51 }
52
54 {
55 if (!player_controller)
56 return;
57
58 const uint64 steam_id = ArkApi::IApiUtils::GetSteamIdFromController(player_controller);
59
60 if (steam_id != 0)
61 {
62 steam_id_map_[steam_id] = player_controller;
63 }
64 }
65
67 {
68 if (!player_controller)
69 return;
70
71 const uint64 steam_id = ArkApi::IApiUtils::GetSteamIdFromController(player_controller);
72
73 if (steam_id != 0)
74 {
75 steam_id_map_.erase(steam_id);
76 }
77 }
78
80 {
81 AShooterPlayerController* found_player = nullptr;
82
83 if (steam_id == 0)
84 return found_player;
85
86 auto iter = steam_id_map_.find(steam_id);
87
88 if (iter != steam_id_map_.end()
89 && iter->first == steam_id)
90 {
91 found_player = iter->second;
92 }
93
94 return found_player;
95 }
96
97 // Free function
99 {
100 return *API::game_api->GetApiUtils();
101 }
102} // namespace AtlasApi
static uint64 GetSteamIdFromController(AController *controller)
Returns Steam ID from player controller.
void SetShooterGameMode(AShooterGameMode *shooter_game_mode)
Definition ApiUtils.cpp:21
void SetPlayerController(AShooterPlayerController *player_controller)
Definition ApiUtils.cpp:53
AShooterGameMode * shooter_game_mode_
Definition ApiUtils.h:35
void SetWorld(UWorld *uworld)
Definition ApiUtils.cpp:9
void RemovePlayerController(AShooterPlayerController *player_controller)
Definition ApiUtils.cpp:66
void SetStatus(ArkApi::ServerStatus status)
Definition ApiUtils.cpp:33
AShooterGameMode * GetShooterGameMode() const override
Returns a pointer to AShooterGameMode.
Definition ApiUtils.cpp:26
UShooterCheatManager * GetCheatManager() const override
Returns a point to URCON CheatManager.
Definition ApiUtils.cpp:48
ArkApi::ServerStatus GetStatus() const override
Returns the current server status.
Definition ApiUtils.cpp:38
UWorld * u_world_
Definition ApiUtils.h:34
UShooterCheatManager * cheatmanager_
Definition ApiUtils.h:37
AShooterPlayerController * FindPlayerFromSteamId_Internal(uint64 steam_id) const override
Definition ApiUtils.cpp:79
UWorld * GetWorld() const override
Returns a pointer to UWorld.
Definition ApiUtils.cpp:14
void SetCheatManager(UShooterCheatManager *cheatmanager)
Definition ApiUtils.cpp:43
ArkApi::IApiUtils & GetApiUtils()
Definition ApiUtils.cpp:98