Esempio n. 1
0
    public void UseItem(S.UseItem p)
    {
        MirItemCell cell = GetCell(Inventory.Cells, p.UniqueID);

        if (cell == null)
        {
            return;
        }

        cell.Locked = false;

        if (!p.Success)
        {
            return;
        }
        if (cell.Item.Count > 1)
        {
            cell.Item.Count--;
        }
        else
        {
            cell.Item = null;
        }
        User.RefreshStats();
    }
Esempio n. 2
0
        public TransformBackDialog()
        {
            Index    = 537;
            Library  = Libraries.Prguse;
            Movable  = false;
            Sort     = true;
            Location = new Point(247, 224);

            TransformButton = new MirButton
            {
                Index        = 496,
                HoverIndex   = 497,
                PressedIndex = 498,
                Library      = Libraries.Title,
                Location     = new Point(70, 134),
                Parent       = this,
                Sound        = SoundList.ButtonA,
            };
            TransformButton.Click += (o, e) => Transform_Click();

            CloseButton = new MirButton
            {
                Index        = 360,
                HoverIndex   = 361,
                PressedIndex = 362,
                Location     = new Point(170, 1),
                Library      = Libraries.Prguse2,
                Parent       = this,
                Sound        = SoundList.ButtonA,
            };
            CloseButton.Click += (o, e) => Hide();

            Title = new MirImageControl
            {
                Index      = 44,
                Library    = Libraries.Title,
                Location   = new Point(30, 5),
                Parent     = this,
                NotControl = true,
            };

            ItemBox = new MirImageControl
            {
                Index      = 989,
                Library    = Libraries.Prguse,
                Location   = new Point(75, 61),
                Parent     = this,
                NotControl = true,
            };

            ItemCell = new MirItemCell
            {
                BorderColour = Color.Lime,
                GridType     = MirGridType.TransformBack,
                Library      = Libraries.Items,
                Parent       = this,
                Location     = new Point(75, 61),
                ItemSlot     = 0,
            };
        }
Esempio n. 3
0
        public void DisplayItemGridEffect(ulong id, int type = 0)
        {
            MirItemCell cell = GetCell(id);

            if (cell.Item == null)
            {
                return;
            }

            MirAnimatedControl animEffect = null;

            switch (type)
            {
            case 0:
                animEffect = new MirAnimatedControl
                {
                    Animated       = true,
                    AnimationCount = 9,
                    AnimationDelay = 150,
                    Index          = 410,
                    Library        = Libraries.Prguse,
                    Location       = cell.Location,
                    Parent         = this,
                    Loop           = false,
                    NotControl     = true,
                    UseOffSet      = true,
                    Blending       = true,
                    BlendingRate   = 1F
                };
                animEffect.AfterAnimation += (o, e) => animEffect.Dispose();
                SoundManager.PlaySound(20000 + (ushort)Spell.MagicShield * 10);
                break;
            }
        }
Esempio n. 4
0
    public void DropItem(S.DropItem p)
    {
        MirItemCell cell = GetCell(Inventory.Cells, p.UniqueID) ?? GetCell(BeltCells, p.UniqueID);

        if (cell == null)
        {
            return;
        }

        cell.Locked = false;

        if (!p.Success)
        {
            return;
        }

        if (p.Count == cell.Item.Count)
        {
            cell.Item = null;
        }
        else
        {
            cell.Item.Count -= p.Count;
        }

        User.RefreshStats();
    }
Esempio n. 5
0
    public void MailLockedItem(S.MailLockedItem p)
    {
        MirItemCell cell = GameScene.Scene.InventoryDialog.GetCell(p.UniqueID);

        if (cell != null)
        {
            cell.Locked = p.Locked;
        }
    }
Esempio n. 6
0
        private void MailLockedItem(S.MailLockedItem p)
        {
            InventoryDialog inventory = GameScene.Scene.InventoryDialog;
            MirItemCell     cell      = inventory.GetCell(p.UniqueID);

            if (cell != null)
            {
                cell.Locked = p.Locked;
            }
        }
Esempio n. 7
0
        public HumupTransformDialog()
        {
            Index    = 661;
            Library  = Libraries.Prguse;
            Movable  = false;
            Sort     = true;
            Location = new Point(125, 224);

            TransformButton = new MirButton
            {
                Index        = 496,
                HoverIndex   = 497,
                PressedIndex = 498,
                Library      = Libraries.Title,
                Location     = new Point(132, 177),
                Parent       = this,
                Sound        = SoundList.ButtonA,
            };
            TransformButton.Click += (o, e) => Transform_Click();

            CloseButton = new MirButton
            {
                Index        = 360,
                HoverIndex   = 361,
                PressedIndex = 362,
                Location     = new Point(286, 5),
                Library      = Libraries.Prguse2,
                Parent       = this,
                Sound        = SoundList.ButtonA,
            };
            CloseButton.Click += (o, e) => Hide();

            Title = new MirImageControl
            {
                Index      = 44,
                Library    = Libraries.Title,
                Location   = new Point(20, 5),
                Parent     = this,
                NotControl = true,
            };

            for (int i = 0; i < ItemCells.Length; i++)
            {
                ItemCells[i] = new MirItemCell
                {
                    BorderColour = Color.Lime,
                    GridType     = MirGridType.HumupTransform,
                    Library      = Libraries.Items,
                    Parent       = this,
                    Location     = new Point(51 + i * 35, 56),
                    ItemSlot     = i,
                    Size         = new Size(35, 31)
                };
            }
        }
Esempio n. 8
0
        public static void Create()
        {
            Window = new MirImageControl
            {
                Index    = 1932,
                Library  = Libraries.Prguse,
                Parent   = GameScene.Scene,
                Movable  = true,
                Sort     = true,
                Visible  = true,
                Location = new Point(230, 450)
            };
            Window.BeforeDraw += new EventHandler(Window_BeforeDraw);

            RotateButton = new MirButton
            {
                HoverIndex   = 1927,
                Index        = 1926,
                Location     = new Point(222, 3),
                Library      = Libraries.Prguse,
                Parent       = Window,
                PressedIndex = 1928,
                Sound        = SoundList.ClickA,
            };
            CloseButton = new MirButton
            {
                HoverIndex   = 1924,
                Index        = 1923,
                Location     = new Point(222, 19),
                Library      = Libraries.Prguse,
                Parent       = Window,
                PressedIndex = 1925,
                Sound        = SoundList.ClickA,
            };

            Grid = new MirItemCell[6];

            for (int X = 0; X < 6; X++)
            {
                Grid[X] = new MirItemCell
                {
                    ItemSlot    = 40 + X, //
                    Size        = new Size(32, 32),
                    BorderColor = Color.Lime,
                    GridType    = MirGridType.Inventory,
                    Library     = Libraries.Items,
                    Parent      = Window,
                    Location    = new Point(X * 35 + 12, 3),
                };
            }
        }
Esempio n. 9
0
        public GuestTradeDialog()
        {
            Index    = 390;
            Library  = Libraries.Prguse;
            Movable  = true;
            Size     = new Size(204, 152);
            Location = new Point((Settings.ScreenWidth / 2) + 10, Settings.ScreenHeight - 350);
            Sort     = true;

            #region Host labels
            GuestNameLabel = new MirLabel
            {
                Parent     = this,
                Location   = new Point(0, 10),
                Size       = new Size(204, 14),
                DrawFormat = TextFormatFlags.HorizontalCenter | TextFormatFlags.VerticalCenter,
                NotControl = true,
            };

            GuestGoldLabel = new MirLabel
            {
                DrawFormat = TextFormatFlags.HorizontalCenter | TextFormatFlags.VerticalCenter,
                Font       = new Font(Settings.FontName, 8F),
                Location   = new Point(35, 123),
                Parent     = this,
                Size       = new Size(90, 15),
                Sound      = SoundList.Gold,
                NotControl = true,
            };
            #endregion

            #region Grids
            GuestGrid = new MirItemCell[5 * 2];

            for (int x = 0; x < 5; x++)
            {
                for (int y = 0; y < 2; y++)
                {
                    GuestGrid[2 * x + y] = new MirItemCell
                    {
                        ItemSlot = 2 * x + y,
                        GridType = MirGridType.GuestTrade,
                        Parent   = this,
                        Location = new Point(x * 36 + 10 + x, y * 32 + 39 + y),
                    };
                }
            }
            #endregion
        }
Esempio n. 10
0
    public void RemoveItem(S.RemoveItem p)
    {
        MirItemCell toCell;

        int index = -1;

        for (int i = 0; i < User.Equipment.Length; i++)
        {
            if (User.Equipment[i] == null || User.Equipment[i].UniqueID != p.UniqueID)
            {
                continue;
            }
            index = i;
            break;
        }

        MirItemCell fromCell = EquipmentCells[index];


        switch (p.Grid)
        {
        case MirGridType.Inventory:
            toCell = p.To < User.BeltIdx ? BeltCells[p.To] : Inventory.Cells[p.To - User.BeltIdx];
            break;

        /*case MirGridType.Storage:
         *  toCell = StorageDialog.Grid[p.To];
         *  break;*/
        default:
            return;
        }

        if (toCell == null || fromCell == null)
        {
            return;
        }

        toCell.Locked   = false;
        fromCell.Locked = false;

        if (!p.Success)
        {
            return;
        }
        toCell.Item   = fromCell.Item;
        fromCell.Item = null;
        User.RefreshStats();
    }
Esempio n. 11
0
        public void ResetLockedCells()
        {
            for (int i = 0; i < _cellCount; i++)
            {
                MirItemCell cell = Cells[i];

                if (cell.Item != null)
                {
                    Network.Enqueue(new C.MailLockedItem {
                        UniqueID = cell.Item.UniqueID, Locked = false
                    });
                    cell.Item = null;
                }

                ItemsIdx[i] = 0;
            }
        }
