示例#1
0
        private void _withdraw()
        {
            int balance = int.Parse(AccountBalance);

            if (balance == 0)
            {
                EOMessageBox.Show(DialogResourceID.BANK_ACCOUNT_UNABLE_TO_WITHDRAW, EODialogButtons.Ok, EOMessageBoxStyle.SmallDialogSmallHeader);
                return;
            }
            if (balance == 1)
            {
                if (!m_api.BankWithdraw(1))
                {
                    Close(null, XNADialogResult.NO_BUTTON_PRESSED);
                    EOGame.Instance.DoShowLostConnectionDialogAndReturnToMainMenu();
                }
                return;
            }

            ItemTransferDialog dlg = new ItemTransferDialog(OldWorld.Instance.EIF[1].Name,
                                                            ItemTransferDialog.TransferType.BankTransfer, balance, EOResourceID.DIALOG_TRANSFER_WITHDRAW);

            dlg.DialogClosing += (o, e) =>
            {
                if (e.Result == XNADialogResult.Cancel)
                {
                    return;
                }

                if (!m_api.BankWithdraw(dlg.SelectedAmount))
                {
                    Close(null, XNADialogResult.NO_BUTTON_PRESSED);
                    EOGame.Instance.DoShowLostConnectionDialogAndReturnToMainMenu();
                }
            };
        }
示例#2
0
        private void _deposit()
        {
            InventoryItem item = OldWorld.Instance.MainPlayer.ActiveCharacter.Inventory.Find(i => i.ItemID == 1);

            if (item.Amount == 0)
            {
                EOMessageBox.Show(DialogResourceID.BANK_ACCOUNT_UNABLE_TO_DEPOSIT, EODialogButtons.Ok, EOMessageBoxStyle.SmallDialogSmallHeader);
                return;
            }
            if (item.Amount == 1)
            {
                if (!m_api.BankDeposit(1))
                {
                    Close(null, XNADialogResult.NO_BUTTON_PRESSED);
                    EOGame.Instance.DoShowLostConnectionDialogAndReturnToMainMenu();
                }
                return;
            }

            ItemTransferDialog dlg = new ItemTransferDialog(OldWorld.Instance.EIF[1].Name,
                                                            ItemTransferDialog.TransferType.BankTransfer, item.Amount, EOResourceID.DIALOG_TRANSFER_DEPOSIT);

            dlg.DialogClosing += (o, e) =>
            {
                if (e.Result == XNADialogResult.Cancel)
                {
                    return;
                }

                if (!m_api.BankDeposit(dlg.SelectedAmount))
                {
                    Close(null, XNADialogResult.NO_BUTTON_PRESSED);
                    EOGame.Instance.DoShowLostConnectionDialogAndReturnToMainMenu();
                }
            };
        }
