Exemple #1
0
        private void OnObjectUpdateComplete(IEnumerable <IWowObject> wowObjects)
        {
            Dispatcher.Invoke(() =>
            {
                IWowPlayer player = AmeisenBot.Bot.Player;

                if (player != null)
                {
                    switch (player.Class)
                    {
                    case WowClass.Deathknight:
                        UpdateBotInfo(player.MaxRunicPower, player.RunicPower, WowColors.dkPrimaryBrush, WowColors.dkSecondaryBrush);
                        break;

                    case WowClass.Druid:
                        UpdateBotInfo(player.MaxMana, player.Mana, WowColors.druidPrimaryBrush, WowColors.druidSecondaryBrush);
                        break;

                    case WowClass.Hunter:
                        UpdateBotInfo(player.MaxMana, player.Mana, WowColors.hunterPrimaryBrush, WowColors.hunterSecondaryBrush);
                        break;

                    case WowClass.Mage:
                        UpdateBotInfo(player.MaxMana, player.Mana, WowColors.magePrimaryBrush, WowColors.mageSecondaryBrush);
                        break;

                    case WowClass.Paladin:
                        UpdateBotInfo(player.MaxMana, player.Mana, WowColors.paladinPrimaryBrush, WowColors.paladinSecondaryBrush);
                        break;

                    case WowClass.Priest:
                        UpdateBotInfo(player.MaxMana, player.Mana, WowColors.priestPrimaryBrush, WowColors.priestSecondaryBrush);
                        break;

                    case WowClass.Rogue:
                        UpdateBotInfo(player.MaxEnergy, player.Energy, WowColors.roguePrimaryBrush, WowColors.rogueSecondaryBrush);
                        break;

                    case WowClass.Shaman:
                        UpdateBotInfo(player.MaxMana, player.Mana, WowColors.shamanPrimaryBrush, WowColors.shamanSecondaryBrush);
                        break;

                    case WowClass.Warlock:
                        UpdateBotInfo(player.MaxMana, player.Mana, WowColors.warlockPrimaryBrush, WowColors.warlockSecondaryBrush);
                        break;

                    case WowClass.Warrior:
                        UpdateBotInfo(player.MaxRage, player.Rage, WowColors.warriorPrimaryBrush, WowColors.warriorSecondaryBrush);
                        break;
                    }

                    if (LabelUpdateEvent.Run())
                    {
                        UpdateBottomLabels();
                    }

                    if (DrawOverlay)
                    {
                        Overlay ??= new(AmeisenBot.Bot.Memory.Process.MainWindowHandle);
                        OverlayRenderCurrentPath();

                        Overlay?.Draw();
                        NeedToClearOverlay = true;
                    }
                    else if (NeedToClearOverlay)
                    {
                        Overlay.Clear();
                        NeedToClearOverlay = false;
                    }
                }
            });
        }
Exemple #2
0
        private void OnObjectUpdateComplete(IEnumerable <WowObject> wowObjects)
        {
            Dispatcher.InvokeAsync(() =>
            {
                // Notification Symbol
                // ------------------- >
                if (NotificationEvent.Run())
                {
                    if (!PendingNotification)
                    {
                        WowChatMessage message = AmeisenBot.WowInterface.ChatManager.ChatMessages
                                                 .Where(e => e.Timestamp > NotificationLastTimestamp)
                                                 .FirstOrDefault(e => e.Type == ChatMessageType.WHISPER);

                        if (message != null)
                        {
                            PendingNotification       = true;
                            NotificationLastTimestamp = message.Timestamp;

                            if (message.Flags.Contains("GM", StringComparison.OrdinalIgnoreCase))
                            {
                                NoticifactionColor = new SolidColorBrush(Colors.Cyan);
                            }
                            else
                            {
                                NoticifactionColor = new SolidColorBrush(Colors.Magenta);
                            }
                        }
                    }
                    else
                    {
                        if (NotificationBlinkState)
                        {
                            buttonNotification.Foreground = DarkBackgroundBrush;
                            buttonNotification.Background = NoticifactionColor;
                        }
                        else
                        {
                            buttonNotification.Foreground = new SolidColorBrush(Colors.White);
                            buttonNotification.Background = new SolidColorBrush(Colors.Transparent);
                        }

                        NotificationBlinkState = !NotificationBlinkState;
                    }
                }

                // Update the main view
                // -------------------- >
                WowPlayer player = AmeisenBot.WowInterface.ObjectManager.Player;

                switch (player.Class)
                {
                case WowClass.Deathknight:
                    UpdateBotInfo(player.MaxRuneenergy, player.Runeenergy, WowColors.dkPrimaryBrush, WowColors.dkSecondaryBrush);
                    break;

                case WowClass.Druid:
                    UpdateBotInfo(player.MaxMana, player.Mana, WowColors.druidPrimaryBrush, WowColors.druidSecondaryBrush);
                    break;

                case WowClass.Hunter:
                    UpdateBotInfo(player.MaxMana, player.Mana, WowColors.hunterPrimaryBrush, WowColors.hunterSecondaryBrush);
                    break;

                case WowClass.Mage:
                    UpdateBotInfo(player.MaxMana, player.Mana, WowColors.magePrimaryBrush, WowColors.mageSecondaryBrush);
                    break;

                case WowClass.Paladin:
                    UpdateBotInfo(player.MaxMana, player.Mana, WowColors.paladinPrimaryBrush, WowColors.paladinSecondaryBrush);
                    break;

                case WowClass.Priest:
                    UpdateBotInfo(player.MaxMana, player.Mana, WowColors.priestPrimaryBrush, WowColors.priestSecondaryBrush);
                    break;

                case WowClass.Rogue:
                    UpdateBotInfo(player.MaxEnergy, player.Energy, WowColors.roguePrimaryBrush, WowColors.rogueSecondaryBrush);
                    break;

                case WowClass.Shaman:
                    UpdateBotInfo(player.MaxMana, player.Mana, WowColors.shamanPrimaryBrush, WowColors.shamanSecondaryBrush);
                    break;

                case WowClass.Warlock:
                    UpdateBotInfo(player.MaxMana, player.Mana, WowColors.warlockPrimaryBrush, WowColors.warlockSecondaryBrush);
                    break;

                case WowClass.Warrior:
                    UpdateBotInfo(player.MaxRage, player.Rage, WowColors.warriorPrimaryBrush, WowColors.warriorSecondaryBrush);
                    break;
                }

                // Bottom labels
                // ------------- >
                if (LabelUpdateEvent.Run())
                {
                    UpdateBottomLabels();
                }

                // Overlay drawing
                // --------------- >
                if (DrawOverlay)
                {
                    Overlay ??= new AmeisenBotOverlay(AmeisenBot.WowInterface.XMemory);
                    OverlayRenderCurrentPath();

                    Overlay?.Draw();
                    NeedToClearOverlay = true;
                }
                else if (NeedToClearOverlay)
                {
                    Overlay.Clear();
                    NeedToClearOverlay = false;
                }
            });
        }