Exemplo n.º 1
0
        private void Browser_Navigating(object sender, WebBrowserNavigatingEventArgs e)
        {
            if (e.Url.Scheme == "build")
            {
                if (e.Url.LocalPath == "profile")
                {
                    e.Cancel = true;

                    TrapProfileForm dlg = new TrapProfileForm(fTrap);
                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        fTrap.Name       = dlg.Trap.Name;
                        fTrap.Type       = dlg.Trap.Type;
                        fTrap.Level      = dlg.Trap.Level;
                        fTrap.Role       = dlg.Trap.Role;
                        fTrap.Initiative = dlg.Trap.Initiative;

                        update_statblock();
                    }
                }

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

                    DetailsForm dlg = new DetailsForm(fTrap.ReadAloud, "Read-Aloud Text", null);
                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        fTrap.ReadAloud = dlg.Details;
                        update_statblock();
                    }
                }

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

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

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

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

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

                    TrapSkillData tsd = new TrapSkillData();
                    tsd.SkillName = "Perception";
                    tsd.DC        = AI.GetSkillDC(Difficulty.Moderate, fTrap.Level);

                    TrapSkillForm dlg = new TrapSkillForm(tsd, fTrap.Level);
                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        fTrap.Skills.Add(dlg.SkillData);
                        update_statblock();
                    }
                }

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

                    TrapAttack ta = new TrapAttack();
                    ta.Name = "Attack";

                    fTrap.Attacks.Add(ta);
                    update_statblock();
                }

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

                    string cm = "";
                    TrapCountermeasureForm dlg = new TrapCountermeasureForm(cm, fTrap.Level);
                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        fTrap.Countermeasures.Add(dlg.Countermeasure);
                        update_statblock();
                    }
                }

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

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

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

                Guid       id     = new Guid(e.Url.LocalPath);
                TrapAttack attack = fTrap.FindAttack(id);
                if (attack != null)
                {
                    TrapActionForm dlg = new TrapActionForm(attack);
                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        attack.Name   = dlg.Attack.Name;
                        attack.Action = dlg.Attack.Action;
                        attack.Range  = dlg.Attack.Range;
                        attack.Target = dlg.Attack.Target;

                        update_statblock();
                    }
                }
            }

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

                Guid       id     = new Guid(e.Url.LocalPath);
                TrapAttack attack = fTrap.FindAttack(id);
                if (attack != null)
                {
                    fTrap.Attacks.Remove(attack);
                    update_statblock();
                }
            }

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

                Guid       id     = new Guid(e.Url.LocalPath);
                TrapAttack attack = fTrap.FindAttack(id);
                if (attack != null)
                {
                    PowerAttackForm dlg = new PowerAttackForm(attack.Attack, false, fTrap.Level, fTrap.Role);
                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        attack.Attack = dlg.Attack;
                        update_statblock();
                    }
                }
            }

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

                Guid       id     = new Guid(e.Url.LocalPath);
                TrapAttack attack = fTrap.FindAttack(id);
                if (attack != null)
                {
                    DetailsForm dlg = new DetailsForm(attack.OnHit, "On Hit", null);
                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        attack.OnHit = dlg.Details;
                        update_statblock();
                    }
                }
            }

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

                Guid       id     = new Guid(e.Url.LocalPath);
                TrapAttack attack = fTrap.FindAttack(id);
                if (attack != null)
                {
                    DetailsForm dlg = new DetailsForm(attack.OnMiss, "On Miss", null);
                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        attack.OnMiss = dlg.Details;
                        update_statblock();
                    }
                }
            }

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

                Guid       id     = new Guid(e.Url.LocalPath);
                TrapAttack attack = fTrap.FindAttack(id);
                if (attack != null)
                {
                    DetailsForm dlg = new DetailsForm(attack.Effect, "Effect", null);
                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        attack.Effect = dlg.Details;
                        update_statblock();
                    }
                }
            }

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

                Guid       id     = new Guid(e.Url.LocalPath);
                TrapAttack attack = fTrap.FindAttack(id);
                if (attack != null)
                {
                    DetailsForm dlg = new DetailsForm(attack.Notes, "Notes", null);
                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        attack.Notes = dlg.Details;
                        update_statblock();
                    }
                }
            }

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

                Guid          id  = new Guid(e.Url.LocalPath);
                TrapSkillData tsd = fTrap.FindSkill(id);
                if (tsd != null)
                {
                    int index = fTrap.Skills.IndexOf(tsd);

                    TrapSkillForm dlg = new TrapSkillForm(tsd, fTrap.Level);
                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        fTrap.Skills[index] = dlg.SkillData;
                        update_statblock();
                    }
                }
            }

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

                Guid          id  = new Guid(e.Url.LocalPath);
                TrapSkillData tsd = fTrap.FindSkill(id);
                if (tsd != null)
                {
                    fTrap.Skills.Remove(tsd);
                    update_statblock();
                }
            }

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

                int    index = int.Parse(e.Url.LocalPath);
                string cm    = fTrap.Countermeasures[index];

                TrapCountermeasureForm dlg = new TrapCountermeasureForm(cm, fTrap.Level);
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    fTrap.Countermeasures[index] = dlg.Countermeasure;
                    update_statblock();
                }
            }
        }
