예제 #1
0
        public static bool Exists(string userNick)
        {
            var result = UserList.ContainsKey(userNick.ToLower());

            if (result)
            {
                return(true);
            }

            var userInfo = NeverApi.GetAll(userNick);

            if (userInfo == null)
            {
                return(false);
            }

            var nick   = userInfo.Nick;
            var sign   = userInfo.ClanSign;
            var level  = userInfo.Level;
            var status = $"{userInfo.ClanName}, {userInfo.ClanStatus}";
            var user   = new ChatUser(nick, level, sign, status);

            UserList.Add(nick.ToLower(), user);
            return(true);
        }
예제 #2
0
        private static void ProcessBossAsync(object state)
        {
            var         nextContactKey = (string)state;
            BossContact contact;

            if (!AppVars.BossContacts.TryGetValue(nextContactKey, out contact))
            {
                return;
            }

            var nick     = contact.Name;
            var userInfo = NeverApi.GetAll(nick);

            if (!AppVars.BossContacts.TryGetValue(nextContactKey, out contact))
            {
                return;
            }

            contact.Process(userInfo);
        }
예제 #3
0
        public void Process(UserInfo userInfo)
        {
            if (userInfo == null)
            {
                return;
            }

            var location   = userInfo.Location;
            var splocation = location.Split(new[] { " [" }, StringSplitOptions.RemoveEmptyEntries);

            if (splocation.Length == 2)
            {
                splocation[1] = splocation[1].Substring(0, splocation[1].Length - 1);
                location      = splocation[1];
            }

            var isonline = !string.IsNullOrEmpty(location);
            var flog     = userInfo.FightLog;

            if (flog.Equals("0", StringComparison.Ordinal))
            {
                flog = string.Empty;
            }

            NextCheck = DateTime.Now.AddSeconds(30);

            if (!isonline)
            {
                return;
            }

            if (flog.Equals(Flog))
            {
                return;
            }

            Flog = flog;

            if (string.IsNullOrEmpty(flog))
            {
                return;
            }

            var fight = NeverApi.GetFlog(flog);

            //fight = File.ReadAllText("boss3.txt");
            if (string.IsNullOrEmpty(fight))
            {
                return;
            }

            // var lives_g2 = [[3,"Королева Змей",49331,100000,2304578,1]];

            // [1,"Anothers_girl",21,4,"c174",1070,1070,1]
            // [1,"PAPA",16,3,"c249",795,795,1]
            // [1,"E Pluribus Unum",15,2,"c176",1095,1095,1]

            // 16:53:27 Босс Королева Змей [25] нападает...
            // 16:53:27 Босс Королева Змей [25]: 99950/100000
            // 13:30:22 Босс Хранитель Леса [25]: 0/100000
            // 13:30:22 Босс Королева Змей [25]: 100000/100000

            var livesg1 = HelperStrings.SubString(fight, "var lives_g1 = [[", "]]");
            var livesg2 = HelperStrings.SubString(fight, "var lives_g2 = [[", "]]");

            if (string.IsNullOrEmpty(livesg1) || string.IsNullOrEmpty(livesg2))
            {
                return;
            }

            //File.WriteAllText($"x{flog}.txt", fight);

            if (CheckLives(Name, flog, userInfo, location, livesg1))
            {
                ContactsManager.AddUsers(livesg2);
                //File.WriteAllText($"x{flog}.txt", fight);
                return;
            }

            if (CheckLives(Name, flog, userInfo, location, livesg2))
            {
                ContactsManager.AddUsers(livesg1);
                //File.WriteAllText($"x{flog}.txt", fight);
            }
        }
예제 #4
0
파일: Contact.cs 프로젝트: wmlabtx/abclient
        private static string HtmlPercEntry(string nick)
        {
            var userInfo = NeverApi.GetAll(nick);

            if (userInfo == null)
            {
                return("Аноним");
            }

            nick = userInfo.Nick;
            var nnhtmlSec = nick.Replace("+", "%2B");
            var colorNick = nick;

            switch (ContactsManager.GetClassIdOfContact(nick))
            {
            case 1:
                colorNick = @"<font color=""#8A0808"">" + colorNick + "</font>";
                break;

            case 2:
                colorNick = @"<font color=""#0B610B"">" + colorNick + "</font>";
                break;

            default:
                colorNick = @"<font color=""#000000"">" + colorNick + "</font>";
                break;
            }

            var align = userInfo.Align;
            var sign  = userInfo.ClanSign;
            var level = userInfo.Level;
            var clan  = userInfo.ClanName;

            var sbeff = new StringBuilder();

            if (userInfo.EffectsCodes.Length > 0)
            {
                for (var k = 0; k < userInfo.EffectsCodes.Length; k++)
                {
                    var effcode = userInfo.EffectsCodes[k];
                    var effname = userInfo.EffectsNames[k];
                    sbeff.AppendFormat(
                        @"&nbsp;<img src=http://image.neverlands.ru/pinfo/eff_{0}.gif width=15 height=15 align=absmiddle title=""{1}"">",
                        effcode,
                        effname);
                }
            }

            var sleeps = string.Empty /*sbeff.ToString()*/;
            var ali1   = string.Empty;
            var ali2   = string.Empty;

            switch (align)
            {
            case "0":
                ali1 = string.Empty;
                ali2 = string.Empty;
                break;

            case "1":
                ali1 = "darks.gif";
                ali2 = "Дети Тьмы";
                break;

            case "2":
                ali1 = "lights.gif";
                ali2 = "Дети Света";
                break;

            case "3":
                ali1 = "sumers.gif";
                ali2 = "Дети Сумерек";
                break;

            case "4":
                ali1 = "chaoss.gif";
                ali2 = "Дети Хаоса";
                break;

            case "5":
                ali1 = "light.gif";
                ali2 = "Истинный Свет";
                break;

            case "6":
                ali1 = "dark.gif";
                ali2 = "Истинная Тьма";
                break;

            case "7":
                ali1 = "sumer.gif";
                ali2 = "Нейтральные Сумерки";
                break;

            case "8":
                ali1 = "chaos.gif";
                ali2 = "Абсолютный Хаос";
                break;

            case "9":
                ali1 = "angel.gif";
                ali2 = "Ангел";
                break;
            }

            align = string.IsNullOrEmpty(ali1)?
                    string.Empty :
                    "<img src=http://image.neverlands.ru/signs/" +
                    ali1 +
                    @" width=15 height=12 align=absmiddle border=0 title=""" +
                    ali2 +
                    @""">&nbsp";

            var ss = string.Empty;

            if (!string.IsNullOrEmpty(clan))
            {
                ss =
                    "<img src=http://image.neverlands.ru/signs/" +
                    sign +
                    @" width=15 height=12 align=absmiddle title=""" +
                    clan +
                    @""">&nbsp;";
            }

            var result =
                @"<a href=""#"" onclick=""top.say_private('" +
                nick +
                @"');""><img src=http://image.neverlands.ru/chat/private.gif width=11 height=12 border=0 align=absmiddle></a>&nbsp;" +
                align +
                ss +
                @"<a class=""activenick"" href=""#"" onclick=""top.say_to('" + nick + @"');""><font class=nickname><b>" +
                colorNick +
                "</b></a>[" +
                level +
                @"]</font><a href=""http://www.neverlands.ru/pinfo.cgi?" +
                nnhtmlSec +
                @""" onclick=""window.open(this.href);""><img src=http://image.neverlands.ru/chat/info.gif width=11 height=12 border=0 align=absmiddle></a>" +
                sleeps;

            return(result);
        }