public static Embed PvPLobby(CombatCreationTool lobb, String url, UserAccount user) { var builder = new EmbedBuilder(); builder.WithColor(255, 0, 0) .WithFooter(user.Name, user.AvatarUrl) .WithImageUrl(url); var embed = builder.Build(); return(embed); }
public static async Task PvPMainMenu(UserAccount user, IUserMessage message, IEmote emote, ContextIds idList) { switch (emote.Name.ToLower()) { case "back1": user.RemoveAllReactionMessages(11); user.RemoveAllReactionMessages(1); await message.RemoveAllReactionsAsync(); await message.ModifyAsync(m => { m.Embed = MonEmbedBuilder.MainMenu(user); m.Content = ""; }); await MessageHandler.MenuEmojis(message); user.ReactionMessages.Add(message.Id, 1); break; case "singlebattle": user.RemoveAllReactionMessages(12); user.RemoveAllReactionMessages(11); user.RemoveAllReactionMessages(1); CombatCreationTool lobby = user.GetOrCreatePvPLobby("single", user.UserId); await message.RemoveAllReactionsAsync(); string url = MessageHandler.GetImageURL(ImageGenerator.PvPSoloLobby(lobby)).Result; await message.ModifyAsync(m => { m.Embed = MonEmbedBuilder.PvPLobby(lobby, url, user); m.Content = ""; }); await MessageHandler.PvPLobbyEmojis(message, user); user.ReactionMessages.Add(message.Id, 12); break; case "doublebattle": await MessageHandler.NotImplemented(idList, "double battle"); break; case "ffa": await MessageHandler.NotImplemented(idList, "free for all"); break; case "custombattle": await MessageHandler.NotImplemented(idList, "custom battle"); break; default: break; } }
public static async Task ParseExpectedInput(SocketUserMessage message, UserAccount user, SocketCommandContext Context) { ContextIds idList = new ContextIds(Context); if ((user.ExpectedInputLocation == idList.ChannelId || user.ExpectedInputLocation == 0) && user.GetTeam() != null) { if (user.ExpectedInput == 0 || user.ExpectedInput == 1) { //Update the menu(s) of the person who sent the invite await UpdateMenu(user, message.Channel, 7, ""); /*foreach(KeyValuePair<ulong, int> kvp in user.ReactionMessages) * { * if(kvp.Value == 7) * { * IMessage teamMess = await message.Channel.GetMessageAsync(kvp.Key); * if(teamMess is IUserMessage) * { * IUserMessage userTeamMess = (IUserMessage)teamMess; * await userTeamMess.ModifyAsync(m => {m.Embed = MonEmbedBuilder.TeamMenu(user); m.Content = "";}); * } * } * }*/ } //Team Invite Sending if (user.ExpectedInput == 0) { foreach (SocketUser u in message.MentionedUsers) { var ua = UserHandler.GetUser(u.Id); if (ua.GetTeam() == null && ua.Char != null) { var m = await _client.GetGuild(idList.GuildId).GetTextChannel(idList.ChannelId).SendMessageAsync("", embed: MonEmbedBuilder.TeamInviteMenu(user, ua)).ConfigureAwait(false); await TeamInviteEmojis(m); ua.ReactionMessages.Add(m.Id, 10); ua.InviteMessages.Add(m.Id, user.UserId); } } } //Kick players from team else if (user.ExpectedInput == 1) { //Kick all players who are on the team as long as the user kicking has kick permissions foreach (SocketUser u in message.MentionedUsers) { var ua = UserHandler.GetUser(u.Id); if (ua.GetTeam() == user.GetTeam() && user.GetTeam().CanKick(user) && user != ua) { ua.GetTeam().KickMember(ua); } } //Update the user's currently active team menu await UpdateMenu(user, message.Channel, 7, ""); /*foreach(KeyValuePair<ulong, int> kvp in user.ReactionMessages) * { * if(kvp.Value == 7) * { * IMessage teamMess = await message.Channel.GetMessageAsync(kvp.Key); * if(teamMess is IUserMessage) * { * IUserMessage userTeamMess = (IUserMessage)teamMess; * await userTeamMess.ModifyAsync(m => {m.Embed = MonEmbedBuilder.TeamMenu(user); m.Content = "";}); * } * } * }*/ } //Edit team name else if (user.ExpectedInput == 2) { var team = user.GetTeam(); if (team.CanAccessSettings(user) && message.Content.Length < 64) { team.TeamName = message.Content; } await UpdateMenu(user, message.Channel, 8, ""); } //Add image url else if (user.ExpectedInput == 3) { var team = user.GetTeam(); if (team.CanAccessSettings(user)) { team.Picture = message.Content; } await UpdateMenu(user, message.Channel, 8, ""); } //Edit RGB else if (user.ExpectedInput == 4) { var team = user.GetTeam(); string updateContent = ""; if (team.CanAccessSettings(user)) { string str = message.Content; str = str.Replace(",", ""); string[] rgb = str.Split(' '); if (rgb.Count() == 3) { try { team.TeamR = Int32.Parse(rgb[0]); team.TeamG = Int32.Parse(rgb[1]); team.TeamB = Int32.Parse(rgb[2]); } catch (FormatException e) { Console.WriteLine(e.Message); updateContent = "**You didn't enter the RGB values correctly!**"; } } } await UpdateMenu(user, message.Channel, 8, updateContent); } user.ExpectedInput = -1; user.ExpectedInputLocation = 0; } //Expected inputs that do not require a team if (user.ExpectedInputLocation == idList.ChannelId || user.ExpectedInputLocation == 0) { //Join open team if (user.ExpectedInput == 5) { string updateContent = ""; var team = user.GetTeam(); UserAccount otherUser = null; if (message.MentionedUsers.Count != 0) { otherUser = UserHandler.GetUser(message.MentionedUsers.First().Id); } Team otherTeam = null; if (otherUser != null) { otherTeam = otherUser.GetTeam(); } if (otherTeam != null) { if (otherTeam.OpenInvite) { if (team == null) { otherTeam.AddMember(user); } else { updateContent = "**You already have a team!**"; } } else { updateContent = "**That team is not open invite!**"; } } else { updateContent = "**That person does not have a team!**"; } await UpdateMenu(user, message.Channel, 9, updateContent); } //Invite player(s) to a pvp lobby else if (user.ExpectedInput == 6) { foreach (SocketUser u in message.MentionedUsers) { var ua = UserHandler.GetUser(u.Id); if (ua.Char != null) { var m = await _client.GetGuild(idList.GuildId).GetTextChannel(idList.ChannelId).SendMessageAsync("", embed: MonEmbedBuilder.LobbyInviteMenu(user, ua)).ConfigureAwait(false); await TeamInviteEmojis(m); ua.ReactionMessages.Add(m.Id, 14); ua.InviteMessages.Add(m.Id, user.UserId); } } if (user.HasLobby()) { CombatCreationTool lobby = user.CombatLobby; await lobby.UpdateAllMenus(new List <ulong>(), idList, ""); } } else if (user.ExpectedInput == 7) { List <ulong> excludeUpdate = new List <ulong>(); foreach (SocketUser u in message.MentionedUsers) { var ua = UserHandler.GetUser(u.Id); if (ua.Char != null) { if (user.HasLobby()) { CombatCreationTool lobby = user.CombatLobby; lobby.RemovePlayer(ua); await UpdateMenu(ua, message.Channel, 12, "You have been kicked from the lobby."); excludeUpdate.Add(ua.UserId); } } } if (user.HasLobby()) { CombatCreationTool lobby = user.CombatLobby; await lobby.UpdateAllMenus(excludeUpdate, idList, ""); } } user.ExpectedInput = -1; user.ExpectedInputLocation = 0; } }
public static async Task SoloPvPLobbyMenu(UserAccount user, IUserMessage message, IEmote emote, ContextIds idList) { switch (emote.Name.ToLower()) { case "back1": user.RemoveAllReactionMessages(12); user.RemoveAllReactionMessages(1); await message.RemoveAllReactionsAsync(); await message.ModifyAsync(m => { m.Embed = MonEmbedBuilder.MainMenu(user); m.Content = ""; }); await MessageHandler.MenuEmojis(message); user.ReactionMessages.Add(message.Id, 1); break; case "check": if (user.HasLobby()) { CombatCreationTool lobby = user.CombatLobby; user.Char.ReadyToggle(); if (user.Char.ReadyUp) { if (lobby.CheckCombatStart()) { CombatInstance2 combat = new CombatInstance2(idList, lobby.Teams); CombatHandler2.StoreInstance(CombatHandler2.NumberOfInstances(), combat); await combat.StartCombat(); } } } break; case "invite": if (user.HasLobby()) { CombatCreationTool lobby = user.CombatLobby; if (lobby.IsLeader(user)) { await message.ModifyAsync(m => { m.Content = "**Please tag the player(s) you wish to invite.**"; }); user.ExpectedInput = 6; user.ExpectedInputLocation = message.Channel.Id; } } break; case "kick_player": if (user.HasLobby()) { CombatCreationTool lobby = user.CombatLobby; if (lobby.IsLeader(user)) { await message.ModifyAsync(m => { m.Content = "**Please tag the player(s) you wish to kick.**"; }); user.ExpectedInput = 7; user.ExpectedInputLocation = message.Channel.Id; } } break; case "lvl": if (user.HasLobby()) { CombatCreationTool lobby = user.CombatLobby; if (lobby.IsLeader(user)) { lobby.LevelToggle(); await lobby.UpdateAllMenus(new List <ulong>(), idList, ""); } } break; case "bag": if (user.HasLobby()) { CombatCreationTool lobby = user.CombatLobby; if (lobby.IsLeader(user)) { lobby.ItemsToggle(); await lobby.UpdateAllMenus(new List <ulong>(), idList, ""); } } break; case "mon": if (user.HasLobby()) { CombatCreationTool lobby = user.CombatLobby; if (lobby.IsLeader(user)) { lobby.MonsToggle(); await lobby.UpdateAllMenus(new List <ulong>(), idList, ""); } } break; case "exit": if (user.HasLobby()) { CombatCreationTool lobby = user.CombatLobby; lobby.RemovePlayer(user); await lobby.UpdateAllMenus(user.UserId, idList, $"{user.Name} left lobby"); user.RemoveAllReactionMessages(12); user.RemoveAllReactionMessages(1); await message.RemoveAllReactionsAsync(); await message.ModifyAsync(m => { m.Embed = MonEmbedBuilder.MainMenu(user); m.Content = ""; }); await MessageHandler.MenuEmojis(message); user.ReactionMessages.Add(message.Id, 1); } break; default: break; } }
public static async Task MainMenu(UserAccount user, IUserMessage message, IEmote emote, ContextIds idList) { switch (emote.Name.ToLower()) { case "location": await MessageHandler.NotImplemented(idList, "location"); break; case "snoril": user.RemoveAllReactionMessages(1); user.RemoveAllReactionMessages(5); await message.RemoveAllReactionsAsync(); string url = MessageHandler.GetImageURL(ImageGenerator.PartyMenu(user.Char.Party)).Result; await message.ModifyAsync(m => { m.Embed = MonEmbedBuilder.PartyMenu(url, user); m.Content = ""; }); await MessageHandler.PartyMenuEmojis(message, user); user.ReactionMessages.Add(message.Id, 5); break; case "bag": await MessageHandler.NotImplemented(idList, "bag"); break; case "dex": await MessageHandler.NotImplemented(idList, "dex"); break; case "team": user.RemoveAllReactionMessages(7); user.RemoveAllReactionMessages(8); user.RemoveAllReactionMessages(9); user.RemoveAllReactionMessages(1); await message.RemoveAllReactionsAsync(); await message.ModifyAsync(m => { m.Embed = MonEmbedBuilder.TeamMenu(user); m.Content = ""; }); await MessageHandler.TeamMenuEmojis(message, user); //Reactionmessage added within TeamMenuEmojis() method break; case "pvp": user.RemoveAllReactionMessages(11); user.RemoveAllReactionMessages(1); if (user.HasLobby()) { CombatCreationTool lobby = user.GetOrCreatePvPLobby("single", user.UserId); await message.RemoveAllReactionsAsync(); string url2 = MessageHandler.GetImageURL(ImageGenerator.PvPSoloLobby(lobby)).Result; await message.ModifyAsync(m => { m.Embed = MonEmbedBuilder.PvPLobby(lobby, url2, user); m.Content = ""; }); await MessageHandler.PvPLobbyEmojis(message, user); user.ReactionMessages.Add(message.Id, 12); } else { await message.RemoveAllReactionsAsync(); await message.ModifyAsync(m => { m.Embed = MonEmbedBuilder.PvPMainMenu(user); m.Content = ""; }); await MessageHandler.PvPMainMenuEmojis(message); user.ReactionMessages.Add(message.Id, 11); } break; case "settings": await MessageHandler.NotImplemented(idList, "settings"); break; default: break; } }