Esempio n. 12
0
        public SocketDialog()
        {
            Index    = 20;
            Library  = Libraries.Prguse3;
            Movable  = true;
            Sort     = true;
            Location = new Point(0, 0);

            Grid = new MirItemCell[6 * 2];

            for (int x = 0; x < 6; x++)
            {
                for (int y = 0; y < 2; y++)
                {
                    int idx = 6 * y + x;

                    Grid[idx] = new MirItemCell
                    {
                        ItemSlot = idx,
                        GridType = MirGridType.Socket,
                        Library  = Libraries.Items,
                        Parent   = this,
                        Location = new Point(x * 36 + 23 + x, y * 33 + 15 + y),
                    };
                }
            }

            CloseButton = new MirButton
            {
                HoverIndex   = 361,
                Index        = 360,
                Location     = new Point(Size.Width - 23, 3),
                Library      = Libraries.Prguse2,
                Parent       = this,
                PressedIndex = 362,
                Sound        = SoundList.ButtonA,
            };
            CloseButton.Click += (o, e) => Hide();
        }
Esempio n. 13
0
 public AddSocketDialog()
 {
     ConfirmButton = new MirButton
     {
         Parent = this,
     };
     ConfirmButton.Click += ConfirmButton_Click;
     CloseButton          = new MirButton
     {
         Parent = this,
     };
     CloseButton.Click += (o, e) => Hide();
     HammerContainer    = new MirImageControl
     {
         Index    = 989,
         Library  = Libraries.Prguse,
         Parent   = this,
         Location = new Point(100, 18),
     };
     HammerCell = new MirItemCell
     {
         GridType = MirGridType.AddSocket,
         Parent   = HammerContainer,
         CellType = 0
     };
     ItemContainer = new MirImageControl
     {
         Index    = 989,
         Library  = Libraries.Prguse,
         Parent   = this,
         Location = new Point(100, 18),
     };
     ItemCell = new MirItemCell
     {
         GridType = MirGridType.AddSocket,
         Parent   = ItemContainer,
         CellType = 1
     };
 }
Esempio n. 14
0
    public void EquipItem(S.EquipItem p)
    {
        MirItemCell fromCell;
        MirItemCell toCell = EquipmentCells[p.To];

        switch (p.Grid)
        {
        case MirGridType.Inventory:
            fromCell = GetCell(Inventory.Cells, p.UniqueID) ?? GetCell(BeltCells, p.UniqueID);
            break;

        /*case MirGridType.Storage:
         *  fromCell = StorageDialog.GetCell(p.UniqueID) ?? BeltDialog.GetCell(p.UniqueID);
         *  break;*/
        default:
            return;
        }

        if (toCell == null || fromCell == null)
        {
            return;
        }

        toCell.Locked   = false;
        fromCell.Locked = false;

        if (!p.Success)
        {
            return;
        }

        UserItem i = fromCell.Item;

        fromCell.Item = toCell.Item;
        toCell.Item   = i;
        User.RefreshStats();
    }
Esempio n. 15
0
        public MailComposeParcelDialog()
        {
            Index    = 674;
            Library  = Libraries.Title;
            Size     = new Size(236, 384);
            Movable  = true;
            Sort     = true;
            Location = new Point(GameScene.Scene.InventoryDialog.Size.Width + 10, 0);

            CloseButton = new MirButton
            {
                HoverIndex   = 361,
                Index        = 360,
                Location     = new Point(Size.Width - 27, 3),
                Library      = Libraries.Prguse2,
                Parent       = this,
                PressedIndex = 362,
                Sound        = SoundList.ButtonA,
            };
            CloseButton.Click += (o, e) =>
            {
                ResetLockedCells();
                Hide();
            };

            RecipientNameLabel = new MirLabel
            {
                Text       = "",
                Parent     = this,
                Font       = new Font(Settings.FontName, 8F),
                ForeColour = Color.White,
                Location   = new Point(70, 35),
                Size       = new Size(150, 15),
                NotControl = true,
            };

            MessageTextBox = new MirTextBox
            {
                ForeColour = Color.White,
                Parent     = this,
                Font       = new Font(Settings.FontName, 8F),
                Location   = new Point(15, 98),
                Size       = new Size(202, 165),
            };

            MessageTextBox.MultiLine();

            StampButton = new MirButton
            {
                Index        = 203,
                HoverIndex   = 203,
                PressedIndex = 203,
                Location     = new Point(73, 56),
                Size         = new Size(20, 20),
                Library      = Libraries.Prguse2,
                Parent       = this,
                Sound        = SoundList.ButtonA,
            };
            StampButton.Click += (o, e) =>
            {
                StampParcel();
            };

            ItemCover = new MirImageControl
            {
                Index    = 676,
                Location = new Point(63, 310),
                Size     = new Size(144, 33),
                Library  = Libraries.Title,
                Parent   = this
            };

            for (int i = 0; i < Cells.Length; i++)
            {
                Cells[i] = new MirItemCell
                {
                    BorderColour = Color.Lime,
                    Size         = new Size(35, 31),
                    GridType     = MirGridType.Mail,
                    Library      = Libraries.Items,
                    Parent       = this,
                    Location     = new Point(27 + (i * 36), 311),
                    ItemSlot     = i
                };
            }

            ParcelCostLabel = new MirLabel
            {
                DrawFormat = TextFormatFlags.VerticalCenter,
                Font       = new Font(Settings.FontName, 8F),
                Location   = new Point(63, 269),
                Parent     = this,
                Size       = new Size(143, 15),
            };

            GoldSendLabel = new MirLabel
            {
                DrawFormat = TextFormatFlags.VerticalCenter,
                Font       = new Font(Settings.FontName, 8F),
                Location   = new Point(63, 290),
                Parent     = this,
                Size       = new Size(143, 15),
                Sound      = SoundList.Gold,
            };
            GoldSendLabel.Click += (o, e) =>
            {
                if (GameScene.SelectedCell == null && GameScene.Gold > 0)
                {
                    MirAmountBox amountBox = new MirAmountBox("Send Amount:", 116, GameScene.Gold);

                    amountBox.OKButton.Click += (c, a) =>
                    {
                        if (amountBox.Amount > 0)
                        {
                            GiftGoldAmount += amountBox.Amount;
                            GameScene.Gold -= amountBox.Amount;
                        }

                        GoldSendLabel.Text = GiftGoldAmount.ToString("###,###,##0");

                        CalculatePostage();
                    };

                    amountBox.Show();
                    GameScene.PickedUpGold = false;
                }
            };

            SendButton = new MirButton
            {
                Index        = 607,
                HoverIndex   = 608,
                PressedIndex = 609,
                Parent       = this,
                Library      = Libraries.Title,
                Sound        = SoundList.ButtonA,
                Location     = new Point(30, 350)
            };
            SendButton.Click += (o, e) =>
            {
                Network.Enqueue(new C.SendMail {
                    Name = RecipientNameLabel.Text, Message = MessageTextBox.Text, Gold = GiftGoldAmount, ItemsIdx = ItemsIdx, Stamped = Stamped
                });
            };

            CancelButton = new MirButton
            {
                Index        = 193,
                HoverIndex   = 194,
                PressedIndex = 195,
                Parent       = this,
                Library      = Libraries.Title,
                Sound        = SoundList.ButtonA,
                Location     = new Point(135, 350)
            };
            CancelButton.Click += (o, e) =>
            {
                ResetLockedCells();
                Hide();
            };
        }
Esempio n. 16
0
        public void ReadMail(ClientMail mail)
        {
            if (mail == null)
            {
                return;
            }

            Mail = mail;

            if (!Mail.Opened)
            {
                Network.Enqueue(new C.ReadMail {
                    MailID = Mail.MailID
                });
            }

            ResetCells();

            SenderNameLabel.Text = Mail.SenderName;
            DateSentLabel.Text   = Mail.DateSent.ToString("dd/MM/yy H:mm:ss");
            MessageLabel.Text    = Mail.Message.Replace("\\r\\n", "\r\n");
            GoldSendLabel.Text   = Mail.Gold.ToString("###,###,##0");

            if (Mail.Items.Count > 0)
            {
                for (int i = 0; i < Cells.Length; i++)
                {
                    if (i >= Mail.Items.Count)
                    {
                        break;
                    }

                    Cells[i] = new MirItemCell
                    {
                        BorderColour = Color.Lime,
                        Size         = new Size(35, 31),
                        GridType     = MirGridType.Mail,
                        Library      = Libraries.Items,
                        Parent       = this,
                        Location     = new Point(27 + (i * 36), 311),
                        ItemSlot     = i,
                        Item         = Mail.Items[i]
                    };
                }
            }

            if (!Mail.Collected)
            {
                CollectButton.Index        = 683;
                CollectButton.HoverIndex   = 684;
                CollectButton.PressedIndex = 685;
                CollectButton.Enabled      = false;
            }
            else
            {
                CollectButton.Index        = 680;
                CollectButton.HoverIndex   = 681;
                CollectButton.PressedIndex = 682;
                CollectButton.Enabled      = true;
            }

            Visible = true;
        }
