Exemplo n.º 1
0
        //Creates a demon object from a data grid view row
        private static Demon LoadDemon(DataRow row)
        {
            var demonVersions = "";
            var name          = row["Name"] is DBNull ? "" : (string)row["Name"];

            if (!(row["Alternate Name"] is DBNull))
            {
                var alternateDemon = (string)row["Alternate Name"];
                demonVersions = "{{DemonVersions|" + name + "|" + alternateDemon + "}}\r\n";
            }

            var demon = new Demon();

            demon.Name   = name;
            demon.Rarity = row["Rarity"] is DBNull ? "" : (string)row["Rarity"];
            demon.Race   = row["Race"] is DBNull ? "" : (string)row["Race"];
            demon.Ai     = row["Type"] is DBNull ? "" : (string)row["Type"];
            demon.Grade  = row["Grade"] is DBNull ? "" : (string)row["Grade"];

            demon.Str  = row["6★ Strength"] is DBNull ? 0 : Convert.ToInt32(row["6★ Strength"]);
            demon.Mag  = row["6★ Magic"] is DBNull ? 0 : Convert.ToInt32(row["6★ Magic"]);
            demon.Vit  = row["6★ Vitality"] is DBNull ? 0 : Convert.ToInt32(row["6★ Vitality"]);
            demon.Agi  = row["6★ Agility"] is DBNull ? 0 : Convert.ToInt32(row["6★ Agility"]);
            demon.Luck = row["6★ Luck"] is DBNull ? 0 : Convert.ToInt32(row["6★ Luck"]);

            demon.DemonVersions = demonVersions;

            demon.Fire  = LoadResist(row["Fire"] is DBNull ? "" : (string)row["Fire"]);
            demon.Dark  = LoadResist(row["Dark"] is DBNull ? "" : (string)row["Dark"]);
            demon.Light = LoadResist(row["Light"] is DBNull ? "" : (string)row["Light"]);
            demon.Elec  = LoadResist(row["Elec"] is DBNull ? "" : (string)row["Elec"]);
            demon.Ice   = LoadResist(row["Ice"] is DBNull ? "" : (string)row["Ice"]);
            demon.Force = LoadResist(row["Force"] is DBNull ? "" : (string)row["Force"]);
            demon.Phys  = LoadResist(row["Phys"] is DBNull ? "" : (string)row["Phys"]);

            demon.Skill1 = row["Skill 1"] is DBNull ? "" : (string)row["Skill 1"];
            demon.Skill2 = row["Skill 2"] is DBNull ? "" : (string)row["Skill 2"];
            demon.Skill3 = row["Skill 3"] is DBNull ? "" : (string)row["Skill 3"];

            demon.AwakenC = row["Clear Awaken"] is DBNull ? "" : (string)row["Clear Awaken"];
            demon.AwakenR = row["Red Awaken"] is DBNull ? "" : (string)row["Red Awaken"];
            demon.AwakenP = row["Purple Awaken"] is DBNull ? "" : (string)row["Purple Awaken"];
            demon.AwakenY = row["Yellow Awaken"] is DBNull ? "" : (string)row["Yellow Awaken"];
            demon.AwakenT = row["Teal Awaken"] is DBNull ? "" : (string)row["Teal Awaken"];

            demon.GachaR = row["Red Gacha"] is DBNull ? "" : (string)row["Red Gacha"];
            demon.GachaP = row["Purple Gacha"] is DBNull ? "" : (string)row["Purple Gacha"];
            demon.GachaY = row["Yellow Gacha"] is DBNull ? "" : (string)row["Yellow Gacha"];
            demon.GachaT = row["Teal Gacha"] is DBNull ? "" : (string)row["Teal Gacha"];

            demon.Panel1 = row["Panel 1"] is DBNull ? "" : (string)row["Panel 1"];
            demon.Panel2 = row["Panel 2"] is DBNull ? "" : (string)row["Panel 2"];
            demon.Panel3 = row["Panel 3"] is DBNull ? "" : (string)row["Panel 3"];

            demon.Panel1Stats = row["Panel 1 Stats"] is DBNull ? "" : (string)row["Panel 1 Stats"];
            demon.Panel2Stats = row["Panel 2 Stats"] is DBNull ? "" : (string)row["Panel 2 Stats"];
            demon.Panel3Stats = row["Panel 3 Stats"] is DBNull ? "" : (string)row["Panel 3 Stats"];

            return(demon);
        }
Exemplo n.º 2
0
        public string CheckType(Demon d, string type, string element)
        {
            var demonsList = "";
            var newType    = TypeTranslator(type);

            if (newType != "")
            {
                var demonLink = d.Name + ", ";

                if (d.Phys == newType && element.ToLower() == "phys")
                {
                    demonsList += demonLink;
                }

                if (d.Fire == newType && element.ToLower() == "fire")
                {
                    demonsList += demonLink;
                }

                if (d.Ice == newType && element.ToLower() == "ice")
                {
                    demonsList += demonLink;
                }

                if (d.Elec == newType && element.ToLower() == "elec")
                {
                    demonsList += demonLink;
                }

                if (d.Force == newType && element.ToLower() == "force")
                {
                    demonsList += demonLink;
                }

                if (d.Light == newType && element.ToLower() == "light")
                {
                    demonsList += demonLink;
                }

                if (d.Dark == newType && element.ToLower() == "dark")
                {
                    demonsList += demonLink;
                }
            }

            return(demonsList);
        }
