private void displayItemInfo(Equipment s) { Item_Name.Text = s.Name; Item_Effects.Text = "Additional Information : " + s.Effects; Item_Value.Text = Money.GoldToCoins(s.Value); }
private Equipment createEquipment() { Equipment item; decimal value = 0m; int pp, gp, ep, sp, cp; decimal weight; if (!int.TryParse(item_pp.Text, out pp)) { pp = 0; } if (!int.TryParse(item_gp.Text, out gp)) { gp = 0; } if (!int.TryParse(item_ep.Text, out ep)) { ep = 0; } if (!int.TryParse(item_sp.Text, out sp)) { sp = 0; } if (!int.TryParse(item_cp.Text, out cp)) { cp = 0; } value += Money.PlatinumToGold(pp) + gp + Money.ElectrumToGold(ep) + Money.SilverToGold(sp) + Money.CopperToGold(cp); if(!decimal.TryParse(txt_ItemWeight.Text, out weight)) { weight = 0; } if (combo_ItemTypes.SelectedItem.ToString().ParseEnum<ItemTypes>() == ItemTypes.Armor) { int ac; if(!int.TryParse(txt_ArmorClass.Text,out ac)) { ac = 0; } item = new Armor(txt_ItemName.Text, combo_ArmorType.SelectedItem.ToString().ParseEnum<ArmorTypes>(), ac,value); } else if (combo_ItemTypes.SelectedItem.ToString().ParseEnum<ItemTypes>() == ItemTypes.Weapon) { string damage = txt_WeaponDamage.Text; int bonus = findBonus(damage); damage = removeBonus(damage); int numDice = Dice.ParseDiceNumber(damage); int diceType = Dice.ParseDiceType(damage); item = new Weapon(txt_ItemName.Text, combo_WeaponType.SelectedItem.ToString().ParseEnum<WeaponClasses>(), diceType,numDice,bonus,value); } else { item = new Equipment(txt_ItemName.Text, value); } item.Effects = txt_ItemEffects.Text; item.Weight = weight; return item; }