示例#1
0
        public static string GetEmmettActualRank(List <string> users)
        {
            StreamReader sr;
            string       placeHolder;
            string       userPrestige;
            string       strUserRank;
            int          intUserRank;

            sr           = new StreamReader("D:\\GoogleDrive\\Discord_Bot\\Player_Profiles\\" + users[0] + ".txt");
            placeHolder  = sr.ReadLine();
            placeHolder  = sr.ReadLine();
            strUserRank  = sr.ReadLine();
            placeHolder  = sr.ReadLine();
            placeHolder  = sr.ReadLine();
            userPrestige = sr.ReadLine();
            sr.Close();

            intUserRank = Convert.ToInt32(strUserRank);

            string starPrestige = UserDataHandling.GetEmmettPrestige(userPrestige);

            string finalRanking = starPrestige + intUserRank;


            return(finalRanking);
        }
示例#2
0
        public async Task CheckUserAsync([Remainder] string userName = "")
        {
            string[]     userData = new string[7];
            EmbedBuilder builder  = new EmbedBuilder();

            userData = UserDataHandling.ReadUserData(userName);

            if (userData[0] == "recordedData")
            {
                string prestigeTag = UserDataHandling.GetEmmettPrestige(userData[6]);

                builder.WithTitle(userName)
                .WithDescription($"Wins: {userData[1]}\nTicks: {userData[2]}\nEmmett Level: {prestigeTag}{userData[3]}\n")
                .WithColor(Color.Green);

                await ReplyAsync("", false, builder.Build());
            }
            else if (userData[0] == "userNonexistent")
            {
                builder.WithTitle("Error")
                .WithDescription("This user does not exist.")
                .WithColor(Color.Red);

                await ReplyAsync("", false, builder.Build());
            }
            else
            {
                builder.WithTitle("Error")
                .WithDescription("An unexpected error occurred. Please contact the server administrators.")
                .WithColor(Color.Orange);

                await ReplyAsync("", false, builder.Build());
            }
        }
示例#3
0
        public async Task UndoTickAsync([Remainder] string userName = "")
        {
            string[]     userData = new string[3]; //0 is value status, 1 is variable value, 2 is type of change
            EmbedBuilder builder  = new EmbedBuilder();

            userData[2] = "undoTick";

            switch (Context.User.Id)
            {
            case 176815679599542274:     //Jared
            case 170671108675076108:     //Thomas
            case 175755733395046400:     //Colin
                userData = UserDataHandling.WriteUserTicks(userName, userData);

                if (userData[0] == "userNonexistent")
                {
                    builder.WithTitle("Error")
                    .WithDescription("This user does not exist.")
                    .WithColor(Color.Red);

                    await ReplyAsync("", false, builder.Build());
                }
                else if (userData[1] == "cannotBeChanged")
                {
                    builder.WithTitle("Error")
                    .WithDescription("This user's data cannot be changed.")
                    .WithColor(Color.Red);

                    await ReplyAsync("", false, builder.Build());
                }
                else if (userData[0] == "recordedData")
                {
                    builder.WithTitle(userName)
                    .WithDescription($"Value updated. This user now has {userData[1]} ticks.")
                    .WithColor(Color.Green);

                    await ReplyAsync("", false, builder.Build());
                }
                else
                {
                    builder.WithTitle("Error")
                    .WithDescription("An unexpected error occurred. Please contact the server administrators.")
                    .WithColor(Color.Red);

                    await ReplyAsync("", false, builder.Build());
                }

                break;

            default:
                builder.WithTitle("Error")
                .WithDescription("You do not have the correct priveleges to complete this action.")
                .WithColor(Color.Red);

                await ReplyAsync("", false, builder.Build());

                break;
            }
        }
