Example #1
0
        private CardDescription ParseCard(Document doc)
        {
            CardDescription card = new CardDescription();

            card.ID        = int.Parse(GetFieldString(doc, "ID"));
            card.name      = GetFieldString(doc, "name");
            card.japName   = GetFieldString(doc, "japName");
            card.enName    = GetFieldString(doc, "enName");
            card.oldName   = GetFieldString(doc, "oldName2");
            card.shortName = GetFieldString(doc, "shortName2");
            card.sCardType = GetFieldString(doc, "cardType");
            card.iCardtype = CardTypeMapper.Mapper(card.sCardType);
            if (card.iCardtype <= 3 || card.iCardtype == 6)
            {
                card.level    = int.Parse(GetFieldString(doc, "level"));
                card.element  = GetFieldString(doc, "element");
                card.tribe    = GetFieldString(doc, "tribe");
                card.atk      = GetFieldString(doc, "atk");
                card.atkValue = int.Parse(GetFieldString(doc, "atkValue"));
                card.def      = GetFieldString(doc, "def");
                card.defValue = int.Parse(GetFieldString(doc, "defValue"));
            }
            card.effecfType  = GetFieldString(doc, "effecfType");
            card.effect      = GetFieldString(doc, "effect");
            card.infrequence = GetFieldString(doc, "infrequence");
            card.package     = GetFieldString(doc, "package");
            card.limit       = int.Parse(GetFieldString(doc, "limit"));
            if (card.limit == -5)
            {
                card.cardCamp = CardCamp.DIY;
                card.limit    = 3;
            }
            card.cheatcode = GetFieldString(doc, "cheatcode");
            card.adjust    = GetFieldString(doc, "adjust").Trim();

            string s = GetFieldString(doc, "cardCamp").Trim();

            switch (s)
            {
            case "TCG、OCG":
                card.cardCamp = CardCamp.BothOT;
                break;

            case "TCG":
                card.cardCamp = CardCamp.TCG;
                break;

            case "OCG":
                card.cardCamp = CardCamp.OCG;
                break;

            case "DIY":
                card.cardCamp = CardCamp.DIY;
                break;
            }

            return(card);
        }
Example #2
0
        private CardDescription ParseCard(OleDbDataReader reader)
        {
            CardDescription card = new CardDescription();

            card.ID        = int.Parse(GetFieldString(reader, "CardID")) - 1;
            card.japName   = GetFieldString(reader, "JPCardName");
            card.name      = GetFieldString(reader, "SCCardName");
            card.enName    = GetFieldString(reader, "ENCardName");
            card.sCardType = GetFieldString(reader, "SCCardType");
            card.tribe     = GetFieldString(reader, "SCCardRace");
            card.package   = GetFieldString(reader, "CardBagNum");
            card.element   = GetFieldString(reader, "SCCardAttribute");
            try
            {
                card.level = int.Parse(GetFieldString(reader, "CardStarNum"));
            }
            catch
            {
                card.level = -1;
            }
            card.infrequence = GetFieldString(reader, "SCCardRare");
            card.atk         = GetFieldString(reader, "CardAtk");
            card.def         = GetFieldString(reader, "CardDef");
            card.effect      = GetFieldString(reader, "SCCardDepict");
            card.cheatcode   = GetFieldString(reader, "CardPass");
            card.adjust      = GetFieldString(reader, "CardAdjust");
            card.associate   = GetFieldString(reader, "CardUnion");
            card.oldName     = GetFieldString(reader, "CardOnceName");
            card.shortName   = GetFieldString(reader, "CardAbbrName");
            string l = GetFieldString(reader, "SCCardBan");

            switch (l)
            {
            case "无限制":
                card.limit = 3;
                break;

            case "禁止卡":
                card.limit = 0;
                break;

            case "限制卡":
                card.limit = 1;
                break;

            case "准限制卡":
                card.limit = 2;
                break;

            default:
                card.limit = -4;
                break;
            }

            l = GetFieldString(reader, "CardCamp").Trim();
            switch (l)
            {
            case "TCG、OCG":
                card.cardCamp = CardCamp.BothOT;
                break;

            case "TCG":
                card.cardCamp = CardCamp.TCG;
                break;

            case "OCG":
                card.cardCamp = CardCamp.OCG;
                break;

            case "DIY":
                card.cardCamp = CardCamp.DIY;
                break;
            }

            if (string.Equals(card.atk, "9999"))
            {
                card.atk      = "?";
                card.atkValue = -1;
            }
            else
            {
                try
                {
                    card.atkValue = int.Parse(card.atk);
                }
                catch
                {
                    card.atkValue = -2;
                }
            }
            if (string.Equals(card.def, "9999"))
            {
                card.def      = "?";
                card.defValue = -1;
            }
            else
            {
                try
                {
                    card.defValue = int.Parse(card.def);
                }
                catch
                {
                    card.defValue = -2;
                }
            }

            if (string.Equals(card.sCardType, "普通怪兽"))
            {
                card.sCardType = "通常怪兽";
            }
            card.iCardtype = CardTypeMapper.Mapper(card.sCardType);

            string sdcardtype = GetFieldString(reader, "SCDCardType").Trim();

            if (sdcardtype.Length > 1)
            {
                if (!string.Equals(card.effect.Substring(0, sdcardtype.Length), sdcardtype))
                {
                    card.effect = sdcardtype + ":" + card.effect;
                }
            }

            return(card);
        }
