SCHALE.GameServer/SCHALE.Common/Database/Models/Game/Account.cs

40 lines
1.2 KiB
C#
Raw Normal View History

2024-04-25 03:50:09 +00:00
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
2024-04-26 01:32:21 +00:00
using SCHALE.Common.FlatData;
using MongoDB.Bson.Serialization.Attributes;
using MongoDB.Driver.Core.Servers;
2024-04-25 03:50:09 +00:00
namespace SCHALE.Common.Database.Models.Game
{
#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
2024-04-26 01:32:21 +00:00
public class Account
2024-04-25 03:50:09 +00:00
{
[Key]
[Column("_id")]
2024-04-26 01:32:21 +00:00
public uint ServerId { get; set; }
public AccountDB AccountDB { get; set; }
public static Account Create(uint guest_account_uid) // make sure ServerId matches GuestAccount UID
{
Account account = new()
{
ServerId = guest_account_uid,
AccountDB = new AccountDB()
{
ServerId = guest_account_uid,
State = AccountState.Normal,
Level = 0,
Exp = 0,
RepresentCharacterServerId = 1037810385, // i think this is the default
LastConnectTime = DateTime.Now,
CreateDate = DateTime.Now,
}
};
return account;
}
2024-04-25 03:50:09 +00:00
}
}