Beispiel #1
0
        protected static bool UpdateRank(int?primary, int?edit, ref Trooper p, ref Trooper s,
                                         [NotNullWhen(true)] out RankChange?update)
        {
            if (primary != edit)
            {
                update = new RankChange()
                {
                    ChangedFrom            = primary ?? -1,
                    ChangedTo              = edit ?? -1,
                    ChangedOn              = DateTime.UtcNow,
                    SubmittedByRosterClerk = true
                };

                p.RankChanges.Add(update);
                s.SubmittedRankChanges.Add(update);

                if (primary < edit)
                {
                    p.LastPromotion = DateTime.UtcNow;
                }

                return(true);
            }

            update = null;
            return(false);
        }
Beispiel #2
0
 internal void OnRankChange(User user, string channel, UserRank rank) => RankChange?.Invoke(user, channel, rank);