Exemplo n.º 1
0
        private static byte[] TradePhp(byte[] array)
        {
            var html = Russian.Codepage.GetString(array);

            if (html.IndexOf(@"onclick=""location='../main.php'"" value=""Отказаться от покупки"">", StringComparison.OrdinalIgnoreCase) == -1)
            {
                return(array);
            }

            var salesNick     = HelperStrings.SubString(html, @"<font color=#cc0000>Купить вещь у ", " за ");
            var strSalesPrice = HelperStrings.SubString(html, @" за ", "NV?</font>");

            if (strSalesPrice == null)
            {
                return(array);
            }

            int salesPrice;

            if (!int.TryParse(strSalesPrice, out salesPrice))
            {
                return(array);
            }

            var nameThing     = HelperStrings.SubString(html, @"NV?</font><br><br> ", "</b>");
            var levelThing    = HelperStrings.SubString(html, @"&nbsp;Уровень: <b>", "</b>");
            var intLevelThing = -1;

            if (levelThing != null)
            {
                if (!int.TryParse(levelThing, out intLevelThing))
                {
                    intLevelThing = -1;
                }

                levelThing = '[' + levelThing + ']';
            }

            var uidThing = HelperStrings.SubString(html, @"&tradeu=", "&");

            if (uidThing == null)
            {
                return(array);
            }

            var regS   = new Regex(@"Долговечность: <b>([\d]+)/([\d]+)</b>");
            var matchS = regS.Match(html);

            if (matchS.Groups.Count != 3)
            {
                return(array);
            }

            int realDolg;

            if (!int.TryParse(matchS.Groups[1].Value, out realDolg))
            {
                return(array);
            }

            int fullDolg;

            if (!int.TryParse(matchS.Groups[2].Value, out fullDolg))
            {
                return(array);
            }

            if (fullDolg == 0)
            {
                return(array);
            }

            var strRealPrice = HelperStrings.SubString(html, @"&nbsp;Цена: <b>", " NV</b>");

            if (strRealPrice == null)
            {
                return(array);
            }

            int realPrice;

            if (!int.TryParse(strRealPrice, out realPrice))
            {
                return(array);
            }

            // Теперь считаем цену продажи

            if (realDolg < fullDolg)
            {
                realPrice = (realPrice * realDolg) / fullDolg;
            }

            var sb = new StringBuilder();

            sb.Append("%<");
            sb.Append(salesNick);
            sb.Append("> ");

            var sbmsg = new StringBuilder();

            sbmsg.Append(" <b>");
            sbmsg.Append(nameThing);
            sbmsg.Append(levelThing);
            sbmsg.Append("</b>, долговечность <b>");
            sbmsg.Append(realDolg);
            sbmsg.Append('/');
            sbmsg.Append(fullDolg);
            sbmsg.Append("</b>, (госцена <font color=#00cc00><b>");
            sbmsg.Append(realPrice);
            sbmsg.Append("NV</b></font>) за <font color=#0000cc><b>");
            sbmsg.Append(salesPrice);
            sbmsg.Append("NV</b></font> у <b>");
            sbmsg.Append(salesNick);
            sbmsg.Append("</b>");

            var price90   = (int)Math.Round(realPrice * 0.9);
            var calcPrice = TorgList.Calculate(realPrice);

            if (salesPrice > calcPrice)
            {
                // Слишком высокая цена

                try
                {
                    if (AppVars.MainForm != null)
                    {
                        AppVars.MainForm.BeginInvoke(
                            new UpdateChatDelegate(AppVars.MainForm.UpdateChat),
                            new object[] { "<font color=#cc0000><b>Отказываемся</b></font> от покупки вещи" + sbmsg });
                    }
                }
                catch (InvalidOperationException)
                {
                }

                sb.Append(TorgList.DoFilter(AppVars.Profile.TorgMessageTooExp, nameThing, levelThing, salesPrice, calcPrice, realDolg, fullDolg, price90));
                Chat.AddAnswer(sb.ToString());
                AppVars.ContentMainPhp = BuildRedirect("Отказ от покупки", "../main.php");
                return(Russian.Codepage.GetBytes(AppVars.ContentMainPhp));
            }

            if (salesPrice < price90)
            {
                // Слишком низкая цена
                try
                {
                    if (AppVars.MainForm != null)
                    {
                        AppVars.MainForm.BeginInvoke(
                            new UpdateChatDelegate(AppVars.MainForm.UpdateChat),
                            new object[] { "<font color=#cc0000><b>Отказываемся</b></font> от покупки вещи" + sbmsg });
                    }
                }
                catch (InvalidOperationException)
                {
                }

                sb.Append(TorgList.DoFilter(AppVars.Profile.TorgMessageLess90, nameThing, levelThing, salesPrice, calcPrice, realDolg, fullDolg, price90));
                Chat.AddAnswer(sb.ToString());
                AppVars.ContentMainPhp = BuildRedirect("Отказ от покупки", "../main.php");
                return(Russian.Codepage.GetBytes(AppVars.ContentMainPhp));
            }

            var spdeny = AppVars.Profile.TorgDeny.Trim().Split(';');

            for (var i = 0; i < spdeny.Length; i++)
            {
                if (string.IsNullOrEmpty(spdeny[i]))
                {
                    continue;
                }

                var keydeny = spdeny[i].Trim();
                if ((keydeny.IndexOf(' ') == -1 && nameThing.IndexOf(keydeny, StringComparison.OrdinalIgnoreCase) != -1) ||
                    (keydeny.IndexOf(' ') != -1 && nameThing.Equals(keydeny, StringComparison.OrdinalIgnoreCase)))
                {
                    try
                    {
                        if (AppVars.MainForm != null)
                        {
                            AppVars.MainForm.BeginInvoke(
                                new UpdateChatDelegate(AppVars.MainForm.UpdateChat),
                                new object[] { "В имени вещи содержится ключевое слово <b>" + keydeny + "</b>, указанное в настройках. Отказываемся от покупки." });
                        }
                    }
                    catch (InvalidOperationException)
                    {
                    }

                    AppVars.ContentMainPhp = BuildRedirect("Отказ от покупки", "../main.php");
                    return(Russian.Codepage.GetBytes(AppVars.ContentMainPhp));
                }
            }

            // Делаем попытку купить

            var linkPrefix = "../main.php?get_id=0";
            var link       = HelperStrings.SubString(html, linkPrefix, "'");

            if (link == null)
            {
                return(array);
            }

            // Готовимся
            try
            {
                if (AppVars.MainForm != null)
                {
                    AppVars.MainForm.BeginInvoke(
                        new UpdateChatDelegate(AppVars.MainForm.UpdateChat),
                        new object[] { "<font color=#00cc00><b>Покупаем</b></font> вещь" + sbmsg });
                }
            }
            catch (InvalidOperationException)
            {
            }

            TorgList.TriggerBuy = false;
            if (AppVars.Profile.TorgSliv)
            {
                if (intLevelThing < AppVars.Profile.TorgMinLevel)
                {
                    if (nameThing.IndexOf("(ап)", StringComparison.OrdinalIgnoreCase) == -1)
                    {
                        var isDisabled = false;
                        var keyword    = string.Empty;
                        if (!string.IsNullOrEmpty(AppVars.Profile.TorgEx))
                        {
                            var sp = AppVars.Profile.TorgEx.Trim().Split(';');
                            var i  = 0;
                            for (; i < sp.Length; i++)
                            {
                                keyword = sp[i].Trim();
                                if ((keyword.IndexOf(' ') == -1 && nameThing.IndexOf(keyword, StringComparison.OrdinalIgnoreCase) == -1) ||
                                    (keyword.IndexOf(' ') != -1 && !nameThing.Equals(keyword, StringComparison.OrdinalIgnoreCase)))
                                {
                                    continue;
                                }

                                isDisabled = true;
                                break;
                            }
                        }

                        if (!isDisabled)
                        {
                            try
                            {
                                if (AppVars.MainForm != null)
                                {
                                    AppVars.MainForm.BeginInvoke(
                                        new UpdateChatDelegate(AppVars.MainForm.UpdateChat),
                                        new object[] { "Делаем попытку сдать вещь в лавку..." });
                                }
                            }
                            catch (InvalidOperationException)
                            {
                            }

                            TorgList.UidThing   = uidThing;
                            TorgList.TriggerBuy = true;
                        }
                        else
                        {
                            try
                            {
                                if (AppVars.MainForm != null)
                                {
                                    AppVars.MainForm.BeginInvoke(
                                        new UpdateChatDelegate(AppVars.MainForm.UpdateChat),
                                        new object[] { "В имени вещи содержится ключевое слово <b>" + keyword + "</b>, указанное в настройках. Оставляем вещь себе." });
                                }
                            }
                            catch (InvalidOperationException)
                            {
                            }
                        }
                    }
                    else
                    {
                        try
                        {
                            if (AppVars.MainForm != null)
                            {
                                AppVars.MainForm.BeginInvoke(
                                    new UpdateChatDelegate(AppVars.MainForm.UpdateChat),
                                    new object[] { "Вещь апнута, оставляем ее себе" });
                            }
                        }
                        catch (InvalidOperationException)
                        {
                        }
                    }
                }
                else
                {
                    try
                    {
                        if (AppVars.MainForm != null)
                        {
                            AppVars.MainForm.BeginInvoke(
                                new UpdateChatDelegate(AppVars.MainForm.UpdateChat),
                                new object[] { "Уровень вещи <b>[" + intLevelThing + "]</b> равен или превышает уровень <b>[" + AppVars.Profile.TorgMinLevel + "]</b>, указанный в настройках. Оставляем вещь себе." });
                        }
                    }
                    catch (InvalidOperationException)
                    {
                    }
                }
            }
            else
            {
                try
                {
                    if (AppVars.MainForm != null)
                    {
                        AppVars.MainForm.BeginInvoke(
                            new UpdateChatDelegate(AppVars.MainForm.UpdateChat),
                            new object[] { "Перепродажа вещей в лавку отключена в настройках" });
                    }
                }
                catch (InvalidOperationException)
                {
                }
            }

            var sbyes = new StringBuilder(sb.ToString());

            sbyes.Append(TorgList.DoFilter(AppVars.Profile.TorgMessageThanks, nameThing, levelThing, salesPrice, calcPrice, realDolg, fullDolg, price90));
            TorgList.MessageThanks = sbyes.ToString();

            var sbno = new StringBuilder(sb.ToString());

            sbno.Append(TorgList.DoFilter(AppVars.Profile.TorgMessageNoMoney, nameThing, levelThing, salesPrice, calcPrice, realDolg, fullDolg, price90));
            TorgList.MessageNoMoney = sbno.ToString();

            TorgList.Trigger = true;

            AppVars.ContentMainPhp = BuildRedirect("Покупка", linkPrefix + link);
            return(Russian.Codepage.GetBytes(AppVars.ContentMainPhp));
        }
