Exemplo n.º 1
0
        private void ActionBtn_Click(object sender, EventArgs e)
        {
            PowerAction     action          = this.fPower.Action ?? new PowerAction();
            PowerActionForm powerActionForm = new PowerActionForm(action);

            if (powerActionForm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                this.fPower.Action = powerActionForm.Action;
                this.update_action();
                this.update_advice();
            }
        }
Exemplo n.º 2
0
        private void ActionBtn_Click(object sender, EventArgs e)
        {
            PowerAction pa = fPower.Action;

            if (pa == null)
            {
                pa = new PowerAction();
            }

            PowerActionForm dlg = new PowerActionForm(pa);

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                fPower.Action = dlg.Action;
                update_action();
                update_advice();
            }
        }
Exemplo n.º 3
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
                {
                }
            }
        }
Exemplo n.º 4
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
                }
            }
        }