Beispiel #1
0
 private void Browser_Navigating(object sender, WebBrowserNavigatingEventArgs e)
 {
     if (e.Url.Scheme == "build")
     {
         if (e.Url.LocalPath == "profile")
         {
             e.Cancel = true;
             CreatureTemplateProfileForm creatureTemplateProfileForm = new CreatureTemplateProfileForm(this.fTemplate);
             if (creatureTemplateProfileForm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
             {
                 this.fTemplate.Name   = creatureTemplateProfileForm.Template.Name;
                 this.fTemplate.Type   = creatureTemplateProfileForm.Template.Type;
                 this.fTemplate.Role   = creatureTemplateProfileForm.Template.Role;
                 this.fTemplate.Leader = creatureTemplateProfileForm.Template.Leader;
                 this.update_statblock();
             }
         }
         if (e.Url.LocalPath == "combat")
         {
             e.Cancel = true;
             CreatureTemplateStatsForm creatureTemplateStatsForm = new CreatureTemplateStatsForm(this.fTemplate);
             if (creatureTemplateStatsForm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
             {
                 this.fTemplate.HP         = creatureTemplateStatsForm.Template.HP;
                 this.fTemplate.Initiative = creatureTemplateStatsForm.Template.Initiative;
                 this.fTemplate.AC         = creatureTemplateStatsForm.Template.AC;
                 this.fTemplate.Fortitude  = creatureTemplateStatsForm.Template.Fortitude;
                 this.fTemplate.Reflex     = creatureTemplateStatsForm.Template.Reflex;
                 this.fTemplate.Will       = creatureTemplateStatsForm.Template.Will;
                 this.update_statblock();
             }
         }
         if (e.Url.LocalPath == "damage")
         {
             e.Cancel = true;
             if ((new DamageModListForm(this.fTemplate)).ShowDialog() == System.Windows.Forms.DialogResult.OK)
             {
                 this.update_statblock();
             }
         }
         if (e.Url.LocalPath == "senses")
         {
             e.Cancel = true;
             DetailsForm detailsForm = new DetailsForm(this.fTemplate.Senses, "Senses", "");
             if (detailsForm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
             {
                 this.fTemplate.Senses = detailsForm.Details;
                 this.update_statblock();
             }
         }
         if (e.Url.LocalPath == "movement")
         {
             e.Cancel = true;
             DetailsForm detailsForm1 = new DetailsForm(this.fTemplate.Movement, "Movement", "");
             if (detailsForm1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
             {
                 this.fTemplate.Movement = detailsForm1.Details;
                 this.update_statblock();
             }
         }
         if (e.Url.LocalPath == "tactics")
         {
             e.Cancel = true;
             DetailsForm detailsForm2 = new DetailsForm(this.fTemplate.Tactics, "Tactics", "");
             if (detailsForm2.ShowDialog() == System.Windows.Forms.DialogResult.OK)
             {
                 this.fTemplate.Tactics = detailsForm2.Details;
                 this.update_statblock();
             }
         }
     }
     if (e.Url.Scheme == "power")
     {
         if (e.Url.LocalPath == "addpower")
         {
             e.Cancel = true;
             CreaturePower creaturePower = new CreaturePower()
             {
                 Name   = "New Power",
                 Action = new PowerAction()
             };
             bool             type             = this.fTemplate.Type == CreatureTemplateType.Functional;
             PowerBuilderForm powerBuilderForm = new PowerBuilderForm(creaturePower, null, type);
             if (powerBuilderForm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
             {
                 this.fTemplate.CreaturePowers.Add(powerBuilderForm.Power);
                 this.update_statblock();
             }
         }
         if (e.Url.LocalPath == "addtrait")
         {
             e.Cancel = true;
             CreaturePower creaturePower1 = new CreaturePower()
             {
                 Name   = "New Trait",
                 Action = null
             };
             bool             flag = this.fTemplate.Type == CreatureTemplateType.Functional;
             PowerBuilderForm powerBuilderForm1 = new PowerBuilderForm(creaturePower1, null, flag);
             if (powerBuilderForm1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
             {
                 this.fTemplate.CreaturePowers.Add(powerBuilderForm1.Power);
                 this.update_statblock();
             }
         }
         if (e.Url.LocalPath == "addaura")
         {
             e.Cancel = true;
             Aura aura = new Aura()
             {
                 Name    = "New Aura",
                 Details = "1"
             };
             AuraForm auraForm = new AuraForm(aura);
             if (auraForm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
             {
                 this.fTemplate.Auras.Add(auraForm.Aura);
                 this.update_statblock();
             }
         }
         if (e.Url.LocalPath == "regenedit")
         {
             e.Cancel = true;
             Regeneration     regeneration     = this.fTemplate.Regeneration ?? new Regeneration(5, "");
             RegenerationForm regenerationForm = new RegenerationForm(regeneration);
             if (regenerationForm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
             {
                 this.fTemplate.Regeneration = regenerationForm.Regeneration;
                 this.update_statblock();
             }
         }
         if (e.Url.LocalPath == "regenremove")
         {
             e.Cancel = true;
             this.fTemplate.Regeneration = null;
             this.update_statblock();
         }
     }
     if (e.Url.Scheme == "poweredit")
     {
         CreaturePower creaturePower2 = this.find_power(new Guid(e.Url.LocalPath));
         if (creaturePower2 != null)
         {
             e.Cancel = true;
             int              power             = this.fTemplate.CreaturePowers.IndexOf(creaturePower2);
             bool             type1             = this.fTemplate.Type == CreatureTemplateType.Functional;
             PowerBuilderForm powerBuilderForm2 = new PowerBuilderForm(creaturePower2, null, type1);
             if (powerBuilderForm2.ShowDialog() == System.Windows.Forms.DialogResult.OK)
             {
                 this.fTemplate.CreaturePowers[power] = powerBuilderForm2.Power;
                 this.update_statblock();
             }
         }
     }
     if (e.Url.Scheme == "powerremove")
     {
         CreaturePower creaturePower3 = this.find_power(new Guid(e.Url.LocalPath));
         if (creaturePower3 != null)
         {
             e.Cancel = true;
             this.fTemplate.CreaturePowers.Remove(creaturePower3);
             this.update_statblock();
         }
     }
     if (e.Url.Scheme == "auraedit")
     {
         Aura aura1 = this.find_aura(new Guid(e.Url.LocalPath));
         if (aura1 != null)
         {
             e.Cancel = true;
             int      num       = this.fTemplate.Auras.IndexOf(aura1);
             AuraForm auraForm1 = new AuraForm(aura1);
             if (auraForm1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
             {
                 this.fTemplate.Auras[num] = auraForm1.Aura;
                 this.update_statblock();
             }
         }
     }
     if (e.Url.Scheme == "auraremove")
     {
         Aura aura2 = this.find_aura(new Guid(e.Url.LocalPath));
         if (aura2 != null)
         {
             e.Cancel = true;
             this.fTemplate.Auras.Remove(aura2);
             this.update_statblock();
         }
     }
 }
        private void Browser_Navigating(object sender, WebBrowserNavigatingEventArgs e)
        {
            if (e.Url.Scheme == "build")
            {
                if (e.Url.LocalPath == "profile")
                {
                    e.Cancel = true;

                    CreatureTemplateProfileForm dlg = new CreatureTemplateProfileForm(fTemplate);
                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        fTemplate.Name   = dlg.Template.Name;
                        fTemplate.Type   = dlg.Template.Type;
                        fTemplate.Role   = dlg.Template.Role;
                        fTemplate.Leader = dlg.Template.Leader;

                        update_statblock();
                    }
                }

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

                    CreatureTemplateStatsForm dlg = new CreatureTemplateStatsForm(fTemplate);
                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        fTemplate.HP         = dlg.Template.HP;
                        fTemplate.Initiative = dlg.Template.Initiative;
                        fTemplate.AC         = dlg.Template.AC;
                        fTemplate.Fortitude  = dlg.Template.Fortitude;
                        fTemplate.Reflex     = dlg.Template.Reflex;
                        fTemplate.Will       = dlg.Template.Will;

                        update_statblock();
                    }
                }

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

                    DamageModListForm dlg = new DamageModListForm(fTemplate);
                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        update_statblock();
                    }
                }

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

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

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

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

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

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

            if (e.Url.Scheme == "power")
            {
                if (e.Url.LocalPath == "addpower")
                {
                    e.Cancel = true;

                    CreaturePower pwr = new CreaturePower();
                    pwr.Name   = "New Power";
                    pwr.Action = new PowerAction();

                    bool             functional = fTemplate.Type == CreatureTemplateType.Functional;
                    PowerBuilderForm dlg        = new PowerBuilderForm(pwr, null, functional);
                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        fTemplate.CreaturePowers.Add(dlg.Power);
                        update_statblock();
                    }
                }

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

                    CreaturePower pwr = new CreaturePower();
                    pwr.Name   = "New Trait";
                    pwr.Action = null;

                    bool             functional = fTemplate.Type == CreatureTemplateType.Functional;
                    PowerBuilderForm dlg        = new PowerBuilderForm(pwr, null, functional);
                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        fTemplate.CreaturePowers.Add(dlg.Power);
                        update_statblock();
                    }
                }

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

                    Aura aura = new Aura();
                    aura.Name    = "New Aura";
                    aura.Details = "1";

                    AuraForm dlg = new AuraForm(aura);
                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        fTemplate.Auras.Add(dlg.Aura);
                        update_statblock();
                    }
                }

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

                    Regeneration regen = fTemplate.Regeneration;
                    if (regen == null)
                    {
                        regen = new Regeneration(5, "");
                    }

                    RegenerationForm dlg = new RegenerationForm(regen);
                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        fTemplate.Regeneration = dlg.Regeneration;
                        update_statblock();
                    }
                }

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

                    fTemplate.Regeneration = null;
                    update_statblock();
                }
            }

            if (e.Url.Scheme == "powerup")
            {
            }

            if (e.Url.Scheme == "powerdown")
            {
            }

            if (e.Url.Scheme == "poweredit")
            {
                CreaturePower pwr = find_power(new Guid(e.Url.LocalPath));
                if (pwr != null)
                {
                    e.Cancel = true;
                    int index = fTemplate.CreaturePowers.IndexOf(pwr);

                    bool             functional = fTemplate.Type == CreatureTemplateType.Functional;
                    PowerBuilderForm dlg        = new PowerBuilderForm(pwr, null, functional);
                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        fTemplate.CreaturePowers[index] = dlg.Power;
                        update_statblock();
                    }
                }
            }

            if (e.Url.Scheme == "powerremove")
            {
                CreaturePower pwr = find_power(new Guid(e.Url.LocalPath));
                if (pwr != null)
                {
                    e.Cancel = true;

                    fTemplate.CreaturePowers.Remove(pwr);
                    update_statblock();
                }
            }

            if (e.Url.Scheme == "auraedit")
            {
                Aura aura = find_aura(new Guid(e.Url.LocalPath));
                if (aura != null)
                {
                    e.Cancel = true;
                    int index = fTemplate.Auras.IndexOf(aura);

                    AuraForm dlg = new AuraForm(aura);
                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        fTemplate.Auras[index] = dlg.Aura;
                        update_statblock();
                    }
                }
            }

            if (e.Url.Scheme == "auraremove")
            {
                Aura aura = find_aura(new Guid(e.Url.LocalPath));
                if (aura != null)
                {
                    e.Cancel = true;

                    fTemplate.Auras.Remove(aura);
                    update_statblock();
                }
            }
        }