Beispiel #1
0
 private List <Rank> getRanks()
 {
     saveExportState();
     clearSearchBtn.PerformClick();
     restoreExportState();
     return(DemonHelper.GetRanks(demonGrid.Rows.Cast <DataGridViewRow>()));
 }
Beispiel #2
0
        //Exports Selected Demons
        private void exportIndividualDemonBtn_Click(object sender, EventArgs e)
        {
            var ranks = getRanks();

            var selectedDemons = demonGrid.Rows.Cast <DataGridViewRow>().Where(r => r.Cells["Export"].Value != null && (bool)r.Cells["Export"].Value == true);

            DemonHelper.ExportDemons(selectedDemons, ranks, demonGrid.Rows.Cast <DataGridViewRow>(), false, LoadedPath);
        }
Beispiel #3
0
        public static void Migrate(string loadedPath, IEnumerable <DataGridViewRow> demons, IEnumerable <DataGridViewRow> skills)
        {
            var lines = "";

            lines += "#Demons \n\n";

            //Migrate Demon Table
            foreach (var row in demons)
            {
                if (row.Cells[0].Value is string)
                {
                    var demon = DemonHelper.LoadDemon(row, demons);

                    if (demon.Name != "")
                    {
                        lines += "# " + demon.Name + "\n";

                        //Insert Demons
                        lines += "Insert Into dx2.demons Values (" +
                                 "null, " +
                                 "\"" + demon.Name + "\"," +
                                 " (Select id from dx2.demon_races where name_en = \"" + demon.Race + "\")," +
                                 " (Select id from dx2.demon_ais where name_en = \"" + demon.Ai + "\")," +
                                 " " + demon.Grade + "," +
                                 " " + demon.Rarity + "); \n";

                        //Insert Resistances
                        lines += "Insert Into dx2.demon_resistances Values (" +
                                 "(Select id from dx2.demons where name_en = \"" + demon.Name + "\"), ";
                        lines += CreateInsertResist(FixResist(demon.Phys)) + ", ";
                        lines += CreateInsertResist(FixResist(demon.Fire)) + ", ";
                        lines += CreateInsertResist(FixResist(demon.Ice)) + ", ";
                        lines += CreateInsertResist(FixResist(demon.Force)) + ", ";
                        lines += CreateInsertResist(FixResist(demon.Elec)) + ", ";
                        lines += CreateInsertResist(FixResist(demon.Light)) + ", ";
                        lines += CreateInsertResist(FixResist(demon.Dark)) + "); \n";

                        //Insert Stats
                        lines += "Insert Into dx2.demon_stats Values (" +
                                 "(Select id from dx2.demons where name_en = \"" + demon.Name + "\"), " +
                                 "50," + demon.HP + "," + demon.Str + "," + demon.Mag + "," + demon.Vit + "," + demon.Agi + "," + demon.Luck + "," + true + "); \n";

                        lines += "\n";
                    }
                }
            }

            lines += "#Skills \n\n";

            foreach (var row in skills)
            {
                if (row.Cells[0].Value is string)
                {
                    var skill = SkillHelper.LoadSkill(row, demons);

                    lines += "# " + skill.Name + "\n";

                    var desc = ReadDescription(skill.Description);
                    var sp   = skill.Sp;

                    if (sp == "")
                    {
                        sp = "null";
                    }

                    //Insert Skills
                    lines += "Insert Into dx2.skills Values (" +
                             "null, " +
                             "\"" + skill.Name + "\"," +
                             " (Select id from dx2.skill_types where name_en = \"" + skill.Element.Substring(0, 1).ToUpper() + skill.Element.Substring(1, skill.Element.Length - 1) + "\")," +
                             " (Select id from dx2.skill_target where name_en = \"" + skill.Target + "\")," +
                             "null, null, " + skill.Cost.Replace(" MP", "").ToLower().Replace("passive", "null") + ", " + sp + ", " + skill.DuelExclusive + ", " + skill.ExtractExclusive + ", null, null); \n";

                    lines += "Insert Into dx2.skill_levels Values (" +
                             "(Select id from dx2.skills where name_en = \"" + skill.Name + "\"), \n" +
                             desc[0] + "," +
                             desc[1] + "," +
                             desc[2] + "," +
                             desc[3] + "," +
                             desc[4] + "," +
                             desc[5] + "," +
                             desc[6] + "," +
                             desc[7] + ");\n";

                    lines += "\n";
                }
            }

            File.WriteAllText(loadedPath + "/Migration.sql", lines);


            lines  = "";
            lines += "#Demon Skills \n\n";

            foreach (var row in demons)
            {
                if (row.Cells[0].Value is string)
                {
                    var demon = DemonHelper.LoadDemon(row, demons);

                    if (demon.Name != "")
                    {
                        lines += "Insert Into dx2.demon_skills Values(" +
                                 "(Select id from dx2.demons where name_en = \"" + demon.Name + "\"), " +
                                 "(Select id from dx2.skills where name_en = \"" + demon.Skill1 + "\"), " +
                                 "(Select id from dx2.skills where name_en = \"" + demon.Skill2 + "\"), " +
                                 "(Select id from dx2.skills where name_en = \"" + demon.Skill3 + "\"), " +
                                 "(Select id from dx2.skills where name_en = \"" + demon.AwakenC + "\"), " +
                                 "(Select id from dx2.skills where name_en = \"" + demon.AwakenR + "\"), " +
                                 "(Select id from dx2.skills where name_en = \"" + demon.AwakenY + "\"), " +
                                 "(Select id from dx2.skills where name_en = \"" + demon.AwakenT + "\"), " +
                                 "(Select id from dx2.skills where name_en = \"" + demon.AwakenP + "\"), " +
                                 "(Select id from dx2.skills where name_en = \"" + demon.GachaR + "\"), " +
                                 "(Select id from dx2.skills where name_en = \"" + demon.GachaY + "\"), " +
                                 "(Select id from dx2.skills where name_en = \"" + demon.GachaT + "\"), " +
                                 "(Select id from dx2.skills where name_en = \"" + demon.GachaP + "\")); \n";
                    }
                }
            }

            File.WriteAllText(loadedPath + "/Migration2.sql", lines);

            lines  = "";
            lines += "#Panel Info \n\n";

            foreach (var row in demons)
            {
                if (row.Cells[0].Value is string)
                {
                    var demon = DemonHelper.LoadDemon(row, demons);

                    if (demon.Name != "")
                    {
                        lines += "Insert Into dx2.demon_skills Values(" +
                                 "(Select id from dx2.demons where name_en = \"" + demon.Name + "\"), " +
                                 demon.Panel1completion + ", " +
                                 demon.Panel1stats + ", " +
                                 demon.Panel2completion + ", " +
                                 demon.Panel2stats + ", " +
                                 demon.Panel3completion + ", " +
                                 demon.Panel3stats + "); \n";
                    }
                }
            }

            File.WriteAllText(loadedPath + "/Migration3.sql", lines);
        }
