public MagicItemSectionForm(MagicItemSection section)
 {
     this.InitializeComponent();
     this.HeaderBox.Items.Add("Price");
     this.HeaderBox.Items.Add("Enhancement");
     this.HeaderBox.Items.Add("Property");
     this.HeaderBox.Items.Add("Power");
     this.fSection        = section.Copy();
     this.HeaderBox.Text  = this.fSection.Header;
     this.DetailsBox.Text = this.fSection.Details;
 }
Exemple #2
0
        private void Browser_Navigating(object sender, WebBrowserNavigatingEventArgs e)
        {
            if (e.Url.Scheme == "build")
            {
                if (e.Url.LocalPath == "profile")
                {
                    e.Cancel = true;

                    MagicItemProfileForm dlg = new MagicItemProfileForm(fMagicItem);
                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        fMagicItem.Name   = dlg.MagicItem.Name;
                        fMagicItem.Level  = dlg.MagicItem.Level;
                        fMagicItem.Type   = dlg.MagicItem.Type;
                        fMagicItem.Rarity = dlg.MagicItem.Rarity;

                        update_statblock();
                    }
                }

                if (e.Url.LocalPath == "desc")
                {
                    e.Cancel = true;

                    DetailsForm dlg = new DetailsForm(fMagicItem.Description, "Description", null);
                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        fMagicItem.Description = dlg.Details;
                        update_statblock();
                    }
                }
            }

            if (e.Url.Scheme == "section")
            {
                e.Cancel = true;

                if (e.Url.LocalPath == "new")
                {
                    MagicItemSection section = new MagicItemSection();
                    section.Header = "New Section";

                    MagicItemSectionForm dlg = new MagicItemSectionForm(section);
                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        fMagicItem.Sections.Add(dlg.Section);
                        update_statblock();
                    }
                }
            }

            if (e.Url.Scheme == "edit")
            {
                e.Cancel = true;

                int index = int.Parse(e.Url.LocalPath);

                MagicItemSectionForm dlg = new MagicItemSectionForm(fMagicItem.Sections[index]);
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    fMagicItem.Sections[index] = dlg.Section;
                    update_statblock();
                }
            }

            if (e.Url.Scheme == "remove")
            {
                e.Cancel = true;

                int index = int.Parse(e.Url.LocalPath);

                fMagicItem.Sections.RemoveAt(index);
                update_statblock();
            }

            if (e.Url.Scheme == "moveup")
            {
                e.Cancel = true;

                int index = int.Parse(e.Url.LocalPath);

                MagicItemSection tmp = fMagicItem.Sections[index - 1];
                fMagicItem.Sections[index - 1] = fMagicItem.Sections[index];
                fMagicItem.Sections[index]     = tmp;

                update_statblock();
            }

            if (e.Url.Scheme == "movedown")
            {
                e.Cancel = true;

                int index = int.Parse(e.Url.LocalPath);

                MagicItemSection tmp = fMagicItem.Sections[index + 1];
                fMagicItem.Sections[index + 1] = fMagicItem.Sections[index];
                fMagicItem.Sections[index]     = tmp;

                update_statblock();
            }
        }
