コード例 #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;
 }
コード例 #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);
        }
コード例 #3
0
ファイル: Appeals.cs プロジェクト: TheGrandCoding/discord-bot
 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");
 }
コード例 #4
0
 int getArbVote(ChessPlayer player, ChessPlayer other)
 {
     return(player.ArbVotes.FirstOrDefault(x => x.VoteeId == other.Id)?.Score ?? 0);
 }
コード例 #5
0
 public ChessBan(ChessPlayer target, ChessPlayer oper)
 {
     TargetId   = target.Id;
     Target     = target;
     OperatorId = oper.Id;
 }
コード例 #6
0
 public ArbiterVote(ChessPlayer voter)
 {
     Voter   = voter;
     VoterId = voter.Id;
 }
コード例 #7
0
 public ChessDateScore(ChessPlayer player)
 {
     Player   = player;
     PlayerId = player.Id;
 }
コード例 #8
0
 public IQueryable <ChessBan> GetBansAgainst(ChessPlayer player)
 => GetBansAgainst(player.Id);
コード例 #9
0
 public IEnumerable <ChessGame> GetCurrentGamesWith(ChessPlayer player)
 => GetCurrentGamesWith(player.Id);
コード例 #10
0
 public IQueryable <ChessGame> GetGamesWith(ChessPlayer player)
 {
     return(GetGamesWith(player.Id));
 }