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;
 }
Beispiel #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);
        }
Beispiel #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");
 }
Beispiel #4
0
 int getArbVote(ChessPlayer player, ChessPlayer other)
 {
     return(player.ArbVotes.FirstOrDefault(x => x.VoteeId == other.Id)?.Score ?? 0);
 }
 public ChessBan(ChessPlayer target, ChessPlayer oper)
 {
     TargetId   = target.Id;
     Target     = target;
     OperatorId = oper.Id;
 }
 public ArbiterVote(ChessPlayer voter)
 {
     Voter   = voter;
     VoterId = voter.Id;
 }
 public ChessDateScore(ChessPlayer player)
 {
     Player   = player;
     PlayerId = player.Id;
 }
 public IQueryable <ChessBan> GetBansAgainst(ChessPlayer player)
 => GetBansAgainst(player.Id);
 public IEnumerable <ChessGame> GetCurrentGamesWith(ChessPlayer player)
 => GetCurrentGamesWith(player.Id);
 public IQueryable <ChessGame> GetGamesWith(ChessPlayer player)
 {
     return(GetGamesWith(player.Id));
 }