Beispiel #1
0
        private void OverlayRenderCurrentPath()
        {
            if (AmeisenBot.WowInterface.MovementEngine.Path != null &&
                AmeisenBot.WowInterface.MovementEngine.Path.Count > 0)
            {
                List <Vector3> currentNodes = AmeisenBot.WowInterface.MovementEngine.Path.ToList();

                for (int i = 0; i < currentNodes.Count; ++i)
                {
                    Vector3 start = currentNodes[i];
                    Vector3 end   = i == 0 ? AmeisenBot.WowInterface.ObjectManager.Player.Position : currentNodes[i - 1];

                    System.Drawing.Color lineColor = System.Drawing.Color.White;
                    System.Drawing.Color startDot  = System.Drawing.Color.Cyan;
                    System.Drawing.Color endDot    = i == 0 ? System.Drawing.Color.Orange : i == currentNodes.Count ? System.Drawing.Color.Orange : System.Drawing.Color.Cyan;

                    Memory.Win32.Rect windowRect = XMemory.GetWindowPosition(AmeisenBot.WowInterface.XMemory.Process.MainWindowHandle);
                    if (OverlayMath.WorldToScreen(windowRect, AmeisenBot.WowInterface.ObjectManager.Camera, start, out System.Drawing.Point startPoint) &&
                        OverlayMath.WorldToScreen(windowRect, AmeisenBot.WowInterface.ObjectManager.Camera, end, out System.Drawing.Point endPoint))
                    {
                        Overlay.AddLine(startPoint.X, startPoint.Y, endPoint.X, endPoint.Y, lineColor);
                        Overlay.AddRectangle(startPoint.X - 4, startPoint.Y - 4, 7, 7, startDot);
                        Overlay.AddRectangle(endPoint.X - 4, endPoint.Y - 4, 7, 7, endDot);
                    }
                }
            }
        }
Beispiel #2
0
        private void OverlayRenderCurrentPath()
        {
            if (AmeisenBot.Bot.Movement.Path != null &&
                AmeisenBot.Bot.Movement.Path.Any())
            {
                // explicitly copy the path as it might change during rendering
                List <Vector3> currentNodes = AmeisenBot.Bot.Movement.Path.ToList();

                for (int i = 0; i < currentNodes.Count; ++i)
                {
                    Vector3 start = currentNodes[i];
                    Vector3 end   = i == 0 ? AmeisenBot.Bot.Player.Position : currentNodes[i - 1];

                    System.Drawing.Color lineColor = System.Drawing.Color.White;
                    System.Drawing.Color startDot  = System.Drawing.Color.Cyan;
                    System.Drawing.Color endDot    = i == 0 ? System.Drawing.Color.Orange : i == currentNodes.Count ? System.Drawing.Color.Orange : System.Drawing.Color.Cyan;

                    Memory.Win32.Rect windowRect = AmeisenBot.Bot.Memory.GetClientSize();

                    if (OverlayMath.WorldToScreen(windowRect, AmeisenBot.Bot.Objects.Camera, start, out System.Drawing.Point startPoint) &&
                        OverlayMath.WorldToScreen(windowRect, AmeisenBot.Bot.Objects.Camera, end, out System.Drawing.Point endPoint))
                    {
                        Overlay.AddLine(startPoint.X, startPoint.Y, endPoint.X, endPoint.Y, lineColor);
                        Overlay.AddRectangle(startPoint.X - 4, startPoint.Y - 4, 7, 7, startDot);
                        Overlay.AddRectangle(endPoint.X - 4, endPoint.Y - 4, 7, 7, endDot);
                    }
                }
            }
        }
