public static Tuple <string, EmbedBuilder, Boolean> rpsResults(Color color, string embedIcon, int randomGuess, string guess, string parent, string username, string[] arrWinReaction, string[] arrLoseReaction, string[] arrDrawReaction, ulong guildId, ulong userId) { //IDictionary<string, string> arrResult = new Dictionary<string, string>(); string randomResult; /*string gameState;*/ string picReactionFolderDir = $"config/rps_reaction/{parent}/"; string embedTitle; string textTemplate = ""; Boolean isWin = false; GAME_STATE gameState = GAME_STATE.LOSE; guess = guess.ToLower(); switch (randomGuess) { case 0: //rock randomResult = ":rock: rock"; switch (guess) { case "rock": gameState = GAME_STATE.DRAW; break; case "paper": gameState = GAME_STATE.WIN; break; default: gameState = GAME_STATE.LOSE; break; } break; case 1: //paper randomResult = "📜 paper"; switch (guess) { case "paper": gameState = GAME_STATE.DRAW; break; case "scissors": gameState = GAME_STATE.WIN; break; default: gameState = GAME_STATE.LOSE; break; } break; default: //scissor randomResult = "✂️ scissors"; switch (guess) { case "scissors": gameState = GAME_STATE.DRAW; break; case "rock": gameState = GAME_STATE.WIN; break; default: gameState = GAME_STATE.LOSE; break; } break; } switch (gameState) { case GAME_STATE.WIN: int rndIndex = new Random().Next(0, arrLoseReaction.Length); picReactionFolderDir += "lose"; embedTitle = $"{username} has win the game!"; textTemplate = $"\"{arrLoseReaction[rndIndex]}\" You got 10 minigame score points & 1 magic seeds!"; //save the data updateScore(guildId, userId, 10); //update player garden data UserDataCore.updateMagicSeeds(userId, 1); isWin = true; break; case GAME_STATE.DRAW: rndIndex = new Random().Next(0, arrDrawReaction.Length); embedTitle = "❌ The game is draw!"; picReactionFolderDir += "draw"; textTemplate = $"\"{arrDrawReaction[rndIndex]}\""; break; default: rndIndex = new Random().Next(0, arrWinReaction.Length); picReactionFolderDir += "win"; embedTitle = $"❌ {username} has lose the game!"; textTemplate = $"\"{arrWinReaction[rndIndex]}\""; break; } switch (guess) { case "scissors": guess = guess.Replace("scissors", "✂️ scissors"); break; case "paper": guess = guess.Replace("paper", "📜 paper"); break; case "rock": guess = guess.Replace("rock", ":rock: rock"); break; } string randomPathFile = GlobalFunctions.getRandomFile(picReactionFolderDir, new string[] { ".png", ".jpg", ".gif", ".webm" }); EmbedBuilder eb = new EmbedBuilder { Color = color, Author = new EmbedAuthorBuilder { Name = "Rock Paper Scissors Shoot!", IconUrl = embedIcon }, Title = embedTitle, Description = textTemplate, ThumbnailUrl = $"attachment://{Path.GetFileName(randomPathFile)}" }; eb.AddField(GlobalFunctions.UppercaseFirst(username) + " use:", guess, true); eb.AddField(GlobalFunctions.UppercaseFirst(parent) + " use:", randomResult, true); return(Tuple.Create($"{randomPathFile}", eb, isWin)); }
public static PaginatedMessage printAchievementsStatus(Color color, ulong guildId, ulong clientId, string username, string thumbnailUrl) { Boolean achievementDataExists = false; PaginatedAppearanceOptions pao = new PaginatedAppearanceOptions(); pao.JumpDisplayOptions = JumpDisplayOptions.Never; pao.DisplayInformationIcon = false; List <string> pageContent = new List <string>(); string title = ""; string tempVal = title; int currentIndex = 0; for (int i = 0; i < achievementList.Count; i++) { string achievementKey = achievementList.ElementAt(i).Key; string[] arrMaster = achievementList[achievementKey];//format: title, description string mTitle = arrMaster[0]; string mDesc = arrMaster[1]; if (!achievementDataExists) { tempVal += ":white_check_mark: "; } else { tempVal += ":x: "; } tempVal += $"**{mTitle}**\n{mDesc}\n"; if (i == achievementList.Count - 1) { pageContent.Add(tempVal); } else { if (currentIndex < 9) { currentIndex++; } else { pageContent.Add(tempVal); currentIndex = 0; tempVal = title; } } } var pager = new PaginatedMessage { Title = $"**{username}'s Achievements**\n", Pages = pageContent, Color = color, Author = new EmbedAuthorBuilder() { Name = GlobalFunctions.UppercaseFirst(username), IconUrl = thumbnailUrl }, Options = pao }; return(pager); }