コード例 #1
0
            public async Task Info([Remainder] string itemName)
            {
                PBEItem?nItem = PBELocalizedString.GetItemByName(itemName);

                if (!nItem.HasValue || nItem.Value == PBEItem.None)
                {
                    await Context.Channel.SendMessageAsync($"{Context.User.Mention} Invalid item!");
                }
                else
                {
                    PBEItem      item  = nItem.Value;
                    PBEItemData  iData = PBEItemData.Data[item];
                    EmbedBuilder embed = new EmbedBuilder()
                                         .WithAuthor(Context.User)
                                         .WithColor(iData.NaturalGiftType == PBEType.None ? Utils.RandomColor() : Utils.TypeToColor[iData.NaturalGiftType])
                                         .WithTitle(PBELocalizedString.GetItemName(item).English)
                                         .WithUrl(Utils.URL)
                                         .WithDescription(PBELocalizedString.GetItemDescription(item).English.Replace('\n', ' '));
                    if (iData.FlingPower > 0)
                    {
                        embed.AddField("Fling Power", iData.FlingPower, true);
                    }
                    if (iData.NaturalGiftPower > 0)
                    {
                        embed.AddField("Natural Gift Power", iData.NaturalGiftPower, true);
                    }
                    if (iData.NaturalGiftType != PBEType.None)
                    {
                        embed.AddField("Natural Gift Type", iData.NaturalGiftType, true);
                    }
                    await Context.Channel.SendMessageAsync(string.Empty, embed : embed.Build());
                }
            }
コード例 #2
0
            public async Task Info([Remainder] string itemName)
            {
                PBEItem?nItem = PBELocalizedString.GetItemByName(itemName);

                if (!nItem.HasValue || nItem.Value == PBEItem.None)
                {
                    await Context.Channel.SendMessageAsync($"{Context.User.Mention} ― Invalid item!");
                }
                else
                {
                    PBEItem     item  = nItem.Value;
                    PBEItemData iData = PBEItemData.Data[item];
                    Color       color;
                    if (PBEBerryData.Data.TryGetValue(item, out PBEBerryData bData))
                    {
                        color = Utils.TypeColors[bData.NaturalGiftType];
                    }
                    else
                    {
                        color = Utils.RandomColor();
                    }
                    EmbedBuilder embed = new EmbedBuilder()
                                         .WithAuthor(Context.User)
                                         .WithColor(color)
                                         .WithTitle(PBELocalizedString.GetItemName(item).English)
                                         .WithUrl(Utils.URL)
                                         .WithDescription(PBELocalizedString.GetItemDescription(item).English.Replace('\n', ' '));
                    if (iData.FlingPower > 0)
                    {
                        embed.AddField("Fling Power", iData.FlingPower, true);
                    }
                    if (bData != null)
                    {
                        embed.AddField("Natural Gift Power", bData.NaturalGiftPower, true);
                        embed.AddField("Natural Gift Type", Utils.TypeEmotes[bData.NaturalGiftType], true);
                        if (bData.Bitterness > 0)
                        {
                            embed.AddField("Bitterness", bData.Bitterness, true);
                        }
                        if (bData.Dryness > 0)
                        {
                            embed.AddField("Dryness", bData.Dryness, true);
                        }
                        if (bData.Sourness > 0)
                        {
                            embed.AddField("Sourness", bData.Sourness, true);
                        }
                        if (bData.Spicyness > 0)
                        {
                            embed.AddField("Spicyness", bData.Spicyness, true);
                        }
                        if (bData.Sweetness > 0)
                        {
                            embed.AddField("Sweetness", bData.Sweetness, true);
                        }
                    }
                    await Context.Channel.SendMessageAsync(string.Empty, embed : embed.Build());
                }
            }