Example #3
0
        private CardDescription ParseCard(Document doc)
        {
            CardDescription card = new CardDescription();

            card.ID        = int.Parse(doc.GetField("CardId").StringValue());
            card.name      = doc.GetField("中文名").StringValue();
            card.japName   = doc.GetField("日文名").StringValue();
            card.enName    = doc.GetField("英文名").StringValue();
            card.sCardType = doc.GetField("卡片类型").StringValue();
            if (string.Equals(card.sCardType.Substring(2, 2), "怪兽"))
            {
                card.level   = int.Parse(doc.GetField("卡片星级").StringValue());
                card.element = doc.GetField("卡片属性").StringValue();
                card.tribe   = doc.GetField("卡片种族").StringValue();
                card.atk     = doc.GetField("攻击力").StringValue();
                if (string.Equals(card.atk, "9999"))
                {
                    card.atk      = "?";
                    card.atkValue = -1;
                }
                else
                {
                    try
                    {
                        card.atkValue = int.Parse(card.atk);
                    }
                    catch
                    {
                        card.atkValue = -2;
                    }
                }
                card.def = doc.GetField("防御力").StringValue();
                if (string.Equals(card.def, "9999"))
                {
                    card.def      = "?";
                    card.defValue = -1;
                }
                else
                {
                    try
                    {
                        card.defValue = int.Parse(card.def);
                    }
                    catch
                    {
                        card.defValue = -2;
                    }
                }
            }
            card.effecfType  = doc.GetField("详细类型").StringValue();
            card.effect      = doc.GetField("效果").StringValue();
            card.infrequence = doc.GetField("罕贵程度").StringValue();
            card.package     = doc.GetField("卡包").StringValue();
            card.cheatcode   = doc.GetField("CardPass").StringValue();
            card.adjust      = doc.GetField("调整").StringValue();
            card.associate   = doc.GetField("关联卡片").StringValue();
            string l = doc.GetField("禁限类型").StringValue();

            switch (l)
            {
            case "无限制":
                card.limit = 3;
                break;

            case "禁止卡":
                card.limit = 0;
                break;

            case "限制卡":
                card.limit = 1;
                break;

            case "准限制卡":
                card.limit = 2;
                break;

            default:
                card.limit = -4;
                break;
            }
            card.iCardtype = CardTypeMapper.Mapper(card.sCardType);

            return(card);
        }
Example #4
0
        private CardDescription ParseCard(CardDescription card, string info)
        {
            string[] infos = info.Split(',');

            //处理文本
            for (int i = 0; i < infos.Length; i++)
            {
                //空字符串不处理
                if (infos[i].Length > 0)
                {
                    //过滤开始的空格
                    while (infos[i][0] == ' ')
                    {
                        infos[i] = infos[i].Substring(1, infos[i].Length - 1);
                        if (infos[i].Length == 0)
                        {
                            break;
                        }
                    }

                    //转换双引号
                    infos[i] = infos[i].Replace("\"", "\"\"");
                }
            }

            //卡片类型
            string s = infos[0].Substring(2, 2);

            if (s == "怪兽")
            {
                card.sCardType = infos[0];
                for (int i = 1; i < 7; i++)
                {
                    s = infos[i].Substring(0, 3);
                    string s2 = infos[i].Substring(3);
                    switch (s)
                    {
                    case "种族:":
                        card.tribe = s2;
                        break;

                    case "属性:":
                        card.element = s2;
                        break;

                    case "星级:":
                        try
                        {
                            card.level = int.Parse(s2);
                        }
                        catch
                        {
                            card.level = -1;
                        }
                        break;

                    case "攻击:":
                        //攻击
                        card.atk = s2;
                        if (card.atk.Equals("?") || card.atk.Equals("?"))
                        {
                            card.atkValue = -1;
                        }
                        else
                        {
                            try
                            {
                                card.atkValue = int.Parse(card.atk);
                            }
                            catch
                            {
                                card.atkValue = -2;
                            }
                        }
                        break;

                    case "防御:":
                        card.def = s2;
                        if (card.def.Equals("?") || card.def.Equals("?"))
                        {
                            card.defValue = -1;
                        }
                        else
                        {
                            try
                            {
                                card.defValue = int.Parse(card.def);
                            }
                            catch
                            {
                                card.defValue = -2;
                            }
                        }
                        break;

                    case "效果:":
                        card.effect = s2;
                        break;
                    }
                }
                for (int i = 7; i < infos.Length; i++)
                {
                    card.effect += "," + infos[i];
                }
            }
            else
            {
                s = infos[0].Substring(0, 5);
                if (s == "魔法种类:" || s == "陷阱种类:")
                {
                    card.sCardType = infos[0].Substring(5, 2) + infos[0].Substring(0, 2);
                    card.atk       = "";
                    card.atkValue  = -10000;
                    card.def       = "";
                    card.defValue  = -10000;
                }
            }
            card.iCardtype = CardTypeMapper.Mapper(card.sCardType);

            return(card);
        }