Пример #1
0
        static public void UpgradeItem(CharacterClass character) // Done
        {
            string upgradeChoice      = "";
            int    shieldCraftingCost = 0;
            int    weaponCraftingCost = 0;

            do
            {
                Console.Clear();
                Console.ForegroundColor = ConsoleColor.Cyan;
                Weapon currentWeapon = character.UserInventory.OfType <Weapon>().FirstOrDefault(w => w.Equipped == true);
                Shield currentShield = character.UserInventory.OfType <Shield>().FirstOrDefault(w => w.Equipped == true);

                Console.WriteLine("Anything you want to upgrade? \nCurrently wearing these Items: ");
                Console.WriteLine("----------------------------------------");
                if (currentWeapon != null)
                {
                    weaponCraftingCost = (int)currentWeapon.ItemQuality * 100;
                    Console.WriteLine($"1. {currentWeapon.ItemQuality} {currentWeapon.TypeOfWeapon} Dmg: ({currentWeapon.DmgLowerBound} - {currentWeapon.DmgUpperBound})");
                    Console.WriteLine($"   Upgrade Cost Gold: {weaponCraftingCost} Material: {weaponCraftingCost}");
                }
                if (currentShield != null)
                {
                    shieldCraftingCost = (int)currentShield.ItemQuality * 100;
                    Console.WriteLine($"2. {currentShield.ItemQuality} {currentShield.ShieldName} Armour: {currentShield.ArmourAmount}");
                    Console.WriteLine($"   Upgrade Cost Gold: {shieldCraftingCost} Material: {shieldCraftingCost}");
                }
                Console.WriteLine("----------------------------------------");
                Console.WriteLine("3. Dont want to upgrade.. Anything");
                Console.WriteLine("----------------------------------------");
                character.PrintInfoForShop();
                upgradeChoice = Console.ReadLine();

                switch (upgradeChoice)
                {
                case "1":
                    UpgradeWeapon(character, currentWeapon, weaponCraftingCost);
                    break;

                case "2":
                    UpgradeShield(character, currentShield, shieldCraftingCost);
                    break;

                case "3":
                    Console.WriteLine("(BlackSmith) -Okey i have others that want help, what do you want!!!");
                    Console.ReadKey();
                    break;

                default:
                    Console.WriteLine("Again with this???");
                    break;
                }
            } while (upgradeChoice != "3");
        }
Пример #2
0
        public void BuyDefensive(CharacterClass character) // Done
        {
            string buyDef = "y";
            int    whatShieldID;

            do
            {
                Console.Clear();

                Console.WriteLine("This is what i have for you..");
                Console.WriteLine("--------------------------------------------------------------------");
                Console.WriteLine("                        Shield Inventory");
                Console.WriteLine("--------------------------------------------------------------------");
                for (int i = 0; i < StoreShieldInventory.Count; i++)
                {
                    Console.WriteLine($"Id:{i + 1}. {StoreShieldInventory[i].ItemQuality} {StoreShieldInventory[i].ShieldName}".PadRight(30) +
                                      $"Armour ({StoreShieldInventory[i].ArmourAmount})".PadRight(16) + $"Rating {StoreShieldInventory[i].BlockRating}  " + $"Price: {StoreShieldInventory[i].Price}");
                }
                Console.WriteLine("");
                Console.WriteLine("0. Not Interested");
                Console.WriteLine("--------------------------------------------------------------------");
                character.PrintInfoForShop();

                Shield currentShield = character.UserInventory.OfType <Shield>().FirstOrDefault(w => w.Equipped == true);

                if (currentShield != null)
                {
                    Console.WriteLine("Equipped Shield");
                    Console.WriteLine($"{currentShield.ItemQuality} {currentShield.ShieldName} Armour: {currentShield.ArmourAmount} Rating: {currentShield.BlockRating}");
                    Console.WriteLine("---------------------------------------------------------");
                }

                Console.WriteLine("What ID number would you like to purchase?");
                if (int.TryParse(Console.ReadLine(), out whatShieldID))
                {
                    if (whatShieldID <= StoreShieldInventory.Count && whatShieldID > 0)
                    {
                        if (character.Gold > StoreShieldInventory[whatShieldID - 1].Price)
                        {
                            var p1 = new System.Windows.Media.MediaPlayer();
                            p1.Open(new System.Uri(Environment.CurrentDirectory + @"\cash.wav"));
                            p1.Play();
                            Console.WriteLine("Congratulations you have bought a new Item");
                            Console.WriteLine($"{StoreShieldInventory[whatShieldID - 1].Price} gold has been removed..");
                            character.AddShieldToInventory(StoreShieldInventory[whatShieldID - 1]);
                            character.Gold -= StoreShieldInventory[whatShieldID - 1].Price;
                            buyDef          = "n";
                            StoreShieldInventory.RemoveAt(whatShieldID - 1);
                        }
                        else
                        {
                            Console.WriteLine("You cannot afford this.. Maybe start out with something smaller?");
                            Console.ReadKey();
                        }
                    }
                    else if (whatShieldID == 0)
                    {
                        Console.WriteLine("Im getting really tiered of this..");
                        buyDef = "n";
                        Console.ReadKey();
                    }
                    else
                    {
                        Console.WriteLine($"Please try a number between 1-{StoreWeaponInventory.Count} Or 0 to exit..");
                        Console.ReadKey();
                    }
                }
                else
                {
                    Console.WriteLine($"I didnt understand that, Please try a number between 1-{StoreWeaponInventory.Count} Or 0 to exit..");
                    Console.ReadKey();
                }
            } while (buyDef != "n");
        }
