Пример #1
0
        /// <summary> Grab all new chat lines and put them in the appropriate List<>s, Increase line
        /// added counters as chat lines are added to a List<>, Keep the List<>s to a maximum size
        /// </summary> <returns> How many lines were added at the beginning of the chatLog so we know
        /// how many to parse through for the logs </returns>
        public int NewChat()
        {
            try
            {
                CurrentLine = Char.Api.Chat.GetNextChatLine();

                while (CurrentLine != null)
                {
                    if (CurrentLine.ChatType != -1)
                    {
                        chatLog.Insert(0, CurrentLine);
                        ChatLogAdded++;

                        switch (CurrentLine.ChatType)
                        {
                        case 9:
                        case 1:
                            sayLog.Insert(0, CurrentLine);
                            SayLogAdded++;
                            break;

                        case 5:
                        case 13:
                            partyLog.Insert(0, CurrentLine);
                            PartyLogAdded++;
                            break;

                        case 2:
                        case 10:
                            shoutLog.Insert(0, CurrentLine);
                            ShoutLogAdded++;
                            break;

                        case 6:
                        case 14:
                            shellLog.Insert(0, CurrentLine);
                            ShellLogAdded++;
                            break;

                        case 4:
                        case 12:
                            tellLog.Insert(0, CurrentLine);
                            TellLogAdded++;
                            break;

                        case 11:
                            yellLog.Insert(0, CurrentLine);
                            YellLogAdded++;
                            break;

                        case 146:
                        case 148:
                            FishLog.Insert(0, CurrentLine);
                            FishLogAdded++;
                            break;

                        case 36:
                            BattleLog.Insert(0, CurrentLine);
                            BattleLogAdded++;
                            break;

                        case 20:
                            BattleLog.Insert(0, CurrentLine);
                            BattleLogAdded++;
                            break;

                        case 101:
                            BattleLog.Insert(0, CurrentLine);
                            BattleLogAdded++;
                            break;

                        case 21:
                            BattleLog.Insert(0, CurrentLine);
                            BattleLogAdded++;
                            break;

                        case 50:
                            BattleLog.Insert(0, CurrentLine);
                            BattleLogAdded++;
                            break;

                        case 110:
                            BattleLog.Insert(0, CurrentLine);
                            BattleLogAdded++;
                            break;

                        case 52:
                            BattleLog.Insert(0, CurrentLine);
                            BattleLogAdded++;
                            break;

                        case 114:
                            BattleLog.Insert(0, CurrentLine);
                            BattleLogAdded++;
                            break;

                        case 56:
                            BattleLog.Insert(0, CurrentLine);
                            BattleLogAdded++;
                            break;

                        default:
                            break;
                        }

                        CurrentLine = Char.Api.Chat.GetNextChatLine();
                    }
                    else
                    {
                        return(-1);  //ChatMode.Error - try to recover
                    }
                }
            }
            catch (Exception)
            {
                return(-1);
            }

            //only need to trim the logs if something was added
            if (0 < ChatLogAdded)
            {
                TrimLogs();
            }

            return(ChatLogAdded);
        }