Exemplo n.º 1
0
 public ChessNote(ChessPlayer oper, ChessPlayer target, string text, int expires)
 {
     OperatorId    = oper?.Id ?? 0;
     Target        = target;
     TargetId      = target.Id;
     GivenAt       = DateTime.Now;
     ExpiresInDays = expires;
     Text          = text;
 }
Exemplo n.º 2
0
        DateTime lastPlayedAgainst(ChessPlayer p1, ChessPlayer p2)
        {
            DateTime last   = DateTime.Now.AddDays(-1000);
            var      games  = DB.GetGamesWith(p1);
            var      withP2 = games.Where(x => x.LoserId == p2.Id || x.WinnerId == p2.Id);

            foreach (var x in withP2)
            {
                if (x.Timestamp > last)
                {
                    last = x.Timestamp;
                }
            }
            return(last);
        }
Exemplo n.º 3
0
 string getCapacity(ChessPlayer player)
 {
     if (player == null)
     {
         return("unknown");
     }
     if (player.Permission.HasFlag(ChessPerm.Arbiter))
     {
         return("Arbiter");
     }
     if (player.Permission.HasFlag(ChessPerm.ChiefJustice))
     {
         return("Chief Justice of the Court Of Appeals");
     }
     if (player.Permission.HasFlag(ChessPerm.Justice))
     {
         return("Associate Justice of the Court Of Appeals");
     }
     if (player.Permission.HasFlag(ChessPerm.Moderator))
     {
         return("Moderator");
     }
     return("something");
 }
Exemplo n.º 4
0
 int getArbVote(ChessPlayer player, ChessPlayer other)
 {
     return(player.ArbVotes.FirstOrDefault(x => x.VoteeId == other.Id)?.Score ?? 0);
 }
Exemplo n.º 5
0
 public ChessBan(ChessPlayer target, ChessPlayer oper)
 {
     TargetId   = target.Id;
     Target     = target;
     OperatorId = oper.Id;
 }
Exemplo n.º 6
0
 public ArbiterVote(ChessPlayer voter)
 {
     Voter   = voter;
     VoterId = voter.Id;
 }
Exemplo n.º 7
0
 public ChessDateScore(ChessPlayer player)
 {
     Player   = player;
     PlayerId = player.Id;
 }
Exemplo n.º 8
0
 public IQueryable <ChessBan> GetBansAgainst(ChessPlayer player)
 => GetBansAgainst(player.Id);
Exemplo n.º 9
0
 public IEnumerable <ChessGame> GetCurrentGamesWith(ChessPlayer player)
 => GetCurrentGamesWith(player.Id);
Exemplo n.º 10
0
 public IQueryable <ChessGame> GetGamesWith(ChessPlayer player)
 {
     return(GetGamesWith(player.Id));
 }