Ejemplo n.º 1
0
 public void AddSection(TooltipSection section)
 {
     sections.Add(section);
 }
Ejemplo n.º 2
0
        public async Task ItemAsync(
            [Remainder]
            string itemName
            )
        {
            string steamId = _identity.DiscordToSteam.GetOrDefault($"{Context.User.Id}");
            User   user    = UserManager.FindUserBySteamId(steamId);

            if (user == null)
            {
                await ReplyAsync($"Your ECO user must be linked to discord to use this command.");

                return;
            }

            Item item = CommandsUtil.ClosestMatchingEntity(user.Player, itemName, Item.AllItems, (Item x) => x.GetType().Name, (Item x) => x.DisplayName);

            if (item == null)
            {
                await ReplyAsync($"Could not find item matching `{itemName}`.");

                return;
            }

            List <TooltipSection> sections = new List <TooltipSection>();

            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.AppendLine(item.DisplayDescription);

            TooltipSection section = item.CraftingRequirementsTooltip(TooltipContext(user.Player));

            if (section != null && section.Content != null && section.Content.ToString().StripTags().Length != 0)
            {
                stringBuilder.AppendLine("");
                stringBuilder.AppendLine("**Crafting requirements:**");
                stringBuilder.AppendLine(section.Content.ToString().StripTags());
            }

            section = item.UsedInTooltip(TooltipContext(user.Player));
            if (section != null && section.Content != null && section.Content.ToString().StripTags().Length != 0)
            {
                stringBuilder.AppendLine("");
                stringBuilder.AppendLine("**Used by:**");
                stringBuilder.AppendLine(section.Content.ToString().StripTags());
            }

            section = item.SellItTooltip(TooltipContext(user.Player));
            if (section != null && section.Content != null && section.Content.ToString().StripTags().Length != 0)
            {
                stringBuilder.AppendLine("");
                stringBuilder.AppendLine("**Buyers:**");
                stringBuilder.AppendLine(section.Content.ToString().StripTags());
            }

            section = item.BuyItTooltip(TooltipContext(user.Player));
            if (section != null && section.Content != null && section.Content.ToString().StripTags().Length != 0)
            {
                stringBuilder.AppendLine("");
                stringBuilder.AppendLine("**Sellers:**");
                stringBuilder.AppendLine(section.Content.ToString().StripTags());
            }

            section = item.SourceSpeciesTooltip(TooltipContext(user.Player));
            if (section != null && section.Content != null && section.Content.ToString().StripTags().Length != 0)
            {
                stringBuilder.AppendLine("");
                stringBuilder.AppendLine("**Dropped from:**");
                stringBuilder.AppendLine(section.Content.ToString().StripTags());
            }

            var embed = new EmbedBuilder
            {
                Title       = item.DisplayName,
                Description = stringBuilder.ToString()
            };

            await ReplyAsync(
                "",
                false,
                embed.Build()
                );
        }
Ejemplo n.º 3
0
 public void OpenTooltipSection()
 {
     TooltipSection.Click();
 }