Esempio n. 1
0
        public async Task ClearAsync(int amount = 0)
        {
            if (amount == 0)
            {
                await ReplyAsync($"{Emotes.GetEmote("redmark")} Please specify how many messages you want to be cleared");

                return;
            }

            var msgs = await Context.Channel.GetMessagesAsync(amount + 1).Flatten(); //Get messages

            try
            {
                await Context.Channel.DeleteMessagesAsync(msgs); //Delete messages.

                if (amount == 1)
                {
                    await ReplyAsync($"{Emotes.GetEmote("greenmark")} {amount} message has been cleared");
                }
                else
                {
                    await ReplyAsync($"{Emotes.GetEmote("greenmark")} {amount} messages have been cleared.");
                }
            }
            catch
            {
                await ReplyAsync($"{Emotes.GetEmote("redmark")} An error has occurred. Please contact @temporis#6402 on discord.");
            }
        }
        public override Task <Optional <InteractivityResult <T> > > ParseAsync(SocketReaction value, DateTime startTime)
        {
            int index = Emotes.FindIndex(x => x.Equals(value.Emote));

            return(Task.FromResult(Optional.Create(
                                       index >= Values.Count
                ? new InteractivityResult <T>(default, DateTime.UtcNow - startTime, false, true)
Esempio n. 3
0
        internal static string SubstituteEmotes(string msg, SocketGuild guild)
        {
            var emote = new Regex(@"\[(\w+)\]", RegexOptions.Compiled);

            return(emote.Replace(msg, (match) =>
            {
                var symbol = match.Groups[1].Value;
                if (Emotes.ContainsKey(symbol))
                {
                    symbol = Emotes[symbol];
                }

                if (symbol.StartsWith(":"))
                {
                    return symbol;
                }

                var found = FindEmote(symbol, guild);
                if (!string.IsNullOrEmpty(found))
                {
                    return found;
                }

                return $"[{match.Value}]";
            }
                                 ));
        }
Esempio n. 4
0
        public MusicControllerItem(Emotes emote, Func <Task> add, Func <Task> remove, Func <Task> addOrRemove = null, bool display = false)
        {
            Emote     = emote;
            Display   = display;
            IsEnabled = false;

            if (addOrRemove != null)
            {
                AddOrRemove = () =>
                {
                    IsEnabled = !IsEnabled;
                    return(addOrRemove());
                };
            }
            else
            {
                AddOrRemove = null;
                Add         = async() =>
                {
                    IsEnabled = !IsEnabled;
                    if (add != null)
                    {
                        await add();
                    }
                };
                Remove = async() =>
                {
                    IsEnabled = !IsEnabled;
                    if (remove != null)
                    {
                        await remove();
                    }
                };
            }
        }
Esempio n. 5
0
        private static SelectMenuBuilder GetTargetMenu(PlayerFighter player)
        {
            var targets = player.SelectedMove.OnEnemy ? player.Enemies : player.Party;

            if ((player.SelectedMove.TargetType & TargetType.NoAim) == player.SelectedMove.TargetType || targets.Count <= 1)
            {
                return(null);
            }
            var team = targets.First().Party;

            List <SelectMenuOptionBuilder> options = new();

            foreach (var f in targets)
            {
                var emote = f.IsAlive ? null : Emotes.GetEmote("Dead");

                if (f.Stats.HP != 0 && 100 * f.Stats.HP / f.Stats.MaxHP <= 10)
                {
                    emote = Emote.Parse("<:Exclamatory:549529360604856323>");
                }

                options.Add(new SelectMenuOptionBuilder
                {
                    Label     = $"{f.Name}",
                    Value     = $"{options.Count}",
                    Emote     = emote,
                    IsDefault = player.HasSelected && team.IndexOf(f) == player.SelectedMove.TargetNr
                });
            }
            return(new SelectMenuBuilder($"{nameof(SelectTargetAction)}", options, "Select a Target"));
        }
        public override Paginator Build(int startPage = 0)
        {
            if (Pages.Count == 0)
            {
                throw new InvalidOperationException("A paginator needs at least one page!");
            }

            if (Emotes.Count == 0)
            {
                WithDefaultEmotes();
            }

            for (int i = 0; i < Pages.Count; i++)
            {
                Pages[i].WithPaginatorFooter(Footer, i, Pages.Count - 1, Users);
            }

            return(new StaticPaginator(Users?.AsReadOnly() ?? throw new ArgumentNullException(nameof(Users)),
                                       Emotes?.AsReadOnly() ?? throw new ArgumentNullException(nameof(Emotes)),
                                       CancelledEmbed?.Build(),
                                       TimeoutedEmbed?.Build(),
                                       Deletion,
                                       Pages?.Select(x => x.Build()).ToList().AsReadOnly() ?? throw new ArgumentNullException(nameof(Pages)),
                                       startPage));
        }
Esempio n. 7
0
        private async Task HandleCommandAsync(SocketMessage s)
        {
            var msg     = s as SocketUserMessage;
            var context = new SocketCommandContext(_client, msg);
            int argPos  = 0;

            if (context.Message.Author == _client.CurrentUser)
            {
                return;
            }
            if (msg.Content == null)
            {
                return;
            }

            if (msg.HasStringPrefix(Program.ConfigHelper.Bot.Prefix, ref argPos) || msg.HasMentionPrefix(_client.CurrentUser, ref argPos))
            {
                var result = await _service.ExecuteAsync(context, argPos);

                if (result.Error == CommandError.UnknownCommand)
                {
                    Console.WriteLine($"Unknown command sent in #{context.Channel.ToString()} in the server {context.Guild.ToString()}");
                    await context.Channel.SendMessageAsync($"{Emotes.GetEmote("redmark")} Unknown command. Do `{Program.ConfigHelper.Bot.Prefix}help` for a list of commands :)");
                }

                if (!result.IsSuccess && result.Error != CommandError.UnknownCommand)
                {
                    Console.WriteLine(result.ErrorReason);
                }
            }
        }
        /// <summary>
        /// Build the <see cref="ReactionSelectionBuilder{T}"/> to a immutable <see cref="ReactionSelection{T}"/>.
        /// </summary>
        /// <returns></returns>
        public override Selection <T, SocketReaction> Build()
        {
            if (Emotes.Count < Values.Count)
            {
                throw new InvalidOperationException("Value count larger than emote count! Please add more Emotes to the selection!");
            }
            if (Emotes.Contains(CancelEmote) == true)
            {
                throw new InvalidOperationException("Please remove the cancel emote from the selection emotes!");
            }

            if (EnableDefaultSelectionDescription == true)
            {
                var builder = new StringBuilder();

                for (int i = 0; i < Values.Count; i++)
                {
                    string possibility = StringConverter.Invoke(Values[i]);
                    builder.AppendLine($"{Emotes[i]} - {possibility}");
                }

                SelectionEmbed.AddField(Title, builder.ToString());
            }

            return(new ReactionSelection <T>(
                       Values?.AsReadOnlyCollection() ?? throw new ArgumentNullException(nameof(Values)),
                       Users?.AsReadOnlyCollection() ?? throw new ArgumentNullException(nameof(Users)),
                       SelectionEmbed?.Build() ?? throw new ArgumentNullException(nameof(SelectionEmbed)),
                       CancelledEmbed?.Build() ?? throw new ArgumentNullException(nameof(CancelledEmbed)),
                       TimeoutedEmbed?.Build() ?? throw new ArgumentNullException(nameof(TimeoutedEmbed)),
                       Deletion,
                       Emotes?.AsReadOnlyCollection() ?? throw new ArgumentNullException(nameof(Emotes)),
                       CancelEmote ?? throw new ArgumentNullException(nameof(CancelEmote)),
                       AllowCancel));
        }
Esempio n. 9
0
    public void ShowEmote(Emotes emote)
    {
        //Transform emote = transform.GetChild(emotes[key]);
        Transform emoteT = transform.GetChild((int)emote);

        emoteT.gameObject.SetActive(true);
        StartCoroutine(EmoteReset(emoteT));
    }
Esempio n. 10
0
 public string NonZerosToString()
 {
     return((
                $"{(VenusAtk != 0 || VenusRes != 0 ? $"{Emotes.GetIcon(Element.Venus)} `{VenusAtk} | {VenusRes}` " : "")}" +
                $"{(MarsAtk != 0 || MarsRes != 0 ? $"{Emotes.GetIcon(Element.Mars)} `{MarsAtk} | {MarsRes}` " : "")}" +
                $"{(JupiterAtk != 0 || JupiterRes != 0 ? $"{Emotes.GetIcon(Element.Jupiter)} `{JupiterAtk} | {JupiterRes}` " : "")}" +
                $"{(MercuryAtk != 0 || MercuryRes != 0 ? $"{Emotes.GetIcon(Element.Mercury)} `{MercuryAtk} | {MercuryRes}` " : "")}")
            .Trim());
 }
        public static string GetEmote(Emotes emote)
        {
            switch (emote)
            {
            case Emotes.question:
                return("\u2753");

            case Emotes.checkmark:
                return("\u2705");

            case Emotes.cross:
                return("\u274c");

            case Emotes.zero:
                return("\u0030\u20E3");

            case Emotes.one:
                return("\u0031\u20E3");

            case Emotes.two:
                return("\u0032\u20E3");

            case Emotes.three:
                return("\u0033\u20E3");

            case Emotes.four:
                return("\u0034\u20E3");

            case Emotes.five:
                return("\u0035\u20E3");

            case Emotes.six:
                return("\u0036\u20E3");

            case Emotes.seven:
                return("\u0037\u20E3");

            case Emotes.eight:
                return("\u0038\u20E3");

            case Emotes.nine:
                return("\u0039\u20E3");

            case Emotes.ten:
                return("\u1F51F");

            case Emotes.triangle_right:
                return("\u23F5");

            case Emotes.warning:
                return("\u26A0");

            default:
                return(null);
            }
        }
Esempio n. 12
0
        public static string GetString(Emotes emote)
        {
            var attribute = typeof(Emotes).GetMember(emote.ToString()).FirstOrDefault()?.GetCustomAttributes(typeof(EmoteValueAttribute), false).FirstOrDefault();

            if (attribute != null && attribute is EmoteValueAttribute emoteValueAttribute)
            {
                return(emoteValueAttribute.Value);
            }
            return(null);
        }
Esempio n. 13
0
 void btnOK_Click(object sender, EventArgs e)
 {
     DialogResult = DialogResult.OK;
     onSave?.Invoke(this, EventArgs.Empty);
     Close();
     foreach (TabPage tp in App.MainForm.TabControl.TabPages)
     {
         tp.Reload();
     }
     Emotes.EmoteAdded();
 }
Esempio n. 14
0
        public async Task PutRoles([Remainder] ITextChannel channel)
        {
            var builder = new ComponentBuilder();

            builder.WithButton("Venus", $"^{nameof(ChangeAdeptAction)}.Venus", ButtonStyle.Primary, emote: Emotes.GetEmote(Element.Venus));
            builder.WithButton("Mars", $"^{nameof(ChangeAdeptAction)}.Mars", ButtonStyle.Primary, emote: Emotes.GetEmote(Element.Mars));
            builder.WithButton("Jupiter", $"^{nameof(ChangeAdeptAction)}.Jupiter", ButtonStyle.Primary, emote: Emotes.GetEmote(Element.Jupiter));
            builder.WithButton("Mercury", $"^{nameof(ChangeAdeptAction)}.Mercury", ButtonStyle.Primary, emote: Emotes.GetEmote(Element.Mercury));
            await channel.SendMessageAsync($"Choose from {Emotes.GetIcon(Element.Venus)}Venus, {Emotes.GetIcon(Element.Mars)}Mars, " +
                                           $"{Emotes.GetIcon(Element.Jupiter)}Jupiter, or {Emotes.GetIcon(Element.Mercury)}Mercury. You can change your role/element at any time.", components : builder.Build());
        }
Esempio n. 15
0
 /// <summary>
 /// Resets the counter
 /// </summary>
 /// <param name="e"></param>
 /// <param name="message"></param>
 private void ResetCounter(ServerMessage e, string message)
 {
     lock (_lock)
     {
         Emotes.Clear();
         Emotes.persist();
         LastResetDate = new DateTimeOffset(DateTime.Now).ToString();
         server.fileCommand(_resetDateFile, x => System.IO.File.WriteAllText(x, LastResetDate));
         server.safeSendMessage(e.Channel, "Counter reset successfully!");
     }
 }
Esempio n. 16
0
        public void HandleTextEmote(ref IPacketReader packet, ref IWorldManager manager)
        {
            uint      emote     = packet.ReadUInt32();
            ulong     guid      = packet.ReadUInt64();
            uint      emoteId   = Emotes.Get((TextEmotes)emote);
            Character character = (Character)manager.Account.ActiveCharacter;

            PacketWriter pw = new PacketWriter(Sandbox.Instance.Opcodes[global::Opcodes.SMSG_TEXT_EMOTE], "SMSG_TEXT_EMOTE");

            pw.Write(character.Guid);
            pw.Write(emote);

            if (guid == character.Guid)
            {
                pw.WriteString(character.Name);
            }
            else
            {
                pw.WriteUInt8(0);
            }

            manager.Send(pw);

            switch ((TextEmotes)emote)
            {
            case TextEmotes.EMOTE_SIT:
                character.StandState = StandState.SITTING;
                manager.Send(character.BuildUpdate());
                return;

            case TextEmotes.EMOTE_STAND:
                character.StandState = StandState.STANDING;
                manager.Send(character.BuildUpdate());
                return;

            case TextEmotes.EMOTE_SLEEP:
                character.StandState = StandState.SLEEPING;
                manager.Send(character.BuildUpdate());
                return;

            case TextEmotes.EMOTE_KNEEL:
                character.StandState = StandState.KNEEL;
                manager.Send(character.BuildUpdate());
                return;
            }

            if (emoteId > 0)
            {
                pw = new PacketWriter(Sandbox.Instance.Opcodes[global::Opcodes.SMSG_EMOTE], "SMSG_EMOTE");
                pw.WriteUInt32(emoteId);
                pw.WriteUInt64(character.Guid);
                manager.Send(pw);
            }
        }
        protected PaginatorBuilder WithDefaultEmotes()
        {
            Emotes.Clear();

            Emotes.Add(new Emoji("◀"), PaginatorAction.Backward);
            Emotes.Add(new Emoji("▶"), PaginatorAction.Forward);
            Emotes.Add(new Emoji("⏮"), PaginatorAction.SkipToStart);
            Emotes.Add(new Emoji("⏭"), PaginatorAction.SkipToEnd);
            Emotes.Add(new Emoji("🛑"), PaginatorAction.Exit);

            return(this);
        }
Esempio n. 18
0
 public override string ToString()
 {
     return((
                $"{(VenusAtk != 0 || VenusRes != 0 ? $"{Emotes.GetIcon(Element.Venus)} `{VenusAtk} | {VenusRes}` " : "")}" +
                $"{(MercuryAtk != 0 || MercuryRes != 0 ? $"{Emotes.GetIcon(Element.Mercury)} `{MercuryAtk} | {MercuryRes}` " : "")}" +
                "\n" +
                $"{(MarsAtk != 0 || MarsRes != 0 ? $"{Emotes.GetIcon(Element.Mars)} `{MarsAtk} | {MarsRes}` " : "")}" +
                $"{(JupiterAtk != 0 || JupiterRes != 0 ? $"{Emotes.GetIcon(Element.Jupiter)} `{JupiterAtk} | {JupiterRes}` " : "")}")
            .Trim());
     //return $"`VnPow: {VenusAtk} MrPow: {MarsAtk} JpPow: {JupiterAtk} McPow: {MercuryAtk}`\n" +
     //    $"`VnRes: {VenusRes} MrRes: {MarsRes} JpRes: {JupiterRes} McRes: {MercuryRes}`";
 }
Esempio n. 19
0
        public async Task SummonInfo([Remainder] string name = "")
        {
            if (name == "")
            {
                return;
            }

            if (!DjinnAndSummonsDatabase.TryGetSummon(name, out var summon))
            {
                var emb = new EmbedBuilder();
                emb.WithDescription(":x: There is no such spirit with that description!");
                emb.WithColor(Colors.Get("Error"));
                await Context.Channel.SendMessageAsync("", false, emb.Build());

                return;
            }

            var embed = new EmbedBuilder();

            embed.WithAuthor($"{summon.Name}");
            embed.AddField("Icon", summon.Emote, true);
            embed.AddField("Needed",
                           string.Join("", Enumerable.Repeat(Emotes.GetIcon(Element.Venus), summon.VenusNeeded)
                                       .Concat(Enumerable.Repeat(Emotes.GetIcon(Element.Mars), summon.MarsNeeded))
                                       .Concat(Enumerable.Repeat(Emotes.GetIcon(Element.Jupiter), summon.JupiterNeeded))
                                       .Concat(Enumerable.Repeat(Emotes.GetIcon(Element.Mercury), summon.MercuryNeeded))),
                           true);
            var effectList = summon.Effects.Count > 0
                ? string.Join("\n", summon.Effects.Select(e => e.ToString()))
                : "";
            var userList = summon.EffectsOnUser?.Count > 0
                ? "On User:\n" + string.Join("\n", summon.EffectsOnUser.Select(e => e.ToString()))
                : "";
            var partyList = summon.EffectsOnParty?.Count > 0
                ? "On party:\n" + string.Join("\n", summon.EffectsOnParty.Select(e => e.ToString()))
                : "";

            embed.AddField("Description",
                           string.Join("\n", summon.ToString(), effectList, userList, partyList,
                                       summon.HasPriority ? "Always goes first." : ""));

            embed.WithColor(Colors.Get(
                                Enumerable.Repeat(Element.Venus.ToString(), summon.VenusNeeded)
                                .Concat(Enumerable.Repeat(Element.Mars.ToString(), summon.MarsNeeded))
                                .Concat(Enumerable.Repeat(Element.Jupiter.ToString(), summon.JupiterNeeded))
                                .Concat(Enumerable.Repeat(Element.Mercury.ToString(), summon.MercuryNeeded))
                                .ToArray()
                                ));

            _ = Context.Channel.SendMessageAsync("", false, embed.Build());
            await Task.CompletedTask;
        }
        internal static async Task HandleEvent(SocketGuild before, SocketGuild after)
        {
            if (before.Emotes.Count > after.Emotes.Count)
            {
                var removedEmote = before.Emotes.Except(after.Emotes).First();
                await using (var database = new BachuzContext())
                {
                    database.Remove(database.Emotes.Single(e => e.EmoteId == removedEmote.Id));
                    await database.SaveChangesAsync();
                }
            }
            else if (after.Emotes.Count > before.Emotes.Count)
            {
                var addedEmote = after.Emotes.Except(before.Emotes).First();

                await using (var database = new BachuzContext())
                {
                    Emotes newEmote = new Emotes
                    {
                        EmoteId = addedEmote.Id,
                        GuildId = after.Id,
                        Name    = addedEmote.Name,
                        Count   = 0
                    };

                    await database.Emotes.AddAsync(newEmote);

                    await database.SaveChangesAsync();
                }
            }
            else
            {
                // updates Emote name in database
                var updatedEmote =
                    (from emoteAfter in after.Emotes
                     let emoteBefore = before.Emotes
                                       .First(e => e.Id == emoteAfter.Id)
                                       where emoteAfter.Name != emoteBefore.Name
                                       select emoteAfter)
                    .FirstOrDefault();

                if (updatedEmote != null)
                {
                    await using (var database = new BachuzContext())
                    {
                        var emote = database.Emotes.First(e => e.EmoteId == updatedEmote.Id);
                        emote.Name = updatedEmote.Name;
                        await database.SaveChangesAsync();
                    }
                }
            }
        }
Esempio n. 21
0
        public async Task ShowInventory(Detail detail = Detail.None)
        {
            var split = new Dictionary <Detail, char>
            {
                { Detail.None, '>' },
                { Detail.Names, ',' },
                { Detail.NameAndPrice, '\n' }
            };
            var account = EntityConverter.ConvertUser(Context.User);
            var inv     = account.Inv;
            var embed   = new EmbedBuilder()
                          .AddField("Warrior Gear", inv.GearToString(ArchType.Warrior), true)
                          .AddField("Mage Gear", inv.GearToString(ArchType.Mage), true);

            var invstring = inv.InventoryToString(detail);

            if (invstring.Length >= 1024)
            {
                var remainingstring = invstring;
                var parts           = new List <string>();
                while (remainingstring.Length >= 1024)
                {
                    var lastitem = remainingstring.Take(1024).ToList().FindLastIndex(s => s.Equals(split[detail])) + 1;
                    parts.Add(string.Join("", remainingstring.Take(lastitem)));
                    remainingstring = string.Join("", remainingstring.Skip(lastitem));
                }

                parts.Add(remainingstring);
                foreach (var(value, index) in parts.Select((v, i) => (v, i)))
                {
                    embed.AddField($"Inventory ({index + 1}/{parts.Count})", value);
                }
            }
            else
            {
                embed.AddField("Inventory", invstring);
            }

            if (inv.GetChestsToString().Length > 0)
            {
                embed.AddField("Chests:", inv.GetChestsToString());
            }

            var fb = new EmbedFooterBuilder();

            fb.WithText(
                $"{inv.Count} / {inv.MaxInvSize} {(inv.Upgrades < 4 ? $"Upgrade: {50000 * Math.Pow(2, inv.Upgrades)}" : "")}");
            embed.AddField("Coin", $"{Emotes.GetIcon("Coin")} {inv.Coins}");
            embed.WithColor(Colors.Get("Iodem"));
            embed.WithFooter(fb);
            await Context.Channel.SendMessageAsync("", false, embed.Build());
        }
Esempio n. 22
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="container">Dependency injection container</param>
 public VMEmotes(IContainer container)
 {
     Container      = container;
     MessageService = Container.Resolve <IMessageService>();
     Emotes.Add(new VMEmote()
     {
         Name = "Smile", WorldEmoteType = WorldEmoteType.Smile
     });
     Emotes.Add(new VMEmote()
     {
         Name = "Frown", WorldEmoteType = WorldEmoteType.Frown
     });
 }
Esempio n. 23
0
        private void AddEmote(string emoteData, int emoteId, string message, bool single = false)
        {
            int startIndex = -1, endIndex = -1;

            if (single)
            {
                startIndex = int.Parse(emoteData.Split(':')[1].Split('-')[0]);
                endIndex   = int.Parse(emoteData.Split(':')[1].Split('-')[1]);
            }
            else
            {
                startIndex = int.Parse(emoteData.Split('-')[0]);
                endIndex   = int.Parse(emoteData.Split('-')[1]);
            }
            Emotes.Add(new Emote(emoteId, message.Substring(startIndex, (endIndex - startIndex) + 1), startIndex, endIndex));
        }
Esempio n. 24
0
        public BrimeChatMessage(JToken message)
        {
            // Logger.Trace("Loading Chat Message: " + message);
            string?__notice = message.Value <string>("__notice");

            if (!string.IsNullOrWhiteSpace(__notice))
            {
                Logger.Info("Notice: " + __notice);
            }

            string?curr = message.Value <string>("channelID");

            ChannelID = (curr == null) ? "" : curr;

            curr = message.Value <string>("_id");
            ID   = (curr == null) ? "" : curr;

            curr    = message.Value <string>("message");
            Message = (curr == null) ? "" : curr;

            JToken?sender = message["sender"];

            Sender = (sender == null) ? new BrimeUser() : new BrimeUser(sender);

            JToken?emotes = message["emotes"];

            if (emotes != null)
            {
                foreach (JToken item in emotes)
                {
                    if (item != null)
                    {
                        JProperty?prop = item.ToObject <JProperty>();
                        if (prop != null)
                        {
                            string name = prop.Name;
                            string?id   = prop.Value.Value <string>("_id");
                            if (id != null)
                            {
                                Emotes.Add(name, new BrimeChatEmote(id));
                            }
                        }
                    }
                }
            }
            Timestamp = message.Value <DateTime>("timestamp");
        }
Esempio n. 25
0
        public async Task ListClasses()
        {
            var account             = EntityConverter.ConvertUser(Context.User);
            var allClasses          = AdeptClassSeriesManager.AllClasses;
            var allAvailableClasses = allClasses.Where(c => c.IsDefault || account.BonusClasses.Any(bc => bc.Equals(c.Name)));
            var ofElement           = allAvailableClasses.Where(c => c.Elements.Contains(account.Element)).Select(c => c.Name).OrderBy(n => n);

            var embed = new EmbedBuilder();

            embed.WithTitle("Classes");
            embed.WithColor(Colors.Get(account.Element.ToString()));
            embed.AddField($"Available as {Emotes.GetIcon(account.Element)} {account.Element} Adept:", string.Join(", ", ofElement));
            embed.AddField("Others Unlocked:", string.Join(", ", allAvailableClasses.Select(c => c.Name).Except(ofElement).OrderBy(n => n)));
            embed.WithFooter($"Total: {allAvailableClasses.Count()}/{allClasses.Count}");
            _ = ReplyAsync(embed: embed.Build());
            await Task.CompletedTask;
        }
Esempio n. 26
0
        public EmoteSet(JSON.EmoteSet emoteSet)
        {
            Category      = (EmoteCategory)emoteSet.category;
            Probability   = emoteSet.probability;
            VendorType    = (VendorType?)emoteSet.vendorType;
            Quest         = emoteSet.quest;
            WeenieClassId = emoteSet.classID;
            Style         = (MotionStance?)emoteSet.style;
            Substyle      = (MotionCommand?)emoteSet.substyle;
            MinHealth     = emoteSet.minhealth;
            MaxHealth     = emoteSet.maxhealth;

            foreach (var emote in emoteSet.emotes)
            {
                Emotes.Add(new Emote(emote));
            }
        }
Esempio n. 27
0
        public List <Emote> GetEmotes(ulong guildId)
        {
            List <Emote> results = new List <Emote>();

            // Get current guild emotes
            SocketGuild guild = DiscordService.DiscordClient.GetGuild(guildId);

            if (guild == null)
            {
                throw new Exception("Unable to access guild");
            }

            foreach (Discord.GuildEmote guildEmote in guild.Emotes.OrderBy(x => x.Name))
            {
                results.Add(new Emote(guildEmote.Id, guildEmote.Name, guildEmote.Url, guildEmote.RequireColons, false));
            }

            // Get emotes from Bot Discord Server
            string discordServerId = Settings.Load().BotDiscordServer;

            if (!string.IsNullOrEmpty(discordServerId) && guildId != ulong.Parse(discordServerId))
            {
                SocketGuild kupoNutsGuild = DiscordService.DiscordClient.GetGuild(ulong.Parse(discordServerId));

                if (kupoNutsGuild == null)
                {
                    throw new Exception("Unable to access guild");
                }

                foreach (Discord.GuildEmote guildEmote in kupoNutsGuild.Emotes.OrderBy(x => x.Name))
                {
                    results.Add(new Emote(guildEmote.Id, guildEmote.Name, guildEmote.Url, guildEmote.RequireColons, false));
                }
            }

            // Get basic emojis
            Emotes emotesClass = new Emotes();

            foreach (KeyValuePair <string, string> emote in emotesClass.GetAllEmotes())
            {
                results.Add(new Emote(emote.Key, emote.Value));
            }

            return(results);
        }
Esempio n. 28
0
        public async Task ItemInfo([Remainder] string name = "")
        {
            if (name == "")
            {
                return;
            }

            var item = ItemDatabase.GetItem(name);

            if (item.Name.Contains("NOT IMPLEMENTED"))
            {
                var emb = new EmbedBuilder();
                emb.WithDescription(
                    ":x: I asked our treasurer, the weapon smith, the priest, the librarian and a cool looking kid walking by, and no one has heard of that item!");
                emb.WithColor(Colors.Get("Error"));
                await Context.Channel.SendMessageAsync("", false, emb.Build());

                return;
            }

            var embed = new EmbedBuilder();

            embed.WithAuthor($"{item.Name} - {item.Rarity}{(item.IsArtifact ? " Artifact" : "")}");

            embed.AddField("Icon", item.IconDisplay, true);
            embed.AddField("Value", $"{Emotes.GetIcon("Coin")} {item.Price}", true);
            embed.AddField("Type", item.ItemType, true);
            embed.AddField("Summary", item.Summary(), true);

            //if (!item.Description.IsNullOrEmpty())
            //{
            //   embed.AddField("Description",$"*{item.Description}*", inline:true);
            //}

            embed.WithColor(item.Category == ItemCategory.Weapon && item.IsUnleashable
                ?
                            Colors.Get(item.Unleash.UnleashAlignment.ToString())
                : item.IsArtifact
                    ? Colors.Get("Artifact")
                    : Colors.Get("Exathi"));

            _ = Context.Channel.SendMessageAsync("", false, embed.Build());
            await Task.CompletedTask;
        }
Esempio n. 29
0
        public async Task DjinnInv(DjinnDetail detail = DjinnDetail.None)
        {
            var djinnPocket = EntityConverter.ConvertUser(Context.User).DjinnPocket;
            var embed       = new EmbedBuilder();

            var equippedstring = string.Join("", djinnPocket.GetDjinns().Select(d => Emotes.GetIcon(d.Element)));

            if (equippedstring.IsNullOrEmpty())
            {
                equippedstring = "-";
            }
            embed.AddField("Equipped", equippedstring);

            foreach (var e in new[]
                     { Element.Venus, Element.Mars, Element.None, Element.Jupiter, Element.Mercury, Element.None })
            {
                if (e == Element.None)
                {
                    embed.AddField("\u200b", "\u200b", true);
                }
                else
                {
                    var djinnString = djinnPocket.Djinn.OfElement(e).GetDisplay(detail);
                    embed.AddField($"{e} Djinn", djinnString, true);
                }
            }

            var eventDjinn = djinnPocket.Djinn.Count(d => d.IsEvent);

            embed.WithFooter(
                $"{djinnPocket.Djinn.Count}/{djinnPocket.PocketSize}{(eventDjinn > 0 ? $"(+{eventDjinn})" : "")} Upgrade: {(djinnPocket.PocketUpgrades + 1) * 3000}");

            var summonString = string.Join(detail == DjinnDetail.Names ? ", " : "",
                                           djinnPocket.Summons.Select(s => $"{s.Emote}{(detail == DjinnDetail.Names ? $" {s.Name}" : "")}"));

            if (summonString.IsNullOrEmpty())
            {
                summonString = "-";
            }
            embed.AddField("Summons", summonString);
            await ReplyAsync(embed : embed.Build());
        }
Esempio n. 30
0
        /// <summary>
        /// コンソールに書くやつ
        /// </summary>
        public void WriteConsole()
        {
            // 今の時間をセット
            NowTime = DateTime.Now;

            // if で切ったところをイベントとして投げるといい感じだったかも
            // 秒数が0だったら凄いエモートするか
            if (NowTime.Second == 0)
            {
                Console.WriteLine($"{NowTime.ToLongTimeString()} / { MyName }、{ SuperEmotes.OrderBy(y => Guid.NewGuid()).First()} ");
            }

            else
            {
                // えもーとする
                // .First()が抜けてました。
                // .Take(1)で 取った気になるじゃないですか!
                // 1発じゃ気づきにくいですよね( ^ω^)・・・
                Console.WriteLine($"{NowTime.ToLongTimeString()} / { MyName }、{ Emotes.OrderBy(y => Guid.NewGuid()).First()} ");
            }
        }
Esempio n. 31
0
 public Telegram(string text, Emotes emotion) { Text = text; Emotion = emotion; }
Esempio n. 32
0
 //Line Format <EMOTION>% MESSAGE
 public Telegram(string RawLine)
 {
     string[] parts = RawLine.Split('>');
     Emotion = (Emotes)Enum.Parse(typeof(Emotes), (parts[0].Trim().TrimStart('<')));
     Text = parts[1].Trim();
 }
Esempio n. 33
0
 public Telegram(ItemTransfer item, Emotes emotion)
 {
     Emotion = emotion;
     Text = item.ToString();
 }