Esempio n. 17
0
    public void RemoveItem()
    {
        int count = 0;

        for (int i = 0; i < User.Inventory.Length; i++)
        {
            MirItemCell itemCell = i < User.BeltIdx ? GameScene.BeltCells[i] : GameScene.Inventory.Cells[i - User.BeltIdx];
            if (itemCell.Item == null)
            {
                count++;
            }
        }

        if (Item == null || count < 1 /*|| (User.RidingMount && Item.Info.Type != ItemType.Torch)*/)
        {
            return;
        }

        if (Item.Info.StackSize > 1)
        {
            UserItem item = null;

            for (int i = 0; i < User.Inventory.Length; i++)
            {
                MirItemCell itemCell = i < User.BeltIdx ? GameScene.BeltCells[i] : GameScene.Inventory.Cells[i - User.BeltIdx];

                if (itemCell.Item == null || itemCell.Item.Info != Item.Info)
                {
                    continue;
                }

                item = itemCell.Item;
            }

            if (item != null && ((item.Count + Item.Count) <= item.Info.StackSize))
            {
                //Merge.
                Network.Enqueue(new C.MergeItem {
                    GridFrom = GridType, GridTo = MirGridType.Inventory, IDFrom = Item.UniqueID, IDTo = item.UniqueID
                });

                Locked = true;

                PlayItemSound();
                return;
            }
        }


        for (int i = 0; i < User.Inventory.Length; i++)
        {
            MirItemCell itemCell = null;

            if (Item.Info.Type == ItemType.Amulet)
            {
                itemCell = i < User.BeltIdx ? GameScene.BeltCells[i] : GameScene.Inventory.Cells[i - User.BeltIdx];
            }
            else
            {
                itemCell = i < (User.Inventory.Length - User.BeltIdx) ? GameScene.Inventory.Cells[i] : GameScene.BeltCells[i - User.Inventory.Length];
            }

            if (itemCell.Item != null)
            {
                continue;
            }

            if (GridType != MirGridType.Equipment)
            {
                Network.Enqueue(new C.RemoveSlotItem {
                    Grid = GridType, UniqueID = Item.UniqueID, To = itemCell.ItemSlot, GridTo = MirGridType.Inventory
                });
            }
            else
            {
                Network.Enqueue(new C.RemoveItem {
                    Grid = MirGridType.Inventory, UniqueID = Item.UniqueID, To = itemCell.ItemSlot
                });
            }

            Locked = true;

            PlayItemSound();
            break;
        }
    }
Esempio n. 18
0
        public HeroBeltDialog()
        {
            Index    = 1921;
            Library  = Libraries.Prguse;
            Movable  = true;
            Sort     = true;
            Visible  = true;
            Location = new Point(GameScene.Scene.MainDialog.Location.X + 475, Settings.ScreenHeight - 150);

            BeforeDraw += BeltPanel_BeforeDraw;

            for (int i = 0; i < Key.Length; i++)
            {
                Key[i] = new MirLabel
                {
                    Parent   = this,
                    Size     = new Size(26, 14),
                    Location = new Point(8 + i * 35, 2),
                    Text     = (i + 7).ToString()
                };
            }

            RotateButton = new MirButton
            {
                HoverIndex   = 1927,
                Index        = 1926,
                Location     = new Point(82, 3),
                Library      = Libraries.Prguse,
                Parent       = this,
                PressedIndex = 1928,
                Sound        = SoundList.ButtonA,
                Hint         = GameLanguage.Rotate
            };
            RotateButton.Click += (o, e) => Flip();

            CloseButton = new MirButton
            {
                HoverIndex   = 1924,
                Index        = 1923,
                Location     = new Point(82, 19),
                Library      = Libraries.Prguse,
                Parent       = this,
                PressedIndex = 1925,
                Sound        = SoundList.ButtonA,
                Hint         = string.Format(GameLanguage.Close, CMain.InputKeys.GetKey(KeybindOptions.Belt))
            };
            CloseButton.Click += (o, e) => Hide();

            Grid = new MirItemCell[2];

            for (int x = 0; x < 2; x++)
            {
                Grid[x] = new MirItemCell
                {
                    ItemSlot = x,
                    Size     = new Size(32, 32),
                    GridType = MirGridType.HeroInventory,
                    Library  = Libraries.Items,
                    Parent   = this,
                    Location = new Point(x * 35 + 12, 3),
                };
            }
        }
Esempio n. 19
0
        public TradeDialog()
        {
            Index    = 389;
            Library  = Libraries.Prguse;
            Movable  = true;
            Size     = new Size(204, 152);
            Location = new Point((Settings.ScreenWidth / 2) - Size.Width - 10, Settings.ScreenHeight - 350);
            Sort     = true;

            #region Buttons
            ConfirmButton = new MirButton
            {
                Index        = 520,
                HoverIndex   = 521,
                Location     = new Point(135, 120),
                Size         = new Size(48, 25),
                Library      = Libraries.Title,
                Parent       = this,
                PressedIndex = 522,
                Sound        = SoundList.ButtonA,
            };
            ConfirmButton.Click += (o, e) =>
            {
                ChangeLockState(!GameScene.User.TradeLocked);
                Network.Enqueue(new C.TradeConfirm {
                    Locked = GameScene.User.TradeLocked
                });
            };

            CloseButton = new MirButton
            {
                HoverIndex   = 361,
                Index        = 360,
                Location     = new Point(Size.Width - 23, 3),
                Library      = Libraries.Prguse2,
                Parent       = this,
                PressedIndex = 362,
                Sound        = SoundList.ButtonA,
            };
            CloseButton.Click += (o, e) =>
            {
                Hide();
                GameScene.Scene.GuestTradeDialog.Hide();
                TradeCancel();
            };

            #endregion

            #region Host labels
            NameLabel = new MirLabel
            {
                Parent     = this,
                Location   = new Point(20, 10),
                Size       = new Size(150, 14),
                DrawFormat = TextFormatFlags.HorizontalCenter | TextFormatFlags.VerticalCenter,
                NotControl = true,
            };

            GoldLabel = new MirLabel
            {
                DrawFormat = TextFormatFlags.HorizontalCenter | TextFormatFlags.VerticalCenter,
                Font       = new Font(Settings.FontName, 8F),
                Location   = new Point(35, 123),
                Parent     = this,
                Size       = new Size(90, 15),
                Sound      = SoundList.Gold,
            };
            GoldLabel.Click += (o, e) =>
            {
                if (GameScene.SelectedCell == null && GameScene.Gold > 0)
                {
                    MirAmountBox amountBox = new MirAmountBox("Trade Amount:", 116, GameScene.Gold);

                    amountBox.OKButton.Click += (c, a) =>
                    {
                        if (amountBox.Amount > 0)
                        {
                            GameScene.User.TradeGoldAmount += amountBox.Amount;
                            Network.Enqueue(new C.TradeGold {
                                Amount = amountBox.Amount
                            });

                            RefreshInterface();
                        }
                    };

                    amountBox.Show();
                    GameScene.PickedUpGold = false;
                }
            };
            #endregion

            #region Grids
            Grid = new MirItemCell[5 * 2];

            for (int x = 0; x < 5; x++)
            {
                for (int y = 0; y < 2; y++)
                {
                    Grid[2 * x + y] = new MirItemCell
                    {
                        ItemSlot = 2 * x + y,
                        GridType = MirGridType.Trade,
                        Parent   = this,
                        Location = new Point(x * 36 + 10 + x, y * 32 + 39 + y),
                    };
                }
            }
            #endregion
        }
Esempio n. 20
0
        public GuestItemRentingDialog()
        {
            Index    = 238;
            Library  = Libraries.Prguse;
            Movable  = true;
            Size     = new Size(204, 109);
            Location = new Point(Settings.ScreenWidth - Size.Width - Size.Width / 2, Size.Height * 2 + Size.Height / 2 + 15);
            Sort     = true;

            _lockButton = new MirButton
            {
                Index    = 250,
                Location = new Point(18, 76),
                Size     = new Size(28, 25),
                Library  = Libraries.Prguse,
                Parent   = this,
                Enabled  = false
            };

            _setRentalPeriodButton = new MirButton
            {
                Index    = 7,
                Location = new Point(46, 76),
                Size     = new Size(84, 28),
                Library  = Libraries.Prguse3,
                Parent   = this,
                Enabled  = false
            };

            _confirmButton = new MirButton
            {
                Index    = 10,
                Location = new Point(130, 76),
                Size     = new Size(58, 28),
                Library  = Libraries.Prguse3,
                Parent   = this,
                Enabled  = false
            };

            _nameLabel = new MirLabel
            {
                Parent     = this,
                Location   = new Point(30, 8),
                Size       = new Size(150, 14),
                DrawFormat = TextFormatFlags.HorizontalCenter | TextFormatFlags.VerticalCenter,
                NotControl = true,
            };

            _rentalPeriodLabel = new MirLabel
            {
                Parent     = this,
                Location   = new Point(60, 42),
                Size       = new Size(150, 14),
                DrawFormat = TextFormatFlags.Left | TextFormatFlags.VerticalCenter,
                NotControl = true,
                Text       = "Rental Period: 0 Days"
            };

            _guestItemCell = new MirItemCell
            {
                BorderColour = Color.Lime,
                GridType     = MirGridType.GuestRenting,
                Library      = Libraries.Items,
                Parent       = this,
                Location     = new Point(16, 35),
                ItemSlot     = 0,
            };
        }
Esempio n. 21
0
 public static void UseItem(MirItemCell Cell)
 {
 }
