public bool SellWithSilver(AdvancedPlayer _player, int shopIndex, int playerIndex) { //Find the item to buy in the inventory array Items itemToBuy = _shopInventory[shopIndex]; //Check to see if the player ourchased the item successfully. if (_player.BuyWithSilver(itemToBuy, playerIndex)) { //Increase shops gold by item cost to complete the transaction _gold += itemToBuy.itemPrice; return(true); } return(false); }
//this allows you to either create a new character or load one public void OpenMenu() { char input; GetInput(out input, "Create new character", "Load Character", "What do you wish to do?"); if (input == '2') { _player = new AdvancedPlayer(); Load(); } else { _player = CreateCharacter(); Save(); } }
//this creates a new player public AdvancedPlayer CreateCharacter() { Console.Clear(); //this is you choosing which role you want Console.WriteLine("1. Wizard"); Console.WriteLine("2. Knight"); Console.WriteLine("3. Hero"); Console.WriteLine("4. Monk"); Console.WriteLine("5. Ranger"); Console.WriteLine("6. Bard"); Console.WriteLine("Choose your role!"); char input = Console.ReadKey().KeyChar; //float healthVal, float damageVal, string nameVal, int levelVal, int manaVal, int charismaVal, int karmaVal, int luckVal, int stealthVal, string roleVal switch (input) { case '1': { Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("\nWhat is your name?"); string name = Console.ReadLine(); AdvancedPlayer _player = new AdvancedPlayer(80.0f, 25.0f, name, 0, 100, 2, 0, 1, 0, "Wizard", 3, 10); Console.ForegroundColor = ConsoleColor.White; return(_player); } case '2': { Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("\nWhat is your name?"); string name = Console.ReadLine(); AdvancedPlayer _player = new AdvancedPlayer(100.0f, 30.0f, name, 0, 50, 3, 0, 2, 0, "Knight", 3, 10); Console.ForegroundColor = ConsoleColor.White; return(_player); } case '3': { Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("\nWhat is your name?"); string name = Console.ReadLine(); AdvancedPlayer _player = new AdvancedPlayer(150.0f, 40.0f, name, 0, 80, 2, 0, 2, 1, "Hero", 3, 10); Console.ForegroundColor = ConsoleColor.White; return(_player); } case '4': { Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("\nWhat is your name?"); string name = Console.ReadLine(); AdvancedPlayer _player = new AdvancedPlayer(200.0f, 40.0f, name, 0, 0, 3, 0, 3, 0, "Monk", 3, 10); Console.ForegroundColor = ConsoleColor.White; return(_player); } case '5': { Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("\nWhat is your name?"); string name = Console.ReadLine(); AdvancedPlayer _player = new AdvancedPlayer(80.0f, 25.0f, name, 0, 50, 1, 0, 2, 5, "Ranger", 3, 10); Console.ForegroundColor = ConsoleColor.White; return(_player); } case '6': { Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("\nWhat is your name?"); string name = Console.ReadLine(); AdvancedPlayer _player = new AdvancedPlayer(100.0f, 30.0f, name, 0, 120, 8, 0, 4, 2, "Bard", 3, 10); Console.ForegroundColor = ConsoleColor.White; return(_player); } default: { Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("\nWhat is your name?"); string name = Console.ReadLine(); AdvancedPlayer _player = new AdvancedPlayer(150.0f, 40.0f, name, 0, 80, 2, 0, 2, 1, "Hero", 3, 10); Console.ForegroundColor = ConsoleColor.White; return(_player); } } }