Esempio n. 1
0
        static void ShowStorage()
        {
            bool IsStorageClose = false;

            while (!IsStorageClose)
            {
                Console.Clear();
                Console.WriteLine($"[{CurrentAccount.Username} > {CurrentChar.Name} > Inventory > Storage]\n");
                ShowEquipStorage();
                ShowEquipBag();
                switch (ShowMenu("[Deposit]", "[Withdraw]", "[Back]"))
                {
                case '1':
                    Console.Clear();
                    Console.WriteLine($"[{CurrentAccount.Username} > {CurrentChar.Name} > Inventory > Storage > Deposit]\n");
                    ShowEquipStorage();
                    ShowEquipBag();
                    Console.Write("Enter item id: ");
                    int DepItemId;
                    int.TryParse(Console.ReadLine(), out DepItemId);
                    if (PRO.ItemDatabase.ContainsKey(DepItemId))
                    {
                        Item Transferable;
                        PRO.ItemDatabase.TryGetValue(DepItemId, out Transferable);
                        if (CurrentChar.Inventory.Contains(Transferable))
                        {
                            CurrentAccount.StorageDeposit(Transferable);
                            CurrentChar.InventoryItemOut(Transferable);
                        }
                        else
                        {
                            Console.WriteLine("You don't have that item.");
                            Console.ReadKey();
                        }
                    }
                    else
                    {
                        Console.WriteLine("Invalid item id.");
                        Console.ReadKey();
                    }
                    continue;

                case '2':
                    Console.Clear();
                    Console.WriteLine($"[{CurrentAccount.Username} > {CurrentChar.Name} > Inventory > Storage > Withdraw]\n");
                    ShowEquipStorage();
                    ShowEquipBag();
                    Console.Write("Enter item id: ");
                    int WthItemId;
                    int.TryParse(Console.ReadLine(), out WthItemId);
                    if (PRO.ItemDatabase.ContainsKey(WthItemId))
                    {
                        Item Transferable;
                        PRO.ItemDatabase.TryGetValue(WthItemId, out Transferable);
                        if (CurrentAccount.Storage.Contains(Transferable))
                        {
                            CurrentAccount.StorageWithdraw(Transferable);
                            CurrentChar.InventoryItemIn(Transferable);
                            Console.Clear();
                        }
                        else
                        {
                            Console.WriteLine("You don't have that item.");
                            Console.ReadKey();
                        }
                    }
                    else
                    {
                        Console.WriteLine("Invalid item id.");
                        Console.ReadKey();
                    }
                    continue;

                case '3':
                    IsStorageClose = true;
                    continue;
                }
            }
        }