//Constructor for the character Inventory public CharacterInventory() { _itemList[0] = new AttackItem("Knife", 7, 5, 1, "Nothing is as light weight as a knife, allowing for quick and precise strikes"); _itemList[1] = new DefenseItem("Steel Helm", 30, 75, 2, "It would be wise to not leave the head unprotected. This works...I guess."); _itemList[2] = new DefenseItem("Steel Shield", 25, 60, 2, "A good steel shield for a good strong mercenary"); _itemList[3] = new DefenseItem("Obsidian Shield", 80, 300, 2, "Everyone knows the heat of Mt. Ranja's lava cannot be cooled, but somehow, some ancient creature possessed this capability and with it, allowed for such a shield to be made."); _itemList[4] = new AttackItem("Sword of Chaos", 85, 1500, 1, "This sword was forged in the blood of battle. As you take hold of it, it almost feels like it's taking hold of you."); }
public void LoadPlayer(string path) { if (File.Exists(path)) { StreamReader reader = File.OpenText(path); GetInventory().InventoryLength = Convert.ToInt32(reader.ReadLine()); GetName = reader.ReadLine(); Item[] newList = new Item[GetInventory().InventoryLength]; int itemID; for (int i = 0; i < GetInventory().InventoryLength; i++) { itemID = Convert.ToInt32(reader.ReadLine()); //If Attack item if (itemID == 1) { AttackItem attackItem = new AttackItem(reader.ReadLine(), //Item Name Convert.ToInt32(reader.ReadLine()), //Item damage Convert.ToInt32(reader.ReadLine()), //Item value itemID, //Item ID reader.ReadLine()); //item Description GetInventory().GetItemList[i] = attackItem; } //If Defense item else if (itemID == 2) { DefenseItem defenseItem = new DefenseItem(reader.ReadLine(), //Item Name Convert.ToInt32(reader.ReadLine()), //Item defense Convert.ToInt32(reader.ReadLine()), //Item value itemID, //Item ID reader.ReadLine()); //item Description GetInventory().GetItemList[i] = defenseItem; } //If consumable item else if (itemID == 3) { Consumables consumables = new Consumables(reader.ReadLine(), //Item Name Convert.ToInt32(reader.ReadLine()), //Item healing Convert.ToInt32(reader.ReadLine()), //Item value itemID, //Item ID reader.ReadLine()); //item Description GetInventory().GetItemList[i] = consumables; } } GetInventory().Gold = Convert.ToInt32(reader.ReadLine()); reader.Close(); } }
//Constructor for the shop's inventory public ShopInventory() { _itemList[0] = new DefenseItem("Rags", 0, 1, 2, "Used to lcean yourself up."); _itemList[1] = new DefenseItem("Leather Armor", 20, 45, 2, "Standard training gear."); _itemList[2] = new DefenseItem("Wooden Shield", 5, 10, 2, "Standard trainging gear."); _itemList[3] = new AttackItem("Long Sword", 16, 55, 1, "For the more adept warrior."); _itemList[4] = new DefenseItem("Gloves", 0, 5, 2, "It's chilly outside."); _itemList[5] = new DefenseItem("Leather Boots", 10, 25, 2, "Standard training gear."); _itemList[6] = new Consumables("Brownies", 15, 3, 3, "Warm and fluffy. Just like mother used to make them."); _itemList[7] = new Consumables("God's Chosen Chicken Sandwich", 777, 10, 3, "This chicken has been embued with the power on high and brings new life to you."); }