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(); } } }