Exemplo n.º 2
0
 private void Browser_Navigating(object sender, WebBrowserNavigatingEventArgs e)
 {
     if (e.Url.Scheme == "build")
     {
         if (e.Url.LocalPath == "profile")
         {
             e.Cancel = true;
             TrapProfileForm trapProfileForm = new TrapProfileForm(this.fTrap);
             if (trapProfileForm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
             {
                 this.fTrap.Name       = trapProfileForm.Trap.Name;
                 this.fTrap.Type       = trapProfileForm.Trap.Type;
                 this.fTrap.Level      = trapProfileForm.Trap.Level;
                 this.fTrap.Role       = trapProfileForm.Trap.Role;
                 this.fTrap.Initiative = trapProfileForm.Trap.Initiative;
                 this.update_statblock();
             }
         }
         if (e.Url.LocalPath == "readaloud")
         {
             e.Cancel = true;
             DetailsForm detailsForm = new DetailsForm(this.fTrap.ReadAloud, "Read-Aloud Text", null);
             if (detailsForm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
             {
                 this.fTrap.ReadAloud = detailsForm.Details;
                 this.update_statblock();
             }
         }
         if (e.Url.LocalPath == "desc")
         {
             e.Cancel = true;
             DetailsForm detailsForm1 = new DetailsForm(this.fTrap.Description, "Description", null);
             if (detailsForm1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
             {
                 this.fTrap.Description = detailsForm1.Details;
                 this.update_statblock();
             }
         }
         if (e.Url.LocalPath == "details")
         {
             e.Cancel = true;
             DetailsForm detailsForm2 = new DetailsForm(this.fTrap.Details, "Details", null);
             if (detailsForm2.ShowDialog() == System.Windows.Forms.DialogResult.OK)
             {
                 this.fTrap.Details = detailsForm2.Details;
                 this.update_statblock();
             }
         }
         if (e.Url.LocalPath == "addskill")
         {
             e.Cancel = true;
             TrapSkillData trapSkillDatum = new TrapSkillData()
             {
                 SkillName = "Perception",
                 DC        = AI.GetSkillDC(Difficulty.Moderate, this.fTrap.Level)
             };
             TrapSkillForm trapSkillForm = new TrapSkillForm(trapSkillDatum, this.fTrap.Level);
             if (trapSkillForm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
             {
                 this.fTrap.Skills.Add(trapSkillForm.SkillData);
                 this.update_statblock();
             }
         }
         if (e.Url.LocalPath == "addattack")
         {
             e.Cancel = true;
             TrapAttack trapAttack = new TrapAttack()
             {
                 Name = "Attack"
             };
             this.fTrap.Attacks.Add(trapAttack);
             this.update_statblock();
         }
         if (e.Url.LocalPath == "addcm")
         {
             e.Cancel = true;
             TrapCountermeasureForm trapCountermeasureForm = new TrapCountermeasureForm("", this.fTrap.Level);
             if (trapCountermeasureForm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
             {
                 this.fTrap.Countermeasures.Add(trapCountermeasureForm.Countermeasure);
                 this.update_statblock();
             }
         }
         if (e.Url.LocalPath == "trigger")
         {
             e.Cancel = true;
             DetailsForm detailsForm3 = new DetailsForm(this.fTrap.Trigger, "Trigger", null);
             if (detailsForm3.ShowDialog() == System.Windows.Forms.DialogResult.OK)
             {
                 this.fTrap.Trigger = detailsForm3.Details;
                 this.update_statblock();
             }
         }
     }
     if (e.Url.Scheme == "attackaction")
     {
         e.Cancel = true;
         Guid       guid = new Guid(e.Url.LocalPath);
         TrapAttack name = this.fTrap.FindAttack(guid);
         if (name != null)
         {
             TrapActionForm trapActionForm = new TrapActionForm(name);
             if (trapActionForm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
             {
                 name.Name   = trapActionForm.Attack.Name;
                 name.Action = trapActionForm.Attack.Action;
                 name.Range  = trapActionForm.Attack.Range;
                 name.Target = trapActionForm.Attack.Target;
                 this.update_statblock();
             }
         }
     }
     if (e.Url.Scheme == "attackremove")
     {
         e.Cancel = true;
         Guid       guid1       = new Guid(e.Url.LocalPath);
         TrapAttack trapAttack1 = this.fTrap.FindAttack(guid1);
         if (trapAttack1 != null)
         {
             this.fTrap.Attacks.Remove(trapAttack1);
             this.update_statblock();
         }
     }
     if (e.Url.Scheme == "attackattack")
     {
         e.Cancel = true;
         Guid       guid2  = new Guid(e.Url.LocalPath);
         TrapAttack attack = this.fTrap.FindAttack(guid2);
         if (attack != null)
         {
             PowerAttackForm powerAttackForm = new PowerAttackForm(attack.Attack, false, this.fTrap.Level, this.fTrap.Role);
             if (powerAttackForm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
             {
                 attack.Attack = powerAttackForm.Attack;
                 this.update_statblock();
             }
         }
     }
     if (e.Url.Scheme == "attackhit")
     {
         e.Cancel = true;
         Guid       guid3   = new Guid(e.Url.LocalPath);
         TrapAttack details = this.fTrap.FindAttack(guid3);
         if (details != null)
         {
             DetailsForm detailsForm4 = new DetailsForm(details.OnHit, "On Hit", null);
             if (detailsForm4.ShowDialog() == System.Windows.Forms.DialogResult.OK)
             {
                 details.OnHit = detailsForm4.Details;
                 this.update_statblock();
             }
         }
     }
     if (e.Url.Scheme == "attackmiss")
     {
         e.Cancel = true;
         Guid       guid4    = new Guid(e.Url.LocalPath);
         TrapAttack details1 = this.fTrap.FindAttack(guid4);
         if (details1 != null)
         {
             DetailsForm detailsForm5 = new DetailsForm(details1.OnMiss, "On Miss", null);
             if (detailsForm5.ShowDialog() == System.Windows.Forms.DialogResult.OK)
             {
                 details1.OnMiss = detailsForm5.Details;
                 this.update_statblock();
             }
         }
     }
     if (e.Url.Scheme == "attackeffect")
     {
         e.Cancel = true;
         Guid       guid5    = new Guid(e.Url.LocalPath);
         TrapAttack details2 = this.fTrap.FindAttack(guid5);
         if (details2 != null)
         {
             DetailsForm detailsForm6 = new DetailsForm(details2.Effect, "Effect", null);
             if (detailsForm6.ShowDialog() == System.Windows.Forms.DialogResult.OK)
             {
                 details2.Effect = detailsForm6.Details;
                 this.update_statblock();
             }
         }
     }
     if (e.Url.Scheme == "attacknotes")
     {
         e.Cancel = true;
         Guid       guid6       = new Guid(e.Url.LocalPath);
         TrapAttack trapAttack2 = this.fTrap.FindAttack(guid6);
         if (trapAttack2 != null)
         {
             DetailsForm detailsForm7 = new DetailsForm(trapAttack2.Notes, "Notes", null);
             if (detailsForm7.ShowDialog() == System.Windows.Forms.DialogResult.OK)
             {
                 trapAttack2.Notes = detailsForm7.Details;
                 this.update_statblock();
             }
         }
     }
     if (e.Url.Scheme == "skill")
     {
         e.Cancel = true;
         Guid          guid7           = new Guid(e.Url.LocalPath);
         TrapSkillData trapSkillDatum1 = this.fTrap.FindSkill(guid7);
         if (trapSkillDatum1 != null)
         {
             int           skillData      = this.fTrap.Skills.IndexOf(trapSkillDatum1);
             TrapSkillForm trapSkillForm1 = new TrapSkillForm(trapSkillDatum1, this.fTrap.Level);
             if (trapSkillForm1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
             {
                 this.fTrap.Skills[skillData] = trapSkillForm1.SkillData;
                 this.update_statblock();
             }
         }
     }
     if (e.Url.Scheme == "skillremove")
     {
         e.Cancel = true;
         Guid          guid8           = new Guid(e.Url.LocalPath);
         TrapSkillData trapSkillDatum2 = this.fTrap.FindSkill(guid8);
         if (trapSkillDatum2 != null)
         {
             this.fTrap.Skills.Remove(trapSkillDatum2);
             this.update_statblock();
         }
     }
     if (e.Url.Scheme == "cm")
     {
         e.Cancel = true;
         int    countermeasure = int.Parse(e.Url.LocalPath);
         string item           = this.fTrap.Countermeasures[countermeasure];
         TrapCountermeasureForm trapCountermeasureForm1 = new TrapCountermeasureForm(item, this.fTrap.Level);
         if (trapCountermeasureForm1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
         {
             this.fTrap.Countermeasures[countermeasure] = trapCountermeasureForm1.Countermeasure;
             this.update_statblock();
         }
     }
 }