Beispiel #3
0
        private void OnObjectUpdateComplete(List <WowObject> wowObjects)
        {
            Dispatcher.InvokeAsync(() =>
            {
                // debug label stuff
                if (AmeisenBot.WowInterface.BattlegroundEngine != null)
                {
                    string ownCarrier   = string.Empty;
                    string enemyCarrier = string.Empty;
                    bool isMeCarrier    = false;

                    if (AmeisenBot.WowInterface.BattlegroundEngine.BattlegroundProfile?.BattlegroundType == Core.Battleground.Enums.BattlegroundType.CaptureTheFlag)
                    {
                        ICtfBattlegroundProfile ctfBattlegroundProfile = (ICtfBattlegroundProfile)AmeisenBot.WowInterface.BattlegroundEngine.BattlegroundProfile;
                        ownCarrier   = ctfBattlegroundProfile.OwnFlagCarrierPlayer?.Name;
                        enemyCarrier = ctfBattlegroundProfile.EnemyFlagCarrierPlayer?.Name;
                        isMeCarrier  = ctfBattlegroundProfile.IsMeFlagCarrier;
                    }
                }

                if (AmeisenBot.WowInterface.ObjectManager?.Player != null)
                {
                    labelDebug.Content = AmeisenBot.WowInterface.ObjectManager.Player.Position;
                }

                // update health and secodary power bar and
                // the colors corresponding to the class
                switch (AmeisenBot.WowInterface.ObjectManager.Player.Class)
                {
                case WowClass.Deathknight:
                    UpdateBotInfo(AmeisenBot.WowInterface.ObjectManager.Player.MaxRuneenergy, AmeisenBot.WowInterface.ObjectManager.Player.Runeenergy, dkPrimaryBrush, dkSecondaryBrush);
                    break;

                case WowClass.Druid:
                    UpdateBotInfo(AmeisenBot.WowInterface.ObjectManager.Player.MaxMana, AmeisenBot.WowInterface.ObjectManager.Player.Mana, druidPrimaryBrush, druidSecondaryBrush);
                    break;

                case WowClass.Hunter:
                    UpdateBotInfo(AmeisenBot.WowInterface.ObjectManager.Player.MaxMana, AmeisenBot.WowInterface.ObjectManager.Player.Mana, hunterPrimaryBrush, hunterSecondaryBrush);
                    break;

                case WowClass.Mage:
                    UpdateBotInfo(AmeisenBot.WowInterface.ObjectManager.Player.MaxMana, AmeisenBot.WowInterface.ObjectManager.Player.Mana, magePrimaryBrush, mageSecondaryBrush);
                    break;

                case WowClass.Paladin:
                    UpdateBotInfo(AmeisenBot.WowInterface.ObjectManager.Player.MaxMana, AmeisenBot.WowInterface.ObjectManager.Player.Mana, paladinPrimaryBrush, paladinSecondaryBrush);
                    break;

                case WowClass.Priest:
                    UpdateBotInfo(AmeisenBot.WowInterface.ObjectManager.Player.MaxMana, AmeisenBot.WowInterface.ObjectManager.Player.Mana, priestPrimaryBrush, priestSecondaryBrush);
                    break;

                case WowClass.Rogue:
                    UpdateBotInfo(AmeisenBot.WowInterface.ObjectManager.Player.MaxEnergy, AmeisenBot.WowInterface.ObjectManager.Player.Energy, roguePrimaryBrush, rogueSecondaryBrush);
                    break;

                case WowClass.Shaman:
                    UpdateBotInfo(AmeisenBot.WowInterface.ObjectManager.Player.MaxMana, AmeisenBot.WowInterface.ObjectManager.Player.Mana, shamanPrimaryBrush, shamanSecondaryBrush);
                    break;

                case WowClass.Warlock:
                    UpdateBotInfo(AmeisenBot.WowInterface.ObjectManager.Player.MaxMana, AmeisenBot.WowInterface.ObjectManager.Player.Mana, warlockPrimaryBrush, warlockSecondaryBrush);
                    break;

                case WowClass.Warrior:
                    UpdateBotInfo(AmeisenBot.WowInterface.ObjectManager.Player.MaxRage, AmeisenBot.WowInterface.ObjectManager.Player.Rage, warriorPrimaryBrush, warriorSecondaryBrush);
                    break;
                }

                // update the ms label every second
                if (LastStateMachineTickUpdate + TimeSpan.FromSeconds(1) < DateTime.Now)
                {
                    UpdateBottomLabels();
                    LastStateMachineTickUpdate = DateTime.Now;
                }

                if (Overlay == null)
                {
                    Overlay = new AmeisenBotOverlay(AmeisenBot.WowInterface.XMemory);
                }
                else
                {
                    if (DrawOverlay)
                    {
                        if (AmeisenBot.WowInterface.MovementEngine.Path != null &&
                            AmeisenBot.WowInterface.MovementEngine.Path.Count > 0)
                        {
                            for (int i = 0; i < AmeisenBot.WowInterface.MovementEngine.Path.Count && i < 10; ++i)
                            {
                                Vector3 start = AmeisenBot.WowInterface.MovementEngine.Path[i];
                                Vector3 end   = i == 0 ? AmeisenBot.WowInterface.ObjectManager.Player.Position : AmeisenBot.WowInterface.MovementEngine.Path[i - 1];

                                Color lineColor = Colors.LightCyan;
                                Color startDot  = Colors.Cyan;
                                Color endDot    = i == 0 ? Colors.Navy : Colors.Cyan;

                                Memory.Win32.Rect windowRect = XMemory.GetWindowPosition(AmeisenBot.WowInterface.XMemory.Process.MainWindowHandle);
                                if (OverlayMath.WorldToScreen(windowRect, AmeisenBot.WowInterface.ObjectManager.Camera, start, out Point startPoint) &&
                                    OverlayMath.WorldToScreen(windowRect, AmeisenBot.WowInterface.ObjectManager.Camera, end, out Point endPoint))
                                {
                                    Overlay.AddLine((int)startPoint.X, (int)startPoint.Y, (int)endPoint.X, (int)endPoint.Y, lineColor);
                                    Overlay.AddRectangle((int)startPoint.X - 3, (int)startPoint.Y - 3, 5, 5, startDot);
                                    Overlay.AddRectangle((int)endPoint.X - 3, (int)endPoint.Y - 3, 5, 5, endDot);
                                }
                            }
                        }

                        if (AmeisenBot.WowInterface.DungeonEngine.Nodes != null &&
                            AmeisenBot.WowInterface.DungeonEngine.Nodes.Count > 0)
                        {
                            for (int i = 0; i < AmeisenBot.WowInterface.DungeonEngine.Nodes.Count && i < 32; ++i)
                            {
                                Vector3 start = AmeisenBot.WowInterface.DungeonEngine.Nodes[i].Position;
                                Vector3 end   = i == 0 ? AmeisenBot.WowInterface.ObjectManager.Player.Position : AmeisenBot.WowInterface.DungeonEngine.Nodes[i - 1].Position;

                                Color lineColor = Colors.White;
                                Color startDot  = Colors.Gray;
                                Color endDot    = i == 0 ? Colors.Orange : Colors.Gray;

                                Memory.Win32.Rect windowRect = XMemory.GetWindowPosition(AmeisenBot.WowInterface.XMemory.Process.MainWindowHandle);
                                if (OverlayMath.WorldToScreen(windowRect, AmeisenBot.WowInterface.ObjectManager.Camera, start, out Point startPoint) &&
                                    OverlayMath.WorldToScreen(windowRect, AmeisenBot.WowInterface.ObjectManager.Camera, end, out Point endPoint))
                                {
                                    Overlay.AddLine((int)startPoint.X, (int)startPoint.Y, (int)endPoint.X, (int)endPoint.Y, lineColor);
                                    Overlay.AddRectangle((int)startPoint.X - 3, (int)startPoint.Y - 3, 5, 5, startDot);
                                    Overlay.AddRectangle((int)endPoint.X - 3, (int)endPoint.Y - 3, 5, 5, endDot);
                                }
                            }
                        }

                        Overlay?.Draw();
                    }
                    else
                    {
                        Overlay.Clear();
                    }
                }
            });
        }