Ejemplo n.º 1
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());
 }
Ejemplo n.º 2
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());
        }
Ejemplo n.º 3
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}`";
 }
Ejemplo n.º 4
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;
        }
Ejemplo n.º 5
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());
        }
Ejemplo n.º 6
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;
        }
Ejemplo n.º 7
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;
        }
Ejemplo n.º 8
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());
        }
Ejemplo n.º 9
0
        public async Task LoadoutTask(LoadoutAction action = LoadoutAction.Show, [Remainder] string loadoutName = "")
        {
            if (Context.User is not SocketGuildUser sgu)
            {
                return;
            }

            var user = EntityConverter.ConvertUser(sgu);

            switch (action)
            {
            case LoadoutAction.Show:
                var embed = new EmbedBuilder();
                if (user.Loadouts.LoadoutsList.Count > 0)
                {
                    foreach (var item in user.Loadouts.LoadoutsList)
                    {
                        var items = item.Gear.Count > 0 ? string.Join("", item.Gear.Select(i => user.Inv.GetItem(i)?.Icon ?? "-")) : "no gear";
                        var djinn = item.Djinn.Count > 0 ? string.Join("", item.Djinn.Select(d => user.DjinnPocket.GetDjinn(d)?.Emote ?? "-")) : "no Djinn";
                        embed.AddField(item.LoadoutName,
                                       $"{Emotes.GetIcon(item.Element)} {item.ClassSeries}\n" +
                                       $"{items}\n" +
                                       $"{djinn}"
                                       , inline: true);
                    }
                }
                else
                {
                    embed.WithDescription("No LoadoutsList saved.");
                }
                _ = ReplyAsync(embed: embed.Build());
                break;

            case LoadoutAction.Save:
                if (loadoutName.IsNullOrEmpty())
                {
                    return;
                }

                user.Loadouts.RemoveLoadout(loadoutName);
                if (user.Loadouts.LoadoutsList.Count >= 9)
                {
                    _ = ReplyAsync("Loadout limit of 9 reached.");
                    return;
                }
                var newLoadout = Loadout.GetLoadout(user);
                newLoadout.LoadoutName = loadoutName;
                user.Loadouts.SaveLoadout(newLoadout);
                UserAccountProvider.StoreUser(user);
                _ = LoadoutTask();
                break;

            case LoadoutAction.Load:
                var loadedLoadout = user.Loadouts.GetLoadout(loadoutName);
                if (loadedLoadout != null)
                {
                    await GiveElementRole(sgu, loadedLoadout.Element);
                    await ChangeElement(user, loadedLoadout.Element);

                    loadedLoadout.ApplyLoadout(user);
                    UserAccountProvider.StoreUser(user);
                    _ = Status();
                }
                break;

            case LoadoutAction.Remove:
                if (loadoutName.IsNullOrEmpty())
                {
                    return;
                }

                user.Loadouts.RemoveLoadout(loadoutName);
                UserAccountProvider.StoreUser(user);
                _ = LoadoutTask();
                break;
            }
            await Task.CompletedTask;
        }
Ejemplo n.º 10
0
        private async Task OpenChestAsync(SocketCommandContext context, ChestQuality cq)
        {
            var user = EntityConverter.ConvertUser(context.User);
            var inv  = user.Inv;

            if (inv.IsFull)
            {
                var emb = new EmbedBuilder();
                emb.WithDescription(":x: Inventory capacity reached!");
                emb.WithColor(Colors.Get("Error"));
                await context.Channel.SendMessageAsync("", false, emb.Build());

                return;
            }

            if (!inv.OpenChest(cq))
            {
                var emb = new EmbedBuilder();

                emb.WithDescription(cq == ChestQuality.Daily
                    ? $":x: No {cq} Chests remaining! Next Daily Chest in: {DateTime.Today.AddDays(1).Subtract(DateTime.Now):hh\\h\\ mm\\m}"
                    : $":x: No {cq} Chests remaining!");

                emb.WithColor(Colors.Get("Error"));
                await context.Channel.SendMessageAsync("", false, emb.Build());

                return;
            }

            Item item;
            var  dailyRewards = new[] { 0, 0, 1, 1, 2 };

            if (cq == ChestQuality.Daily)
            {
                var value = user.LevelNumber;
                item = ItemDatabase.GetRandomItem((ItemRarity)(dailyRewards[inv.DailiesInARow % dailyRewards.Length] +
                                                               Math.Min(2, value / 33)));
            }
            else
            {
                var rarity = ItemDatabase.ChestValues[cq].GenerateReward();
                item = ItemDatabase.GetRandomItem(rarity);
            }

            inv.Add(item);
            var autoSold = false;

            if (user.Preferences.AutoSell.Contains(item.Rarity))
            {
                autoSold = inv.Sell(item.Name);
            }

            UserAccountProvider.StoreUser(user);
            var embed = new EmbedBuilder();

            embed.WithDescription($"Opening {cq} Chest {Emotes.GetIcon(cq)}...");

            embed.WithColor(Colors.Get("Iodem"));
            var msg = await context.Channel.SendMessageAsync("", false, embed.Build());

            embed = new EmbedBuilder();
            embed.WithColor(item.Color);
            if (cq == ChestQuality.Daily)
            {
                embed.WithFooter(
                    $"Current Reward: {inv.DailiesInARow % dailyRewards.Length + 1}/{dailyRewards.Length} | Overall Streak: {inv.DailiesInARow + 1}");
            }
            embed.WithDescription($"{Emotes.GetIcon(cq)} You found a {item.Name} {item.IconDisplay}{(autoSold ? $" (Autosold)" : "")}");

            await Task.Delay((int)cq * 700);

            _ = msg.ModifyAsync(m => m.Embed = embed.Build());

            var message = await context.Channel.AwaitMessage(m => m.Author == context.User);

            if (message != null && message.Content.Equals("Sell", StringComparison.OrdinalIgnoreCase))
            {
                _ = SellItem(item.Name);
            }
        }