Beispiel #4
0
        //Exports all Demons
        private void exportDemonAllBtn_Click(object sender, EventArgs e)
        {
            var ranks = DemonHelper.GetRanks(demonGrid.Rows.Cast <DataGridViewRow>());

            DemonHelper.ExportDemons(demonGrid.Rows.Cast <DataGridViewRow>(), ranks, demonGrid.Rows.Cast <DataGridViewRow>(), true, LoadedPath);
        }
Beispiel #5
0
        //Creates a Wiki string for Individual by themselves
        public string CreateWikiStringIndividual(List <Rank> ranks)
        {
            //Avoid calling count multiple times?
            var total = ranks.Count;

            //Lets generate a handful of useful categories to add on
            var extraCats = "";

            if (Gacha)
            {
                extraCats += "[[Category: Gacha Demons]]\r\n";
            }
            if (Event)
            {
                extraCats += "[[Category: Event Demons]]\r\n";
            }
            if (MultiFusion)
            {
                extraCats += "[[Category: Multi-Fusion Demons]]\r\n";
            }
            if (BannerRequired)
            {
                extraCats += "[[Category: Time Limited Demons]]\r\n";
            }

            if (Negotiation)
            {
                extraCats += "[[Category: Negotiation Demons]]\r\n";
            }
            else if (Exchangeable)
            {
                extraCats += "[[Category: Exchangable Demons]]\r\n";
            }
            else if (MultiFusion || (!Gacha && !Event))
            {
                extraCats += "[[Category: Fusible Demons]]\r\n";
            }

            //Generate Fusion and Fission URL
            var newName = Name;

            Regex regex = new Regex(@"\b A\b");

            newName = regex.Replace(newName, " %5BDimensional%5D");
            var fissionLink = "https://oceanxdds.github.io/dx2_fusion/?route=fission&demon=" + Uri.EscapeUriString(newName) + "#en";
            var fusionLink  = "https://oceanxdds.github.io/dx2_fusion/?route=fusion&demon=" + Uri.EscapeUriString(newName) + "#en";

            //Generate Flag Info
            var flagInfo = "";

            flagInfo += "gacha=" + Gacha.ToString() + "|";
            flagInfo += "multi-fusion=" + MultiFusion.ToString() + "|";
            flagInfo += "event=" + Event.ToString() + "|";
            flagInfo += "banner=" + BannerRequired.ToString() + "|";
            flagInfo += "negotiation=" + Negotiation.ToString() + "|";
            flagInfo += "exchangeable=" + Exchangeable.ToString() + "|";
            flagInfo += "fusible=" + (MultiFusion || (!Gacha && !Event)).ToString() + "|";
            flagInfo += "fissionLink=" + fissionLink;

            //Return the data
            return
                ("__TOC__\r\n" +
                 "{{Demon\r\n" +
                 "|id=\r\n" +
                 "|jpname=\r\n" +
                 "|name= " + Name + Environment.NewLine +
                 "|release_version= 1.0\r\n" +
                 "|link_altema=\r\n" +
                 "|art= {{PAGENAME}}.jpg\r\n" +
                 "|phys= " + Phys + Environment.NewLine +
                 "|fire= " + Fire + Environment.NewLine +
                 "|ice= " + Ice + Environment.NewLine +
                 "|elec= " + Elec + Environment.NewLine +
                 "|force= " + Force + Environment.NewLine +
                 "|light= " + Light + Environment.NewLine +
                 "|dark= " + Dark + Environment.NewLine +
                 "|race= " + Race + Environment.NewLine +
                 "|grade= " + Grade + Environment.NewLine +
                 "|rarity= " + Rarity + Environment.NewLine +
                 "|ai= " + Ai + Environment.NewLine +
                 "|max_hp= " + HP + " (" + DemonHelper.GetMyRank(ranks, Name).HP + "/" + total + ")\r\n" +
                 "|max_str= " + Str + " (" + DemonHelper.GetMyRank(ranks, Name).Str + "/" + total + ")\r\n" +
                 "|max_mag= " + Mag + " (" + DemonHelper.GetMyRank(ranks, Name).Mag + "/" + total + ")\r\n" +
                 "|max_vit= " + Vit + " (" + DemonHelper.GetMyRank(ranks, Name).Vit + "/" + total + ")\r\n" +
                 "|max_agi= " + Agi + " (" + DemonHelper.GetMyRank(ranks, Name).Agility + "/" + total + ")\r\n" +
                 "|max_luck= " + Luck + " (" + DemonHelper.GetMyRank(ranks, Name).Luck + "/" + total + ")\r\n" +
                 "|patk= " + PAtk + Environment.NewLine +
                 "|pdef= " + PDef + Environment.NewLine +
                 "|matk= " + MAtk + Environment.NewLine +
                 "|mdef= " + MDef + Environment.NewLine +
                 "|panel1= " + Panel1completion + Environment.NewLine +
                 "|panel2= " + Panel2completion + Environment.NewLine +
                 "|panel3= " + Panel3completion + Environment.NewLine +
                 "|panel4= " + Panel4completion + Environment.NewLine +
                 "|panel1stats= " + Panel1stats + Environment.NewLine +
                 "|panel2stats= " + Panel2stats + Environment.NewLine +
                 "|panel3stats= " + Panel3stats + Environment.NewLine +
                 "|panel4stats= " + Panel4stats + Environment.NewLine +
                 "|transfer_skill= " + (Skill1 == "" ? "N/A" : Skill1.Replace("[", "(").Replace("]", ")")) + Environment.NewLine +
                 "|innate_skill1= " + (Skill2 == "" ? "N/A" : Skill2.Replace("[", "(").Replace("]", ")")) + Environment.NewLine +
                 "|innate_skill2= " + (Skill3 == "" ? "N/A" : Skill3.Replace("[", "(").Replace("]", ")")) + Environment.NewLine +
                 "|a_clear= " + (AwakenC == "" ? "N/A" : AwakenC.Replace("[", "(").Replace("]", ")")) + Environment.NewLine +
                 "|a_red= " + (AwakenR == "" ? "N/A" : AwakenR.Replace("[", "(").Replace("]", ")")) + Environment.NewLine +
                 "|a_yellow= " + (AwakenY == "" ? "N/A" : AwakenY.Replace("[", "(").Replace("]", ")")) + Environment.NewLine +
                 "|a_purple= " + (AwakenP == "" ? "N/A" : AwakenP.Replace("[", "(").Replace("]", ")")) + Environment.NewLine +
                 "|a_teal= " + (AwakenT == "" ? "N/A" : AwakenT.Replace("[", "(").Replace("]", ")")) + Environment.NewLine +
                 "|g_red= " + (GachaR == "" ? "N/A" : GachaR.Replace("[", "(").Replace("]", ")")) + Environment.NewLine +
                 "|g_yellow= " + (GachaY == "" ? "N/A" : GachaY.Replace("[", "(").Replace("]", ")")) + Environment.NewLine +
                 "|g_purple= " + (GachaP == "" ? "N/A" : GachaP.Replace("[", "(").Replace("]", ")")) + Environment.NewLine +
                 "|g_teal= " + (GachaT == "" ? "N/A" : GachaT.Replace("[", "(").Replace("]", ")")) + Environment.NewLine +
                 "|awaken1= " + Awaken1 + "|awaken2=" + Awaken2 + "|awaken3=" + Awaken3 + "|awaken4=" + Awaken4 + "|awaken1amnt=" + Awaken1Amount + "|awaken2amnt=" + Awaken2Amount + "|awaken3amnt=" + Awaken3Amount + "|awaken4amnt=" + Awaken4Amount + Environment.NewLine +
                 "|gacha= " + Gacha + Environment.NewLine +
                 "|event= " + Event + Environment.NewLine +
                 "|multifusion= " + MultiFusion + Environment.NewLine +
                 "|bannerrequired= " + BannerRequired + Environment.NewLine +
                 "|negotiation= " + Negotiation + Environment.NewLine +
                 "|exchangeable= " + Exchangeable + Environment.NewLine +
                 "|class= " + Class + Environment.NewLine +
                 "|fissionlink= " + fissionLink + Environment.NewLine +
                 "|fusionlink= " + fusionLink + Environment.NewLine +
                 "|}}\r\n" +
                 "<section begin=gachaFlags/>{{#ifeq:{{PAGENAME}}| Tier List |{{GachaFlag|" + flagInfo + "}}|}}<section end=gachaFlags/>\r\n" +
                 "{{:{{PAGENAME}}/Sword}}\r\n" +
                 "{{:{{PAGENAME}}/Shield}}\r\n" +
                 "{{:{{PAGENAME}}/Builds}}\r\n" +
                 "{{:{{PAGENAME}}/Lore}}\r\n" +
                 "[[Category: Demons]]\r\n" +
                 "[[Category: " + Race + "]]\r\n" +
                 "[[Category: " + Rarity + " Star Demons]]\r\n" +
                 "[[Category: " + Ai + " AI]]\r\n" +
                 extraCats);
        }