Example #1
0
        private static EmbedBuilder GetEmbed(YuGiOhCard card)
        {
            var author = new EmbedAuthorBuilder()
            {
                Name    = "YuGiOh",
                IconUrl = "http://card-masters.com/cardmasters/wp-content/uploads/2013/08/yugioh-product-icon-lg.png",
                Url     = "http://www.yugioh-card.com/en/"
            };

            var footer = new EmbedFooterBuilder()
            {
                Text    = "It's time to d-d-d-d-duel | Database made by chinhodado",
                IconUrl = "http://i722.photobucket.com/albums/ww227/omar_alami/icon_gold_classic_zps66eae1c7.png"
            };

            var organizedDescription = new StringBuilder();

            if (!string.IsNullOrEmpty(card.RealName))
            {
                organizedDescription.AppendLine($"**Real Name:** {card.RealName}");
            }

            organizedDescription.AppendLine($"**Format:** {GetFormat(card.TcgOnly == "1" ? true : false, card.OcgOnly == "1" ? true : false)}");
            organizedDescription.AppendLine($"**Card Type:** {card.CardType}");

            if (card is MonsterCard)
            {
                var monster = card as MonsterCard;
                organizedDescription.AppendLine($"**Attribute:** {monster.Attribute}");

                if (monster is XyzMonster)
                {
                    var xyz = monster as XyzMonster;
                    organizedDescription.AppendLine($"**Rank:** {xyz.Rank}");
                }
                else if (monster is LinkMonster)
                {
                    var link = monster as LinkMonster;
                    organizedDescription.AppendLine($"**Links:** {link.Links}");
                    organizedDescription.AppendLine($"**Link Markers:** {link.LinkMarkers}");
                }
                else
                {
                    var regular = monster as RegularMonster;
                    organizedDescription.AppendLine($"**Level:** {regular.Level}");
                }

                if (monster is PendulumMonster)
                {
                    var pendulum = monster as PendulumMonster;
                    organizedDescription.AppendLine($"**Scale:** {pendulum.PendulumScale}");
                }
            }
            else
            {
                var spelltrap = card as SpellTrapCard;
                organizedDescription.AppendLine($"**Property:** {spelltrap.Property}");
            }

            var embed = new EmbedBuilder()
            {
                Author      = author,
                Color       = WhatColorIsTheCard(card),
                Title       = card.Name,
                Description = organizedDescription.ToString(),
                Footer      = footer
            };

            string description;

            if (card.Lore.StartsWith("Pendulum Effect")) //not all pendulum monsters have an effect
            {
                var monster   = card as MonsterCard;
                var tempArray = card.Lore.Split(new string[] { "Monster Effect" }, StringSplitOptions.None);
                description = $"{monster.Types}\n" + "__Pendulum Effect__\n" + tempArray[0].Replace("Pendulum Effect", "").Replace("\" ", "\"").Trim() + "\n__Monster Effect__\n" + tempArray[1].Replace("Monster Effect", "").Replace("\" ", "\"").Trim();
            }
            else if (card is MonsterCard)
            {
                var monster = card as MonsterCard;
                description = $"{monster.Types}\n" + card.Lore;
            }
            else
            {
                description = card.Lore;
            }

            embed.AddField(x =>
            {
                x.Name     = card.HasEffect ? "Effect" : "Description";
                x.Value    = description;
                x.IsInline = false;
            });

            if (card is MonsterCard)
            {
                var monster = card as MonsterCard;

                embed.AddField(x =>
                {
                    x.Name     = "Attack";
                    x.Value    = monster.Atk;
                    x.IsInline = !(monster is LinkMonster);
                });

                if (!(monster is LinkMonster))
                {
                    embed.AddField(x =>
                    {
                        x.Name     = "Defense";
                        x.Value    = monster.Def;
                        x.IsInline = true;
                    });
                }
            }

            if (!string.IsNullOrEmpty(card.Archetype))
            {
                embed.AddField(x =>
                {
                    x.Name     = "Archetype(s)";
                    x.Value    = card.Archetype;
                    x.IsInline = false;
                });
            }

            return(embed);
        }
Example #2
0
        private static Color WhatColorIsTheCard(YuGiOhCard card)
        {
            if (card.Name.Equals("Slifer the Sky Dragon"))
            {
                return(new Color(255, 0, 0));
            }
            else if (card.Name.Equals("The Winged Dragon of Ra"))
            {
                return(new Color(255, 215, 0));
            }
            else if (card.Name.Equals("Obelisk the Tormentor"))
            {
                return(new Color(50, 50, 153));
            }

            if (card.CardType.Equals("Trap"))
            {
                return(new Color(188, 90, 132));
            }
            else if (card.CardType.Equals("Spell"))
            {
                return(new Color(29, 158, 116));
            }

            if (card is PendulumMonster)
            {
                return(new Color(175, 219, 205));
            }
            else if (card is XyzMonster)
            {
                return(new Color(0, 0, 1));
            }
            else if (card is LinkMonster)
            {
                return(new Color(17, 57, 146));
            }
            else if (card is RegularMonster)
            {
                var monster = card as RegularMonster;
                if (monster.Types.Contains("Synchro"))
                {
                    return(new Color(204, 204, 204));
                }
                else if (monster.Types.Contains("Fusion"))
                {
                    return(new Color(160, 134, 183));
                }
                else if (monster.Types.Contains("Ritual"))
                {
                    return(new Color(157, 181, 204));
                }
                else if (monster.Types.Contains("Effect"))
                {
                    return(new Color(174, 121, 66));
                }
                else if (monster.Types.Contains("Token"))
                {
                    return(new Color(192, 192, 192));
                }
            }

            return(new Color(216, 171, 12));
        }