Ejemplo n.º 1
0
        internal EmbedBuilder EvolveOptions(EmbedBuilder evolveField)
        {
            if (evolveField == null)
            {
                evolveField = new EmbedBuilder();
            }
            string value = "";

            if (evolves != null)
            {
                for (int i = 0; i < evolves.Length; i++)
                {
                    Ability a = Load(evolves[i]);
                    value +=
                        $"{EUI.GetNum(i)} | **{a.name}**{Environment.NewLine}" +
                        $"*{a.description}*{Environment.NewLine}" +
                        $"`{a.GetStats()}`{Environment.NewLine}";
                }
                if (level < maxLevel)
                {
                    value += $"{Environment.NewLine}{Environment.NewLine}{name} is not ready to evolve: {level}/{maxLevel}";
                }
            }
            else
            {
                value = "No Evolves Available";
            }
            evolveField.AddField($"{name} Evolve Options", value);
            return(evolveField);
        }
Ejemplo n.º 2
0
        internal static async Task StarterAbilities(Player player, IMessageChannel chan, int page, int firstPick = -1, int firstpickpage = -1)
        {
            EmbedBuilder embed = new EmbedBuilder();

            embed.WithDescription("**You may select 2 out of these 9 abilities**");
            player.UserEmbedColor(embed);
            switch (page)
            {
            case 0: embed.Title = "Simple Abilities"; break;

            case 1: embed.Title = "Medium Abilities"; break;

            case 2: embed.Title = "Complex Abilities"; break;
            }
            for (int i = 0; i < 3; i++)
            {
                Ability a = Ability.Load(LoadAbility.Starters[page, i]);
                if (player.HasAbility(a.name, out _))
                {
                    firstPick     = i;
                    firstpickpage = page;
                }
                else
                {
                    embed.AddField($"{EUI.GetNum(i)} {a.name}", a.type.ToString() + Environment.NewLine +
                                   a.description + Environment.NewLine + a.GetStats());
                }
            }
            embed.AddField("Commands",
                           "Use ``~ability level #level 'ability name'`` to get the stats for a specific level." +
                           " ex: ``~ability level 5 Shelter`` displays the stats of Shelter at level 5");
            embed.WithFooter($"Cycle through the ability type pages using {EUI.prev} {EUI.next}");
            await player.NewUI(null, embed.Build(), chan,
                               MsgType.StarterAbilities, $"{page}/{firstPick}/{firstpickpage}");
        }
Ejemplo n.º 3
0
        internal EmbedBuilder PerkListEmbed(Player player, out string available)
        {
            EmbedBuilder  e     = new EmbedBuilder();
            List <string> perks = GetPerkList();

            available = "";
            for (int i = 0; i < perks.Count; i++)
            {
                string r = null;
                if (player.HasPerk(perks[i]) > -1)
                {
                    r = " [Owned]";
                }
                else if (specPoints < 20)
                {
                    r += $" [Missing {20 - specPoints} Spec Points]";
                }
                else
                {
                    available += $";{i}";
                }
                e.AddField($"{EUI.GetNum(i)} {perks[i]} {r}", PerkLoad.Load(perks[i]).desc);
            }
            e.WithFooter($"{specPoints} Specialization Points");
            return(e);
        }
Ejemplo n.º 4
0
 internal static async Task TavernGames(Player player, IMessageChannel chan)
 {
     EmbedBuilder games = DUtils.BuildEmbed("Tavern Games", "Hello, Traveler. Would you like a gambling table?", null, player.userSettings.Color,
                                            DUtils.NewField("Dice Games", $"{EUI.Dice(1)} Even Odd"),
                                            DUtils.NewField("Card Games", $"{EUI.GetNum(0)} Blackjack")
                                            );
     await player.EditUI(null, games.Build(), chan, MsgType.GamblingGames, "Tavern");
 }
Ejemplo n.º 5
0
        public static async Task SelectIntensity(Player player, ISocketMessageChannel chan, int quest)
        {
            Intensity[]         diffs  = (Intensity[])Enum.GetValues(typeof(Intensity));
            EmbedFieldBuilder[] fields = new EmbedFieldBuilder[diffs.Length];
            for (int i = 0; i < fields.Length; i++)
            {
                fields[i] = DUtils.NewField($"{EUI.GetNum(i + 1)} {diffs[i]}",
                                            $"Encounter rate: ~{(int)diffs[i]} minutes" + Environment.NewLine
                                            + $"{1 + (MultiplierReference - (int)diffs[i])/Percentage}x Damage Taken"
                                            );
            }
            EmbedBuilder embed = DUtils.BuildEmbed($"{player.name}'s Planned Adventure",
                                                   "Select the adventure's difficulty." + Environment.NewLine +
                                                   "**If defeated, all loot, coins and xp collected during the adventure will be lost**",
                                                   null, player.userSettings.Color, fields);

            await player.EditUI("Select a difficulty", embed.Build(), chan, MsgType.Adventure, $"{quest}");
        }