示例#3
0
		private void _buySellItem(ShopItem item)
		{
			if (m_state != ShopState.Buying && m_state != ShopState.Selling)
				return;
			bool isBuying = m_state == ShopState.Buying;

			InventoryItem ii = World.Instance.MainPlayer.ActiveCharacter.Inventory.Find(x => (isBuying ? x.id == 1 : x.id == item.ID));
			ItemRecord rec = World.Instance.EIF.GetItemRecordByID(item.ID);
			if (isBuying)
			{
				if (!EOGame.Instance.Hud.InventoryFits((short)item.ID))
				{
					EOMessageBox.Show(World.GetString(DATCONST2.DIALOG_TRANSFER_NOT_ENOUGH_SPACE),
						World.GetString(DATCONST2.STATUS_LABEL_TYPE_WARNING),
						XNADialogButtons.Ok, EOMessageBoxStyle.SmallDialogSmallHeader);
					return;
				}

				if (rec.Weight + World.Instance.MainPlayer.ActiveCharacter.Weight >
					World.Instance.MainPlayer.ActiveCharacter.MaxWeight)
				{
					EOMessageBox.Show(World.GetString(DATCONST2.DIALOG_TRANSFER_NOT_ENOUGH_WEIGHT),
						World.GetString(DATCONST2.STATUS_LABEL_TYPE_WARNING),
						XNADialogButtons.Ok, EOMessageBoxStyle.SmallDialogSmallHeader);
					return;
				}

				if (ii.amount < item.Buy)
				{
					EOMessageBox.Show(DATCONST1.WARNING_YOU_HAVE_NOT_ENOUGH, " gold.", XNADialogButtons.Ok, EOMessageBoxStyle.SmallDialogSmallHeader);
					return;
				}
			}
			else if (ii.amount == 0)
				return; //can't sell if amount of item is 0

			//special case: no need for prompting if selling an item with count == 1 in inventory
			if (!isBuying && ii.amount == 1)
			{
				string _message = string.Format("{0} 1 {1} {2} {3} gold?",
					World.GetString(DATCONST2.DIALOG_WORD_SELL),
					rec.Name,
					World.GetString(DATCONST2.DIALOG_WORD_FOR),
					item.Sell);
				EOMessageBox.Show(_message, World.GetString(DATCONST2.DIALOG_SHOP_SELL_ITEMS), XNADialogButtons.OkCancel,
					EOMessageBoxStyle.SmallDialogSmallHeader, (oo, ee) =>
					{
						if (ee.Result == XNADialogResult.OK && !m_api.SellItem((short)item.ID, 1))
						{
							EOGame.Instance.DoShowLostConnectionDialogAndReturnToMainMenu();
						}
					});
			}
			else
			{
				ItemTransferDialog dlg = new ItemTransferDialog(rec.Name, ItemTransferDialog.TransferType.ShopTransfer,
					isBuying ? item.MaxBuy : ii.amount, isBuying ? DATCONST2.DIALOG_TRANSFER_BUY : DATCONST2.DIALOG_TRANSFER_SELL);
				dlg.DialogClosing += (o, e) =>
				{
					if (e.Result == XNADialogResult.OK)
					{
						string _message = string.Format("{0} {1} {2} {3} {4} gold?",
							World.GetString(isBuying ? DATCONST2.DIALOG_WORD_BUY : DATCONST2.DIALOG_WORD_SELL),
							dlg.SelectedAmount, rec.Name,
							World.GetString(DATCONST2.DIALOG_WORD_FOR),
							(isBuying ? item.Buy : item.Sell) * dlg.SelectedAmount);

						EOMessageBox.Show(_message,
							World.GetString(isBuying ? DATCONST2.DIALOG_SHOP_BUY_ITEMS : DATCONST2.DIALOG_SHOP_SELL_ITEMS),
							XNADialogButtons.OkCancel, EOMessageBoxStyle.SmallDialogSmallHeader, (oo, ee) =>
							{
								if (ee.Result == XNADialogResult.OK)
								{
									//only actually do the buy/sell if the user then clicks "OK" in the second prompt
									if (isBuying && !m_api.BuyItem((short)item.ID, dlg.SelectedAmount) ||
										!isBuying && !m_api.SellItem((short)item.ID, dlg.SelectedAmount))
									{
										EOGame.Instance.DoShowLostConnectionDialogAndReturnToMainMenu();
									}
								}
							});
					}
				};
			}
		}
		public override void Update(GameTime gameTime)
		{
			if (!Game.IsActive || !Enabled) return;

			//check for drag-drop here
			MouseState currentState = Mouse.GetState();

			if (!m_beingDragged && MouseOverPreviously && MouseOver && PreviousMouseState.LeftButton == ButtonState.Pressed && currentState.LeftButton == ButtonState.Pressed)
			{
				//Conditions for starting are the mouse is over, the button is pressed, and no other items are being dragged
				if (((EOInventory)parent).NoItemsDragging())
				{
					//start the drag operation and hide the item label
					m_beingDragged = true;
					m_nameLabel.Visible = false;
					m_preDragDrawOrder = DrawOrder;
					m_preDragParent = parent;

					//make sure the offsets are maintained!
					//required to enable dragging past bounds of the inventory panel
					m_oldOffX = xOff;
					m_oldOffY = yOff;
					SetParent(null);

					m_alpha = 128;
					DrawOrder = 200; //arbitrarily large constant so drawn on top while dragging
				}
			}

			if (m_beingDragged && PreviousMouseState.LeftButton == ButtonState.Pressed &&
				currentState.LeftButton == ButtonState.Pressed)
			{
				//dragging has started. continue dragging until mouse is released, update position based on mouse location
				DrawLocation = new Vector2(currentState.X - (DrawArea.Width / 2), currentState.Y - (DrawArea.Height / 2));
			}
			else if (m_beingDragged && PreviousMouseState.LeftButton == ButtonState.Pressed &&
					 currentState.LeftButton == ButtonState.Released)
			{
				//need to check for: drop on map (drop action)
				//					 drop on button junk/drop
				//					 drop on grid (inventory move action)
				//					 drop on [x] dialog ([x] add action)

				m_alpha = 255;
				SetParent(m_preDragParent);

				if (((EOInventory)parent).IsOverDrop() || (World.Instance.ActiveMapRenderer.MouseOver &&
					ChestDialog.Instance == null && EOPaperdollDialog.Instance == null && LockerDialog.Instance == null
					&& BankAccountDialog.Instance == null && TradeDialog.Instance == null))
				{
					Point loc = World.Instance.ActiveMapRenderer.MouseOver ? World.Instance.ActiveMapRenderer.GridCoords :
						new Point(World.Instance.MainPlayer.ActiveCharacter.X, World.Instance.MainPlayer.ActiveCharacter.Y);

					//in range if maximum coordinate difference is <= 2 away
					bool inRange = Math.Abs(Math.Max(World.Instance.MainPlayer.ActiveCharacter.X - loc.X, World.Instance.MainPlayer.ActiveCharacter.Y - loc.Y)) <= 2;

					if (m_itemData.Special == ItemSpecial.Lore)
					{
						EOMessageBox.Show(DATCONST1.ITEM_IS_LORE_ITEM, XNADialogButtons.Ok, EOMessageBoxStyle.SmallDialogSmallHeader);
					}
					else if (World.Instance.JailMap == World.Instance.MainPlayer.ActiveCharacter.CurrentMap)
					{
						EOMessageBox.Show(World.GetString(DATCONST2.JAIL_WARNING_CANNOT_DROP_ITEMS),
							World.GetString(DATCONST2.STATUS_LABEL_TYPE_WARNING),
							XNADialogButtons.Ok, EOMessageBoxStyle.SmallDialogSmallHeader);
					}
					else if (m_inventory.amount > 1 && inRange)
					{
						ItemTransferDialog dlg = new ItemTransferDialog(m_itemData.Name, ItemTransferDialog.TransferType.DropItems,
							m_inventory.amount);
						dlg.DialogClosing += (sender, args) =>
						{
							if (args.Result == XNADialogResult.OK)
							{
								//note: not sure of the actual limit. 10000 is arbitrary here
								if (dlg.SelectedAmount > 10000 && m_inventory.id == 1 && !safetyCommentHasBeenShown)
									EOMessageBox.Show(DATCONST1.DROP_MANY_GOLD_ON_GROUND, XNADialogButtons.Ok, EOMessageBoxStyle.SmallDialogSmallHeader,
										(o, e) => { safetyCommentHasBeenShown = true; });
								else if (!m_api.DropItem(m_inventory.id, dlg.SelectedAmount, (byte)loc.X, (byte)loc.Y))
									((EOGame)Game).DoShowLostConnectionDialogAndReturnToMainMenu();
							}
						};
					}
					else if (inRange)
					{
						if (!m_api.DropItem(m_inventory.id, 1, (byte)loc.X, (byte)loc.Y))
							((EOGame)Game).DoShowLostConnectionDialogAndReturnToMainMenu();
					}
					else /*if (!inRange)*/
					{
						EOGame.Instance.Hud.SetStatusLabel(DATCONST2.STATUS_LABEL_TYPE_WARNING, DATCONST2.STATUS_LABEL_ITEM_DROP_OUT_OF_RANGE);
					}
				}
				else if (((EOInventory)parent).IsOverJunk())
				{
					if (m_inventory.amount > 1)
					{
						ItemTransferDialog dlg = new ItemTransferDialog(m_itemData.Name, ItemTransferDialog.TransferType.JunkItems,
							m_inventory.amount, DATCONST2.DIALOG_TRANSFER_JUNK);
						dlg.DialogClosing += (sender, args) =>
						{
							if (args.Result == XNADialogResult.OK && !m_api.JunkItem(m_inventory.id, dlg.SelectedAmount))
								((EOGame)Game).DoShowLostConnectionDialogAndReturnToMainMenu();
						};
					}
					else if (!m_api.JunkItem(m_inventory.id, 1))
						((EOGame)Game).DoShowLostConnectionDialogAndReturnToMainMenu();
				}
				else if (ChestDialog.Instance != null && ChestDialog.Instance.MouseOver && ChestDialog.Instance.MouseOverPreviously)
				{
					if (m_itemData.Special == ItemSpecial.Lore)
					{
						EOMessageBox.Show(DATCONST1.ITEM_IS_LORE_ITEM, XNADialogButtons.Ok, EOMessageBoxStyle.SmallDialogSmallHeader);
					}
					else if (m_inventory.amount > 1)
					{
						ItemTransferDialog dlg = new ItemTransferDialog(m_itemData.Name, ItemTransferDialog.TransferType.DropItems, m_inventory.amount);
						dlg.DialogClosing += (sender, args) =>
						{
							if (args.Result == XNADialogResult.OK &&
								!m_api.ChestAddItem(ChestDialog.Instance.CurrentChestX, ChestDialog.Instance.CurrentChestY,
									m_inventory.id, dlg.SelectedAmount))
								EOGame.Instance.DoShowLostConnectionDialogAndReturnToMainMenu();
						};
					}
					else
					{
						if (!m_api.ChestAddItem(ChestDialog.Instance.CurrentChestX, ChestDialog.Instance.CurrentChestY, m_inventory.id, 1))
							EOGame.Instance.DoShowLostConnectionDialogAndReturnToMainMenu();
					}
				}
				else if (EOPaperdollDialog.Instance != null && EOPaperdollDialog.Instance.MouseOver && EOPaperdollDialog.Instance.MouseOverPreviously)
				{
					//equipable items should be equipped
					//other item types should do nothing
					switch (m_itemData.Type)
					{
						case ItemType.Accessory:
						case ItemType.Armlet:
						case ItemType.Armor:
						case ItemType.Belt:
						case ItemType.Boots:
						case ItemType.Bracer:
						case ItemType.Gloves:
						case ItemType.Hat:
						case ItemType.Necklace:
						case ItemType.Ring:
						case ItemType.Shield:
						case ItemType.Weapon:
							_handleDoubleClick();
							break;
					}
				}
				else if (LockerDialog.Instance != null && LockerDialog.Instance.MouseOver && LockerDialog.Instance.MouseOverPreviously)
				{
					byte x = LockerDialog.Instance.X;
					byte y = LockerDialog.Instance.Y;
					if (m_inventory.id == 1)
					{
						EOMessageBox.Show(DATCONST1.LOCKER_DEPOSIT_GOLD_ERROR, XNADialogButtons.Ok, EOMessageBoxStyle.SmallDialogSmallHeader);
					}
					else if (m_inventory.amount > 1)
					{
						ItemTransferDialog dlg = new ItemTransferDialog(m_itemData.Name, ItemTransferDialog.TransferType.ShopTransfer, m_inventory.amount, DATCONST2.DIALOG_TRANSFER_TRANSFER);
						dlg.DialogClosing += (sender, args) =>
						{
							if (args.Result == XNADialogResult.OK)
							{
								if (LockerDialog.Instance.GetNewItemAmount(m_inventory.id, dlg.SelectedAmount) > Constants.LockerMaxSingleItemAmount)
									EOMessageBox.Show(DATCONST1.LOCKER_FULL_SINGLE_ITEM_MAX, XNADialogButtons.Ok, EOMessageBoxStyle.SmallDialogSmallHeader);
								else if (!m_api.LockerAddItem(x, y, m_inventory.id, dlg.SelectedAmount))
									EOGame.Instance.DoShowLostConnectionDialogAndReturnToMainMenu();
							}
						};
					}
					else
					{
						if (LockerDialog.Instance.GetNewItemAmount(m_inventory.id, 1) > Constants.LockerMaxSingleItemAmount)
							EOMessageBox.Show(DATCONST1.LOCKER_FULL_SINGLE_ITEM_MAX, XNADialogButtons.Ok, EOMessageBoxStyle.SmallDialogSmallHeader);
						else if (!m_api.LockerAddItem(x, y, m_inventory.id, 1))
							EOGame.Instance.DoShowLostConnectionDialogAndReturnToMainMenu();
					}
				}
				else if (BankAccountDialog.Instance != null && BankAccountDialog.Instance.MouseOver && BankAccountDialog.Instance.MouseOverPreviously && m_inventory.id == 1)
				{
					if (m_inventory.amount == 0)
					{
						EOMessageBox.Show(DATCONST1.BANK_ACCOUNT_UNABLE_TO_DEPOSIT, XNADialogButtons.Ok, EOMessageBoxStyle.SmallDialogSmallHeader);
					}
					else if (m_inventory.amount > 1)
					{
						ItemTransferDialog dlg = new ItemTransferDialog(m_itemData.Name, ItemTransferDialog.TransferType.BankTransfer,
							m_inventory.amount, DATCONST2.DIALOG_TRANSFER_DEPOSIT);
						dlg.DialogClosing += (o, e) =>
						{
							if (e.Result == XNADialogResult.Cancel)
								return;

							if (!m_api.BankDeposit(dlg.SelectedAmount))
								EOGame.Instance.DoShowLostConnectionDialogAndReturnToMainMenu();
						};
					}
					else
					{
						if (!m_api.BankDeposit(1))
							EOGame.Instance.DoShowLostConnectionDialogAndReturnToMainMenu();
					}
				}
				else if (TradeDialog.Instance != null && TradeDialog.Instance.MouseOver && TradeDialog.Instance.MouseOverPreviously
					&& !TradeDialog.Instance.MainPlayerAgrees)
				{
					if (m_itemData.Special == ItemSpecial.Lore)
					{
						EOMessageBox.Show(DATCONST1.ITEM_IS_LORE_ITEM);
					}
					else if (m_inventory.amount > 1)
					{
						ItemTransferDialog dlg = new ItemTransferDialog(m_itemData.Name, ItemTransferDialog.TransferType.TradeItems,
							m_inventory.amount, DATCONST2.DIALOG_TRANSFER_OFFER);
						dlg.DialogClosing += (o, e) =>
						{
							if (e.Result != XNADialogResult.OK) return;

							if (!m_api.TradeAddItem(m_inventory.id, dlg.SelectedAmount))
							{
								TradeDialog.Instance.Close(XNADialogResult.NO_BUTTON_PRESSED);
								((EOGame)Game).DoShowLostConnectionDialogAndReturnToMainMenu();
							}
						};
					}
					else if (!m_api.TradeAddItem(m_inventory.id, 1))
					{
						TradeDialog.Instance.Close(XNADialogResult.NO_BUTTON_PRESSED);
						((EOGame)Game).DoShowLostConnectionDialogAndReturnToMainMenu();
					}
				}

				//update the location - if it isn't on the grid, the bounds check will set it back to where it used to be originally
				//Item amount will be updated or item will be removed in packet response to the drop operation
				UpdateItemLocation(ItemCurrentSlot());

				//mouse has been released. finish dragging.
				m_beingDragged = false;
				m_nameLabel.Visible = true;
				DrawOrder = m_preDragDrawOrder;
			}

			if (!m_beingDragged && PreviousMouseState.LeftButton == ButtonState.Pressed &&
				currentState.LeftButton == ButtonState.Released && MouseOver && MouseOverPreviously)
			{
				Interlocked.Increment(ref m_recentClickCount);
				if (m_recentClickCount == 2)
				{
					_handleDoubleClick();
				}
			}

			if (!MouseOverPreviously && MouseOver && !m_beingDragged)
			{
				m_nameLabel.Visible = true;
				EOGame.Instance.Hud.SetStatusLabel(DATCONST2.STATUS_LABEL_TYPE_ITEM, m_nameLabel.Text);
			}
			else if (!MouseOver && !m_beingDragged && m_nameLabel != null && m_nameLabel.Visible)
			{
				m_nameLabel.Visible = false;
			}

			base.Update(gameTime); //sets mouseoverpreviously = mouseover, among other things
		}
