Example #1
0
        private void HandleClilocMessage(ClilocMessagePacket packet)
        {
            var message = translator.Translate(packet.MessageId.Value, packet.Arguments);

            journalSource.AddMessage(packet.Name, message, packet.SpeakerId, packet.SpeakerBody, packet.Color, packet.Type);
            console.WriteSpeech(packet.Name, message, packet.SpeakerId, packet.Color, packet.SpeakerBody, packet.Type);
        }
Example #2
0
        internal int InJournalBetweenTime(string searchPhrase, int startTime, int endTime, int limit)
        {
            var searchPatterns = searchPhrase.Split('|');

            lock (journalLock)
            {
                foreach (var pattern in searchPatterns)
                {
                    var word = pattern;

                    if (pattern.StartsWith(clilocPrefix, StringComparison.OrdinalIgnoreCase) && pattern.Length > clilocPrefix.Length)
                    {
                        var messageIdText = pattern.Substring(clilocPrefix.Length).Trim();
                        var messageId     = int.Parse(messageIdText, System.Globalization.NumberStyles.HexNumber) + 0x70000;
                        word = clilocTranslator.Translate(messageId, string.Empty);
                    }

                    var foundIndex = 1;
                    var entry      = journal.First;
                    while (entry != null)
                    {
                        if ((startTime < 0 || entry.Value.Created >= startTime) &&
                            (endTime < 0 || entry.Value.Created <= endTime) &&
                            (limit < 0 || foundIndex <= limit) &&
                            GetText(entry.Value).Contains(word))
                        {
                            return(foundIndex);
                        }

                        entry = entry.Next;
                        foundIndex++;
                    }
                }
            }

            return(0);
        }