Ejemplo n.º 6
0
        public static async Task ViewInbox(BotUser user, int page, IMessageChannel chan, bool edit)
        {
            Mail[] mails = await Mail.Load(user._id);

            if (mails.Length == 0)
            {
                await chan.SendMessageAsync("Your inbox is empty");

                return;
            }

            EmbedBuilder embed = DUtils.BuildEmbed("Inbox", $"**Rewards will be given to the currently loaded character: {user.loaded}**");

            page = page < 0 ? 0 : Math.Min(page, (mails.Length - 1) / 5);

            int    n   = 1;
            int    i   = page * 5;
            int    l   = Math.Min(i + 5, mails.Length);
            string ids = $"{page};";

            for (; i < l; i++, n++)
            {
                Mail   mail    = mails[i];
                string rewards = mail.GetRewards();
                embed.AddField($"{EUI.GetNum(n)} {mail.subject}",
                               mail.body + (rewards != null ? Environment.NewLine + Environment.NewLine + rewards : null));
                ids += $"{mail._id}";
                if (i + 1 < l)
                {
                    ids += ",";
                }
            }

            if (!edit)
            {
                user.NewUI(await chan.SendMessageAsync(embed: embed.Build()),
                           MsgType.Inbox, ids);
            }
            else
            {
                await user.EditUI(null, embed.Build(), MsgType.Inbox, ids);
            }
        }
Ejemplo n.º 7
0
        internal Embed EmbedInfo(Encounter encounter)
        {
            EmbedBuilder info = new EmbedBuilder();

            info.WithTitle(partyName);
            for (int i = 0; i < members.Count; i++)
            {
                info.Description += $"{(i == 0 ? "👑" : "🔘")} {GetPartyPlayerInfo(members[i], encounter)} {Environment.NewLine}";
            }
            if (NPCMembers.Count > 0)
            {
                info.Description += "--Followers--" + Environment.NewLine;
                for (int i = 0; i < NPCMembers.Count; i++)
                {
                    info.Description += EUI.GetNum(i + 1) + NPCMembers[i].ToString() + Environment.NewLine;
                }
            }
            return(info.Build());
        }
Ejemplo n.º 8
0
        internal (List <int>, EmbedFieldBuilder) LoadCategory(Player player, Cycle cycle)
        {
            var list = cycle == Cycle.Daily ? dailies : weeklies;

            string     board   = null;
            List <int> options = new List <int>();

            for (int i = 0; i < list.Length; i++)
            {
                var(available, info) = LoadQuest(player, i, cycle);
                int k = i + (cycle == Cycle.Daily ? 1 : 4);
                board += (available ? EUI.GetNum(k) : "> ") + info + Environment.NewLine;
                if (available)
                {
                    options.Add(k);
                }
            }

            return(options, DUtils.NewField($"{cycle} Quests", board));
        }
Ejemplo n.º 9
0
        internal static async Task ViewJunctions(Player player, ISocketMessageChannel chan, int page, bool edit = true)
        {
            string juncList = null;
            Area   pArea    = player.Area;

            if (pArea.type == AreaType.Dungeon)
            {
                throw NeitsilliaError.ReplyError("You can not leave a dungeon so easily." +
                                                 " Fight or cower your way out, but whichever you choose, you must reach the end of these dark floors or leave them your life.");
            }

            List <string> juncIds = new List <string>();
            int           n       = 0;

            if (pArea.junctions != null)
            {
                for (int i = page * 5; i < pArea.junctions.Count && i < (page + 1) * 5; i++)
                {
                    if (pArea.junctions[i] != null &&
                        player.AreaInfo.floor >= pArea.junctions[i].floorRequirement)
                    {
                        juncList += $"{EUI.GetNum(n)} {pArea.junctions[i]} {Environment.NewLine}";
                        juncIds.Add(pArea.junctions[i].destination);
                        n++;
                    }
                }
            }
            if (player.Encounter != null && player.Encounter.Name == Encounter.Names.Floor)
            {
                juncList += "Floor";
            }
            EmbedBuilder junctions = new EmbedBuilder();

            junctions = player.UserEmbedColor(junctions);
            junctions.WithTitle(pArea.name + " Junctions");
            junctions.WithDescription(juncList);
            junctions.WithFooter($"Use reactions to enter Areas");

            await player.EnUI(edit, null, junctions.Build(), chan, MsgType.Junctions,
                              $"{page};{(pArea.junctions?.Count ?? 0)};{JsonConvert.SerializeObject(juncIds)}");
        }
