Ejemplo n.º 1
0
 protected virtual void OnUserRankUp(KaosUser user, KaosPlayerRank rank)
 {
     if (UserRankedUp == null)
     {
         return;
     }
     UserRankedUp(this, new UserRankUpEventArgs()
     {
         Rank = rank,
         User = user
     });
 }
Ejemplo n.º 2
0
        internal async Task SetRankAsync(KaosUser user, KaosPlayerRank rank)
        {
            var oldRank = await GetKaosRankAsync(user.Rank);

            await RemovePermissionGroupAsync(user, oldRank.PermissionGroup);
            await AddPermissionGroupAsync(user, rank.PermissionGroup);

            var sql = $"UPDATE players SET Rank = @Rank WHERE SteamId = @SteamId";

            using (IDbConnection connection = new MySqlConnection(ConnectionString))
            {
                await connection.ExecuteAsync(sql, new { Rank = rank.Id, SteamId = user.SteamId });
            }
        }