コード例 #1
0
        public static bool WaitForPanel(this Player client, InterfacePanel panel, TimeSpan timeout)
        {
            var startTime = DateTime.Now;

            while (true)
            {
                client.Update(PlayerFieldFlags.GameClient);

                var activePanel = client.GameClient.ActivePanel;

                if (activePanel.IsSameAs(panel))
                {
                    return(true);
                }

                var delaTime = DateTime.Now - startTime;

                if (timeout != TimeSpan.Zero && delaTime >= timeout)
                {
                    break;
                }

                Thread.Sleep(1);
            }

            return(false);
        }
コード例 #2
0
        public static bool IsSharedPanel(this InterfacePanel panel, InterfacePanel target)
        {
            if (panel == InterfacePanel.TemuairSkills && target == InterfacePanel.MedeniaSkills)
            return true;

              if (panel == InterfacePanel.MedeniaSkills && target == InterfacePanel.TemuairSkills)
            return true;

              if (panel == InterfacePanel.TemuairSpells && target == InterfacePanel.MedeniaSpells)
            return true;

              if (panel == InterfacePanel.MedeniaSpells && target == InterfacePanel.TemuairSpells)
            return true;

              if (panel == InterfacePanel.Chat && target == InterfacePanel.ChatHistory)
            return true;

              if (panel == InterfacePanel.ChatHistory && target == InterfacePanel.Chat)
            return true;

              if (panel == InterfacePanel.Stats && target == InterfacePanel.Modifiers)
            return true;

              if (panel == InterfacePanel.Modifiers && target == InterfacePanel.Stats)
            return true;

              return false;
        }
コード例 #3
0
        public static Point ToSlotPoint(this InterfacePanel panel, int slot, bool isExpandedInventory = false, int iconWidth = 35, int iconHeight = 35)
        {
            Point pt;

            if (isExpandedInventory)
            {
                pt = new Point(110, 285);
            }
            else
            {
                pt = new Point(110, 350);
            }

            slot = slot % (Inventory.InventoryCount + 1);

            var rowSize      = panel.IsWorldPanel() ? 6 : 12;
            var rowOffset    = 0;
            var columnOffset = (panel == InterfacePanel.WorldSpells) ? 6 : 0;

            var row    = ((slot - 1) / rowSize) + rowOffset;
            var column = ((slot - 1) % rowSize) + columnOffset;

            pt.Offset(column * iconWidth, row * iconHeight);

            return(pt);
        }
コード例 #4
0
        private void Compile(string path, InterfacePanel res)
        {
            Writer.Write((int)Type.Panel);
            var cpanel = new CPanel();

            cpanel.Base  = new CElement(res);
            cpanel.Image = Compile(path, res.Image);
            cpanel.Write(Writer);
        }
コード例 #5
0
        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);
        }
コード例 #6
0
        public static Point ToPoint(this InterfacePanel panel)
        {
            var pt = new Point(545, 0);

            switch (panel)
            {
            case InterfacePanel.Inventory:
                pt.Y = 340;
                break;

            case InterfacePanel.TemuairSkills:
                pt.Y = 360;
                break;

            case InterfacePanel.MedeniaSkills:
                goto case InterfacePanel.TemuairSkills;

            case InterfacePanel.TemuairSpells:
                pt.Y = 390;
                break;

            case InterfacePanel.MedeniaSpells:
                goto case InterfacePanel.TemuairSpells;

            case InterfacePanel.Chat:
                pt.Y = 410;
                break;

            case InterfacePanel.ChatHistory:
                goto case InterfacePanel.Chat;

            case InterfacePanel.Stats:
                pt.Y = 435;
                break;

            case InterfacePanel.Modifiers:
                goto case InterfacePanel.Stats;

            case InterfacePanel.WorldSkills:
                pt.Y = 460;
                break;

            case InterfacePanel.WorldSpells:
                goto case InterfacePanel.WorldSkills;

            default:
                pt = new Point(-1, -1);
                break;
            }

            return(pt);
        }
