public void ModifyArmor(ArmorName newArmor) { currentArmor = pool.Pool[newArmor]; armorValue = currentArmor.armorValue; display.DisplayArmor(newArmor); display.DisplayDurability(armorValue); }
private void BuyArmor(List <Item> Armor) { string ArmorName; int Index = new int(); Console.Clear(); while (true) { Console.WriteLine("Which armor do you want to buy? (Type ENTER on empty armor to return)"); Console.WriteLine("Current gold: {0}\n", this.H.Gold); Console.Write("> {0} - Buying price: {1}\t", StringModify.FirstToUpper(Armor[0].Name), Armor[0].Type, Armor[0].Value); Console.Write("> {0} - Buying price: {1}\n", StringModify.FirstToUpper(Armor[1].Name), Armor[1].Value); for (int i = 2; i < Armor.Count; i += 2) { Console.Write("> {0} - Buying price: {1}\t\t", StringModify.FirstToUpper(Armor[i].Name), Armor[i].Value); Console.Write("> {0} - Buying price: {1}\n", StringModify.FirstToUpper(Armor[i + 1].Name), Armor[i + 1].Value); } ArmorName = Console.ReadLine(); ArmorName = ArmorName.ToLower(); if (ArmorName.Equals("")) { Console.Clear(); return; } Index = this.Find(Armor, ArmorName); Console.Clear(); if (Index < 0) { Console.WriteLine("Weapon not found\n"); } else { Item It = new Item(Armor[Index]); if (this.H.Gold < It.Value) { Console.WriteLine("Not enough gold\n"); } else { this.H.Gold -= It.Value; this.H.PickItem(It); Console.WriteLine("{0} bought\n", StringModify.FirstToUpper(It.Name)); } } } }
/// <summary> /// Saves the armor. /// </summary> /// <returns>Armor Object</returns> public Armor SaveArmor() { SqlDataReader result; DatabaseConnection dbconn = new DatabaseConnection(); SqlCommand command = new SqlCommand(); SqlConnection connection = new SqlConnection(dbconn.SQLSEVERConnString); try { connection.Open(); command.Connection = connection; command.CommandType = CommandType.StoredProcedure; command.CommandText = "InsertUpdate_Armor"; command.Parameters.Add(dbconn.GenerateParameterObj("@ArmorID", SqlDbType.Int, ArmorID.ToString(), 0)); command.Parameters.Add(dbconn.GenerateParameterObj("@ArmorTypeID", SqlDbType.Int, ArmorTypeID.ToString(), 0)); command.Parameters.Add(dbconn.GenerateParameterObj("@ArmorName", SqlDbType.VarChar, ArmorName.ToString(), 100)); command.Parameters.Add(dbconn.GenerateParameterObj("@ArmorDescription", SqlDbType.VarChar, ArmorDescription.ToString(), 1000)); command.Parameters.Add(dbconn.GenerateParameterObj("@ReflexAdjustment", SqlDbType.Int, ReflexAdjustment.ToString(), 0)); command.Parameters.Add(dbconn.GenerateParameterObj("@FortitudeAdjustment", SqlDbType.Int, FortitudeAdjustment.ToString(), 0)); command.Parameters.Add(dbconn.GenerateParameterObj("@ArmorProficiencyFeatID", SqlDbType.Int, ArmorProficiencyFeatID.ToString(), 0)); command.Parameters.Add(dbconn.GenerateParameterObj("@EmplacementPoints", SqlDbType.Int, EmplacementPoints.ToString(), 0)); command.Parameters.Add(dbconn.GenerateParameterObj("@Cost", SqlDbType.Int, Cost.ToString(), 0)); command.Parameters.Add(dbconn.GenerateParameterObj("@Weight", SqlDbType.Decimal, Weight.ToString(), 0)); command.Parameters.Add(dbconn.GenerateParameterObj("@MaxDefBonus", SqlDbType.Int, MaxDefBonus.ToString(), 0)); command.Parameters.Add(dbconn.GenerateParameterObj("@BookID", SqlDbType.Int, BookID.ToString(), 0)); result = command.ExecuteReader(); result.Read(); SetReaderToObject(ref result); } catch { Exception e = new Exception(); this._insertUpdateOK = false; this._insertUpdateMessage.Append(e.Message + " Inner Exception= " + e.InnerException); throw e; } finally { command.Dispose(); connection.Close(); } return(this); }
// public public Armor GetArmorNamed(ArmorName name) { return(armors.First(armor => armor.GetComponent <Armor>().armor_name == name).GetComponent <Armor>()); }
private void ArmorLootHandler(ArmorName obj) { ModifyArmor(obj); }
public void DisplayArmor(ArmorName newArmor) { armorName.text = newArmor.ToString(); }