Exemplo n.º 2
0
        internal static string ChatFilter(string message)
        {
            var xpstr = HelperStrings.SubString(message, "Получено <font color=#CC0000>боевого</font> опыта: <b><font color=#CC0000>", "</font></b>.");

            if (!string.IsNullOrEmpty(xpstr))
            {
                long xp;
                if (long.TryParse(xpstr, out xp))
                {
                    try
                    {
                        if (AppVars.MainForm != null)
                        {
                            AppVars.MainForm.BeginInvoke(
                                new UpdateXPIncDelegate(AppVars.MainForm.UpdateXPInc),
                                new object[] { xp });
                        }
                    }
                    catch (InvalidOperationException)
                    {
                    }
                }
            }

            // <font class=chattime>&nbsp;23:56:08&nbsp;</font>
            // Результат обыска бота: <B>Денежные средства «19 NV», Денежные средства «30 NV»</B>.
            // Результат обыска бота: <B>Вещь «Кинжал Разбойника»</B>.

            //message =
            //    "<font class=chattime>&nbsp;23:56:08&nbsp;</font> <font color=000000><B><font color=#CC0000>Внимание!</font> Системная информация.</B> Результат обыска бота: <B>Денежные средства «19 NV», Денежные средства «30 NV»</B>.</font><br>";

            var thingstr = HelperStrings.SubString(message, "Результат обыска бота: <B>", "</B>.");

            if (!string.IsNullOrEmpty(thingstr))
            {
                var timestr = HelperStrings.SubString(message, "<font class=chattime>&nbsp;", "&nbsp;</font> <font color=000000><B><font color=#CC0000>Внимание!</font> Системная информация.</B> Результат обыска бота: ");
                if (!string.IsNullOrEmpty(timestr))
                {
                    var          thinglist = new List <string>();
                    const string pattern   = @"«([^»]+)»";
                    foreach (Match match in Regex.Matches(thingstr, pattern))
                    {
                        thinglist.Add(match.ToString().Trim(new[] { '«', '»' }));
                    }

                    if (thinglist.Count > 0)
                    {
                        try
                        {
                            if (AppVars.MainForm != null)
                            {
                                AppVars.MainForm.BeginInvoke(
                                    new UpdateThingIncDelegate(AppVars.MainForm.UpdateThingInc),
                                    new object[] { timestr, thinglist });
                            }
                        }
                        catch (InvalidOperationException)
                        {
                        }
                    }
                }
            }

            // <font class=clchattime>&nbsp;16:45:54&nbsp;</font> >>> <SPAN alt="%Josaphina">Josaphina</SPAN>  > clan: > <SPAN alt="%Josaphina">Райская Птица</SPAN>: <font color=CC0099>+</font>

            if (message.IndexOf("<font color=#000000><b>Системная информация.</b></font> Поединок завершён.", StringComparison.OrdinalIgnoreCase) != -1)
            {
                // Конец боя
                if (!string.IsNullOrEmpty(AppVars.LastBoiLog) &&
                    !string.IsNullOrEmpty(AppVars.LastBoiSostav) &&
                    !string.IsNullOrEmpty(AppVars.LastBoiTravm) &&
                    !string.IsNullOrEmpty(AppVars.LastBoiUron))
                {
                    var newLog =
                        "Бой" +
                        AppVars.LastBoiTravm +
                        " против " +
                        AppVars.LastBoiSostav +
                        @" завершен (<a href=http://www.neverlands.ru/logs.fcg?fid=" +
                        AppVars.LastBoiLog +
                        @" onclick=""window.open(this.href);"">лог</a> боя). Нанесено урона: <FONT color=#339900><b>" +
                        AppVars.LastBoiUron +
                        "</b></FONT>";

                    /*@" target=_blank>лог</a> боя). Нанесено урона: <FONT color=#339900><b>" +*/
                    /*@" onclick=""window.open(this.href);"">лог</a> боя). Нанесено урона: <FONT color=#339900><b>" +*/

                    message = message.Replace("Поединок завершён", newLog);
                    var pos = message.IndexOf("Получено <font color=#004BBB>магического", StringComparison.OrdinalIgnoreCase);
                    if (pos != -1)
                    {
                        const string se   = "</font></b>.";
                        var          spos = message.IndexOf(se, pos, StringComparison.OrdinalIgnoreCase);
                        if (spos != -1)
                        {
                            message = message.Remove(pos, spos + se.Length - pos);
                        }
                    }

                    var texlogMessage =
                        "Бой против " +
                        AppVars.LastBoiSostav +
                        @" завершен (" +
                        AppVars.LastBoiLog +
                        @")";
                    try
                    {
                        if (AppVars.MainForm != null)
                        {
                            AppVars.MainForm.BeginInvoke(
                                new UpdateTexLogDelegate(AppVars.MainForm.UpdateTexLog),
                                new object[] { texlogMessage });
                        }
                    }
                    catch (InvalidOperationException)
                    {
                    }

                    AppVars.LastBoiLog    = string.Empty;
                    AppVars.LastBoiSostav = string.Empty;
                }
            }
            else
            {
                /*
                 * message = "<font class=prchattime>&nbsp;11:22:41&nbsp;</font> >>> <SPAN alt=\"%МасКит\">МасКит</SPAN>  > <SPAN alt=\"%Умник\">Умник</SPAN>: <font color=000000>хай</font> ";
                 * message = "<font class=yochattime>&nbsp;10:46:03&nbsp;</font> <SPAN>МасКит</SPAN>&nbsp;для <SPAN alt=\"Умник\">Умник</SPAN>: <font color=000000>я, а что?</font> ";
                 * message = "<font class=clchattime>&nbsp;16:45:54&nbsp;</font> >>> <SPAN alt=\"%Josaphina\">Josaphina</SPAN>  > clan: > <SPAN alt=\"%Умник\">Умник</SPAN>: <font color=CC0099>+</font> ";
                 */

                var posSpanEnd = message.IndexOf(@""">" + AppVars.Profile.UserNick + "</SPAN>", StringComparison.OrdinalIgnoreCase);
                if (posSpanEnd != -1)
                {
                    const string strSpanStart = "<SPAN title=\"";
                    const string strSpanEnd   = "\">";
                    var          fromNick     = HelperStrings.SubString(message, strSpanStart, strSpanEnd).TrimStart(new[] { '%' });
                    if (!fromNick.Equals(AppVars.Profile.UserNick, StringComparison.OrdinalIgnoreCase))
                    {
                        EventSounds.PlaySndMsg();
                        var istoclan = message.IndexOf(" > clan: ", StringComparison.OrdinalIgnoreCase) != -1;
                        var istopair = message.IndexOf(" > pair: ", StringComparison.OrdinalIgnoreCase) != -1;
                        if (AppVars.Profile.DoAutoAnswer)
                        {
                            var answer = "%<" + fromNick + "> " + AutoAnswerMachine.GetNextAnswer();
                            if (istoclan)
                            {
                                answer = answer.Insert(0, "%clan%");
                            }
                            else
                            if (istopair)
                            {
                                answer = answer.Insert(0, "%pair%");
                            }

                            Chat.AddAnswer(answer);
                        }
                    }
                }

                if (AppVars.Profile.DoChatLevels)
                {
                    posSpanEnd = message.IndexOf("</SPAN>", StringComparison.OrdinalIgnoreCase);
                    if (posSpanEnd != -1)
                    {
                        var posSpanTagEnd = message.LastIndexOf('>', posSpanEnd);
                        if (posSpanTagEnd != -1)
                        {
                            var sayNick = message.Substring(posSpanTagEnd + 1, posSpanEnd - posSpanTagEnd - 1);
                            if (ChatUsersManager.Exists(sayNick))
                            {
                                var posSpanTagStart = message.LastIndexOf('<', posSpanTagEnd);
                                if (posSpanTagStart != -1)
                                {
                                    var chatUser = ChatUsersManager.GetUserData(sayNick);
                                    if (!string.IsNullOrEmpty(chatUser.Level))
                                    {
                                        message = message.Insert(posSpanEnd + "</SPAN>".Length,
                                                                 "&nbsp;[" + chatUser.Level +
                                                                 @"]<a href=""http://www.neverlands.ru/pinfo.cgi?" +
                                                                 chatUser.Nick +
                                                                 @""" onclick=""window.open(this.href);""><img src=http://image.neverlands.ru/chat/info.gif width=11 height=12 border=0 align=bottom></a>");
                                    }

                                    var sb = new StringBuilder();
                                    if (!string.IsNullOrEmpty(chatUser.Sign))
                                    {
                                        sb.Append("<img src=http://image.neverlands.ru/signs/");
                                        sb.Append(chatUser.Sign);
                                        sb.Append(@" width=15 height=12 align=bottom title=""");
                                        sb.Append(chatUser.Status);
                                        sb.Append(@""">&nbsp;");
                                    }

                                    message = message.Insert(posSpanTagStart, sb.ToString());
                                }
                            }
                        }
                    }
                }
            }

            // >>> <SPAN alt="%Not Alone">Not Alone</SPAN>  > clan: > <SPAN alt="%Not Alone">Райская Птица</SPAN>:

            if (message.IndexOf("pair:", StringComparison.OrdinalIgnoreCase) != -1)
            {
                message = message.Replace("<SPAN title=\"%", "<SPAN title=\"%%%");
            }
            else
            {
                if (message.IndexOf("clan:", StringComparison.OrdinalIgnoreCase) != -1)
                {
                    message = message.Replace("<SPAN title=\"%", "<SPAN title=\"%%");
                }
            }

            do
            {
                var pos1 = message.IndexOf("[[[", StringComparison.Ordinal);
                if (pos1 == -1)
                {
                    break;
                }

                var pos2 = message.IndexOf("]]]", pos1, StringComparison.Ordinal);
                if (pos2 == -1)
                {
                    break;
                }

                var    sorig = message.Substring(pos1 + 3, pos2 - pos1 - 3);
                string msg   = string.Empty;
                if (!sorig.Contains(":"))
                {
                    msg =
                        $"<a href=http://www.neverlands.ru/logs.fcg?fid={sorig} onclick=\"window.open(this.href);\">лог</a> боя";
                }

                message = string.Concat(message.Substring(0, pos1), msg, message.Substring(pos2 + 3));
            } while (true);

            Chat.AddStringToChat(message);
            return(message);
        }
Exemplo n.º 3
0
        private void TimerCrap()
        {
            if (AppVars.MustReload || (DateTime.Now > AppVars.NextCheckNoConnection))
            {
                AppVars.MustReload = false;
                LogOn();
                return;
            }

            if (AppVars.Profile.SkinAuto && DateTime.Now.Subtract(AppVars.AutoSkinLastChecked).TotalMinutes > 1.0)
            {
                AppVars.AutoSkinLastChecked = DateTime.Now;
                AppVars.AutoSkinCheckKnife  = true;
            }

            // Таймеры
            UpdateTimers();

            // После лечения
            if (!string.IsNullOrEmpty(AppVars.CureNickDone))
            {
                if (browserGame.Document != null)
                {
                    if (!string.IsNullOrEmpty(AppVars.Profile.CureAfter))
                    {
                        Chat.AddAnswer("%<" + AppVars.CureNickDone + "> " + AppVars.Profile.CureAfter);
                    }
                }

                AppVars.CureNickDone = string.Empty;
            }
            else
            {
                if (!string.IsNullOrEmpty(AppVars.CureNickBoi))
                {
                    if (browserGame.Document != null)
                    {
                        if (!string.IsNullOrEmpty(AppVars.CureNickBoi))
                        {
                            Chat.AddAnswer("%<" + AppVars.CureNickBoi + "> " + AppVars.Profile.CureBoi);
                        }
                    }

                    AppVars.CureNickBoi = string.Empty;
                }
            }

            // Реклама

            if (AppVars.AdvActive)
            {
                if (DateTime.Now > AppVars.LastAdv)
                {
                    statuslabelAutoAdv.Text = @"0:00";
                    AppVars.LastAdv         = DateTime.Now.AddSeconds(AppVars.Profile.AutoAdv.Sec);
                    if (AppVars.AdvArray == null)
                    {
                        AppVars.AdvArray = HelperStrings.RandomArray(AppVars.Profile.AutoAdv.Phraz);
                        AppVars.AdvIndex = 0;
                    }

                    if (AppVars.AdvArray != null)
                    {
                        if (AppVars.AdvIndex < AppVars.AdvArray.Length)
                        {
                            Chat.AddAnswer(AppVars.AdvArray[AppVars.AdvIndex]);
                        }

                        AppVars.AdvIndex++;
                        if (AppVars.AdvIndex >= AppVars.AdvArray.Length)
                        {
                            AppVars.AdvArray = null;
                        }
                    }
                }
                else
                {
                    var advdiff = AppVars.LastAdv.Subtract(DateTime.Now);
                    statuslabelAutoAdv.Text = advdiff.Minutes + @":" + advdiff.Seconds.ToString("00");
                }
            }

            // Реклама автоторга

            if (AppVars.Profile.TorgActive)
            {
                if (DateTime.Now > AppVars.LastTorgAdv)
                {
                    statuslabelTorgAdv.Text = "0:00";
                    AppVars.LastTorgAdv     = DateTime.Now.AddMinutes(AppVars.Profile.TorgAdvTime);
                    Chat.AddAnswer(AppVars.Profile.TorgMessageAdv.Replace("{таблица}", AppVars.Profile.TorgTabl));
                }
                else
                {
                    var advdiff = AppVars.LastTorgAdv.Subtract(DateTime.Now);
                    statuslabelTorgAdv.Text = advdiff.Minutes + ":" + advdiff.Seconds.ToString("00");
                }
            }

            if (DateTime.Now.Subtract(AppVars.LastTied).TotalSeconds > 200)
            {
                UpdateCheckTied();
            }

            // ChangeAutoboiState(AppVars.Profile.Autoboi.Active ? AutoboiState.AutoboiOn : AutoboiState.AutoboiOff);
            ChangeAutoboiState(AppVars.Autoboi);

            // Можно вывести в чат результат разделки?
            if (DateTime.Now > AppVars.RazdelkaTime)
            {
                if (AppVars.Profile.RazdChatReport)
                {
                    var sb = new StringBuilder();
                    //sb.Append(AppVars.AppVersion.ProductShortVersion);
                    //sb.Append(": ");
                    sb.Append("Результат разделки: ");
                    for (var i = 0; i < AppVars.RazdelkaResultList.Count; i++)
                    {
                        sb.Append('«');
                        sb.Append(AppVars.RazdelkaResultList[i]);
                        sb.Append('»');
                        if (AppVars.RazdelkaResultList.Count > 1 && i < (AppVars.RazdelkaResultList.Count - 1))
                        {
                            sb.Append(", ");
                        }
                    }

                    sb.Append('.');
                    if (AppVars.RazdelkaLevelUp > 0)
                    {
                        sb.Append(" Умение «Охота» повысилось на ");
                        sb.Append(AppVars.RazdelkaLevelUp);
                        sb.Append('!');
                    }

                    Chat.AddAnswer(sb.ToString());
                }

                AppVars.RazdelkaResultList.Clear();
                AppVars.RazdelkaLevelUp = 0;
                AppVars.RazdelkaTime    = DateTime.MaxValue;
            }

            // Работает ли пауза?
            if (DateTime.Now.Ticks < AppVars.Profile.Pers.Ready)
            {
                if (AppVars.Autoboi == AutoboiState.Timeout)
                {
                    if (!string.IsNullOrEmpty(AppVars.AccountError))
                    {
                        AppVars.DoPromptExit = false;
                        Close();
                    }
                    else
                    {
                        if (DateTime.Now.Subtract(AppVars.LastMainPhp).TotalSeconds > 28)
                        {
                            try
                            {
                                if (AppVars.MainForm != null)
                                {
                                    AppVars.MainForm.BeginInvoke(
                                        new ReloadMainPhpInvokeDelegate(AppVars.MainForm.ReloadMainPhpInvoke),
                                        new object[] { });
                                }
                            }
                            catch (InvalidOperationException)
                            {
                            }

                            var expected =
                                HelperConverters.TimeSpanToString(
                                    new TimeSpan(AppVars.Profile.Pers.Ready - DateTime.Now.Ticks));
                            WriteChatMsg(string.Format(CultureInfo.InvariantCulture, "До таймаута боя: <b>{0}</b>", expected));
                        }
                    }
                }

                return;
            }

            // Оглядываемся...

            /*
             * if (AppVars.DoHerbAutoCut)
             * {
             *  // ["ogl","Оглядеться","e108c4be017325666d1744fd977189f4",
             *  if (PressOgl())
             *  {
             *  }
             * }
             */

            // Обновление списка людей на клетке

            /*
             * if (AppVars.DoShowWalkers)
             * {
             *  var diffc = DateTime.Now.Subtract(AppVars.LastChList);
             *  if (diffc.TotalSeconds > 1)
             *  {
             *      AppVars.LastChList = DateTime.Now;
             *      ReloadChlistFrame();
             *  }
             * }
             */

            if (AppVars.FishNoCaptchaReady)
            {
                AppVars.FishNoCaptchaReady = false;
                UpdateTexLog("Завершение рыбалки без капчи");
                EnterFishCode(string.Empty);
                return;
            }

            if (string.IsNullOrEmpty(AppVars.FightLink))
            {
                if (DateTime.Now.Subtract(AppVars.IdleTimer).TotalMinutes > 4)
                {
                    AppVars.IdleTimer = DateTime.Now;
                    ReloadMainPhpInvoke();
                }

                return;
            }

            // Если нераспознанной капчи нет
            if (AppVars.FightLink.IndexOf("????", StringComparison.Ordinal) == -1)
            {
                if (AppVars.Profile.LezDoAutoboi)
                {
                    AppVars.Profile.Pers.Ready = 0;
                    if (AppVars.FightLink.Length > 5)
                    {
                        UpdateTexLog("Завершение боя");
                        if (AppVars.FightLink != null)
                        {
                            if (AppVars.FightLink.IndexOf("=00000&", StringComparison.Ordinal) == -1)
                            {
                                SetMainTopInvoke(AppVars.FightLink);
                            }
                        }
                    }
                    else
                    {
                        UpdateTexLog("Завершение рыбалки");
                        EnterFishCode(AppVars.FightLink);
                    }

                    if (AppVars.Profile.ShowTrayBaloons && trayIcon.Visible)
                    {
                        try
                        {
                            LockBaloon.AcquireWriterLock(5000);
                            try
                            {
                                trayIcon.Visible = false;
                                trayIcon.Visible = true;
                            }
                            finally
                            {
                                LockBaloon.ReleaseWriterLock();
                            }
                        }
                        catch (ApplicationException)
                        {
                        }
                    }

                    AppVars.FightLink = string.Empty;
                    ChangeAutoboiState(AppVars.Profile.LezDoAutoboi
                                           ? AutoboiState.AutoboiOn
                                           : AutoboiState.AutoboiOff);
                }

                return;
            }

            // Все дальнейшие операции - только если включен гуамод
            if (!AppVars.Profile.DoGuamod)
            {
                if (DateTime.Now.Subtract(AppVars.IdleTimer).TotalMinutes > 4)
                {
                    AppVars.IdleTimer = DateTime.Now;
                    ReloadMainPhpInvoke();
                }

                return;
            }

            if (AppVars.Autoboi == AutoboiState.Guamod)
            {
                // Уже идет распознавание
                ChangeAutoboiState(AutoboiState.Guamod);
            }
            else
            {
                // Запуск гуамода
                if (string.IsNullOrEmpty(AppVars.CodeAddress))
                {
                    try
                    {
                        if (AppVars.MainForm != null)
                        {
                            AppVars.MainForm.BeginInvoke(
                                new ReloadMainPhpInvokeDelegate(AppVars.MainForm.ReloadMainPhpInvoke),
                                new object[] { });
                        }
                    }
                    catch (InvalidOperationException)
                    {
                    }

                    return;
                }

                AppVars.GuamodCode = "?????";
                ChangeAutoboiState(AutoboiState.Guamod);
                Recognizer.Perform();
            }
        }