Exemple #3
0
        private void Browser_Navigating(object sender, WebBrowserNavigatingEventArgs e)
        {
            if (e.Url.Scheme == "build")
            {
                if (e.Url.LocalPath == "profile")
                {
                    e.Cancel = true;

                    ArtifactProfileForm dlg = new ArtifactProfileForm(fArtifact);
                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        fArtifact.Name = dlg.Artifact.Name;
                        fArtifact.Tier = dlg.Artifact.Tier;
                        update_statblock();
                    }
                }

                if (e.Url.LocalPath == "description")
                {
                    e.Cancel = true;

                    DetailsForm dlg = new DetailsForm(fArtifact.Description, "Description", null);
                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        fArtifact.Description = dlg.Details;
                        update_statblock();
                    }
                }

                if (e.Url.LocalPath == "details")
                {
                    e.Cancel = true;

                    DetailsForm dlg = new DetailsForm(fArtifact.Details, "Details", null);
                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        fArtifact.Details = dlg.Details;
                        update_statblock();
                    }
                }

                if (e.Url.LocalPath == "goals")
                {
                    e.Cancel = true;

                    DetailsForm dlg = new DetailsForm(fArtifact.Goals, "Goals", null);
                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        fArtifact.Goals = dlg.Details;
                        update_statblock();
                    }
                }

                if (e.Url.LocalPath == "rp")
                {
                    e.Cancel = true;

                    DetailsForm dlg = new DetailsForm(fArtifact.RoleplayingTips, "Roleplaying", null);
                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        fArtifact.RoleplayingTips = dlg.Details;
                        update_statblock();
                    }
                }
            }

            if (e.Url.Scheme == "section")
            {
                if (e.Url.LocalPath == "new")
                {
                    e.Cancel = true;

                    MagicItemSection     mis = new MagicItemSection();
                    MagicItemSectionForm dlg = new MagicItemSectionForm(mis);
                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        fArtifact.Sections.Add(dlg.Section);
                        update_statblock();
                    }
                }

                if (e.Url.LocalPath.Contains(",new"))
                {
                    e.Cancel = true;

                    try
                    {
                        string str             = e.Url.LocalPath.Substring(0, e.Url.LocalPath.IndexOf(","));
                        int    n               = int.Parse(str);
                        ArtifactConcordance ac = fArtifact.ConcordanceLevels[n];

                        MagicItemSection     mis = new MagicItemSection();
                        MagicItemSectionForm dlg = new MagicItemSectionForm(mis);
                        if (dlg.ShowDialog() == DialogResult.OK)
                        {
                            ac.Sections.Add(dlg.Section);
                            update_statblock();
                        }
                    }
                    catch
                    {
                        // Not a number
                    }
                }
            }

            if (e.Url.Scheme == "sectionedit")
            {
                if (e.Url.LocalPath.Contains(","))
                {
                    e.Cancel = true;

                    int    comma = e.Url.LocalPath.IndexOf(",");
                    string pre   = e.Url.LocalPath.Substring(0, comma);
                    string post  = e.Url.LocalPath.Substring(comma);

                    try
                    {
                        int ac_index      = int.Parse(pre);
                        int section_index = int.Parse(post);

                        ArtifactConcordance  ac  = fArtifact.ConcordanceLevels[ac_index];
                        MagicItemSection     mis = ac.Sections[section_index];
                        MagicItemSectionForm dlg = new MagicItemSectionForm(mis);
                        if (dlg.ShowDialog() == DialogResult.OK)
                        {
                            ac.Sections[section_index] = dlg.Section;
                            update_statblock();
                        }
                    }
                    catch
                    {
                        // Not a number
                    }
                }
                else
                {
                    e.Cancel = true;

                    try
                    {
                        int n = int.Parse(e.Url.LocalPath);
                        MagicItemSection mis = fArtifact.Sections[n];

                        MagicItemSectionForm dlg = new MagicItemSectionForm(mis);
                        if (dlg.ShowDialog() == DialogResult.OK)
                        {
                            fArtifact.Sections[n] = dlg.Section;
                            update_statblock();
                        }
                    }
                    catch
                    {
                        // Not a number
                    }
                }
            }

            if (e.Url.Scheme == "sectionremove")
            {
                if (e.Url.LocalPath.Contains(","))
                {
                    e.Cancel = true;

                    int    comma = e.Url.LocalPath.IndexOf(",");
                    string pre   = e.Url.LocalPath.Substring(0, comma);
                    string post  = e.Url.LocalPath.Substring(comma);

                    try
                    {
                        int ac_index      = int.Parse(pre);
                        int section_index = int.Parse(post);

                        ArtifactConcordance ac = fArtifact.ConcordanceLevels[ac_index];
                        ac.Sections.RemoveAt(section_index);
                        update_statblock();
                    }
                    catch
                    {
                        // Not a number
                    }
                }
                else
                {
                    e.Cancel = true;

                    try
                    {
                        int n = int.Parse(e.Url.LocalPath);

                        fArtifact.Sections.RemoveAt(n);
                        update_statblock();
                    }
                    catch
                    {
                        // Not a number
                    }
                }
            }

            if (e.Url.Scheme == "rule")
            {
                e.Cancel = true;

                if (e.Url.LocalPath == "new")
                {
                    Pair <string, string>   rule = new Pair <string, string>("", "");
                    ArtifactConcordanceForm dlg  = new ArtifactConcordanceForm(rule);
                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        fArtifact.ConcordanceRules.Add(dlg.Concordance);
                        update_statblock();
                    }
                }
            }

            if (e.Url.Scheme == "ruleedit")
            {
                e.Cancel = true;

                try
                {
                    int n = int.Parse(e.Url.LocalPath);
                    Pair <string, string> rule = fArtifact.ConcordanceRules[n];

                    ArtifactConcordanceForm dlg = new ArtifactConcordanceForm(rule);
                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        fArtifact.ConcordanceRules[n] = dlg.Concordance;
                        update_statblock();
                    }
                }
                catch
                {
                    // Not a number
                }
            }

            if (e.Url.Scheme == "ruleremove")
            {
                e.Cancel = true;

                try
                {
                    int n = int.Parse(e.Url.LocalPath);

                    fArtifact.ConcordanceRules.RemoveAt(n);
                    update_statblock();
                }
                catch
                {
                    // Not a number
                }
            }

            if (e.Url.Scheme == "quote")
            {
                e.Cancel = true;

                try
                {
                    int n = int.Parse(e.Url.LocalPath);
                    ArtifactConcordance ac = fArtifact.ConcordanceLevels[n];

                    DetailsForm dlg = new DetailsForm(ac.Quote, "Concordance Quote", null);
                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        ac.Quote = dlg.Details;
                        update_statblock();
                    }
                }
                catch
                {
                    // Not a number
                }
            }

            if (e.Url.Scheme == "desc")
            {
                e.Cancel = true;

                try
                {
                    int n = int.Parse(e.Url.LocalPath);
                    ArtifactConcordance ac = fArtifact.ConcordanceLevels[n];

                    DetailsForm dlg = new DetailsForm(ac.Description, "Concordance Description", null);
                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        ac.Description = dlg.Details;
                        update_statblock();
                    }
                }
                catch
                {
                    // Not a number
                }
            }
        }
 private void Browser_Navigating(object sender, WebBrowserNavigatingEventArgs e)
 {
     if (e.Url.Scheme == "build")
     {
         if (e.Url.LocalPath == "profile")
         {
             e.Cancel = true;
             MagicItemProfileForm magicItemProfileForm = new MagicItemProfileForm(this.fMagicItem);
             if (magicItemProfileForm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
             {
                 this.fMagicItem.Name   = magicItemProfileForm.MagicItem.Name;
                 this.fMagicItem.Level  = magicItemProfileForm.MagicItem.Level;
                 this.fMagicItem.Type   = magicItemProfileForm.MagicItem.Type;
                 this.fMagicItem.Rarity = magicItemProfileForm.MagicItem.Rarity;
                 this.update_statblock();
             }
         }
         if (e.Url.LocalPath == "desc")
         {
             e.Cancel = true;
             DetailsForm detailsForm = new DetailsForm(this.fMagicItem.Description, "Description", null);
             if (detailsForm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
             {
                 this.fMagicItem.Description = detailsForm.Details;
                 this.update_statblock();
             }
         }
     }
     if (e.Url.Scheme == "section")
     {
         e.Cancel = true;
         if (e.Url.LocalPath == "new")
         {
             MagicItemSectionForm magicItemSectionForm = new MagicItemSectionForm(new MagicItemSection()
             {
                 Header = "New Section"
             });
             if (magicItemSectionForm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
             {
                 this.fMagicItem.Sections.Add(magicItemSectionForm.Section);
                 this.update_statblock();
             }
         }
     }
     if (e.Url.Scheme == "edit")
     {
         e.Cancel = true;
         int section = int.Parse(e.Url.LocalPath);
         MagicItemSectionForm magicItemSectionForm1 = new MagicItemSectionForm(this.fMagicItem.Sections[section]);
         if (magicItemSectionForm1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
         {
             this.fMagicItem.Sections[section] = magicItemSectionForm1.Section;
             this.update_statblock();
         }
     }
     if (e.Url.Scheme == "remove")
     {
         e.Cancel = true;
         int num = int.Parse(e.Url.LocalPath);
         this.fMagicItem.Sections.RemoveAt(num);
         this.update_statblock();
     }
     if (e.Url.Scheme == "moveup")
     {
         e.Cancel = true;
         int item = int.Parse(e.Url.LocalPath);
         MagicItemSection magicItemSection = this.fMagicItem.Sections[item - 1];
         this.fMagicItem.Sections[item - 1] = this.fMagicItem.Sections[item];
         this.fMagicItem.Sections[item]     = magicItemSection;
         this.update_statblock();
     }
     if (e.Url.Scheme == "movedown")
     {
         e.Cancel = true;
         int item1 = int.Parse(e.Url.LocalPath);
         MagicItemSection magicItemSection1 = this.fMagicItem.Sections[item1 + 1];
         this.fMagicItem.Sections[item1 + 1] = this.fMagicItem.Sections[item1];
         this.fMagicItem.Sections[item1]     = magicItemSection1;
         this.update_statblock();
     }
 }