コード例 #1
0
ファイル: MainWindow.xaml.cs プロジェクト: jfla15/AmeisenBotX
        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;
                    }

                    labelBgObjective.Content = $"BGEngine State: {AmeisenBot.WowInterface.BattlegroundEngine.CurrentState.Key}\nBGEngine Last State: {AmeisenBot.WowInterface.BattlegroundEngine.LastState}\n\nBGOwnFlagCarrier: {ownCarrier}\nBGEnemyFlagCarrier: {enemyCarrier}\nisMeCarrier: {isMeCarrier}";
                }

                // 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)
                {
                    UpdateExecutionMsLabel();
                    LastStateMachineTickUpdate = DateTime.Now;
                }

                // update the object count label
                labelCurrentObjectCount.Content = AmeisenBot.WowInterface.ObjectManager.WowObjects.Count;
            });
        }
コード例 #2
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();
                    }
                }
            });
        }