Esempio n. 22
0
        public TrustMerchantDialog()
        {
            Index   = 670;
            Library = Libraries.Prguse;
            Sort    = true;


            TitleLabel = new MirImageControl
            {
                Index    = 24,
                Library  = Libraries.Title,
                Location = new Point(18, 9),
                Parent   = this
            };

            SearchTextBox = new MirTextBox
            {
                Location     = new Point(19, 329),
                Parent       = this,
                Size         = new Size(104, 15),
                MaxLength    = 20,
                CanLoseFocus = true
            };
            SearchTextBox.TextBox.KeyPress += SearchTextBox_KeyPress;
            SearchTextBox.TextBox.KeyUp    += SearchTextBox_KeyUp;
            SearchTextBox.TextBox.KeyDown  += SearchTextBox_KeyDown;

            FindButton = new MirButton
            {
                HoverIndex   = 481,
                Index        = 480,
                Location     = new Point(130, 325),
                Library      = Libraries.Title,
                Parent       = this,
                PressedIndex = 482,
                Sound        = SoundList.ButtonA,
            };
            FindButton.Click += (o, e) =>
            {
                if (string.IsNullOrEmpty(SearchTextBox.Text))
                {
                    return;
                }
                if (CMain.Time < SearchTime)
                {
                    GameScene.Scene.ChatDialog.ReceiveChat(string.Format("You can search again after {0} seconds.", Math.Ceiling((SearchTime - CMain.Time) / 1000D)), ChatType.System);
                    return;
                }

                SearchTime = CMain.Time + Globals.SearchDelay;
                Network.Enqueue(new C.MarketSearch
                {
                    Match = SearchTextBox.Text,
                });
            };

            RefreshButton = new MirButton
            {
                HoverIndex   = 664,
                Index        = 663,
                Location     = new Point(190, 325),
                Library      = Libraries.Prguse,
                Parent       = this,
                PressedIndex = 665,
                Sound        = SoundList.ButtonA,
            };
            RefreshButton.Click += (o, e) =>
            {
                if (CMain.Time < SearchTime)
                {
                    GameScene.Scene.ChatDialog.ReceiveChat(string.Format("You can search again after {0} seconds.", Math.Ceiling((SearchTime - CMain.Time) / 1000D)), ChatType.System);
                    return;
                }
                SearchTime         = CMain.Time + Globals.SearchDelay;
                SearchTextBox.Text = string.Empty;
                Network.Enqueue(new C.MarketRefresh());
            };


            MailButton = new MirButton
            {
                HoverIndex   = 667,
                Index        = 666,
                Location     = new Point(225, 325),
                Library      = Libraries.Prguse,
                Parent       = this,
                PressedIndex = 668,
                Sound        = SoundList.ButtonA,
                Visible      = false
            };

            BuyButton = new MirButton
            {
                HoverIndex   = 484,
                Index        = 483,
                Location     = new Point(400, 325),
                Library      = Libraries.Title,
                Parent       = this,
                PressedIndex = 485,
                Sound        = SoundList.ButtonA,
            };
            BuyButton.Click += (o, e) =>
            {
                if (Selected == null || CMain.Time < MarketTime)
                {
                    return;
                }

                if (UserMode)
                {
                    if (Selected.Listing.Seller == "For Sale")
                    {
                        MirMessageBox box = new MirMessageBox(string.Format("{0} has not sold, Are you sure you want to get it back?", Selected.Listing.Item.FriendlyName), MirMessageBoxButtons.YesNo);
                        box.YesButton.Click += (o1, e2) =>
                        {
                            MarketTime = CMain.Time + 3000;
                            Network.Enqueue(new C.MarketGetBack {
                                AuctionID = Selected.Listing.AuctionID
                            });
                        };
                        box.Show();
                    }
                    else
                    {
                        MarketTime = CMain.Time + 3000;
                        Network.Enqueue(new C.MarketGetBack {
                            AuctionID = Selected.Listing.AuctionID
                        });
                    }
                }
                else
                {
                    MirMessageBox box = new MirMessageBox(string.Format("Are you sure you want to buy {0} for {1}?", Selected.Listing.Item.FriendlyName, Selected.Listing.Price), MirMessageBoxButtons.YesNo);
                    box.YesButton.Click += (o1, e2) =>
                    {
                        MarketTime = CMain.Time + 3000;
                        Network.Enqueue(new C.MarketBuy {
                            AuctionID = Selected.Listing.AuctionID
                        });
                    };
                    box.Show();
                }
            };


            BackButton = new MirButton
            {
                Index        = 398,
                Location     = new Point(189, 298),
                Library      = Libraries.Prguse,
                Parent       = this,
                PressedIndex = 399,
                Sound        = SoundList.ButtonA,
            };
            BackButton.Click += (o, e) =>
            {
                if (Page <= 0)
                {
                    return;
                }

                Page--;
                UpdateInterface();
            };

            NextButton = new MirButton
            {
                Index        = 396,
                Location     = new Point(283, 298),
                Library      = Libraries.Prguse,
                Parent       = this,
                PressedIndex = 397,
                Sound        = SoundList.ButtonA,
            };
            NextButton.Click += (o, e) =>
            {
                if (Page >= PageCount - 1)
                {
                    return;
                }
                if (Page < (Listings.Count - 1) / 10)
                {
                    Page++;
                    UpdateInterface();
                    return;
                }

                Network.Enqueue(new C.MarketPage {
                    Page = Page + 1
                });
            };

            CloseButton = new MirButton
            {
                HoverIndex   = 361,
                Index        = 360,
                Location     = new Point(462, 3),
                Library      = Libraries.Prguse2,
                Parent       = this,
                PressedIndex = 362,
                Sound        = SoundList.ButtonA,
            };
            CloseButton.Click += (o, e) => Hide();

            PageLabel = new MirLabel
            {
                Location   = new Point(207, 298),
                Size       = new Size(70, 18),
                DrawFormat = TextFormatFlags.HorizontalCenter,
                Parent     = this,
                NotControl = true,
                Text       = "0/0",
            };


            NameLabel = new MirLabel
            {
                AutoSize   = true,
                ForeColour = Color.Yellow,
                Location   = new Point(20, 240),
                Parent     = this,
                NotControl = true,
            };
            TotalPriceLabel = new MirLabel
            {
                AutoSize   = true,
                Location   = new Point(20, 256),
                Parent     = this,
                NotControl = true,
            };
            SplitPriceLabel = new MirLabel
            {
                AutoSize   = true,
                Location   = new Point(20, 272),
                Parent     = this,
                NotControl = true,
            };

            DateLabel = new MirLabel
            {
                AutoSize   = true,
                Location   = new Point(250, 245),
                Parent     = this,
                NotControl = true,
                Text       = "Start Date:"
            };

            ExpireLabel = new MirLabel
            {
                AutoSize   = true,
                Location   = new Point(250, 265),
                Parent     = this,
                NotControl = true,
                Text       = "Expire Date:"
            };

            ItemLabel = new MirLabel
            {
                Location   = new Point(7, 32),
                Size       = new Size(142, 22),
                DrawFormat = TextFormatFlags.HorizontalCenter | TextFormatFlags.VerticalCenter,
                Parent     = this,
                NotControl = true,
                Text       = "Item",
            };

            PriceLabel = new MirLabel
            {
                Location   = new Point(148, 32),
                Size       = new Size(180, 22),
                DrawFormat = TextFormatFlags.HorizontalCenter | TextFormatFlags.VerticalCenter,
                Parent     = this,
                NotControl = true,
                Text       = "Price",
            };

            SellerLabel = new MirLabel
            {
                Location   = new Point(327, 32),
                Size       = new Size(150, 22),
                DrawFormat = TextFormatFlags.HorizontalCenter | TextFormatFlags.VerticalCenter,
                Parent     = this,
                NotControl = true,
                Text       = "Seller",
            };

            for (int i = 0; i < Rows.Length; i++)
            {
                Rows[i] = new AuctionRow
                {
                    Location = new Point(8, 54 + i * 18),
                    Parent   = this
                };
                Rows[i].Click += (o, e) =>
                {
                    Selected = (AuctionRow)o;
                    UpdateInterface();
                };
            }


            ItemCell = new MirItemCell
            {
                ItemSlot = 0,
                GridType = MirGridType.TrustMerchant,
                Library  = Libraries.Items,
                Parent   = this,
                Location = new Point(195, 248),
            };
        }
