Arma Reforger Explorer
1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Toggle main menu visibility
Loading...
Searching...
No Matches
SCR_PlayerIdentityUtils.c
Go to the documentation of this file.
1
class
SCR_PlayerIdentityUtils
2
{
3
//------------------------------------------------------------------------------------------------
7
static
UUID
GetPlayerIdentityId(
int
playerId)
8
{
9
if
(playerId <= 0)
10
return
UUID
.NULL_UUID;
11
12
if
(!
Replication
.IsServer())
13
{
14
#ifdef ENABLE_DIAG
15
Debug
.Error(
"GetPlayerIdentityId can only be used on the server and after OnPlayerAuditSuccess."
);
16
#endif
17
return
UUID
.NULL_UUID;
18
}
19
20
string
uid =
GetGame
().GetBackendApi().GetPlayerIdentityId(playerId);
21
if
(uid.IsEmpty())
22
{
23
if
(
RplSession
.Mode() !=
RplMode
.Dedicated)
24
{
25
// Peer tool support
26
const
string
playerName =
GetGame
().GetPlayerManager().GetPlayerName(playerId);
27
const
int
splitLength =
Math
.Max(1, playerName.Length() / 3);
28
const
string
split1 =
Math
.AbsInt(playerName.Substring(0, splitLength).Hash()).ToString(8,
true
);
29
const
string
split2 =
Math
.AbsInt(playerName.Substring(splitLength, splitLength).Hash()).ToString(8,
true
);
30
const
int
doubleSplit = splitLength * 2;
31
const
string
split3 =
Math
.AbsInt(playerName.Substring(doubleSplit, playerName.Length() - doubleSplit).Hash()).ToString(8,
true
);
32
33
// 00bbbddd-SPL1-SPL1-SPL2-SPL2 SPL3 SPL3
34
uid =
string
.Format(
"00bbbddd-%1-%2-%3-%4%5"
, split1.Substring(0, 4), split1.Substring(4, 4), split2.Substring(0, 4), split2.Substring(4, 4), split3);
35
uid.ToLower();
36
}
37
#ifdef ENABLE_DIAG
38
else
39
{
40
Debug
.Error(
"Dedicated server is not correctly configured to connect to the BI backend.\nSee https://community.bistudio.com/wiki/Arma_Reforger:Server_Config#publicAddress"
);
41
}
42
#endif
43
}
44
45
return
uid;
46
}
47
48
//------------------------------------------------------------------------------------------------
52
static
string
GetPlayerIdentityId(
IEntity
player)
53
{
54
return
GetPlayerIdentityId(
GetGame
().GetPlayerManager().GetPlayerIdFromControlledEntity(player));
55
}
56
57
//------------------------------------------------------------------------------------------------
61
static
string
GetPlayerLogInfo(
int
playerID)
62
{
63
string
playerName =
GetGame
().GetPlayerManager().GetPlayerName(playerID);
64
UUID
playerUUID = GetPlayerIdentityId(playerID);
65
return
string
.Format(
"%1 (playerID = %2 | UUID = %3)"
, playerName, playerID, playerUUID);
66
}
67
}
GetGame
ArmaReforgerScripted GetGame()
Definition
game.c:1398
RplMode
RplMode
Mode of replication.
Definition
RplMode.c:9
Debug
Definition
Debug.c:13
IEntity
Definition
IEntity.c:13
Math
Definition
Math.c:13
Replication
Main replication API.
Definition
Replication.c:14
RplSession
Definition
RplSession.c:8
SCR_PlayerIdentityUtils
Definition
SCR_PlayerIdentityUtils.c:2
UUID
Definition
UUID.c:28
scripts
Game
Utilities
SCR_PlayerIdentityUtils.c
Generated by
1.17.0