PlayerInfo.cs 895 B

12345678910111213141516171819202122232425262728293031323334353637
  1. using Content.Shared.Mind;
  2. using Robust.Shared.Network;
  3. using Robust.Shared.Serialization;
  4. namespace Content.Shared.Administration;
  5. [Serializable, NetSerializable]
  6. public sealed record PlayerInfo(
  7. string Username,
  8. string CharacterName,
  9. string IdentityName,
  10. string StartingJob,
  11. bool Antag,
  12. RoleTypePrototype RoleProto,
  13. NetEntity? NetEntity,
  14. NetUserId SessionId,
  15. bool Connected,
  16. bool ActiveThisRound,
  17. TimeSpan? OverallPlaytime)
  18. {
  19. private string? _playtimeString;
  20. public bool IsPinned { get; set; }
  21. public string PlaytimeString => _playtimeString ??=
  22. OverallPlaytime?.ToString("%d':'hh':'mm") ?? Loc.GetString("generic-unknown-title");
  23. public bool Equals(PlayerInfo? other)
  24. {
  25. return other?.SessionId == SessionId;
  26. }
  27. public override int GetHashCode()
  28. {
  29. return SessionId.GetHashCode();
  30. }
  31. }