Example #1
0
        private void AddWeapon(WeaponData data)
        {
            if (FormDetails.itemDataManager.WeaponData.ContainsKey(data.name))
            {
                DialogResult result = MessageBox.Show(data.name + "already exists. Overwrite it?",
                                                      "Existing Weapon", MessageBoxButtons.YesNo);

                if (result == DialogResult.No)
                {
                    return;
                }

                itemDataManager.WeaponData[data.name] = data;
                FillListBox();
                return;
            }

            itemDataManager.WeaponData.Add(data.name, data);
            lbDetails.Items.Add(data);
        }
Example #2
0
 void btnCancel_Click(object sender, EventArgs e)
 {
     weapon = null;
     this.FormClosing -= FormWeaponDetails_FormClosing;
     this.Close();
 }
Example #3
0
        void btnOK_Click(object sender, EventArgs e)
        {
            int price = 0, attVal = 0, attMod = 0, damVal = 0, damMod = 0;
            float weight = 0f;

            if (string.IsNullOrEmpty(tbName.Text))
            {
                MessageBox.Show("You must enter a name for the item");
                return;
            }

            if (!int.TryParse(mtbPrice.Text, out price))
            {
                MessageBox.Show("Price must be a value greater than '1'");
                return;
            }

            weight = (float)nudWeight.Value;

            if (!int.TryParse(mtbAttackVal.Text, out attVal))
            {
                MessageBox.Show("Attack Value must be greater than '1'");
                return;
            }

            if (!int.TryParse(mtbAttackMod.Text, out attMod))
            {
                MessageBox.Show("Attack Modifier must be greater than '1'");
                return;
            }

            if (!int.TryParse(mtbDamageVal.Text, out damVal))
            {
                MessageBox.Show("Damage Value must be greater than '1'");
                return;
            }

            if (!int.TryParse(mtbDamageMod.Text, out damMod))
            {
                MessageBox.Show("Damage Modifier must be greater than '1'");
                return;
            }

            List<string> allowedClasses = new List<string>();

            foreach (object o in lbSelectedClasses.Items)
            {
                allowedClasses.Add(o.ToString());
            }

            weapon = new WeaponData();
            weapon.name = tbName.Text;
            weapon.type = tbType.Text;
            weapon.price = price;
            weapon.weight = weight;
            weapon.attackValue = attVal;
            weapon.attackModifier = attMod;
            weapon.damageValue = damVal;
            weapon.damageModifier = damMod;
            weapon.allowableClasses = allowedClasses.ToArray();

            this.FormClosing -= new FormClosingEventHandler(Form_Close);
            this.Close();
        }
Example #4
0
        void btnOK_Click(object sender, EventArgs e)
        {
            int price = 0;
            float weight = 0f;
            int attVal = 0;
            int attMod = 0;
            int damMod = 0;

            if (string.IsNullOrEmpty(tbName.Text))
            {
                MessageBox.Show("You must enter a name for the item.");
                return;
            }

            if (!int.TryParse(mtbPrice.Text, out price))
            {
                MessageBox.Show("Price must be an integer value.");
                return;
            }

            weight = (float)nudWeight.Value;

            if (!int.TryParse(mtbAttackValue.Text, out attVal))
            {
                MessageBox.Show("Attack value must be an interger value.");
                return;
            }

            if (!int.TryParse(mtbAttackModifier.Text, out attMod))
            {
                MessageBox.Show("Attack modifier must be an interger value.");
                return;
            }

            if (!int.TryParse(mtbDamageModifier.Text, out damMod))
            {
                MessageBox.Show("Damage modifier must be an integer value.");
                return;
            }

            List<string> allowedClasses = new List<string>();

            foreach (object o in lbAllowedClasses.Items)
                allowedClasses.Add(o.ToString());

            weapon = new WeaponData();

            weapon.Name = tbName.Text;
            weapon.Type = tbType.Text;
            weapon.Price = price;
            weapon.Weight = weight;
            weapon.NumberHands = (Hands)cboHands.SelectedIndex;
            weapon.AttackValue = attVal;
            weapon.AttackModifier = attMod;
            weapon.AllowableClasses = allowedClasses.ToArray();

            weapon.DamageEffectData.Name = tbName.Text;
            weapon.DamageEffectData.AttackType = RpgLibrary.EffectClasses.AttackType.Health;
            weapon.DamageEffectData.DamageType = RpgLibrary.EffectClasses.DamageType.Weapon;

            weapon.DamageEffectData.DieType = (DieType)Enum.Parse(
                typeof(DieType), 
                cboDieType.Items[cboDieType.SelectedIndex].ToString());

            weapon.DamageEffectData.NumberOfDice = (int)nudDice.Value;
            weapon.DamageEffectData.Modifier = damMod;

            this.FormClosing -= FormWeaponDetails_FormClosing;
            this.Close();
        }
Example #5
0
 void btnCancel_Click(object sender, EventArgs e)
 {
     weapon = null;
     this.FormClosing -= new FormClosingEventHandler(Form_Close);
     this.Close();
 }