示例#4
0
        public async Task TopEmmettAsync()
        {
            List <string> topUsers = new List <string>();
            int           topValue;
            string        userChoice        = "getEmmett";
            string        concatenatedUsers = "";
            EmbedBuilder  builder           = new EmbedBuilder();
            int           i = 1;
            string        emmettCount;

            (topUsers, topValue) = UserDataHandling.GetTopStats(userChoice);
            emmettCount          = UserDataHandling.GetEmmettActualRank(topUsers);


            if (topUsers.Count == 2)
            {
                concatenatedUsers = topUsers[0] + "' and '" + topUsers[1];

                builder.WithTitle("Top Wins")
                .WithDescription($"The users '{concatenatedUsers}' are the most Emmett with rank {emmettCount}.")
                .WithColor(Color.LighterGrey);

                await ReplyAsync("", false, builder.Build());
            }
            else if (topUsers.Count > 2)
            {
                while (i < topUsers.Count)
                {
                    concatenatedUsers = concatenatedUsers + "'" + topUsers[i - 1] + "', ";
                    i = i + 1;
                }
                concatenatedUsers = concatenatedUsers + "and '" + topUsers[i - 1] + "'";

                builder.WithTitle("Top Wins")
                .WithDescription($"The users {concatenatedUsers} are the most Emmett with rank {emmettCount}.")
                .WithColor(Color.LighterGrey);

                await ReplyAsync("", false, builder.Build());
            }
            else
            {
                builder.WithTitle("Top Wins")
                .WithDescription($"The user '{topUsers[0]}' is the most Emmett with rank {emmettCount}.")
                .WithColor(Color.LighterGrey);

                await ReplyAsync("", false, builder.Build());
            }
        }
示例#5
0
        public async Task TopTicksAsync()
        {
            List <string> topUsers = new List <string>();
            int           topValue;
            string        userChoice        = "getTicks";
            string        concatenatedUsers = "";
            EmbedBuilder  builder           = new EmbedBuilder();
            int           i = 1;

            (topUsers, topValue) = UserDataHandling.GetTopStats(userChoice);

            if (topUsers.Count == 2)
            {
                concatenatedUsers = topUsers[0] + "' and '" + topUsers[1];

                builder.WithTitle("Top Ticks")
                .WithDescription($"The users '{concatenatedUsers}' have the most ticks with {topValue} ticks.")
                .WithColor(Color.LighterGrey);

                await ReplyAsync("", false, builder.Build());
            }
            else if (topUsers.Count > 2)
            {
                while (i < topUsers.Count)
                {
                    concatenatedUsers = concatenatedUsers + "'" + topUsers[i - 1] + "', ";
                    i = i + 1;
                }
                concatenatedUsers = concatenatedUsers + "and '" + topUsers[i - 1] + "'";

                builder.WithTitle("Top Ticks")
                .WithDescription($"The users {concatenatedUsers} have the most ticks with {topValue} ticks.")
                .WithColor(Color.LighterGrey);

                await ReplyAsync("", false, builder.Build());
            }
            else
            {
                builder.WithTitle("Top Ticks")
                .WithDescription($"The user '{topUsers[0]}' has the most ticks with {topValue} ticks.")
                .WithColor(Color.LighterGrey);

                await ReplyAsync("", false, builder.Build());
            }
        }
示例#6
0
        public async Task AddEmmettAsync([Remainder] string userName = "")
        {
            string[]     userData = new string[5]; //0 is value status, 1 is variable value, 2 is secondary variable value, 3 is type of change, 4 is prestige level
            EmbedBuilder builder  = new EmbedBuilder();

            userData[3] = "addEmmett";

            switch (Context.User.Id)
            {
            case 176815679599542274:     //Jared
            case 170671108675076108:     //Thomas
            case 175755733395046400:     //Colin
                userData = UserDataHandling.WriteEmmettLevel(userName, userData);

                if (userData[0] == "userNonexistent")
                {
                    builder.WithTitle("Error")
                    .WithDescription("This user does not exist.")
                    .WithColor(Color.Red);

                    await ReplyAsync("", false, builder.Build());
                }
                else if (userData[0] == "cannotBeChanged")
                {
                    builder.WithTitle("Error")
                    .WithDescription("This user's data cannot be changed.")
                    .WithColor(Color.Red);

                    await ReplyAsync("", false, builder.Build());
                }
                else if (userData[0] == "recordedData")
                {
                    string prestigeTag = UserDataHandling.GetEmmettPrestige(userData[4]);

                    builder.WithTitle(userName)
                    .WithDescription($"Value updated. This user is now Emmett level {prestigeTag}{userData[1]}.")
                    .WithColor(Color.Green);

                    await ReplyAsync("", false, builder.Build());
                }
                else if (userData[0] == "divideByZero")
                {
                    builder.WithTitle("Error")
                    .WithDescription("This user's level of Emmett is already at 0. It cannot be lowered further.")
                    .WithColor(Color.Red);

                    await ReplyAsync("", false, builder.Build());
                }
                else if (userData[0] == "levelTooLarge")
                {
                    builder.WithTitle("Error")
                    .WithDescription("This user is already at the maximum level of Emmett. It cannot be raised any higher.")
                    .WithColor(Color.Red);

                    await ReplyAsync("", false, builder.Build());
                }
                else
                {
                    builder.WithTitle("Error")
                    .WithDescription("An unexpected error occurred. Please contact the server administrators.")
                    .WithColor(Color.Red);

                    await ReplyAsync("", false, builder.Build());
                }

                break;

            default:
                builder.WithTitle("Error")
                .WithDescription("You do not have the correct priveleges to complete this action.")
                .WithColor(Color.Red);

                await ReplyAsync("", false, builder.Build());

                break;
            }
        }
