private void OnWhisper(long timestamp, List <string> args) { if (!PendingNotification) { WowChatMessage message = AmeisenBot.Bot.Chat.ChatMessages .Where(e => e.Timestamp > NotificationLastTimestamp) .FirstOrDefault(e => e.Type == WowChat.WHISPER); if (message != null) { PendingNotification = true; NotificationLastTimestamp = message.Timestamp; NoticifactionColor = message.Flags.Contains("GM", StringComparison.OrdinalIgnoreCase) ? NotificationGmBrush : NotificationBrush; } } else { if (NotificationBlinkState) { buttonNotification.Foreground = DarkBackgroundBrush; buttonNotification.Background = NoticifactionColor; } else { buttonNotification.Foreground = NotificationWhiteBrush; buttonNotification.Background = NotificationTransparentBrush; } NotificationBlinkState = !NotificationBlinkState; } }
public bool TryParseMessage(ChatMessageType type, long timestamp, List <string> args) { if (args.Count < 6) { return(false); } WowChatMessage chatMessage = new WowChatMessage(type, timestamp, args); ChatMessages.Add(chatMessage); if (Config.ChatProtocols) { try { string typeName = chatMessage.Type switch { ChatMessageType.ADDON => "misc", ChatMessageType.CHANNEL => "channel", ChatMessageType.DND => "misc", ChatMessageType.FILTERED => "filtered", ChatMessageType.GUILD => "guild", ChatMessageType.GUILD_ACHIEVEMENT => "guild", ChatMessageType.IGNORED => "misc", ChatMessageType.MONSTER_EMOTE => "npc", ChatMessageType.MONSTER_PARTY => "npc", ChatMessageType.MONSTER_SAY => "npc", ChatMessageType.MONSTER_WHISPER => "npc", ChatMessageType.MONSTER_YELL => "npc", ChatMessageType.RAID_BOSS_EMOTE => "npc", ChatMessageType.RAID_BOSS_WHISPER => "npc", ChatMessageType.SYSTEM => "system", _ => "normal", }; string protocolName = ProtocolName(typeName); string dirName = Path.GetDirectoryName(protocolName); if (!Directory.Exists(dirName)) { Directory.CreateDirectory(dirName); } File.AppendAllText(protocolName, $"{chatMessage}\n"); } catch { } } OnNewChatMessage?.Invoke(chatMessage); return(true); }
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; } }); }