Ejemplo n.º 10
0
        public async Task CratesListUI(ISocketMessageChannel chan)
        {
            if (ResourceCrates == null)
            {
                ResourceCrates = new int[5];
            }
            while (ResourceCrates.Length < 5)
            {
                ResourceCrates = ArrayM.AddItem(ResourceCrates, 0);
            }

            EmbedBuilder em = AMYPrototype.Commands.DUtils.BuildEmbed("Resource Crates",
                                                                      "Select a Crate type to open." + Environment.NewLine +
                                                                      $"{EUI.GetNum(0)} {ResourceCrates[0]} x Wooden Crates" + Environment.NewLine +
                                                                      $"{EUI.GetNum(1)} {ResourceCrates[1]} x Bronze Crates" + Environment.NewLine +
                                                                      $"{EUI.GetNum(2)} {ResourceCrates[2]} x Silver Crates" + Environment.NewLine +
                                                                      $"{EUI.GetNum(3)} {ResourceCrates[3]} x Golden Crates" + Environment.NewLine +
                                                                      $"{EUI.GetNum(4)} {ResourceCrates[4]} x Platinum Crates");

            NewUI(await chan.SendMessageAsync(embed: em.Build()), MsgType.ResourceCrateList);
        }
Ejemplo n.º 11
0
        internal static async Task GetOffers(Player player, int page, OfferQuery q, ISocketMessageChannel chan)
        {
            int itemPerPage = 5;

            ItemOffer[]  array = null;
            EmbedBuilder em    = player.UserEmbedColor(new EmbedBuilder());

            switch (q)
            {
            case OfferQuery.Receiver:
                array = await GetOffers(player.userid);

                em.WithTitle("Received Offers");
                break;

            case OfferQuery.Sender:
                array = await SentOffers(player.userid);

                em.WithTitle("Sent Offers");
                break;
            }
            if (array != null && array.Length > 0)
            {
                page = Methods.Verify.MinMax(page, Methods.NumbersM.CeilParse <int>(array.Length / 5.00));
                int         x     = 1;
                List <Guid> guids = new List <Guid>();
                for (int p = (itemPerPage * page); p < (itemPerPage * (page + 1)) &&
                     p < array.Length; p++, x++)
                {
                    em.AddField($"{EUI.GetNum(x)} {array[p]._id}", array[p].ToInfo(false));
                    guids.Add(array[p]._id);
                }
                em.WithFooter("Use reactions to inspect Offer and use accept and deny/delete options");
                await player.NewUI(await chan.SendMessageAsync(embed: em.Build()), MsgType.OfferList, $"{page}.{array.Length}.{q}.{JsonConvert.SerializeObject(guids)}");
            }
            else
            {
                await chan.SendMessageAsync("No offers to display");
            }
        }
Ejemplo n.º 12
0
        public async Task CharListForCrate(ISocketMessageChannel chan, int crateNum)
        {
            string desc  = null;
            var    chars = GetCharFiles(_id);

            if (chars.Count < 1)
            {
                await chan.SendMessageAsync("No characters were found for this user, create a character using `new character`");
            }
            else
            {
                for (int i = 0; i < chars.Count; i++)
                {
                    desc += EUI.GetNum(i) + " " + chars[i].ToString() + Environment.NewLine;
                }

                EmbedBuilder em = AMYPrototype.Commands.DUtils.BuildEmbed($"Opening {(ReferenceData.ResourceCrate)crateNum} Crates",
                                                                          "Select a character to reward crate content to." + Environment.NewLine + desc);

                await EditUI(null, em.Build(), MsgType.ResourceCrateOpening, crateNum + ";" + chars.Count, chan);
            }
        }
Ejemplo n.º 13
0
 internal static async Task ViewTiles(Player player, Sandbox sandbox, string source, ISocketMessageChannel channel)
 {
     await player.EditUI(null, DUtils.BuildEmbed("Buildings",
                                                 sandbox.tiles.Join(Environment.NewLine, (tile, i) => $"{EUI.GetNum(i + 1)} {tile.Name}") ?? "No buildings to display"
                                                 ).Build(), channel, MsgType.TileControls, $"{source};{sandbox.tiles.Count}");
 }
Ejemplo n.º 14
0
        internal static async Task ProductSelection(Player player, Sandbox sb, string source, int tileIndex, int page, ISocketMessageChannel channel)
        {
            SandboxTile tile = sb.tiles[tileIndex];

            int count = tile.productionOptions.Count;
            int max   = count / RECIPE_PERP;

            if (page < 0)
            {
                page = max;
            }
            else if (page > max)
            {
                page = max;
            }

            int start    = page * RECIPE_PERP;
            var products = tile.productionOptions.GetRange(start, Math.Min(RECIPE_PERP, count - start));

            await player.EditUI(null, DUtils.BuildEmbed($"{tile.Name} Productions",
                                                        products.Join(Environment.NewLine, (name, i) => $"{EUI.GetNum(i + 1)} {name}"),
                                                        null, player.userSettings.Color).Build(), channel,
                                MsgType.TileProductions, $"{source};{tileIndex};{products.Count};{page}");
        }
Ejemplo n.º 15
0
 internal string ShortDescription(int?i = null)
 => $"{(i.HasValue ? EUI.GetNum(i.Value) : "")} **{name}** {Environment.NewLine} {enemiesDesc}";