示例#7
0
        public async Task AddWinAsync(string user1Name = "defaultValue", string user2Name = "defaultValue", string user3Name = "defaultValue", string user4Name = "defaultValue")
        {
            string[]     user1Data = new string[3]; //0 is value status, 1 is variable value, 2 is type of change
            string[]     user2Data = new string[3];
            string[]     user3Data = new string[3];
            string[]     user4Data = new string[3];
            EmbedBuilder builder   = new EmbedBuilder();

            user1Data[2] = "addWin";
            user2Data[2] = "addWin";
            user3Data[2] = "addWin";
            user4Data[2] = "addWin";
            string user1Message = "";
            string user2Message = "";
            string user3Message = "";
            string user4Message = "";

            user1Data[0] = "startingValue";
            user2Data[0] = "startingValue";
            user3Data[0] = "startingValue";
            user4Data[0] = "startingValue";

            switch (Context.User.Id)
            {
            case 176815679599542274:     //Jared
            case 170671108675076108:     //Thomas
            case 175755733395046400:     //Colin
                user1Data = UserDataHandling.WriteUserWins(user1Name, user1Data);
                user2Data = UserDataHandling.WriteUserWins(user2Name, user2Data);
                user3Data = UserDataHandling.WriteUserWins(user3Name, user3Data);
                user4Data = UserDataHandling.WriteUserWins(user4Name, user4Data);

                switch (user1Data[0])
                {
                case "noEntry":
                    user1Message = "";
                    break;

                case "cannotBeChanged":
                    user1Message = "Data for the user '" + user1Name + "' cannot be changed.\n";
                    break;

                case "userNonexistent":
                    user1Message = "The user '" + user1Name + "' does not exist.\n";
                    break;

                case "recordedData":
                    user1Message = "The user '" + user1Name + "' now has " + user1Data[1] + " wins.\n";
                    break;
                }
                switch (user2Data[0])
                {
                case "noEntry":
                    user2Message = "";
                    break;

                case "cannotBeChanged":
                    user2Message = "Data for the user '" + user2Name + "' cannot be changed.\n";
                    break;

                case "userNonexistent":
                    user2Message = "The user '" + user2Name + "' does not exist.\n";
                    break;

                case "recordedData":
                    user2Message = "The user '" + user2Name + "' now has " + user2Data[1] + " wins.\n";
                    break;
                }
                switch (user3Data[0])
                {
                case "noEntry":
                    user3Message = "";
                    break;

                case "cannotBeChanged":
                    user3Message = "Data for the user '" + user3Name + "' cannot be changed.\n";
                    break;

                case "userNonexistent":
                    user3Message = "The user '" + user3Name + "' does not exist.\n";
                    break;

                case "recordedData":
                    user3Message = "The user '" + user3Name + "' now has " + user3Data[1] + " wins.\n";
                    break;
                }
                switch (user4Data[0])
                {
                case "noEntry":
                    user4Message = "";
                    break;

                case "cannotBeChanged":
                    user4Message = "Data for the user '" + user4Name + "' cannot be changed.\n";
                    break;

                case "userNonexistent":
                    user4Message = "The user '" + user4Name + "' does not exist.\n";
                    break;

                case "recordedData":
                    user4Message = "The user '" + user4Name + "' now has " + user4Data[1] + " wins.\n";
                    break;
                }

                Console.WriteLine(user1Data[0]);

                builder.WithTitle("Value(s) Updated")
                .WithDescription($"{user1Message}{user2Message}{user3Message}{user4Message}")
                .WithColor(Color.Green);

                await ReplyAsync("", false, builder.Build());

                break;

            default:
                builder.WithTitle("Error")
                .WithDescription("You do not have the correct priveleges to complete this action.")
                .WithColor(Color.Red);

                await ReplyAsync("", false, builder.Build());

                break;
            }
        }