Ejemplo n.º 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();
                }
            }
        }
Ejemplo n.º 3
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();
            }
        }
Ejemplo n.º 4
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();
                }
            }
        }
Ejemplo n.º 5
0
        private void Browser_Navigating(object sender, WebBrowserNavigatingEventArgs e)
        {
            IRole role;

            if (e.Url.Scheme == "power")
            {
                if (e.Url.LocalPath == "info")
                {
                    e.Cancel = true;
                    PowerInfoForm powerInfoForm = new PowerInfoForm(this.fPower);
                    if (powerInfoForm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        this.fPower.Name     = powerInfoForm.PowerName;
                        this.fPower.Keywords = powerInfoForm.PowerKeywords;
                        this.update_statblock();
                    }
                }
                if (e.Url.LocalPath == "action")
                {
                    e.Cancel = true;
                    PowerActionForm powerActionForm = new PowerActionForm(this.fPower.Action);
                    if (powerActionForm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        this.fPower.Action = powerActionForm.Action;
                        this.refresh_examples();
                        this.update_statblock();
                    }
                }
                if (e.Url.LocalPath == "prerequisite")
                {
                    e.Cancel = true;
                    DetailsForm detailsForm = new DetailsForm(this.fPower.Condition, "Power Prerequisite", null);
                    if (detailsForm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        this.fPower.Condition = detailsForm.Details;
                        this.update_statblock();
                    }
                }
                if (e.Url.LocalPath == "range")
                {
                    e.Cancel = true;
                    PowerRangeForm powerRangeForm = new PowerRangeForm(this.fPower);
                    if (powerRangeForm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        this.fPower.Range = powerRangeForm.PowerRange;
                        this.update_statblock();
                    }
                }
                if (e.Url.LocalPath == "attack")
                {
                    e.Cancel = true;
                    PowerAttack attack = this.fPower.Attack ?? new PowerAttack();
                    int         num    = (this.fCreature != null ? this.fCreature.Level : 0);
                    if (this.fCreature != null)
                    {
                        role = this.fCreature.Role;
                    }
                    else
                    {
                        role = null;
                    }
                    PowerAttackForm powerAttackForm = new PowerAttackForm(attack, this.fFromFunctionalTemplate, num, role);
                    if (powerAttackForm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        this.fPower.Attack = powerAttackForm.Attack;
                        this.refresh_examples();
                        this.update_statblock();
                    }
                }
                if (e.Url.LocalPath == "clearattack")
                {
                    e.Cancel           = true;
                    this.fPower.Attack = null;
                    this.refresh_examples();
                    this.update_statblock();
                }
                if (e.Url.LocalPath == "details")
                {
                    e.Cancel = true;
                    PowerDetailsForm powerDetailsForm = new PowerDetailsForm(this.fPower.Details, this.fCreature);
                    if (powerDetailsForm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        this.fPower.Details = powerDetailsForm.Details;
                        this.update_statblock();
                    }
                }
                if (e.Url.LocalPath == "desc")
                {
                    e.Cancel = true;
                    DetailsForm detailsForm1 = new DetailsForm(this.fPower.Description, "Power Description", null);
                    if (detailsForm1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        this.fPower.Description = detailsForm1.Details;
                        this.update_statblock();
                    }
                }
            }
            if (e.Url.Scheme == "details")
            {
                if (e.Url.LocalPath == "refresh")
                {
                    e.Cancel = true;
                    this.refresh_examples();
                    this.update_statblock();
                }
                try
                {
                    int num1 = int.Parse(e.Url.LocalPath);
                    e.Cancel            = true;
                    this.fPower.Details = this.fExamples[num1];
                    this.fExamples.RemoveAt(num1);
                    if (this.fExamples.Count == 0)
                    {
                        this.refresh_examples();
                    }
                    this.update_statblock();
                }
                catch
                {
                }
            }
        }
Ejemplo n.º 6
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
                }
            }
        }
Ejemplo n.º 7
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();
         }
     }
 }