Esempio n. 23
0
        public InventoryDialog()
        {
            Index   = 196;
            Library = Libraries.Title;
            Movable = true;
            Sort    = true;
            Visible = false;

            WeightBar = new MirImageControl
            {
                Index      = 24,
                Library    = Libraries.Prguse,
                Location   = new Point(182, 217),
                Parent     = this,
                DrawImage  = false,
                NotControl = true,
            };

            ItemButton = new MirButton
            {
                Index    = 197,
                Library  = Libraries.Title,
                Location = new Point(6, 7),
                Parent   = this,
                Size     = new Size(72, 23),
                Sound    = SoundList.ButtonA,
            };
            ItemButton.Click += Button_Click;

            ItemButton2 = new MirButton
            {
                Index    = 738,
                Library  = Libraries.Title,
                Location = new Point(76, 7),
                Parent   = this,
                Size     = new Size(72, 23),
                Sound    = SoundList.ButtonA,
            };
            ItemButton2.Click += Button_Click;

            QuestButton = new MirButton
            {
                Index    = 739,
                Library  = Libraries.Title,
                Location = new Point(146, 7),
                Parent   = this,
                Size     = new Size(72, 23),
                Sound    = SoundList.ButtonA,
            };
            QuestButton.Click += Button_Click;

            AddButton = new MirButton
            {
                Index        = 483,
                HoverIndex   = 484,
                PressedIndex = 485,
                Library      = Libraries.Title,
                Location     = new Point(235, 5),
                Parent       = this,
                Size         = new Size(72, 23),
                Sound        = SoundList.ButtonA,
                Visible      = false,
            };
            AddButton.Click += (o1, e) =>
            {
                int           openLevel  = (GameScene.User.Inventory.Length - 46) / 4;
                int           openGold   = (1000000 + openLevel * 1000000);
                MirMessageBox messageBox = new MirMessageBox(string.Format("Are you sure you would like to unlock 4 extra slots for {0:###,###} gold ?\n" +
                                                                           "This will take your inventory space up to {1} slots in total.", openGold, GameScene.User.Inventory.Length + 4), MirMessageBoxButtons.OKCancel);

                messageBox.OKButton.Click += (o, a) =>
                {
                    Network.Enqueue(new C.Chat {
                        Message = "@ADDINVENTORY"
                    });
                };
                messageBox.Show();
            };

            CloseButton = new MirButton
            {
                HoverIndex   = 361,
                Index        = 360,
                Location     = new Point(289, 3),
                Library      = Libraries.Prguse2,
                Parent       = this,
                PressedIndex = 362,
                Sound        = SoundList.ButtonA,
            };
            CloseButton.Click += (o, e) => Hide();

            GoldLabel = new MirLabel
            {
                Parent   = this,
                Location = new Point(40, 212),
                Size     = new Size(111, 14),
                Sound    = SoundList.Gold,
            };
            GoldLabel.Click += (o, e) =>
            {
                if (GameScene.SelectedCell == null)
                {
                    GameScene.PickedUpGold = !GameScene.PickedUpGold && GameScene.Gold > 0;
                }
            };


            Grid = new MirItemCell[8 * 10];

            for (int x = 0; x < 8; x++)
            {
                for (int y = 0; y < 10; y++)
                {
                    int idx = 8 * y + x;
                    Grid[idx] = new MirItemCell
                    {
                        ItemSlot = 6 + idx,
                        GridType = MirGridType.Inventory,
                        Library  = Libraries.Items,
                        Parent   = this,
                        Location = new Point(x * 36 + 9 + x, y % 5 * 32 + 37 + y % 5),
                    };

                    if (idx >= 40)
                    {
                        Grid[idx].Visible = false;
                    }
                }
            }

            QuestGrid = new MirItemCell[8 * 5];

            for (int x = 0; x < 8; x++)
            {
                for (int y = 0; y < 5; y++)
                {
                    QuestGrid[8 * y + x] = new MirItemCell
                    {
                        ItemSlot = 8 * y + x,
                        GridType = MirGridType.QuestInventory,
                        Library  = Libraries.Items,
                        Parent   = this,
                        Location = new Point(x * 36 + 9 + x, y * 32 + 37 + y),
                        Visible  = false
                    };
                }
            }

            WeightLabel = new MirLabel
            {
                Parent   = this,
                Location = new Point(268, 212),
                Size     = new Size(26, 14)
            };
            WeightBar.BeforeDraw += WeightBar_BeforeDraw;

            for (int i = 0; i < LockBar.Length; i++)
            {
                LockBar[i] = new MirImageControl
                {
                    Index      = 307,
                    Library    = Libraries.Prguse2,
                    Location   = new Point(9 + i % 2 * 148, 37 + i / 2 * 33),
                    Parent     = this,
                    DrawImage  = true,
                    NotControl = true,
                    Visible    = false,
                };
            }
        }
Esempio n. 24
0
        public SocketingDialog()
        {
            Index    = 143;
            Library  = Libraries.EdensEliteInter;
            Location = new Point(Settings.ScreenWidth / 2 - this.Size.Width / 2, Settings.ScreenHeight / 2 - this.Size.Height / 2);
            Sort     = true;
            Movable  = true;

            CloseBtn = new MirButton
            {
                Parent       = this,
                Library      = Libraries.Prguse2,
                Location     = new Point(236, 0),
                Index        = 7,
                HoverIndex   = 8,
                PressedIndex = 9,
                Sound        = SoundList.ButtonA,
                Hint         = "Exit"
            };
            CloseBtn.Click += (o, e) => Hide();

            AplyBtn = new MirButton
            {
                Parent       = this,
                Library      = Libraries.CustomTitle,
                Location     = new Point(160, 20),
                Index        = 712,
                HoverIndex   = 713,
                PressedIndex = 714,
                Sound        = SoundList.ButtonA,
                Hint         = "Forge"
            };
            AplyBtn.Click += (o, e) => Hide();



            SocketsContainer = new MirImageControl
            {
                Index    = 28,
                Library  = Libraries.EdensEliteInter,
                Location = new Point(12, 56),
                Parent   = this,
            };

            RuneSlots[0] = new MirImageControl
            {
                Index    = 989,
                Library  = Libraries.Prguse,
                Parent   = this,
                Location = new Point(100, 18),
            };
            //  Main Item
            ItemCells[0] = new MirItemCell
            {
                BorderColour = Color.OrangeRed,
                GridType     = MirGridType.Socketing,
                Library      = Libraries.Items,
                Parent       = RuneSlots[0],
                Location     = new Point(2, 2),
                ItemSlot     = 0,
                Hint         = "Place your Item here."
            };
            RuneSlots[1] = new MirImageControl
            {
                Index    = 16,
                Library  = Libraries.Prguse2,
                Parent   = SocketsContainer,
                Location = new Point(32, 9),
                Visible  = false
            };
            //  Runes
            ItemCells[1] = new MirItemCell
            {
                BorderColour = Color.Aqua,
                GridType     = MirGridType.Socketing,
                Library      = Libraries.Items,
                Parent       = RuneSlots[1],
                Location     = new Point(2, 2),
                ItemSlot     = 1,
                Visible      = false,
                Hint         = "Place your Rune here."
            };
            RuneSlots[2] = new MirImageControl
            {
                Index    = 16,
                Library  = Libraries.Prguse2,
                Parent   = SocketsContainer,
                Location = new Point(96, 9),
                Visible  = false
            };
            ItemCells[2] = new MirItemCell
            {
                BorderColour = Color.Aqua,
                GridType     = MirGridType.Socketing,
                Library      = Libraries.Items,
                Parent       = RuneSlots[2],
                Location     = new Point(2, 2),
                ItemSlot     = 2,
                Visible      = false,
                Hint         = "Place your Rune here."
            };
            RuneSlots[3] = new MirImageControl
            {
                Index    = 16,
                Library  = Libraries.Prguse2,
                Parent   = SocketsContainer,
                Location = new Point(160, 9),
                Visible  = false
            };
            ItemCells[3] = new MirItemCell
            {
                BorderColour = Color.Aqua,
                GridType     = MirGridType.Socketing,
                Library      = Libraries.Items,
                Parent       = RuneSlots[3],
                Location     = new Point(2, 2),
                ItemSlot     = 3,
                Visible      = false,
                Hint         = "Place your Rune here."
            };
        }