示例#5
0
        private void _buySellItem(ShopItem item)
        {
            if (m_state != ShopState.Buying && m_state != ShopState.Selling)
            {
                return;
            }
            bool isBuying = m_state == ShopState.Buying;

            InventoryItem ii  = OldWorld.Instance.MainPlayer.ActiveCharacter.Inventory.Find(x => (isBuying ? x.ItemID == 1 : x.ItemID == item.ID));
            var           rec = OldWorld.Instance.EIF[item.ID];

            if (isBuying)
            {
                if (!EOGame.Instance.Hud.InventoryFits((short)item.ID))
                {
                    EOMessageBox.Show(OldWorld.GetString(EOResourceID.DIALOG_TRANSFER_NOT_ENOUGH_SPACE),
                                      OldWorld.GetString(EOResourceID.STATUS_LABEL_TYPE_WARNING),
                                      EODialogButtons.Ok, EOMessageBoxStyle.SmallDialogSmallHeader);
                    return;
                }

                if (rec.Weight + OldWorld.Instance.MainPlayer.ActiveCharacter.Weight >
                    OldWorld.Instance.MainPlayer.ActiveCharacter.MaxWeight)
                {
                    EOMessageBox.Show(OldWorld.GetString(EOResourceID.DIALOG_TRANSFER_NOT_ENOUGH_WEIGHT),
                                      OldWorld.GetString(EOResourceID.STATUS_LABEL_TYPE_WARNING),
                                      EODialogButtons.Ok, EOMessageBoxStyle.SmallDialogSmallHeader);
                    return;
                }

                if (ii.Amount < item.Buy)
                {
                    EOMessageBox.Show(DialogResourceID.WARNING_YOU_HAVE_NOT_ENOUGH, " gold.", EODialogButtons.Ok, EOMessageBoxStyle.SmallDialogSmallHeader);
                    return;
                }
            }
            else if (ii.Amount == 0)
            {
                return; //can't sell if amount of item is 0
            }
            //special case: no need for prompting if selling an item with count == 1 in inventory
            if (!isBuying && ii.Amount == 1)
            {
                string _message =
                    $"{OldWorld.GetString(EOResourceID.DIALOG_WORD_SELL)} 1 {rec.Name} {OldWorld.GetString(EOResourceID.DIALOG_WORD_FOR)} {item.Sell} gold?";
                EOMessageBox.Show(_message, OldWorld.GetString(EOResourceID.DIALOG_SHOP_SELL_ITEMS), EODialogButtons.OkCancel,
                                  EOMessageBoxStyle.SmallDialogSmallHeader, (oo, ee) =>
                {
                    if (ee.Result == XNADialogResult.OK && !m_api.SellItem((short)item.ID, 1))
                    {
                        EOGame.Instance.DoShowLostConnectionDialogAndReturnToMainMenu();
                    }
                });
            }
            else
            {
                ItemTransferDialog dlg = new ItemTransferDialog(rec.Name, ItemTransferDialog.TransferType.ShopTransfer,
                                                                isBuying ? item.MaxBuy : ii.Amount, isBuying ? EOResourceID.DIALOG_TRANSFER_BUY : EOResourceID.DIALOG_TRANSFER_SELL);
                dlg.DialogClosing += (o, e) =>
                {
                    if (e.Result == XNADialogResult.OK)
                    {
                        string _message =
                            $"{OldWorld.GetString(isBuying ? EOResourceID.DIALOG_WORD_BUY : EOResourceID.DIALOG_WORD_SELL)} {dlg.SelectedAmount} {rec.Name} {OldWorld.GetString(EOResourceID.DIALOG_WORD_FOR)} {(isBuying ? item.Buy : item.Sell)*dlg.SelectedAmount} gold?";

                        EOMessageBox.Show(_message,
                                          OldWorld.GetString(isBuying ? EOResourceID.DIALOG_SHOP_BUY_ITEMS : EOResourceID.DIALOG_SHOP_SELL_ITEMS),
                                          EODialogButtons.OkCancel, EOMessageBoxStyle.SmallDialogSmallHeader, (oo, ee) =>
                        {
                            if (ee.Result == XNADialogResult.OK)
                            {
                                //only actually do the buy/sell if the user then clicks "OK" in the second prompt
                                if (isBuying && !m_api.BuyItem((short)item.ID, dlg.SelectedAmount) ||
                                    !isBuying && !m_api.SellItem((short)item.ID, dlg.SelectedAmount))
                                {
                                    EOGame.Instance.DoShowLostConnectionDialogAndReturnToMainMenu();
                                }
                            }
                        });
                    }
                };
            }
        }
		private void _withdraw()
		{
			int balance = int.Parse(AccountBalance);
			if (balance == 0)
			{
				EOMessageBox.Show(DATCONST1.BANK_ACCOUNT_UNABLE_TO_WITHDRAW, XNADialogButtons.Ok, EOMessageBoxStyle.SmallDialogSmallHeader);
				return;
			}
			if (balance == 1)
			{
				if (!m_api.BankWithdraw(1))
				{
					Close(null, XNADialogResult.NO_BUTTON_PRESSED);
					EOGame.Instance.DoShowLostConnectionDialogAndReturnToMainMenu();
				}
				return;
			}

			ItemTransferDialog dlg = new ItemTransferDialog(World.Instance.EIF.GetItemRecordByID(1).Name,
				ItemTransferDialog.TransferType.BankTransfer, balance, DATCONST2.DIALOG_TRANSFER_WITHDRAW);
			dlg.DialogClosing += (o, e) =>
			{
				if (e.Result == XNADialogResult.Cancel)
					return;

				if (!m_api.BankWithdraw(dlg.SelectedAmount))
				{
					Close(null, XNADialogResult.NO_BUTTON_PRESSED);
					EOGame.Instance.DoShowLostConnectionDialogAndReturnToMainMenu();
				}
			};
		}
		private void _deposit()
		{
			InventoryItem item = World.Instance.MainPlayer.ActiveCharacter.Inventory.Find(i => i.id == 1);
			if (item.amount == 0)
			{
				EOMessageBox.Show(DATCONST1.BANK_ACCOUNT_UNABLE_TO_DEPOSIT, XNADialogButtons.Ok, EOMessageBoxStyle.SmallDialogSmallHeader);
				return;
			}
			if (item.amount == 1)
			{
				if (!m_api.BankDeposit(1))
				{
					Close(null, XNADialogResult.NO_BUTTON_PRESSED);
					EOGame.Instance.DoShowLostConnectionDialogAndReturnToMainMenu();
				}
				return;
			}

			ItemTransferDialog dlg = new ItemTransferDialog(World.Instance.EIF.GetItemRecordByID(1).Name,
				ItemTransferDialog.TransferType.BankTransfer, item.amount, DATCONST2.DIALOG_TRANSFER_DEPOSIT);
			dlg.DialogClosing += (o, e) =>
			{
				if (e.Result == XNADialogResult.Cancel)
					return;

				if (!m_api.BankDeposit(dlg.SelectedAmount))
				{
					Close(null, XNADialogResult.NO_BUTTON_PRESSED);
					EOGame.Instance.DoShowLostConnectionDialogAndReturnToMainMenu();
				}
			};
		}