Ejemplo n.º 8
0
        private void Browser_Navigating(object sender, WebBrowserNavigatingEventArgs e)
        {
            if (e.Url.Scheme == "power")
            {
                if (e.Url.LocalPath == "info")
                {
                    e.Cancel = true;

                    PowerInfoForm dlg = new PowerInfoForm(fPower);
                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        fPower.Name     = dlg.PowerName;
                        fPower.Keywords = dlg.PowerKeywords;

                        update_statblock();
                    }
                }

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

                    PowerAction     action = fPower.Action;
                    PowerActionForm dlg    = new PowerActionForm(action);
                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        fPower.Action = dlg.Action;

                        refresh_examples();
                        update_statblock();
                    }
                }

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

                    DetailsForm dlg = new DetailsForm(fPower.Condition, "Power Prerequisite", null);
                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        fPower.Condition = dlg.Details;
                        update_statblock();
                    }
                }

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

                    PowerRangeForm dlg = new PowerRangeForm(fPower);
                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        fPower.Range = dlg.PowerRange;
                        update_statblock();
                    }
                }

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

                    PowerAttack attack = fPower.Attack;
                    if (attack == null)
                    {
                        attack = new PowerAttack();
                    }

                    int             level = (fCreature != null) ? fCreature.Level : 0;
                    IRole           role  = (fCreature != null) ? fCreature.Role : null;
                    PowerAttackForm dlg   = new PowerAttackForm(attack, fFromFunctionalTemplate, level, role);
                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        fPower.Attack = dlg.Attack;

                        refresh_examples();
                        update_statblock();
                    }
                }

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

                    fPower.Attack = null;

                    refresh_examples();
                    update_statblock();
                }

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

                    PowerDetailsForm dlg = new PowerDetailsForm(fPower.Details, fCreature);
                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        fPower.Details = dlg.Details;
                        update_statblock();
                    }
                }

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

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

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

                    refresh_examples();
                    update_statblock();
                }

                try
                {
                    int index = int.Parse(e.Url.LocalPath);
                    e.Cancel = true;

                    fPower.Details = fExamples[index];
                    fExamples.RemoveAt(index);

                    if (fExamples.Count == 0)
                    {
                        refresh_examples();
                    }

                    update_statblock();
                }
                catch
                {
                    // Not a number
                }
            }
        }