Esempio n. 25
0
        static CharacterDialog()
        {
            Window = new MirImageControl
            {
                Index    = 504,
                Library  = Libraries.Title,
                Location = new Point(536, 0),
                Parent   = GameScene.Scene,
                Movable  = true,
                Sort     = true,
                Visible  = false,
            };
            Window.VisibleChanged += new EventHandler(Window_VisibleChanged);

            CharacterPage = new MirImageControl
            {
                Index    = 345,
                Parent   = Window,
                Library  = Libraries.Prguse,
                Location = new Point(8, 90),
            };
            CharacterPage.AfterDraw += new EventHandler(CharacterPage_AfterDraw);

            StatusPage = new MirImageControl
            {
                Index    = 506,
                Parent   = Window,
                Library  = Libraries.Title,
                Location = new Point(8, 90),
                Visible  = false,
            };
            StatusPage.BeforeDraw += new EventHandler(StatusPage_BeforeDraw);

            StatePage = new MirImageControl
            {
                Index    = 507,
                Parent   = Window,
                Library  = Libraries.Title,
                Location = new Point(8, 90),
                Visible  = false
            };
            StatePage.BeforeDraw += new EventHandler(StatePage_BeforeDraw);

            SkillPage = new MirImageControl
            {
                Index    = 508,
                Parent   = Window,
                Library  = Libraries.Title,
                Location = new Point(8, 90),
                Visible  = false
            };


            CharacterButton = new MirButton
            {
                Index        = 500,
                Library      = Libraries.Title,
                Location     = new Point(8, 70),
                Parent       = Window,
                PressedIndex = 500,
                Size         = new Size(64, 20),
                Sound        = SoundList.ClickA,
            };
            CharacterButton.Click += new EventHandler(CharacterButton_Click);

            StatusButton = new MirButton
            {
                Library      = Libraries.Title,
                Location     = new Point(70, 70),
                Parent       = Window,
                PressedIndex = 501,
                Size         = new Size(64, 20),
                Sound        = SoundList.ClickA
            };
            StatusButton.Click += new EventHandler(StatusButton_Click);

            StateButton = new MirButton
            {
                Library      = Libraries.Title,
                Location     = new Point(132, 70),
                Parent       = Window,
                PressedIndex = 502,
                Size         = new Size(64, 20),
                Sound        = SoundList.ClickA
            };
            StateButton.Click += new EventHandler(StateButton_Click);

            SkillButton = new MirButton
            {
                Library      = Libraries.Title,
                Location     = new Point(194, 70),
                Parent       = Window,
                PressedIndex = 503,
                Size         = new Size(64, 20),
                Sound        = SoundList.ClickA
            };
            SkillButton.Click += new EventHandler(SkillButton_Click);

            CloseButton = new MirButton
            {
                HoverIndex   = 361,
                Index        = 360,
                Location     = new Point(241, 3),
                Library      = Libraries.Prguse2,
                Parent       = Window,
                PressedIndex = 362,
                Sound        = SoundList.ClickA,
            };
            CloseButton.Click += new EventHandler(CloseButton_Click);

            NameLabel = new MirLabel
            {
                DrawFormat = DrawTextFormat.VerticalCenter | DrawTextFormat.Center,
                Parent     = Window,
                Location   = new Point(50, 12),
                Size       = new Size(190, 20),
                NotControl = true,
            };
            ClassImage = new MirImageControl
            {
                Index      = 100,
                Library    = Libraries.Prguse,
                Location   = new Point(15, 33),
                Parent     = Window,
                NotControl = true,
            };

            WeaponCell = new MirItemCell
            {
                ItemSlot = (int)MirEquipmentSlot.Weapon,
                GridType = MirGridType.Equipment,
                Parent   = CharacterPage,
                Location = new Point(125, 7),
            };

            ArmorCell = new MirItemCell
            {
                ItemSlot = (int)MirEquipmentSlot.Armour,
                GridType = MirGridType.Equipment,
                Parent   = CharacterPage,
                Location = new Point(164, 7),
            };

            HelmetCell = new MirItemCell
            {
                ItemSlot = (int)MirEquipmentSlot.Helmet,
                GridType = MirGridType.Equipment,
                Parent   = CharacterPage,
                Location = new Point(203, 7),
            };


            TorchCell = new MirItemCell
            {
                ItemSlot = (int)MirEquipmentSlot.Torch,
                GridType = MirGridType.Equipment,
                Parent   = CharacterPage,
                Location = new Point(203, 134),
            };

            NecklaceCell = new MirItemCell
            {
                ItemSlot = (int)MirEquipmentSlot.Necklace,
                GridType = MirGridType.Equipment,
                Parent   = CharacterPage,
                Location = new Point(203, 98),
            };

            BraceletLCell = new MirItemCell
            {
                ItemSlot = (int)MirEquipmentSlot.BraceletL,
                GridType = MirGridType.Equipment,
                Parent   = CharacterPage,
                Location = new Point(8, 170),
            };
            BraceletRCell = new MirItemCell
            {
                ItemSlot = (int)MirEquipmentSlot.BraceletR,
                GridType = MirGridType.Equipment,
                Parent   = CharacterPage,
                Location = new Point(203, 170),
            };
            RingLCell = new MirItemCell
            {
                ItemSlot = (int)MirEquipmentSlot.RingL,
                GridType = MirGridType.Equipment,
                Parent   = CharacterPage,
                Location = new Point(8, 206),
            };
            RingRCell = new MirItemCell
            {
                ItemSlot = (int)MirEquipmentSlot.RingR,
                GridType = MirGridType.Equipment,
                Parent   = CharacterPage,
                Location = new Point(203, 206),
            };

            AmuletCell = new MirItemCell
            {
                ItemSlot = (int)MirEquipmentSlot.Amulet,
                GridType = MirGridType.Equipment,
                Parent   = CharacterPage,
                Location = new Point(8, 241),
            };

            BootsCell = new MirItemCell
            {
                ItemSlot = (int)MirEquipmentSlot.Boots,
                GridType = MirGridType.Equipment,
                Parent   = CharacterPage,
                Location = new Point(47, 241),
            };
            BeltCell = new MirItemCell
            {
                ItemSlot = (int)MirEquipmentSlot.Belt,
                GridType = MirGridType.Equipment,
                Parent   = CharacterPage,
                Location = new Point(86, 241),
            };

            StoneCell = new MirItemCell
            {
                ItemSlot = (int)MirEquipmentSlot.Stone,
                GridType = MirGridType.Equipment,
                Parent   = CharacterPage,
                Location = new Point(125, 241),
            };


            ACLabel = new MirLabel
            {
                AutoSize   = true,
                Parent     = StatusPage,
                Location   = new Point(105, 62),
                NotControl = true,
                Text       = "0-0"
            };

            MACLabel = new MirLabel
            {
                AutoSize   = true,
                Parent     = StatusPage,
                Location   = new Point(105, 89),
                NotControl = true,
                Text       = "0-0"
            };

            DCLabel = new MirLabel
            {
                AutoSize   = true,
                Parent     = StatusPage,
                Location   = new Point(105, 115),
                NotControl = true,
                Text       = "0-0"
            };

            MCLabel = new MirLabel
            {
                AutoSize   = true,
                Parent     = StatusPage,
                Location   = new Point(105, 143),
                NotControl = true,
                Text       = "0-0"
            };
            SCLabel = new MirLabel
            {
                AutoSize   = true,
                Parent     = StatusPage,
                Location   = new Point(105, 170),
                NotControl = true,
                Text       = "0-0"
            };
            HealthLabel = new MirLabel
            {
                AutoSize   = true,
                Parent     = StatusPage,
                Location   = new Point(105, 196),
                NotControl = true,
                Text       = "0/0"
            };
            ManaLabel = new MirLabel
            {
                AutoSize   = true,
                Parent     = StatusPage,
                Location   = new Point(105, 222),
                NotControl = true,
                Text       = "0/0"
            };

            HeadingLabel = new MirLabel
            {
                AutoSize   = true,
                Parent     = StatePage,
                Location   = new Point(10, 59),
                NotControl = true,
                Text       = "Experience\nBag Weight\nBody Weight\nHand Weight\nAccuracy\nAgility\nMagic Resist\nPoison Resist\nHealth Regen\nMana Regen\nLuck\nHoly"
            };
            StatLabel = new MirLabel
            {
                AutoSize   = true,
                Parent     = StatePage,
                Location   = new Point(120, 59),
                NotControl = true,
            };
        }
Esempio n. 26
0
    void Update()
    {
        if (shopController.IsShopWindowOpen())
        {
            Debug.Log("ShopControllerIsActive");
            if (Inventory.UseShopInventoryControls())
            {
                return;
            }
        }

        if (SelectedItemImage.gameObject.activeSelf)
        {
            SelectedItemImage.transform.position = Input.mousePosition;
            SelectedItemImage.transform.SetAsLastSibling();
        }

        MouseObject = GetMouseObject();

        if (Input.GetKeyDown(KeyCode.Tab))
        {
            if (Time.time > PickUpTime)
            {
                PickUpTime = Time.time + 0.2f;
                Network.Enqueue(new C.PickUp());
            }
        }

        if (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift))
        {
            if (Input.GetMouseButton(0))
            {
                if (!eventSystem.IsPointerOverGameObject() && CanAttack())
                {
                    GameManager.InputDelay = Time.time + 0.5f;
                    NextHitTime            = Time.time + 1.6f;
                    QueuedAction           = new QueuedAction {
                        Action = MirAction.Attack, Direction = GameManager.MouseUpdate(), Location = User.Player.CurrentLocation
                    };
                }
                return;
            }
            else if (TargetObject != null && !(TargetObject is MonsterObject) && !TargetObject.Dead && TargetObject.gameObject.activeSelf && CanAttack())
            {
                Point self = new Point(User.Player.CurrentLocation.x, User.Player.CurrentLocation.y);
                Point targ = new Point(TargetObject.CurrentLocation.x, TargetObject.CurrentLocation.y);
                if (Functions.InRange(self, targ, 1))
                {
                    NextHitTime = Time.time + 1.6f;
                    MirDirection direction = Functions.DirectionFromPoint(self, targ);
                    QueuedAction = new QueuedAction {
                        Action = MirAction.Attack, Direction = direction, Location = User.Player.CurrentLocation
                    };
                    return;
                }

                MirDirection targetdirection = Functions.DirectionFromPoint(self, targ);

                if (!CanWalk(targetdirection))
                {
                    return;
                }

                QueuedAction = new QueuedAction {
                    Action = MirAction.Walking, Direction = targetdirection, Location = ClientFunctions.VectorMove(User.Player.CurrentLocation, targetdirection, 1)
                };
            }
        }

        if (Input.GetMouseButtonUp(0) && !eventSystem.IsPointerOverGameObject() && Time.time > GameManager.InputDelay)
        {
            if (SelectedCell != null)
            {
                SelectedItemImage.gameObject.SetActive(false);

                MessageBox.Show($"Drop {SelectedCell.Item.Name}?", okbutton: true, cancelbutton: true);
                MessageBox.OK += () =>
                {
                    Network.Enqueue(new C.DropItem {
                        UniqueID = SelectedCell.Item.UniqueID, Count = 1
                    });
                    SelectedCell.Locked = true;
                    SelectedCell        = null;
                };
                MessageBox.Cancel += () =>
                {
                    Debug.Log("CancelInvoke");
                    SelectedCell = null;
                };
                return;
            }
        }

        if (Input.GetMouseButton(0) && SelectedCell == null && !eventSystem.IsPointerOverGameObject() && Time.time > GameManager.InputDelay)
        {
            GameManager.User.CanRun = false;

            if (MouseObject != null)
            {
                switch (MouseObject.gameObject.layer)
                {
                case 9:     //Monster
                    MonsterObject monster = (MonsterObject)MouseObject;
                    if (monster.Dead)
                    {
                        break;
                    }
                    TargetObject           = monster;
                    GameManager.InputDelay = Time.time + 0.5f;
                    return;

                case 10:     //NPC
                    NPCObject npc = (NPCObject)MouseObject;
                    NPCName = npc.Name;
                    NPCID   = npc.ObjectID;
                    NPCCamera.transform.SetParent(npc.CameraLocation.transform, false);
                    Network.Enqueue(new C.CallNPC {
                        ObjectID = npc.ObjectID, Key = "[@Main]"
                    });
                    GameManager.InputDelay = Time.time + 0.5f;
                    return;
                }
            }

            TargetObject = null;
            GameManager.CheckMouseInput();
        }
        else if (Input.GetMouseButton(1) && !eventSystem.IsPointerOverGameObject())
        {
            GameManager.CheckMouseInput();
        }
        else
        {
            GameManager.User.CanRun = false;
            if (TargetObject != null && TargetObject is MonsterObject && !TargetObject.Dead && TargetObject.gameObject.activeSelf && CanAttack())
            {
                Point self = new Point(User.Player.CurrentLocation.x, User.Player.CurrentLocation.y);
                Point targ = new Point(TargetObject.CurrentLocation.x, TargetObject.CurrentLocation.y);
                if (Functions.InRange(self, targ, 1))
                {
                    NextHitTime = Time.time + 1.6f;
                    MirDirection direction = Functions.DirectionFromPoint(self, targ);
                    QueuedAction = new QueuedAction {
                        Action = MirAction.Attack, Direction = direction, Location = User.Player.CurrentLocation
                    };
                    return;
                }

                MirDirection targetdirection = Functions.DirectionFromPoint(self, targ);

                if (!CanWalk(targetdirection))
                {
                    return;
                }

                QueuedAction = new QueuedAction {
                    Action = MirAction.Walking, Direction = targetdirection, Location = ClientFunctions.VectorMove(User.Player.CurrentLocation, targetdirection, 1)
                };
            }
        }
    }
