# Communication Tools **Referenced Files in This Document** - [ChatManager.cs](file://ClassicAssist.Shared/Data/Chat/ChatManager.cs) - [ChatMessage.cs](file://ClassicAssist.Shared/Data/Chat/ChatMessage.cs) - [ChatUser.cs](file://ClassicAssist.Shared/Data/Chat/ChatUser.cs) - [ClilocFilter.cs](file://ClassicAssist.Shared/Data/Filters/ClilocFilter.cs) - [RepeatedMessagesFilter.cs](file://ClassicAssist.Shared/Data/Filters/RepeatedMessagesFilter.cs) - [FilterEntry.cs](file://ClassicAssist.Shared/Data/Filters/FilterEntry.cs) - [IConfigurableFilter.cs](file://ClassicAssist.Shared/Data/Filters/IConfigurableFilter.cs) - [IncomingPacketHandlers.cs](file://ClassicAssist.Shared/UO/Network/IncomingPacketHandlers.cs) - [OutgoingPacketHandlers.cs](file://ClassicAssist.Shared/UO/Network/OutgoingPacketHandlers.cs) - [IncomingPacketFilters.cs](file://ClassicAssist.Shared/UO/Network/IncomingPacketFilters.cs) - [OutgoingPacketFilters.cs](file://ClassicAssist.Shared/UO/Network/OutgoingPacketFilters.cs) - [PacketHandler.cs](file://ClassicAssist.Shared/UO/Network/PacketHandler.cs) - [UnicodeText.cs](file://ClassicAssist.Shared/UO/Network/Packets/UnicodeText.cs) - [Cliloc.cs](file://ClassicAssist.Shared/UO/Data/Cliloc.cs) - [FriendsTabControl.xaml.cs](file://ClassicAssist.Avalonia/Views/Agents/FriendsTabControl.axaml.cs) - [FriendsTabViewModel.cs](file://ClassicAssist.Shared/UI/ViewModels/Agents/FriendsTabViewModel.cs) - [FriendEntry.cs](file://ClassicAssist.Shared/Data/Friends/FriendEntry.cs) - [FriendsCommands.cs](file://ClassicAssist.Shared/Data/Hotkeys/Commands/FriendsCommands.cs) - [ChatWindow.xaml.cs](file://ClassicAssist.Avalonia/Views/ChatWindow.axaml.cs) - [ChatViewModel.cs](file://ClassicAssist.Avalonia/ViewModels/ChatViewModel.cs) - [ClilocFilterConfigureWindow.xaml.cs](file://ClassicAssist.Avalonia/Views/Filters/ClilocFilterConfigureWindow.axaml.cs) - [ClilocFilterConfigureViewModel.cs](file://ClassicAssist.Avalonia/ViewModels/Filters/ClilocFilterConfigureViewModel.cs) ## Table of Contents 1. [Introduction](#introduction) 2. [Project Structure](#project-structure) 3. [Core Components](#core-components) 4. [Architecture Overview](#architecture-overview) 5. [Detailed Component Analysis](#detailed-component-analysis) 6. [Dependency Analysis](#dependency-analysis) 7. [Performance Considerations](#performance-considerations) 8. [Troubleshooting Guide](#troubleshooting-guide) 9. [Conclusion](#conclusion) ## Introduction This document explains the communication tools in ClassicAssist.Avalonia with a focus on chat, friends, localization (cliloc), real-time protocols, filtering, and performance. It covers channel management, message filtering, logging/export, social features, status monitoring, party coordination, filter configuration (including regex support), integration with Ultima Online’s native chat system, and strategies for high-volume processing and memory management. ## Project Structure The communication subsystem spans shared data models, network handlers, filters, UI views, and view models: - Shared data models for chat, friends, and cliloc - Network layer for incoming/outgoing packets and routing - Filter pipeline for chat messages - Avalonia UI components for chat window and friends tab - Configuration UI for filters ```mermaid graph TB subgraph "Shared" CM["ChatManager"] MSG["ChatMessage"] USER["ChatUser"] CLF["ClilocFilter"] RMF["RepeatedMessagesFilter"] FE["FilterEntry"] CF["IConfigurableFilter"] IPH["IncomingPacketHandlers"] OPH["OutgoingPacketHandlers"] IPF["IncomingPacketFilters"] OPF["OutgoingPacketFilters"] PH["PacketHandler"] UT["UnicodeText"] CLILOC["Cliloc"] FF["FriendEntry"] FVM["FriendsTabViewModel"] FCMD["FriendsCommands"] end subgraph "Avalonia UI" CW["ChatWindow"] CVM["ChatViewModel"] FCT["FriendsTabControl"] CLFCW["ClilocFilterConfigureWindow"] CLFCVM["ClilocFilterConfigureViewModel"] end CM --> MSG CM --> USER CM --> CLF CM --> RMF CM --> FE CM --> CF IPH --> CM OPH --> CM IPF --> CM OPF --> CM PH --> IPH PH --> OPH UT --> CM CLILOC --> CLF FVM --> FF FCMD --> FVM CW --> CVM CVM --> CM FCT --> FVM CLFCW --> CLFCVM CLFCVM --> CLF ``` **Diagram sources** - [ChatManager.cs](file://ClassicAssist.Shared/Data/Chat/ChatManager.cs) - [ChatMessage.cs](file://ClassicAssist.Shared/Data/Chat/ChatMessage.cs) - [ChatUser.cs](file://ClassicAssist.Shared/Data/Chat/ChatUser.cs) - [ClilocFilter.cs](file://ClassicAssist.Shared/Data/Filters/ClilocFilter.cs) - [RepeatedMessagesFilter.cs](file://ClassicAssist.Shared/Data/Filters/RepeatedMessagesFilter.cs) - [FilterEntry.cs](file://ClassicAssist.Shared/Data/Filters/FilterEntry.cs) - [IConfigurableFilter.cs](file://ClassicAssist.Shared/Data/Filters/IConfigurableFilter.cs) - [IncomingPacketHandlers.cs](file://ClassicAssist.Shared/UO/Network/IncomingPacketHandlers.cs) - [OutgoingPacketHandlers.cs](file://ClassicAssist.Shared/UO/Network/OutgoingPacketHandlers.cs) - [IncomingPacketFilters.cs](file://ClassicAssist.Shared/UO/Network/IncomingPacketFilters.cs) - [OutgoingPacketFilters.cs](file://ClassicAssist.Shared/UO/Network/OutgoingPacketFilters.cs) - [PacketHandler.cs](file://ClassicAssist.Shared/UO/Network/PacketHandler.cs) - [UnicodeText.cs](file://ClassicAssist.Shared/UO/Network/Packets/UnicodeText.cs) - [Cliloc.cs](file://ClassicAssist.Shared/UO/Data/Cliloc.cs) - [FriendsTabViewModel.cs](file://ClassicAssist.Shared/UI/ViewModels/Agents/FriendsTabViewModel.cs) - [FriendEntry.cs](file://ClassicAssist.Shared/Data/Friends/FriendEntry.cs) - [FriendsCommands.cs](file://ClassicAssist.Shared/Data/Hotkeys/Commands/FriendsCommands.cs) - [ChatWindow.xaml.cs](file://ClassicAssist.Avalonia/Views/ChatWindow.axaml.cs) - [ChatViewModel.cs](file://ClassicAssist.Avalonia/ViewModels/ChatViewModel.cs) - [FriendsTabControl.xaml.cs](file://ClassicAssist.Avalonia/Views/Agents/FriendsTabControl.axaml.cs) - [ClilocFilterConfigureWindow.xaml.cs](file://ClassicAssist.Avalonia/Views/Filters/ClilocFilterConfigureWindow.axaml.cs) - [ClilocFilterConfigureViewModel.cs](file://ClassicAssist.Avalonia/ViewModels/Filters/ClilocFilterConfigureViewModel.cs) **Section sources** - [ChatManager.cs](file://ClassicAssist.Shared/Data/Chat/ChatManager.cs) - [IncomingPacketHandlers.cs](file://ClassicAssist.Shared/UO/Network/IncomingPacketHandlers.cs) - [OutgoingPacketHandlers.cs](file://ClassicAssist.Shared/UO/Network/OutgoingPacketHandlers.cs) - [IncomingPacketFilters.cs](file://ClassicAssist.Shared/UO/Network/IncomingPacketFilters.cs) - [OutgoingPacketFilters.cs](file://ClassicAssist.Shared/UO/Network/OutgoingPacketFilters.cs) - [PacketHandler.cs](file://ClassicAssist.Shared/UO/Network/PacketHandler.cs) - [UnicodeText.cs](file://ClassicAssist.Shared/UO/Network/Packets/UnicodeText.cs) - [Cliloc.cs](file://ClassicAssist.Shared/UO/Data/Cliloc.cs) - [FriendsTabViewModel.cs](file://ClassicAssist.Shared/UI/ViewModels/Agents/FriendsTabViewModel.cs) - [FriendEntry.cs](file://ClassicAssist.Shared/Data/Friends/FriendEntry.cs) - [FriendsCommands.cs](file://ClassicAssist.Shared/Data/Hotkeys/Commands/FriendsCommands.cs) - [ChatWindow.xaml.cs](file://ClassicAssist.Avalonia/Views/ChatWindow.axaml.cs) - [ChatViewModel.cs](file://ClassicAssist.Avalonia/ViewModels/ChatViewModel.cs) - [FriendsTabControl.xaml.cs](file://ClassicAssist.Avalonia/Views/Agents/FriendsTabControl.axaml.cs) - [ClilocFilterConfigureWindow.xaml.cs](file://ClassicAssist.Avalonia/Views/Filters/ClilocFilterConfigureWindow.axaml.cs) - [ClilocFilterConfigureViewModel.cs](file://ClassicAssist.Avalonia/ViewModels/Filters/ClilocFilterConfigureViewModel.cs) ## Core Components - Chat system: central manager orchestrating channels, messages, users, filters, logging, and export hooks. - Friends system: list management, presence/status, commands for invites/parties. - Cliloc localization: text lookup and filtering by cliloc IDs. - Network protocol: packet handlers for chat-related packets, filter pipeline, and routing to managers. - UI: chat window and friends tab bound to view models that interact with managers. Key responsibilities: - Channel management: grouping messages by type/channel and controlling visibility. - Message filtering: built-in and custom filters including regex-based rules. - Logging and export: persisting messages and exporting logs for analysis. - Social features: friend list CRUD, status updates, invitations, and party coordination. - Localization: resolving cliloc entries and applying filters based on localized text or IDs. **Section sources** - [ChatManager.cs](file://ClassicAssist.Shared/Data/Chat/ChatManager.cs) - [ChatMessage.cs](file://ClassicAssist.Shared/Data/Chat/ChatMessage.cs) - [ChatUser.cs](file://ClassicAssist.Shared/Data/Chat/ChatUser.cs) - [ClilocFilter.cs](file://ClassicAssist.Shared/Data/Filters/ClilocFilter.cs) - [RepeatedMessagesFilter.cs](file://ClassicAssist.Shared/Data/Filters/RepeatedMessagesFilter.cs) - [FilterEntry.cs](file://ClassicAssist.Shared/Data/Filters/FilterEntry.cs) - [IConfigurableFilter.cs](file://ClassicAssist.Shared/Data/Filters/IConfigurableFilter.cs) - [IncomingPacketHandlers.cs](file://ClassicAssist.Shared/UO/Network/IncomingPacketHandlers.cs) - [OutgoingPacketHandlers.cs](file://ClassicAssist.Shared/UO/Network/OutgoingPacketHandlers.cs) - [IncomingPacketFilters.cs](file://ClassicAssist.Shared/UO/Network/IncomingPacketFilters.cs) - [OutgoingPacketFilters.cs](file://ClassicAssist.Shared/UO/Network/OutgoingPacketFilters.cs) - [PacketHandler.cs](file://ClassicAssist.Shared/UO/Network/PacketHandler.cs) - [UnicodeText.cs](file://ClassicAssist.Shared/UO/Network/Packets/UnicodeText.cs) - [Cliloc.cs](file://ClassicAssist.Shared/UO/Data/Cliloc.cs) - [FriendsTabViewModel.cs](file://ClassicAssist.Shared/UI/ViewModels/Agents/FriendsTabViewModel.cs) - [FriendEntry.cs](file://ClassicAssist.Shared/Data/Friends/FriendEntry.cs) - [FriendsCommands.cs](file://ClassicAssist.Shared/Data/Hotkeys/Commands/FriendsCommands.cs) - [ChatWindow.xaml.cs](file://ClassicAssist.Avalonia/Views/ChatWindow.axaml.cs) - [ChatViewModel.cs](file://ClassicAssist.Avalonia/ViewModels/ChatViewModel.cs) - [FriendsTabControl.xaml.cs](file://ClassicAssist.Avalonia/Views/Agents/FriendsTabControl.axaml.cs) - [ClilocFilterConfigureWindow.xaml.cs](file://ClassicAssist.Avalonia/Views/Filters/ClilocFilterConfigureWindow.axaml.cs) - [ClilocFilterConfigureViewModel.cs](file://ClassicAssist.Avalonia/ViewModels/Filters/ClilocFilterConfigureViewModel.cs) ## Architecture Overview The communication architecture integrates UO network packets into a layered pipeline: - PacketHandler routes incoming/outgoing packets to specific handlers. - IncomingPacketHandlers parse chat and social packets and forward events to ChatManager and Friends systems. - OutgoingPacketHandlers send chat and social actions back to the server. - IncomingPacketFilters and OutgoingPacketFilters provide interception points for inspection/modification. - ChatManager applies filters (regex, repeated messages, cliloc-based) and manages channels/users/messages. - UI layers bind to view models which call into managers for display and user actions. ```mermaid sequenceDiagram participant Net as "PacketHandler" participant InH as "IncomingPacketHandlers" participant InF as "IncomingPacketFilters" participant CM as "ChatManager" participant FM as "FriendsTabViewModel" participant UI as "ChatWindow/ChatViewModel" Net->>InH : "Dispatch incoming packet" InH->>InF : "Apply incoming filters" InF-->>InH : "Filtered result" InH->>CM : "Publish chat/social event" CM->>CM : "Apply filters (regex, repeated, cliloc)" CM-->>UI : "Notify new message/channel update" UI->>FM : "Sync friends/party state" FM-->>UI : "Status changes" ``` **Diagram sources** - [PacketHandler.cs](file://ClassicAssist.Shared/UO/Network/PacketHandler.cs) - [IncomingPacketHandlers.cs](file://ClassicAssist.Shared/UO/Network/IncomingPacketHandlers.cs) - [OutgoingPacketHandlers.cs](file://ClassicAssist.Shared/UO/Network/OutgoingPacketHandlers.cs) - [IncomingPacketFilters.cs](file://ClassicAssist.Shared/UO/Network/IncomingPacketFilters.cs) - [OutgoingPacketFilters.cs](file://ClassicAssist.Shared/UO/Network/OutgoingPacketFilters.cs) - [ChatManager.cs](file://ClassicAssist.Shared/Data/Chat/ChatManager.cs) - [ChatViewModel.cs](file://ClassicAssist.Avalonia/ViewModels/ChatViewModel.cs) - [ChatWindow.xaml.cs](file://ClassicAssist.Avalonia/Views/ChatWindow.axaml.cs) - [FriendsTabViewModel.cs](file://ClassicAssist.Shared/UI/ViewModels/Agents/FriendsTabViewModel.cs) ## Detailed Component Analysis ### Chat System Responsibilities: - Channel management: categorize messages by channel type and control visibility. - Message lifecycle: creation, filtering, persistence, and export. - User tracking: maintain ChatUser instances per sender. - Integration: receives parsed chat from UnicodeText via handlers. ```mermaid classDiagram class ChatManager { +AddMessage(message) +GetChannel(channelType) +RemoveOldEntries(maxCount) +ExportLog(path) +SubscribeToEvents() } class ChatMessage { +Sender +Content +Channel +Timestamp } class ChatUser { +Name +Serial +LastSeen } class ClilocFilter { +Matches(clilocId, text) +Configure(options) } class RepeatedMessagesFilter { +ShouldSuppress(previous, current) } class FilterEntry { +Pattern +Enabled +Regex } class IConfigurableFilter { <> +Configure(options) } ChatManager --> ChatMessage : "creates/manages" ChatManager --> ChatUser : "tracks" ChatManager --> ClilocFilter : "applies" ChatManager --> RepeatedMessagesFilter : "applies" ChatManager --> FilterEntry : "iterates" ClilocFilter ..|> IConfigurableFilter RepeatedMessagesFilter ..|> IConfigurableFilter ``` **Diagram sources** - [ChatManager.cs](file://ClassicAssist.Shared/Data/Chat/ChatManager.cs) - [ChatMessage.cs](file://ClassicAssist.Shared/Data/Chat/ChatMessage.cs) - [ChatUser.cs](file://ClassicAssist.Shared/Data/Chat/ChatUser.cs) - [ClilocFilter.cs](file://ClassicAssist.Shared/Data/Filters/ClilocFilter.cs) - [RepeatedMessagesFilter.cs](file://ClassicAssist.Shared/Data/Filters/RepeatedMessagesFilter.cs) - [FilterEntry.cs](file://ClassicAssist.Shared/Data/Filters/FilterEntry.cs) - [IConfigurableFilter.cs](file://ClassicAssist.Shared/Data/Filters/IConfigurableFilter.cs) **Section sources** - [ChatManager.cs](file://ClassicAssist.Shared/Data/Chat/ChatManager.cs) - [ChatMessage.cs](file://ClassicAssist.Shared/Data/Chat/ChatMessage.cs) - [ChatUser.cs](file://ClassicAssist.Shared/Data/Chat/ChatUser.cs) - [ClilocFilter.cs](file://ClassicAssist.Shared/Data/Filters/ClilocFilter.cs) - [RepeatedMessagesFilter.cs](file://ClassicAssist.Shared/Data/Filters/RepeatedMessagesFilter.cs) - [FilterEntry.cs](file://ClassicAssist.Shared/Data/Filters/FilterEntry.cs) - [IConfigurableFilter.cs](file://ClassicAssist.Shared/Data/Filters/IConfigurableFilter.cs) - [UnicodeText.cs](file://ClassicAssist.Shared/UO/Network/Packets/UnicodeText.cs) ### Friends List and Party Coordination Responsibilities: - Maintain friend entries with status and metadata. - Provide commands for inviting, accepting/rejecting parties, and viewing status. - UI binds to view model for interactive management. ```mermaid sequenceDiagram participant UI as "FriendsTabControl" participant VM as "FriendsTabViewModel" participant CMD as "FriendsCommands" participant NET as "OutgoingPacketHandlers" participant S as "Server" UI->>VM : "User action (invite/accept/reject)" VM->>CMD : "Invoke command" CMD->>NET : "Build and send packet" NET->>S : "Transmit" S-->>NET : "Response (status/party update)" NET-->>VM : "Update state" VM-->>UI : "Refresh list and status" ``` **Diagram sources** - [FriendsTabControl.xaml.cs](file://ClassicAssist.Avalonia/Views/Agents/FriendsTabControl.axaml.cs) - [FriendsTabViewModel.cs](file://ClassicAssist.Shared/UI/ViewModels/Agents/FriendsTabViewModel.cs) - [FriendEntry.cs](file://ClassicAssist.Shared/Data/Friends/FriendEntry.cs) - [FriendsCommands.cs](file://ClassicAssist.Shared/Data/Hotkeys/Commands/FriendsCommands.cs) - [OutgoingPacketHandlers.cs](file://ClassicAssist.Shared/UO/Network/OutgoingPacketHandlers.cs) **Section sources** - [FriendsTabControl.xaml.cs](file://ClassicAssist.Avalonia/Views/Agents/FriendsTabControl.axaml.cs) - [FriendsTabViewModel.cs](file://ClassicAssist.Shared/UI/ViewModels/Agents/FriendsTabViewModel.cs) - [FriendEntry.cs](file://ClassicAssist.Shared/Data/Friends/FriendEntry.cs) - [FriendsCommands.cs](file://ClassicAssist.Shared/Data/Hotkeys/Commands/FriendsCommands.cs) - [OutgoingPacketHandlers.cs](file://ClassicAssist.Shared/UO/Network/OutgoingPacketHandlers.cs) ### Cliloc Text System Responsibilities: - Resolve localized strings using cliloc IDs. - Support filtering by cliloc ID or resolved text. - Provide configuration UI for filter options. ```mermaid flowchart TD Start(["Resolve Cliloc"]) --> Lookup["Lookup ID in Cliloc"] Lookup --> Found{"Found?"} Found --> |Yes| ReturnText["Return localized text"] Found --> |No| Fallback["Fallback to raw ID"] ReturnText --> ApplyFilter["Apply ClilocFilter"] Fallback --> ApplyFilter ApplyFilter --> End(["Result"]) ``` **Diagram sources** - [Cliloc.cs](file://ClassicAssist.Shared/UO/Data/Cliloc.cs) - [ClilocFilter.cs](file://ClassicAssist.Shared/Data/Filters/ClilocFilter.cs) - [ClilocFilterConfigureWindow.xaml.cs](file://ClassicAssist.Avalonia/Views/Filters/ClilocFilterConfigureWindow.axaml.cs) - [ClilocFilterConfigureViewModel.cs](file://ClassicAssist.Avalonia/ViewModels/Filters/ClilocFilterConfigureViewModel.cs) **Section sources** - [Cliloc.cs](file://ClassicAssist.Shared/UO/Data/Cliloc.cs) - [ClilocFilter.cs](file://ClassicAssist.Shared/Data/Filters/ClilocFilter.cs) - [ClilocFilterConfigureWindow.xaml.cs](file://ClassicAssist.Avalonia/Views/Filters/ClilocFilterConfigureWindow.axaml.cs) - [ClilocFilterConfigureViewModel.cs](file://ClassicAssist.Avalonia/ViewModels/Filters/ClilocFilterConfigureViewModel.cs) ### Real-Time Communication Protocols and Routing Responsibilities: - Parse and dispatch chat-related packets (e.g., UnicodeText). - Route events to ChatManager and friends/party handlers. - Provide filter hooks before/after processing. ```mermaid sequenceDiagram participant Client as "Client" participant PH as "PacketHandler" participant IN as "IncomingPacketHandlers" participant CH as "ChatManager" participant FR as "FriendsTabViewModel" Client->>PH : "Send UnicodeText" PH->>IN : "Route to handler" IN->>CH : "Create ChatMessage" CH->>CH : "Apply filters" CH-->>FR : "Broadcast updates" ``` **Diagram sources** - [PacketHandler.cs](file://ClassicAssist.Shared/UO/Network/PacketHandler.cs) - [IncomingPacketHandlers.cs](file://ClassicAssist.Shared/UO/Network/IncomingPacketHandlers.cs) - [OutgoingPacketHandlers.cs](file://ClassicAssist.Shared/UO/Network/OutgoingPacketHandlers.cs) - [UnicodeText.cs](file://ClassicAssist.Shared/UO/Network/Packets/UnicodeText.cs) - [ChatManager.cs](file://ClassicAssist.Shared/Data/Chat/ChatManager.cs) - [FriendsTabViewModel.cs](file://ClassicAssist.Shared/UI/ViewModels/Agents/FriendsTabViewModel.cs) **Section sources** - [PacketHandler.cs](file://ClassicAssist.Shared/UO/Network/PacketHandler.cs) - [IncomingPacketHandlers.cs](file://ClassicAssist.Shared/UO/Network/IncomingPacketHandlers.cs) - [OutgoingPacketHandlers.cs](file://ClassicAssist.Shared/UO/Network/OutgoingPacketHandlers.cs) - [UnicodeText.cs](file://ClassicAssist.Shared/UO/Network/Packets/UnicodeText.cs) - [ChatManager.cs](file://ClassicAssist.Shared/Data/Chat/ChatManager.cs) - [FriendsTabViewModel.cs](file://ClassicAssist.Shared/UI/ViewModels/Agents/FriendsTabViewModel.cs) ### Filter Configuration and Custom Filters Responsibilities: - Built-in filters: repeated messages suppression, cliloc-based matching. - Regex support via FilterEntry patterns. - Configurable filters interface for advanced customization. - UI for configuring cliloc filters. ```mermaid flowchart TD Entry(["New Message"]) --> Iterate["Iterate FilterEntry list"] Iterate --> CheckEnabled{"Enabled?"} CheckEnabled --> |No| Next["Next filter"] CheckEnabled --> |Yes| Match["Match pattern (regex if set)"] Match --> Hit{"Hit?"} Hit --> |Yes| Action["Suppress/Tag/Modify"] Hit --> |No| Next Next --> Done{"More filters?"} Done --> |Yes| Iterate Done --> |No| Publish["Publish to ChatManager"] ``` **Diagram sources** - [FilterEntry.cs](file://ClassicAssist.Shared/Data/Filters/FilterEntry.cs) - [RepeatedMessagesFilter.cs](file://ClassicAssist.Shared/Data/Filters/RepeatedMessagesFilter.cs) - [ClilocFilter.cs](file://ClassicAssist.Shared/Data/Filters/ClilocFilter.cs) - [IConfigurableFilter.cs](file://ClassicAssist.Shared/Data/Filters/IConfigurableFilter.cs) - [ClilocFilterConfigureViewModel.cs](file://ClassicAssist.Avalonia/ViewModels/Filters/ClilocFilterConfigureViewModel.cs) - [ClilocFilterConfigureWindow.xaml.cs](file://ClassicAssist.Avalonia/Views/Filters/ClilocFilterConfigureWindow.axaml.cs) **Section sources** - [FilterEntry.cs](file://ClassicAssist.Shared/Data/Filters/FilterEntry.cs) - [RepeatedMessagesFilter.cs](file://ClassicAssist.Shared/Data/Filters/RepeatedMessagesFilter.cs) - [ClilocFilter.cs](file://ClassicAssist.Shared/Data/Filters/ClilocFilter.cs) - [IConfigurableFilter.cs](file://ClassicAssist.Shared/Data/Filters/IConfigurableFilter.cs) - [ClilocFilterConfigureViewModel.cs](file://ClassicAssist.Avalonia/ViewModels/Filters/ClilocFilterConfigureViewModel.cs) - [ClilocFilterConfigureWindow.xaml.cs](file://ClassicAssist.Avalonia/Views/Filters/ClilocFilterConfigureWindow.axaml.cs) ### Integration with Ultima Online Native Chat and Protocol Handling Responsibilities: - Map UO chat packets to internal ChatMessage objects. - Preserve channel semantics and sender identity. - Ensure outgoing chat commands are serialized correctly. ```mermaid sequenceDiagram participant UO as "UO Server" participant PH as "PacketHandler" participant IN as "IncomingPacketHandlers" participant CH as "ChatManager" participant UI as "ChatViewModel" UO->>PH : "UnicodeText packet" PH->>IN : "Parse" IN->>CH : "Create ChatMessage" CH->>UI : "Notify channel update" UI-->>UO : "User sends chat via OutgoingPacketHandlers" ``` **Diagram sources** - [UnicodeText.cs](file://ClassicAssist.Shared/UO/Network/Packets/UnicodeText.cs) - [IncomingPacketHandlers.cs](file://ClassicAssist.Shared/UO/Network/IncomingPacketHandlers.cs) - [OutgoingPacketHandlers.cs](file://ClassicAssist.Shared/UO/Network/OutgoingPacketHandlers.cs) - [ChatManager.cs](file://ClassicAssist.Shared/Data/Chat/ChatManager.cs) - [ChatViewModel.cs](file://ClassicAssist.Avalonia/ViewModels/ChatViewModel.cs) **Section sources** - [UnicodeText.cs](file://ClassicAssist.Shared/UO/Network/Packets/UnicodeText.cs) - [IncomingPacketHandlers.cs](file://ClassicAssist.Shared/UO/Network/IncomingPacketHandlers.cs) - [OutgoingPacketHandlers.cs](file://ClassicAssist.Shared/UO/Network/OutgoingPacketHandlers.cs) - [ChatManager.cs](file://ClassicAssist.Shared/Data/Chat/ChatManager.cs) - [ChatViewModel.cs](file://ClassicAssist.Avalonia/ViewModels/ChatViewModel.cs) ## Dependency Analysis High-level dependencies among communication components: ```mermaid graph LR PH["PacketHandler"] --> INH["IncomingPacketHandlers"] PH --> OPH["OutgoingPacketHandlers"] INH --> CM["ChatManager"] OPH --> CM INH --> FRM["FriendsTabViewModel"] OPH --> FRM CM --> CLF["ClilocFilter"] CM --> RMF["RepeatedMessagesFilter"] CM --> FE["FilterEntry"] CLF --> CLILOC["Cliloc"] UI["ChatWindow/ChatViewModel"] --> CM FUI["FriendsTabControl"] --> FRM ``` **Diagram sources** - [PacketHandler.cs](file://ClassicAssist.Shared/UO/Network/PacketHandler.cs) - [IncomingPacketHandlers.cs](file://ClassicAssist.Shared/UO/Network/IncomingPacketHandlers.cs) - [OutgoingPacketHandlers.cs](file://ClassicAssist.Shared/UO/Network/OutgoingPacketHandlers.cs) - [ChatManager.cs](file://ClassicAssist.Shared/Data/Chat/ChatManager.cs) - [ClilocFilter.cs](file://ClassicAssist.Shared/Data/Filters/ClilocFilter.cs) - [RepeatedMessagesFilter.cs](file://ClassicAssist.Shared/Data/Filters/RepeatedMessagesFilter.cs) - [FilterEntry.cs](file://ClassicAssist.Shared/Data/Filters/FilterEntry.cs) - [Cliloc.cs](file://ClassicAssist.Shared/UO/Data/Cliloc.cs) - [ChatViewModel.cs](file://ClassicAssist.Avalonia/ViewModels/ChatViewModel.cs) - [ChatWindow.xaml.cs](file://ClassicAssist.Avalonia/Views/ChatWindow.axaml.cs) - [FriendsTabControl.xaml.cs](file://ClassicAssist.Avalonia/Views/Agents/FriendsTabControl.axaml.cs) - [FriendsTabViewModel.cs](file://ClassicAssist.Shared/UI/ViewModels/Agents/FriendsTabViewModel.cs) **Section sources** - [PacketHandler.cs](file://ClassicAssist.Shared/UO/Network/PacketHandler.cs) - [IncomingPacketHandlers.cs](file://ClassicAssist.Shared/UO/Network/IncomingPacketHandlers.cs) - [OutgoingPacketHandlers.cs](file://ClassicAssist.Shared/UO/Network/OutgoingPacketHandlers.cs) - [ChatManager.cs](file://ClassicAssist.Shared/Data/Chat/ChatManager.cs) - [ClilocFilter.cs](file://ClassicAssist.Shared/Data/Filters/ClilocFilter.cs) - [RepeatedMessagesFilter.cs](file://ClassicAssist.Shared/Data/Filters/RepeatedMessagesFilter.cs) - [FilterEntry.cs](file://ClassicAssist.Shared/Data/Filters/FilterEntry.cs) - [Cliloc.cs](file://ClassicAssist.Shared/UO/Data/Cliloc.cs) - [ChatViewModel.cs](file://ClassicAssist.Avalonia/ViewModels/ChatViewModel.cs) - [ChatWindow.xaml.cs](file://ClassicAssist.Avalonia/Views/ChatWindow.axaml.cs) - [FriendsTabControl.xaml.cs](file://ClassicAssist.Avalonia/Views/Agents/FriendsTabControl.axaml.cs) - [FriendsTabViewModel.cs](file://ClassicAssist.Shared/UI/ViewModels/Agents/FriendsTabViewModel.cs) ## Performance Considerations - High-volume chat processing: - Use efficient filtering order; place frequent matches early. - Prefer compiled regex patterns where supported to reduce overhead. - Limit retained message history with bounded collections and periodic cleanup. - Memory management: - Avoid retaining large string copies; reuse buffers where possible. - Unsubscribe from events when windows close to prevent leaks. - Export logs asynchronously to avoid blocking UI thread. - UI responsiveness: - Batch updates to observable collections. - Debounce heavy operations like log exports. - Network efficiency: - Coalesce outgoing chat commands when appropriate. - Leverage packet filters to drop unnecessary traffic early. [No sources needed since this section provides general guidance] ## Troubleshooting Guide Common issues and diagnostics: - Messages not appearing: - Verify incoming packet handlers route to ChatManager. - Check filter configurations (regex, cliloc) for over-aggressive suppression. - Incorrect localization: - Confirm cliloc ID mapping and fallback behavior. - Friends/party state out of sync: - Inspect outgoing/incoming packet flows for missing updates. - Validate command invocations and response handling. - Performance degradation: - Profile filter execution time and message retention size. - Monitor UI thread workloads during export operations. **Section sources** - [IncomingPacketHandlers.cs](file://ClassicAssist.Shared/UO/Network/IncomingPacketHandlers.cs) - [OutgoingPacketHandlers.cs](file://ClassicAssist.Shared/UO/Network/OutgoingPacketHandlers.cs) - [ChatManager.cs](file://ClassicAssist.Shared/Data/Chat/ChatManager.cs) - [ClilocFilter.cs](file://ClassicAssist.Shared/Data/Filters/ClilocFilter.cs) - [FriendsTabViewModel.cs](file://ClassicAssist.Shared/UI/ViewModels/Agents/FriendsTabViewModel.cs) ## Conclusion ClassicAssist.Avalonia’s communication tools integrate tightly with Ultima Online’s protocol while providing robust chat management, social features, localization, and extensible filtering. The layered design separates concerns across network handlers, managers, filters, and UI, enabling scalability and maintainability. By following the performance and troubleshooting recommendations, users can optimize for high-volume environments and ensure reliable operation.