public FilteredChatBoxMessageEventProvider(IDecalEventsProxy decalEventsProxy, Util.ChatFlags chatFilter, Util.ChatChannels channelFilter) { this._decalEventsProxy = decalEventsProxy; this._chatFilter = chatFilter; this._channelFilter = channelFilter; this._decalEventsProxy.ChatBoxMessage += this.DecalEventsProxy_ChatBoxMessage; }
public LoggedChat(DateTime timeStamp, Util.ChatChannels chatType, string message) { TimeStamp = timeStamp; ChatType = chatType; Message = message; }
void Current_ChatBoxMessage(object sender, ChatTextInterceptEventArgs e) { try { // Do we even have a receiver? if (LogItem == null) { return; } if (Util.IsChat(e.Text, Util.ChatFlags.NpcSays | Util.ChatFlags.NpcTellsYou)) { return; } if (Util.IsSpellCastingMessage(e.Text)) { return; } LoggedChat item; if (Util.IsChat(e.Text, Util.ChatFlags.PlayerTellsYou | Util.ChatFlags.YouTell)) { item = new LoggedChat(DateTime.Now, Util.ChatChannels.Tells, e.Text); } else if (Util.IsChat(e.Text, Util.ChatFlags.PlayerSaysLocal | Util.ChatFlags.YouSay)) { item = new LoggedChat(DateTime.Now, Util.ChatChannels.Area, e.Text); } else if (Util.IsChat(e.Text, Util.ChatFlags.PlayerSaysChannel)) { Util.ChatChannels channel = Util.GetChatChannel(e.Text); if (channel == Util.ChatChannels.None) { return; } item = new LoggedChat(DateTime.Now, channel, e.Text); } else { //item = new LoggedChat(DateTime.Now, Util.ChatChannels.None, e.Text); return; } if (LogItem != null) { LogItem(item); } } catch (Exception ex) { Debug.LogException(ex); } }
public void AddItem(LoggedChat item) { Util.ChatChannels chatChannels = Util.ChatChannels.None; if (settings.Area.Value) { chatChannels |= Util.ChatChannels.Area; } if (settings.Tells.Value) { chatChannels |= Util.ChatChannels.Tells; } if (settings.Fellowship.Value) { chatChannels |= Util.ChatChannels.Fellowship; } if (settings.General.Value) { chatChannels |= Util.ChatChannels.General; } if (settings.Trade.Value) { chatChannels |= Util.ChatChannels.Trade; } if (settings.Allegiance.Value) { chatChannels |= Util.ChatChannels.Allegiance; } if ((chatChannels & item.ChatType) != 0) { // Limit the list to no more than 10,000 rows if (hudList.RowCount >= 10000) { for (int i = hudList.RowCount - 1; i > 9000; i--) { hudList.RemoveRow(i); } } HudList.HudListRowAccessor newRow = hudList.InsertRow(1); ((HudStaticText)newRow[0]).Text = item.TimeStamp.ToString("yy/MM/dd HH:mm"); ((HudStaticText)newRow[1]).Text = Util.CleanMessage(item.Message); } }
void logger_LogItem(LoggedChat item) { if (!Settings.SettingsManager.ChatLogger.Persistent.Value) { return; } Util.ChatChannels chatChannels = Util.ChatChannels.None; foreach (var group in Settings.SettingsManager.ChatLogger.Groups) { if (group.Area.Value) { chatChannels |= Util.ChatChannels.Area; } if (group.Tells.Value) { chatChannels |= Util.ChatChannels.Tells; } if (group.Fellowship.Value) { chatChannels |= Util.ChatChannels.Fellowship; } if (group.General.Value) { chatChannels |= Util.ChatChannels.General; } if (group.Trade.Value) { chatChannels |= Util.ChatChannels.Trade; } if (group.Allegiance.Value) { chatChannels |= Util.ChatChannels.Allegiance; } } if ((chatChannels & item.ChatType) != 0) { items.Add(item); } }