Пример #3
0
        static public void VendorMenu(CharacterClass character, Vendor vendor)
        {
            string answer = "";

            if (character.Charisma > 5)
            {
                do
                {
                    Console.ForegroundColor = ConsoleColor.DarkYellow;
                    Console.Clear();
                    Console.WriteLine("**********************************************************");
                    Console.WriteLine("                       Vendor ");
                    Console.WriteLine("**********************************************************");
                    Console.WriteLine($"- How may i help you {character.Name}?\n");
                    Console.WriteLine("----------------------------------------------------------");
                    Console.WriteLine("(Answer) ");
                    Console.WriteLine("1. I have items to sell.");
                    Console.WriteLine("2. I would like to buy Weapons.");
                    Console.WriteLine("3. I would like to buy Shields.");
                    Console.WriteLine("4. I would like to buy a Potion (150 gold).");
                    Console.WriteLine();
                    Console.WriteLine("5. Bye... (Go back to city menu).");
                    character.PrintInfoForShop();
                    answer = Console.ReadLine();
                    switch (answer)
                    {
                    case "1":
                        vendor.SellItems(character);     // fix this menu
                        break;

                    case "2":
                        vendor.BuyWeapons(character);
                        break;

                    case "3":
                        vendor.BuyDefensive(character);
                        break;

                    case "4":
                        vendor.BuyPotion(character);
                        break;

                    case "5":
                        Console.WriteLine("Hope to see you soon..");
                        Console.ReadKey();
                        Console.Clear();
                        break;

                    default:
                        Console.WriteLine("Please try again I didnt understand..");
                        Console.ReadKey();
                        Console.Clear();
                        break;
                    }
                } while (answer != "5");
            }
            else
            {
                Console.WriteLine("Im sorry just get out of here, i cant look at you even..");
            }
            Console.ForegroundColor = ConsoleColor.White;
        }
Пример #4
0
        public void BuyWeapons(CharacterClass character) // Done
        {
            string buyWep = "y";
            int    whatWeaponID;

            do
            {
                Console.Clear();
                Console.ForegroundColor = ConsoleColor.DarkYellow;

                Console.WriteLine("This is what i have for you..");
                Console.WriteLine("---------------------------------------------------------");
                Console.WriteLine("                 Weapons Inventory");
                Console.WriteLine("---------------------------------------------------------");
                for (int i = 0; i < StoreWeaponInventory.Count; i++)
                {
                    Console.WriteLine($"Id:{i + 1}. {StoreWeaponInventory[i].ItemQuality} {StoreWeaponInventory[i].TypeOfWeapon}".PadRight(25) +
                                      $"Dmg ({StoreWeaponInventory[i].DmgLowerBound} - {StoreWeaponInventory[i].DmgUpperBound})".PadRight(16) + $"Price: {StoreWeaponInventory[i].Price}");
                }
                Console.WriteLine("");
                Console.WriteLine("0. Not Interested");
                Console.WriteLine("---------------------------------------------------------");
                character.PrintInfoForShop();

                Weapon currentWeapon = character.UserInventory.OfType <Weapon>().FirstOrDefault(w => w.Equipped == true);


                if (currentWeapon != null)
                {
                    Console.WriteLine("Equipped Weapon");
                    Console.WriteLine($"{currentWeapon.ItemQuality} {currentWeapon.TypeOfWeapon} Dmg: ({currentWeapon.DmgLowerBound} - {currentWeapon.DmgUpperBound})");
                    Console.WriteLine("---------------------------------------------------------");
                }

                Console.WriteLine("What ID number would you like to purchase?");
                if (int.TryParse(Console.ReadLine(), out whatWeaponID))
                {
                    if (whatWeaponID <= StoreWeaponInventory.Count && whatWeaponID > 0)
                    {
                        if (character.Gold >= StoreWeaponInventory[whatWeaponID - 1].Price)
                        {
                            if (character.Charisma >= 10)
                            {
                                Console.WriteLine("(Vendor) -You know what I like you, i will give it to you for half price.. ");
                                Console.WriteLine("Dont tell anyone..");
                                character.Gold -= StoreWeaponInventory[whatWeaponID - 1].Price / 2;
                                Console.WriteLine($"{StoreWeaponInventory[whatWeaponID - 1].Price / 2} gold has been removed..");
                            }
                            else
                            {
                                character.Gold -= StoreWeaponInventory[whatWeaponID - 1].Price;
                                Console.WriteLine($"{StoreWeaponInventory[whatWeaponID - 1].Price} has been removed..");
                            }
                            var p1 = new System.Windows.Media.MediaPlayer();
                            p1.Open(new System.Uri(Environment.CurrentDirectory + @"\cash.wav"));
                            p1.Play();
                            Console.WriteLine("Congratulations you have bought a new Item");
                            character.AddWeaponToInventory(StoreWeaponInventory[whatWeaponID - 1]);
                            buyWep = "n";
                            StoreWeaponInventory.RemoveAt(whatWeaponID - 1);
                        }
                        else
                        {
                            Console.WriteLine("You cannot afford this.. Maybe start out with something smaller?");
                            Console.ReadKey();
                        }
                    }
                    else if (whatWeaponID == 0)
                    {
                        Console.WriteLine("Okeeeeey So what are you doing in here?????");
                        Console.ReadKey();
                        buyWep = "n";
                    }
                    else
                    {
                        Console.WriteLine($"Please try a number between 1-{StoreWeaponInventory.Count}, or 0 to exit..");
                        Console.ReadKey();
                    }
                }
                else
                {
                    Console.WriteLine($"I didnt understand that, Please try a number between 1-{StoreWeaponInventory.Count}, or 0 to exit..");
                    Console.ReadKey();
                }
            } while (buyWep != "n");
        }