Esempio n. 27
0
    private void MoveItem()
    {
        if (GridType == MirGridType.BuyBack || GridType == MirGridType.DropPanel || GridType == MirGridType.Inspect || GridType == MirGridType.TrustMerchant || GridType == MirGridType.Craft)
        {
            return;
        }

        if (GameScene.SelectedCell != null)
        {
            if (GameScene.SelectedCell.Item == null || GameScene.SelectedCell == this)
            {
                GameScene.SelectedCell = null;
                return;
            }

            switch (GridType)
            {
                #region To Inventory
            case MirGridType.Inventory:     // To Inventory
                switch (GameScene.SelectedCell.GridType)
                {
                    #region From Inventory
                case MirGridType.Inventory:         //From Invenotry
                    if (Item != null)
                    {
                        /*if (CMain.Ctrl)
                         * {
                         *  MirMessageBox messageBox = new MirMessageBox("Do you want to try and combine these items?", MirMessageBoxButtons.YesNo);
                         *  messageBox.YesButton.Click += (o, e) =>
                         *  {
                         *      //Combine
                         *      Network.Enqueue(new C.CombineItem { IDFrom = GameScene.SelectedCell.Item.UniqueID, IDTo = Item.UniqueID });
                         *      Locked = true;
                         *      GameScene.SelectedCell.Locked = true;
                         *      GameScene.SelectedCell = null;
                         *  };
                         *
                         *  messageBox.Show();
                         *  return;
                         * }*/

                        if (GameScene.SelectedCell.Item.Info == Item.Info && Item.Count < Item.Info.StackSize)
                        {
                            //Merge
                            Network.Enqueue(new C.MergeItem {
                                GridFrom = GameScene.SelectedCell.GridType, GridTo = GridType, IDFrom = GameScene.SelectedCell.Item.UniqueID, IDTo = Item.UniqueID
                            });

                            Locked = true;
                            GameScene.SelectedCell.Locked = true;
                            GameScene.SelectedCell        = null;
                            return;
                        }
                    }

                    Network.Enqueue(new C.MoveItem {
                        Grid = GridType, From = GameScene.SelectedCell.ItemSlot, To = ItemSlot
                    });

                    Locked = true;
                    GameScene.SelectedCell.Locked = true;
                    GameScene.SelectedCell        = null;
                    return;

                    #endregion

                    #region From Equipment
                case MirGridType.Equipment:         //From Equipment
                    if (Item != null && GameScene.SelectedCell.Item.Info.Type == ItemType.Amulet)
                    {
                        if (GameScene.SelectedCell.Item.Info == Item.Info && Item.Count < Item.Info.StackSize)
                        {
                            Network.Enqueue(new C.MergeItem {
                                GridFrom = GameScene.SelectedCell.GridType, GridTo = GridType, IDFrom = GameScene.SelectedCell.Item.UniqueID, IDTo = Item.UniqueID
                            });

                            Locked = true;
                            GameScene.SelectedCell.Locked = true;
                            GameScene.SelectedCell        = null;
                            return;
                        }
                    }

                    if (!CanRemoveItem(GameScene.SelectedCell.Item))
                    {
                        GameScene.SelectedCell = null;
                        return;
                    }
                    if (Item == null)
                    {
                        Network.Enqueue(new C.RemoveItem {
                            Grid = GridType, UniqueID = GameScene.SelectedCell.Item.UniqueID, To = ItemSlot
                        });

                        Locked = true;
                        GameScene.SelectedCell.Locked = true;
                        GameScene.SelectedCell        = null;
                        return;
                    }

                    for (int x = 6; x < ItemArray.Length; x++)
                    {
                        if (ItemArray[x] == null)
                        {
                            Network.Enqueue(new C.RemoveItem {
                                Grid = GridType, UniqueID = GameScene.SelectedCell.Item.UniqueID, To = x
                            });

                            MirItemCell temp = x < GameManager.User.BeltIdx ? GameScene.BeltCells[x] : GameScene.Inventory.Cells[x - GameManager.User.BeltIdx];

                            if (temp != null)
                            {
                                temp.Locked = true;
                            }
                            GameScene.SelectedCell.Locked = true;
                            GameScene.SelectedCell        = null;
                            return;
                        }
                    }
                    break;
                    #endregion
                }
                break;
                #endregion

                #region To Equipment
            case MirGridType.Equipment:     //To Equipment

                if (GameScene.SelectedCell.GridType != MirGridType.Inventory && GameScene.SelectedCell.GridType != MirGridType.Storage)
                {
                    return;
                }


                if (Item != null && GameScene.SelectedCell.Item.Info.Type == ItemType.Amulet)
                {
                    if (GameScene.SelectedCell.Item.Info == Item.Info && Item.Count < Item.Info.StackSize)
                    {
                        Network.Enqueue(new C.MergeItem {
                            GridFrom = GameScene.SelectedCell.GridType, GridTo = GridType, IDFrom = GameScene.SelectedCell.Item.UniqueID, IDTo = Item.UniqueID
                        });

                        Locked = true;
                        GameScene.SelectedCell.Locked = true;
                        GameScene.SelectedCell        = null;
                        return;
                    }
                }

                if (CorrectSlot(GameScene.SelectedCell.Item))
                {
                    if (CanWearItem(GameScene.SelectedCell.Item))
                    {
                        Network.Enqueue(new C.EquipItem {
                            Grid = GameScene.SelectedCell.GridType, UniqueID = GameScene.SelectedCell.Item.UniqueID, To = ItemSlot
                        });
                        Locked = true;
                        GameScene.SelectedCell.Locked = true;
                    }
                    GameScene.SelectedCell = null;
                }
                return;

                #endregion
            }

            return;
        }

        if (Item != null)
        {
            GameScene.SelectedCell = this;
        }
    }
Esempio n. 28
0
        public HeroInventoryDialog()
        {
            Index   = 1422;
            Library = Libraries.Prguse;
            Movable = true;
            Sort    = true;
            Visible = false;

            CloseButton = new MirButton
            {
                HoverIndex   = 361,
                Index        = 360,
                Location     = new Point(299, 2),
                Library      = Libraries.Prguse2,
                Parent       = this,
                PressedIndex = 362,
                Sound        = SoundList.ButtonA,
            };
            CloseButton.Click += (o, e) => Hide();

            Grid = new MirItemCell[8 * 5];

            for (int x = 0; x < 8; x++)
            {
                for (int y = 0; y < 5; y++)
                {
                    int idx = 8 * y + x;
                    Grid[idx] = new MirItemCell
                    {
                        ItemSlot = 2 + idx,
                        GridType = MirGridType.HeroInventory,
                        Library  = Libraries.Items,
                        Parent   = this,
                        Location = new Point(x * 36 + 14 + x, y % 5 * 32 + 23 + y % 5),
                    };

                    if (idx >= 40)
                    {
                        Grid[idx].Visible = false;
                    }
                }
            }

            for (int i = 0; i < LockBar.Length; i++)
            {
                LockBar[i] = new MirImageControl
                {
                    Index      = 1423,
                    Library    = Libraries.Prguse,
                    Location   = new Point(14, 56 + i * 33),
                    Parent     = this,
                    DrawImage  = true,
                    NotControl = true,
                    Visible    = false,
                };
            }

            HPLockBar = new MirImageControl
            {
                Index      = 1428,
                Library    = Libraries.Prguse,
                Location   = new Point(57, 196),
                Parent     = this,
                DrawImage  = true,
                NotControl = true,
                Visible    = false,
            };

            MPLockBar = new MirImageControl
            {
                Index      = 1429,
                Library    = Libraries.Prguse,
                Location   = new Point(162, 196),
                Parent     = this,
                DrawImage  = true,
                NotControl = true,
                Visible    = false,
            };

            HPButton = new MirButton
            {
                Index        = 560,
                HoverIndex   = 561,
                PressedIndex = 562,
                Library      = Libraries.Title,
                Location     = new Point(58, Size.Height - 60),
                Parent       = this,
                Size         = new Size(60, 25),
                Sound        = SoundList.ButtonA,
                Visible      = false,
            };
            HPButton.Click += (o1, e) =>
            {
                MirAmountBox amountBox = new MirAmountBox("Enter a value", 116, 99);
                amountBox.OKButton.Click += (o, a) => Network.Enqueue(new C.SetAutoPotValue {
                    Stat = Stat.HP, Value = amountBox.Amount
                });
                amountBox.Show();
            };

            MPButton = new MirButton
            {
                Index        = 563,
                HoverIndex   = 564,
                PressedIndex = 565,
                Library      = Libraries.Title,
                Location     = new Point(206, Size.Height - 60),
                Parent       = this,
                Size         = new Size(60, 25),
                Sound        = SoundList.ButtonA,
                Visible      = false,
            };
            MPButton.Click += (o1, e) =>
            {
                MirAmountBox amountBox = new MirAmountBox("Enter a value", 116, 99);
                amountBox.OKButton.Click += (o, a) => Network.Enqueue(new C.SetAutoPotValue {
                    Stat = Stat.MP, Value = amountBox.Amount
                });
                amountBox.Show();
            };

            AutoHPPercentLabel = new MirLabel
            {
                Parent     = this,
                Location   = new Point(HPButton.Location.X, HPButton.Location.Y + 27),
                AutoSize   = false,
                Size       = new Size(60, 25),
                DrawFormat = TextFormatFlags.HorizontalCenter,
                Visible    = false
            };

            AutoMPPercentLabel = new MirLabel
            {
                Parent     = this,
                Location   = new Point(MPButton.Location.X, MPButton.Location.Y + 27),
                AutoSize   = false,
                Size       = new Size(60, 25),
                DrawFormat = TextFormatFlags.HorizontalCenter,
                Visible    = false
            };

            HPItem = new MirItemCell
            {
                ItemSlot = 0,
                GridType = MirGridType.HeroHPItem,
                Library  = Libraries.Items,
                Parent   = this,
                Location = new Point(HPButton.Location.X + 64, HPButton.Location.Y + 5),
                Visible  = false
            };

            MPItem = new MirItemCell
            {
                ItemSlot = 0,
                GridType = MirGridType.HeroMPItem,
                Library  = Libraries.Items,
                Parent   = this,
                Location = new Point(MPButton.Location.X - 40, MPButton.Location.Y + 5),
                Visible  = false
            };

            RefreshInterface();
        }