コード例 #7
0
        static int GetRelativeSlot(this InterfacePanel panel, int slot)
        {
            int maxSlotCount = 36;

            if (panel == InterfacePanel.Inventory)
            {
                maxSlotCount = 60;
            }

            if (panel.IsWorldPanel())
            {
                maxSlotCount = 18;
            }

            return(slot % maxSlotCount);
        }
コード例 #8
0
        public static bool IsSharedPanel(this InterfacePanel panel, InterfacePanel target)
        {
            if (panel == InterfacePanel.TemuairSkills && target == InterfacePanel.MedeniaSkills)
            {
                return(true);
            }

            if (panel == InterfacePanel.MedeniaSkills && target == InterfacePanel.TemuairSkills)
            {
                return(true);
            }

            if (panel == InterfacePanel.TemuairSpells && target == InterfacePanel.MedeniaSpells)
            {
                return(true);
            }

            if (panel == InterfacePanel.MedeniaSpells && target == InterfacePanel.TemuairSpells)
            {
                return(true);
            }

            if (panel == InterfacePanel.Chat && target == InterfacePanel.ChatHistory)
            {
                return(true);
            }

            if (panel == InterfacePanel.ChatHistory && target == InterfacePanel.Chat)
            {
                return(true);
            }

            if (panel == InterfacePanel.Stats && target == InterfacePanel.Modifiers)
            {
                return(true);
            }

            if (panel == InterfacePanel.Modifiers && target == InterfacePanel.Stats)
            {
                return(true);
            }

            return(false);
        }
コード例 #9
0
 public static bool IsTemuairToMedenia(this InterfacePanel panel, InterfacePanel target)
 {
     return (panel == InterfacePanel.TemuairSkills && target == InterfacePanel.MedeniaSkills) ||
      (panel == InterfacePanel.TemuairSpells && target == InterfacePanel.MedeniaSpells);
 }
コード例 #10
0
 public static bool SwitchToPanelAndWait(this Player client, InterfacePanel panel, out bool didRequireSwitch, bool useShiftKey = true)
 {
     return(SwitchToPanelAndWait(client, panel, TimeSpan.Zero, out didRequireSwitch, useShiftKey));
 }
コード例 #11
0
 public static bool IsSameAs(this InterfacePanel panel, InterfacePanel target)
 {
     return panel == target || (panel.IsWorldPanel() && target.IsWorldPanel());
 }
コード例 #12
0
 public static bool SwitchToPanelAndWait(this Player client, InterfacePanel panel, TimeSpan timeout, out bool didRequireSwitch, bool useShiftKey = true)
 {
     SwitchToPanel(client, panel, out didRequireSwitch, useShiftKey);
     return(WaitForPanel(client, panel, timeout));
 }
コード例 #13
0
 public static bool IsSpellPanel(this InterfacePanel panel)
 {
     return(panel == InterfacePanel.TemuairSpells ||
            panel == InterfacePanel.MedeniaSpells ||
            panel == InterfacePanel.WorldSpells);
 }
コード例 #14
0
 public static bool IsWorldPanel(this InterfacePanel panel)
 {
     return(panel == InterfacePanel.WorldSkills || panel == InterfacePanel.WorldSpells);
 }
コード例 #15
0
 public static bool IsMedeniaPanel(this InterfacePanel panel)
 {
     return(panel == InterfacePanel.MedeniaSkills || panel == InterfacePanel.MedeniaSpells);
 }
コード例 #16
0
 public static bool IsTemuairPanel(this InterfacePanel panel)
 {
     return(!IsMedeniaPanel(panel) && !IsWorldPanel(panel));
 }
コード例 #17
0
 public static bool IsSameAs(this InterfacePanel panel, InterfacePanel target)
 {
     return(panel == target || (panel.IsWorldPanel() && target.IsWorldPanel()));
 }
コード例 #18
0
        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);
            }
        }
