mirror of
https://github.com/tribufu/ServerManagers
synced 2026-05-06 15:17:34 +00:00
RCON Player List Fixes
- fixed player list for EPIC players.
This commit is contained in:
parent
b19626ecd4
commit
1a45d85ff6
8 changed files with 81 additions and 304 deletions
|
|
@ -332,21 +332,25 @@ namespace ServerManagerTool.Lib
|
|||
// This is bound to the UI thread
|
||||
private List<string> HandleListPlayersCommand(IEnumerable<string> commandLines)
|
||||
{
|
||||
/*
|
||||
> listplayers
|
||||
0. Bletch, 76561197991984752 <- steam
|
||||
0. Bletch, 7171521174456260817 <- epic
|
||||
*/
|
||||
var output = new List<string>();
|
||||
var onlinePlayers = new List<PlayerInfo>();
|
||||
|
||||
var playerLines = commandLines?.ToList() ?? new List<string>();
|
||||
|
||||
if (playerLines.Count > 0)
|
||||
{
|
||||
|
||||
foreach (var line in playerLines)
|
||||
{
|
||||
var elements = line.Split(',');
|
||||
if (elements.Length != 2)
|
||||
var elements = line.Split(',', '.');
|
||||
if (elements.Length != 3)
|
||||
// Invalid data. Ignore it.
|
||||
continue;
|
||||
|
||||
var id = elements[1]?.Trim();
|
||||
var id = elements[2].Trim();
|
||||
|
||||
if (onlinePlayers.FirstOrDefault(p => p.PlayerId.Equals(id, StringComparison.OrdinalIgnoreCase)) != null)
|
||||
// Duplicate data. Ignore it.
|
||||
|
|
@ -355,7 +359,7 @@ namespace ServerManagerTool.Lib
|
|||
var newPlayer = new PlayerInfo()
|
||||
{
|
||||
PlayerId = id,
|
||||
PlayerName = elements[0].Substring(elements[0].IndexOf('.') + 1).Trim(),
|
||||
PlayerName = elements[1].Trim(),
|
||||
IsOnline = true,
|
||||
};
|
||||
onlinePlayers.Add(newPlayer);
|
||||
|
|
|
|||
|
|
@ -124,7 +124,8 @@ namespace ServerManagerTool.Lib.ViewModel.RCON
|
|||
if (playerData == null)
|
||||
return;
|
||||
|
||||
playerData.PlayerName = PlayerData?.PlayerName;
|
||||
if (PlayerData?.PlayerName != null)
|
||||
playerData.PlayerName = PlayerData.PlayerName;
|
||||
playerData.LastPlatformUpdateUtc = PlayerData?.LastPlatformUpdateUtc ?? DateTime.MinValue;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue