internal Deny(PlayerDenyDto dto)
        {
            ExistsInDatabase = true;
            Id     = dto.Id;
            DenyId = (ulong)dto.DenyPlayer.Id;

            // Try a fast lookup first in case the player is currently online
            // otherwise get the name from the database
            Nickname = GameServer.Instance.PlayerManager[DenyId]?.Account.Nickname ??
                       AuthDatabase.Instance.Accounts.GetReference((int)DenyId).Nickname;
        }
Example #2
0
        internal Deny(PlayerDenyDto dto)
        {
            ExistsInDatabase = true;
            Id     = dto.Id;
            DenyId = (ulong)dto.DenyPlayerId;

            // Try a fast lookup first in case the player is currently online
            // otherwise get the name from the database
            Nickname = GameServer.Instance.PlayerManager[DenyId]?.Account.Nickname;
            if (Nickname == null)
            {
                using (var db = AuthDatabase.Open())
                {
                    Nickname = db.Get(new AccountDto {
                        Id = (int)DenyId
                    })?.Nickname ?? "<Player not found>";
                }
            }
        }