Exemplo n.º 3
0
        //Creates a demon object from a data grid view row
        public static Demon LoadDemon(DataRow row)
        {
            var demonVersions = "";
            var name          = row["Name"] is DBNull ? "" : (string)row["Name"];

            if (!(row["Alternate Name"] is DBNull))
            {
                var alternateDemon = (string)row["Alternate Name"];
                demonVersions = "{{DemonVersions|" + name + "|" + alternateDemon + "}}\r\n";
            }

            var demon = new Demon();

            demon.Name   = name;
            demon.Rarity = row["Rarity"] is DBNull ? "" : (string)row["Rarity"];
            demon.Race   = row["Race"] is DBNull ? "" : (string)row["Race"];
            demon.Ai     = row["Type"] is DBNull ? "" : (string)row["Type"];
            demon.Grade  = row["Grade"] is DBNull ? "" : (string)row["Grade"];

            demon.Str  = row["6★ Strength"] is DBNull ? 0 : Convert.ToInt32(row["6★ Strength"]);
            demon.Mag  = row["6★ Magic"] is DBNull ? 0 : Convert.ToInt32(row["6★ Magic"]);
            demon.Vit  = row["6★ Vitality"] is DBNull ? 0 : Convert.ToInt32(row["6★ Vitality"]);
            demon.Agi  = row["6★ Agility"] is DBNull ? 0 : Convert.ToInt32(row["6★ Agility"]);
            demon.Luck = row["6★ Luck"] is DBNull ? 0 : Convert.ToInt32(row["6★ Luck"]);

            demon.DemonVersions = demonVersions;

            demon.Fire  = LoadResist(row["Fire"] is DBNull ? "" : (string)row["Fire"]);
            demon.Dark  = LoadResist(row["Dark"] is DBNull ? "" : (string)row["Dark"]);
            demon.Light = LoadResist(row["Light"] is DBNull ? "" : (string)row["Light"]);
            demon.Elec  = LoadResist(row["Elec"] is DBNull ? "" : (string)row["Elec"]);
            demon.Ice   = LoadResist(row["Ice"] is DBNull ? "" : (string)row["Ice"]);
            demon.Force = LoadResist(row["Force"] is DBNull ? "" : (string)row["Force"]);
            demon.Phys  = LoadResist(row["Phys"] is DBNull ? "" : (string)row["Phys"]);

            demon.Skill1 = row["Skill 1"] is DBNull ? "" : (string)row["Skill 1"];
            demon.Skill2 = row["Skill 2"] is DBNull ? "" : (string)row["Skill 2"];
            demon.Skill3 = row["Skill 3"] is DBNull ? "" : (string)row["Skill 3"];

            demon.AwakenC = row["Clear Awaken"] is DBNull ? "" : (string)row["Clear Awaken"];
            demon.AwakenR = row["Red Awaken"] is DBNull ? "" : (string)row["Red Awaken"];
            demon.AwakenP = row["Purple Awaken"] is DBNull ? "" : (string)row["Purple Awaken"];
            demon.AwakenY = row["Yellow Awaken"] is DBNull ? "" : (string)row["Yellow Awaken"];
            demon.AwakenT = row["Teal Awaken"] is DBNull ? "" : (string)row["Teal Awaken"];

            demon.GachaR = row["Red Gacha"] is DBNull ? "" : (string)row["Red Gacha"];
            demon.GachaP = row["Purple Gacha"] is DBNull ? "" : (string)row["Purple Gacha"];
            demon.GachaY = row["Yellow Gacha"] is DBNull ? "" : (string)row["Yellow Gacha"];
            demon.GachaT = row["Teal Gacha"] is DBNull ? "" : (string)row["Teal Gacha"];

            demon.Panel1 = row["Panel 1"] is DBNull ? "" : (string)row["Panel 1"];
            demon.Panel2 = row["Panel 2"] is DBNull ? "" : (string)row["Panel 2"];
            demon.Panel3 = row["Panel 3"] is DBNull ? "" : (string)row["Panel 3"];
            demon.Panel4 = row["Panel 4"] is DBNull ? "" : (string)row["Panel 4"];

            demon.Panel1Stats = row["Panel 1 Stats"] is DBNull ? "" : (string)row["Panel 1 Stats"];
            demon.Panel2Stats = row["Panel 2 Stats"] is DBNull ? "" : (string)row["Panel 2 Stats"];
            demon.Panel3Stats = row["Panel 3 Stats"] is DBNull ? "" : (string)row["Panel 3 Stats"];
            demon.Panel4Stats = row["Panel 4 Stats"] is DBNull ? "" : (string)row["Panel 4 Stats"];

            demon.Gacha          = row["Gacha"] is DBNull ? false : (string)row["Gacha"] == "1";
            demon.Event          = row["Event"] is DBNull ? false : (string)row["Event"] == "1";
            demon.MultiFusion    = row["Multi-Fusion"] is DBNull ? false : (string)row["Multi-Fusion"] == "1";
            demon.BannerRequired = row["Banner Required"] is DBNull ? false : (string)row["Banner Required"] == "1";
            demon.Negotiation    = row["Negotiation"] is DBNull ? false : (string)row["Negotiation"] == "1";
            demon.Exchangeable   = row["Exchangeable"] is DBNull ? false : (string)row["Exchangeable"] == "1";

            demon.Nicknames     = row["Nickname"] is DBNull ? "" : (string)row["Nickname"];
            demon.NicknamesList = new List <string>();

            if (demon.Nicknames.Contains(","))
            {
                var nicknameList = demon.Nicknames.Split(",");
                foreach (var nickname in nicknameList)
                {
                    demon.NicknamesList.Add(nickname.Trim());
                }
            }
            else
            {
                demon.NicknamesList.Add(demon.Nicknames.Trim());
            }

            return(demon);
        }