52 lines
1.9 KiB
C#
52 lines
1.9 KiB
C#
using LiteDB;
|
|
using static DeluxeBackend.Enums;
|
|
|
|
namespace DeluxeBackend.Models
|
|
{
|
|
public class AccountPresence
|
|
{
|
|
[BsonId]
|
|
public long Id { get; set; }
|
|
|
|
[BsonRef("accounts")]
|
|
public required Account Account { get; set; }
|
|
public PlayerType PlayerType { get; set; } = PlayerType.UNINITIALIZED;
|
|
public StatusVisibilityType StatusVisibility { get; set; } = StatusVisibilityType.Public;
|
|
public PlatformType LastPlatform { get; set; } = PlatformType.All;
|
|
//public something LastDeviceClass { get; set; }
|
|
public VrMovementModeType VrMovementMode { get; set; } = VrMovementModeType.TELEPORT;
|
|
public DateTime LastOnline { get; set; } = DateTime.UtcNow;
|
|
public bool IsOnline { get; set; } = false;
|
|
public string? AppVersion { get; set; } = null;
|
|
|
|
[BsonRef("roominstances")]
|
|
public RoomInstance? Instance { get; set; } = null;
|
|
|
|
[BsonIgnore]
|
|
public Dictionary<string, object> ToDictionary()
|
|
{
|
|
Dictionary<string, object?>? RoomInstance = null;
|
|
if (Instance != null)
|
|
{
|
|
RoomInstance = Instance.ToDictionary();
|
|
}
|
|
|
|
#pragma warning disable CS8601 // Possible null reference assignment.
|
|
return new Dictionary<string, object>()
|
|
{
|
|
["serverTime"] = DateTime.UtcNow.Ticks,
|
|
["playerId"] = Account!.Id,
|
|
["statusVisibility"] = (int)StatusVisibility,
|
|
["platform"] = (int)PlatformType.Steam,//(int)LastPlatform,
|
|
["deviceClass"] = 0,
|
|
["roomInstance"] = RoomInstance,
|
|
["vrMovementMode"] = (int)VrMovementMode,
|
|
["lastOnline"] = LastOnline,
|
|
["isOnline"] = IsOnline,
|
|
["appVersion"] = AppVersion
|
|
};
|
|
#pragma warning restore CS8601
|
|
}
|
|
}
|
|
}
|