コード例 #19
0
 public static bool IsMedeniaToTemuair(this InterfacePanel panel, InterfacePanel target)
 {
     return((panel == InterfacePanel.MedeniaSkills && target == InterfacePanel.TemuairSkills) ||
            (panel == InterfacePanel.MedeniaSpells && target == InterfacePanel.TemuairSpells));
 }
コード例 #20
0
        protected override void MacroLoop(object argument)
        {
            client.Update(PlayerFieldFlags.GameClient);

            if (client.GameClient.IsUserChatting)
            {
                SetPlayerStatus(PlayerMacroStatus.ChatIsUp);
                return;
            }

            var didUseSkill  = false;
            var didCastSpell = false;
            var didFlower    = false;

            var            preserveUserPanel = UserSettingsManager.Instance.Settings.PreserveUserPanel;
            InterfacePanel currentPanel      = InterfacePanel.Stats;

            if (preserveUserPanel)
            {
                client.Update(PlayerFieldFlags.GameClient);
                currentPanel = client.GameClient.ActivePanel;
            }

            if (UserSettingsManager.Instance.Settings.FlowerBeforeSpellMacros)
            {
                didFlower    = DoFlowerMacro();
                didCastSpell = DoSpellMacro();
            }
            else
            {
                didFlower = DoSpellMacro();
                didFlower = DoFlowerMacro();
            }

            bool didAssail = false;

            didUseSkill = DoSkillMacro(out didAssail);

            if (!this.IsSpellCasting)
            {
                client.Spellbook.ActiveSpell = null;
            }

            bool didRequireSwitch;

            if (preserveUserPanel)
            {
                client.SwitchToPanel(currentPanel, out didRequireSwitch);
            }

            if (this.Status == MacroStatus.Running)
            {
                if (this.IsSpellCasting)
                {
                    var spellName = client.Spellbook.ActiveSpell;

                    if (string.Equals(Spell.FasSpioradKey, spellName, StringComparison.OrdinalIgnoreCase))
                    {
                        SetPlayerStatus(PlayerMacroStatus.FasSpiorad);
                    }
                    else if (string.Equals(Spell.LyliacPlantKey, spellName, StringComparison.OrdinalIgnoreCase))
                    {
                        SetPlayerStatus(PlayerMacroStatus.Flowering);
                    }
                    else if (string.Equals(Spell.LyliacVineyardKey, spellName, StringComparison.OrdinalIgnoreCase))
                    {
                        SetPlayerStatus(PlayerMacroStatus.Vineyarding);
                    }
                    else
                    {
                        SetPlayerStatus(PlayerMacroStatus.Casting);
                    }
                }
                else if (this.IsWaitingOnMana)
                {
                    SetPlayerStatus(PlayerMacroStatus.WaitingForMana);
                }
                else if (this.FlowerAlternateCharacters)
                {
                    SetPlayerStatus(PlayerMacroStatus.ReadyToFlower);
                }
                else if (this.UseLyliacVineyard)
                {
                    SetPlayerStatus(PlayerMacroStatus.WaitingOnVineyard);
                }
                else if (didUseSkill)
                {
                    SetPlayerStatus(PlayerMacroStatus.UsingSkills);
                }
                else if (didAssail)
                {
                    SetPlayerStatus(PlayerMacroStatus.Assailing);
                }
                else
                {
                    if (this.flowerQueue.Count > 0)
                    {
                        SetPlayerStatus(PlayerMacroStatus.ReadyToFlower);
                    }
                    else if (client.Skillbook.ActiveSkills.Count() > 0)
                    {
                        SetPlayerStatus(PlayerMacroStatus.Waiting);
                    }
                    else
                    {
                        SetPlayerStatus(PlayerMacroStatus.Idle);
                    }
                }
            }
        }
コード例 #21
0
 public static void WaitForPanel(this Player client, InterfacePanel panel)
 {
     WaitForPanel(client, panel, TimeSpan.Zero);
 }