Esempio n. 29
0
        public ItemRentingDialog()
        {
            Index    = 238;
            Library  = Libraries.Prguse;
            Movable  = true;
            Size     = new Size(204, 109);
            Location = new Point(Settings.ScreenWidth - Size.Width - Size.Width / 2, Size.Height * 2 + Size.Height / 2 + 15);
            Sort     = true;

            // Confirm Button

            _confirmButton = new MirButton
            {
                Index        = 10,
                HoverIndex   = 11,
                Location     = new Point(130, 76),
                Size         = new Size(58, 28),
                Library      = Libraries.Prguse3,
                Parent       = this,
                PressedIndex = 12,
                Sound        = SoundList.ButtonA,
                Enabled      = false
            };
            _confirmButton.Click += (o, e) =>
            {
                Network.Enqueue(new C.ConfirmItemRental());
            };

            // Close Button

            var closeButton = new MirButton
            {
                HoverIndex   = 361,
                Index        = 360,
                Location     = new Point(180, 3),
                Library      = Libraries.Prguse2,
                Parent       = this,
                PressedIndex = 362,
                Sound        = SoundList.ButtonA,
            };

            closeButton.Click += (sender, args) =>
            {
                CancelItemRental();
            };

            // Lock Button

            _lockButton = new MirButton
            {
                Index        = 250,
                HoverIndex   = 251,
                Location     = new Point(18, 76),
                Size         = new Size(28, 25),
                Library      = Libraries.Prguse,
                Parent       = this,
                PressedIndex = 252,
                Sound        = SoundList.ButtonA,
            };
            _lockButton.Click += (o, e) =>
            {
                if (RentalPeriod < 1 || RentalPeriod > 30)
                {
                    return;
                }

                Network.Enqueue(new C.ItemRentalLockItem());
            };

            // Set Rental Period Button

            _setRentalPeriodButton = new MirButton
            {
                Index        = 7,
                HoverIndex   = 8,
                Location     = new Point(46, 76),
                Size         = new Size(84, 28),
                Library      = Libraries.Prguse3,
                Parent       = this,
                PressedIndex = 9,
                Sound        = SoundList.ButtonA,
            };
            _setRentalPeriodButton.Click += (o, e) =>
            {
                InputRentalPeroid();
            };

            // Name Label

            _nameLabel = new MirLabel
            {
                Parent     = this,
                Location   = new Point(30, 8),
                Size       = new Size(150, 14),
                DrawFormat = TextFormatFlags.HorizontalCenter | TextFormatFlags.VerticalCenter,
                NotControl = true,
            };

            // Rental Period Label

            _rentalPeriodLabel = new MirLabel
            {
                Parent     = this,
                Location   = new Point(60, 42),
                Size       = new Size(150, 14),
                DrawFormat = TextFormatFlags.Left | TextFormatFlags.VerticalCenter,
                NotControl = true,
            };

            // Item Cell

            ItemCell = new MirItemCell
            {
                BorderColour = Color.Lime,
                GridType     = MirGridType.Renting,
                Library      = Libraries.Items,
                Parent       = this,
                Location     = new Point(16, 35),
                ItemSlot     = 0,
            };
        }
Esempio n. 30
0
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Return))
        {
            if (ChatBar.gameObject.activeSelf)
            {
                if (ChatBar.text.Length > 0)
                {
                    Network.Enqueue(new C.Chat()
                    {
                        Message = ChatBar.text
                    });
                }
                ChatBar.text = string.Empty;
                ChatBar.gameObject.SetActive(false);
            }
            else
            {
                ChatBar.gameObject.SetActive(true);
                ChatBar.Select();
            }
        }

        if (SelectedItemImage.gameObject.activeSelf)
        {
            SelectedItemImage.transform.position = Input.mousePosition;
            SelectedItemImage.transform.SetAsLastSibling();
        }

        MouseObject = GetMouseObject();

        if (Input.GetKeyDown(KeyCode.Tab))
        {
            if (Time.time > PickUpTime)
            {
                PickUpTime = Time.time + 0.2f;
                Network.Enqueue(new C.PickUp());
            }
        }

        if (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift))
        {
            if (Input.GetMouseButton(0))
            {
                if (!eventSystem.IsPointerOverGameObject() && CanAttack())
                {
                    GameManager.InputDelay = Time.time + 0.5f;
                    NextHitTime            = Time.time + 1.6f;
                    QueuedAction           = new QueuedAction {
                        Action = MirAction.Attack, Direction = GameManager.MouseUpdate(), Location = User.Player.CurrentLocation
                    };
                }
                return;
            }
            else if (TargetObject != null && !(TargetObject is MonsterObject) && !TargetObject.Dead && TargetObject.gameObject.activeSelf && CanAttack())
            {
                Point self = new Point((int)User.Player.CurrentLocation.x, (int)User.Player.CurrentLocation.y);
                Point targ = new Point((int)TargetObject.CurrentLocation.x, (int)TargetObject.CurrentLocation.y);
                if (Functions.InRange(self, targ, 1))
                {
                    NextHitTime = Time.time + 1.6f;
                    MirDirection direction = Functions.DirectionFromPoint(self, targ);
                    QueuedAction = new QueuedAction {
                        Action = MirAction.Attack, Direction = direction, Location = User.Player.CurrentLocation
                    };
                    return;
                }

                MirDirection targetdirection = Functions.DirectionFromPoint(self, targ);

                if (!CanWalk(targetdirection))
                {
                    return;
                }

                QueuedAction = new QueuedAction {
                    Action = MirAction.Walking, Direction = targetdirection, Location = ClientFunctions.VectorMove(User.Player.CurrentLocation, targetdirection, 1)
                };
            }
        }

        if (Input.GetMouseButton(0) && !eventSystem.IsPointerOverGameObject())
        {
            GameManager.User.CanRun = false;

            if (SelectedCell != null)
            {
                SelectedItemImage.gameObject.SetActive(false);

                MessageBox.Show($"Drop {SelectedCell.Item.Name}?", true, true);
                MessageBox.OK += () =>
                {
                    Network.Enqueue(new C.DropItem {
                        UniqueID = SelectedCell.Item.UniqueID, Count = 1
                    });
                    SelectedCell.Locked = true;
                    SelectedCell        = null;
                };
                MessageBox.Cancel += () =>
                {
                    SelectedCell = null;
                };
                return;
            }

            if (MouseObject != null)
            {
                switch (MouseObject.gameObject.layer)
                {
                case 9:     //Monster
                    MonsterObject monster = (MonsterObject)MouseObject;
                    if (monster.Dead)
                    {
                        break;
                    }
                    TargetObject = monster;
                    return;
                }
            }

            TargetObject = null;
            GameManager.CheckMouseInput();
        }
        else if (Input.GetMouseButton(1) && !eventSystem.IsPointerOverGameObject())
        {
            GameManager.CheckMouseInput();
        }
        else
        {
            GameManager.User.CanRun = false;
            if (TargetObject != null && TargetObject is MonsterObject && !TargetObject.Dead && TargetObject.gameObject.activeSelf && CanAttack())
            {
                Point self = new Point((int)User.Player.CurrentLocation.x, (int)User.Player.CurrentLocation.y);
                Point targ = new Point((int)TargetObject.CurrentLocation.x, (int)TargetObject.CurrentLocation.y);
                if (Functions.InRange(self, targ, 1))
                {
                    NextHitTime = Time.time + 1.6f;
                    MirDirection direction = Functions.DirectionFromPoint(self, targ);
                    QueuedAction = new QueuedAction {
                        Action = MirAction.Attack, Direction = direction, Location = User.Player.CurrentLocation
                    };
                    return;
                }

                MirDirection targetdirection = Functions.DirectionFromPoint(self, targ);

                if (!CanWalk(targetdirection))
                {
                    return;
                }

                QueuedAction = new QueuedAction {
                    Action = MirAction.Walking, Direction = targetdirection, Location = ClientFunctions.VectorMove(User.Player.CurrentLocation, targetdirection, 1)
                };
            }
        }
    }