public static void Disarm(this Player client)
        {
            client.Update(PlayerFieldFlags.Equipment);

            if (!client.Equipment.IsEmpty(EquipmentSlot.Weapon | EquipmentSlot.Shield))
            {
                WindowAutomator.SendKeystroke(client.Process.WindowHandle, '`');
            }
        }
        public static void ClickSlot(this Player client, InterfacePanel panel, int slot, bool isExpandedInventory = false)
        {
            slot = panel.GetRelativeSlot(slot);

            var pt = panel.ToSlotPoint(slot, isExpandedInventory);

            pt = pt.ScalePoint(client.Process.WindowScaleX, client.Process.WindowScaleY);

            WindowAutomator.SendMouseClick(client.Process.WindowHandle, MouseButton.Left, (int)pt.X, (int)pt.Y);
        }
        public static void CollapseInventory(this Player client)
        {
            var pt = new Point(570, 320);

            pt = pt.ScalePoint(client.Process.WindowScaleX, client.Process.WindowScaleY);

            client.Update(PlayerFieldFlags.GameClient);

            if (client.GameClient.IsInventoryExpanded)
            {
                WindowAutomator.SendMouseClick(client.Process.WindowHandle, MouseButton.Left, (int)pt.X, (int)pt.Y);
            }
        }
 public static void ClickAt(this Player client, double x, double y, bool moveMouseBeforeClick = true)
 {
     WindowAutomator.SendMouseClick(client.Process.WindowHandle, MouseButton.Left, (int)x, (int)y, moveMouseBeforeClick);
 }
 public static void Terminate(this Player client)
 {
     WindowAutomator.SendCloseWindow(client.Process.WindowHandle);
 }
 public static void CancelDialog(this Player client)
 {
     WindowAutomator.SendKeystroke(client.Process.WindowHandle, WindowAutomator.VK_ESCAPE);
 }
 public static void Assail(this Player client)
 {
     WindowAutomator.SendKeystroke(client.Process.WindowHandle, WindowAutomator.VK_SPACE);
 }
        public static void SwitchToPanel(this Player client, InterfacePanel panel, out bool didRequireSwitch, bool useShiftKey = true)
        {
            didRequireSwitch = false;
            var pt = panel.ToPoint();

            pt = pt.ScalePoint(client.Process.WindowScaleX, client.Process.WindowScaleY);

            var x = (int)pt.X;
            var y = (int)pt.Y;

            var hwnd = client.Process.WindowHandle;

            client.Update(PlayerFieldFlags.GameClient);
            var currentPanel = client.GameClient.ActivePanel;

            if (currentPanel.IsSameAs(panel))
            {
                return;
            }

            didRequireSwitch = true;

            // Tem Skills/Spells to Medenia
            if (currentPanel.IsTemuairToMedenia(panel))
            {
                if (useShiftKey)
                {
                    WindowAutomator.SendShiftKeyDown(hwnd);
                }

                WindowAutomator.SendMouseClick(hwnd, MouseButton.Left, x, y);

                if (useShiftKey)
                {
                    WindowAutomator.SendShiftKeyUp(hwnd);
                }
            }
            // Med Skills/Spells to Temuair
            else if (currentPanel.IsMedeniaToTemuair(panel))
            {
                WindowAutomator.SendMouseClick(hwnd, MouseButton.Left, x, y);
            }
            // Switching to Medenia from non-Temuair
            else if (panel.IsMedeniaPanel())
            {
                if (useShiftKey)
                {
                    WindowAutomator.SendShiftKeyDown(hwnd);
                }

                WindowAutomator.SendMouseClick(hwnd, MouseButton.Left, x, y);

                if (!useShiftKey)
                {
                    WindowAutomator.SendMouseClick(hwnd, MouseButton.Left, x, y);
                }

                if (useShiftKey)
                {
                    WindowAutomator.SendShiftKeyUp(hwnd);
                }
            }
            // Switching to Temauir from non-Medenia
            else
            {
                WindowAutomator.SendMouseClick(hwnd, MouseButton.Left, x, y);
            }
        }