Ejemplo n.º 9
0
 private void Browser_Navigating(object sender, WebBrowserNavigatingEventArgs e)
 {
     if (e.Url.Scheme == "build")
     {
         if (e.Url.LocalPath == "profile")
         {
             e.Cancel = true;
             ArtifactProfileForm artifactProfileForm = new ArtifactProfileForm(this.fArtifact);
             if (artifactProfileForm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
             {
                 this.fArtifact.Name = artifactProfileForm.Artifact.Name;
                 this.fArtifact.Tier = artifactProfileForm.Artifact.Tier;
                 this.update_statblock();
             }
         }
         if (e.Url.LocalPath == "description")
         {
             e.Cancel = true;
             DetailsForm detailsForm = new DetailsForm(this.fArtifact.Description, "Description", null);
             if (detailsForm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
             {
                 this.fArtifact.Description = detailsForm.Details;
                 this.update_statblock();
             }
         }
         if (e.Url.LocalPath == "details")
         {
             e.Cancel = true;
             DetailsForm detailsForm1 = new DetailsForm(this.fArtifact.Details, "Details", null);
             if (detailsForm1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
             {
                 this.fArtifact.Details = detailsForm1.Details;
                 this.update_statblock();
             }
         }
         if (e.Url.LocalPath == "goals")
         {
             e.Cancel = true;
             DetailsForm detailsForm2 = new DetailsForm(this.fArtifact.Goals, "Goals", null);
             if (detailsForm2.ShowDialog() == System.Windows.Forms.DialogResult.OK)
             {
                 this.fArtifact.Goals = detailsForm2.Details;
                 this.update_statblock();
             }
         }
         if (e.Url.LocalPath == "rp")
         {
             e.Cancel = true;
             DetailsForm detailsForm3 = new DetailsForm(this.fArtifact.RoleplayingTips, "Roleplaying", null);
             if (detailsForm3.ShowDialog() == System.Windows.Forms.DialogResult.OK)
             {
                 this.fArtifact.RoleplayingTips = detailsForm3.Details;
                 this.update_statblock();
             }
         }
     }
     if (e.Url.Scheme == "section")
     {
         if (e.Url.LocalPath == "new")
         {
             e.Cancel = true;
             MagicItemSectionForm magicItemSectionForm = new MagicItemSectionForm(new MagicItemSection());
             if (magicItemSectionForm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
             {
                 this.fArtifact.Sections.Add(magicItemSectionForm.Section);
                 this.update_statblock();
             }
         }
         if (e.Url.LocalPath.Contains(",new"))
         {
             e.Cancel = true;
             try
             {
                 string str = e.Url.LocalPath.Substring(0, e.Url.LocalPath.IndexOf(","));
                 int    num = int.Parse(str);
                 ArtifactConcordance  item = this.fArtifact.ConcordanceLevels[num];
                 MagicItemSectionForm magicItemSectionForm1 = new MagicItemSectionForm(new MagicItemSection());
                 if (magicItemSectionForm1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                 {
                     item.Sections.Add(magicItemSectionForm1.Section);
                     this.update_statblock();
                 }
             }
             catch
             {
             }
         }
     }
     if (e.Url.Scheme == "sectionedit")
     {
         if (!e.Url.LocalPath.Contains(","))
         {
             e.Cancel = true;
             try
             {
                 int section = int.Parse(e.Url.LocalPath);
                 MagicItemSectionForm magicItemSectionForm2 = new MagicItemSectionForm(this.fArtifact.Sections[section]);
                 if (magicItemSectionForm2.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                 {
                     this.fArtifact.Sections[section] = magicItemSectionForm2.Section;
                     this.update_statblock();
                 }
             }
             catch
             {
             }
         }
         else
         {
             e.Cancel = true;
             int    num1 = e.Url.LocalPath.IndexOf(",");
             string str1 = e.Url.LocalPath.Substring(0, num1);
             string str2 = e.Url.LocalPath.Substring(num1);
             try
             {
                 int num2     = int.Parse(str1);
                 int section1 = int.Parse(str2);
                 ArtifactConcordance  artifactConcordance   = this.fArtifact.ConcordanceLevels[num2];
                 MagicItemSectionForm magicItemSectionForm3 = new MagicItemSectionForm(artifactConcordance.Sections[section1]);
                 if (magicItemSectionForm3.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                 {
                     artifactConcordance.Sections[section1] = magicItemSectionForm3.Section;
                     this.update_statblock();
                 }
             }
             catch
             {
             }
         }
     }
     if (e.Url.Scheme == "sectionremove")
     {
         if (!e.Url.LocalPath.Contains(","))
         {
             e.Cancel = true;
             try
             {
                 int num3 = int.Parse(e.Url.LocalPath);
                 this.fArtifact.Sections.RemoveAt(num3);
                 this.update_statblock();
             }
             catch
             {
             }
         }
         else
         {
             e.Cancel = true;
             int    num4 = e.Url.LocalPath.IndexOf(",");
             string str3 = e.Url.LocalPath.Substring(0, num4);
             string str4 = e.Url.LocalPath.Substring(num4);
             try
             {
                 int num5 = int.Parse(str3);
                 int num6 = int.Parse(str4);
                 this.fArtifact.ConcordanceLevels[num5].Sections.RemoveAt(num6);
                 this.update_statblock();
             }
             catch
             {
             }
         }
     }
     if (e.Url.Scheme == "rule")
     {
         e.Cancel = true;
         if (e.Url.LocalPath == "new")
         {
             ArtifactConcordanceForm artifactConcordanceForm = new ArtifactConcordanceForm(new Pair <string, string>("", ""));
             if (artifactConcordanceForm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
             {
                 this.fArtifact.ConcordanceRules.Add(artifactConcordanceForm.Concordance);
                 this.update_statblock();
             }
         }
     }
     if (e.Url.Scheme == "ruleedit")
     {
         e.Cancel = true;
         try
         {
             int concordance = int.Parse(e.Url.LocalPath);
             ArtifactConcordanceForm artifactConcordanceForm1 = new ArtifactConcordanceForm(this.fArtifact.ConcordanceRules[concordance]);
             if (artifactConcordanceForm1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
             {
                 this.fArtifact.ConcordanceRules[concordance] = artifactConcordanceForm1.Concordance;
                 this.update_statblock();
             }
         }
         catch
         {
         }
     }
     if (e.Url.Scheme == "ruleremove")
     {
         e.Cancel = true;
         try
         {
             int num7 = int.Parse(e.Url.LocalPath);
             this.fArtifact.ConcordanceRules.RemoveAt(num7);
             this.update_statblock();
         }
         catch
         {
         }
     }
     if (e.Url.Scheme == "quote")
     {
         e.Cancel = true;
         try
         {
             int num8 = int.Parse(e.Url.LocalPath);
             ArtifactConcordance details      = this.fArtifact.ConcordanceLevels[num8];
             DetailsForm         detailsForm4 = new DetailsForm(details.Quote, "Concordance Quote", null);
             if (detailsForm4.ShowDialog() == System.Windows.Forms.DialogResult.OK)
             {
                 details.Quote = detailsForm4.Details;
                 this.update_statblock();
             }
         }
         catch
         {
         }
     }
     if (e.Url.Scheme == "desc")
     {
         e.Cancel = true;
         try
         {
             int num9 = int.Parse(e.Url.LocalPath);
             ArtifactConcordance item1        = this.fArtifact.ConcordanceLevels[num9];
             DetailsForm         detailsForm5 = new DetailsForm(item1.Description, "Concordance Description", null);
             if (detailsForm5.ShowDialog() == System.Windows.Forms.DialogResult.OK)
             {
                 item1.Description = detailsForm5.Details;
                 this.update_statblock();
             }
         }
         catch
         {
         }
     }
 }
Ejemplo n.º 10
0
 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();
     }
 }