Пример #1
0
        void AddAtacker(TTInfo troop)
        {
            if (!IsAttack(troop) && !IsRaid(troop))
            {
                return;
            }

            if (!attackers.ContainsKey(troop.OwnerVillageZ))
            {
                TAttacker att = ParseAttacker(troop);
                if (att != null)
                {
                    attackers.Add(troop.OwnerVillageZ, att);
                }
                else
                {
                    return;
                }
            }

            if (IsTrustful(attackers[troop.OwnerVillageZ].Name))
            {
                return;
            }

            attackers[troop.OwnerVillageZ].troops.Add(troop);
            if (LatestIncoming == null || troop.FinishTime < LatestIncoming.FinishTime)
            {
                LatestIncoming = troop;
            }
        }
Пример #2
0
        TAttacker ParseAttacker(TTInfo troop)
        {
            string data = UpCall.PageQuery(VillageID, troop.OwnerVillageUrl, null, true, true);

            if (string.IsNullOrEmpty(data))
            {
                return(null);
            }

            string name = "", ally = "";
            int    uid = 0, popu = 0;

            string pattern = "allianz\\.php\\?aid=\\d+\">(.*?)</a></td>" +
                             "[^<]*?</tr>[^<]*?<tr>[^<]*?<th>[^<]*?</th>[^<]*?<td><a href=\"spieler\\.php\\?uid=(\\d+)\">(.*?)</a></td>" +
                             "[^<]*?</tr>[^<]*?<tr>[^<]*?<th>[^<]*?</th>[^<]*?<td>(\\d+)</td>";
            Regex reg = new Regex(pattern);
            Match m   = reg.Match(data);

            if (m.Success)
            {
                ally = m.Groups[1].Value;
                uid  = int.Parse(m.Groups[2].Value);
                name = m.Groups[3].Value;
                popu = int.Parse(m.Groups[4].Value);
            }
            else
            {
                return(null);
            }

            TPoint point = new TPoint();

            point.Z = troop.OwnerVillageZ;
            TAttacker attacker = new TAttacker
            {
                Point       = point,
                Tribe       = troop.Tribe,
                troops      = new List <TTInfo>(),
                VileageName = troop.Owner,
                Ally        = ally,
                Name        = name,
                Uid         = uid,
                Population  = popu,
            };

            return(attacker);
        }
Пример #3
0
        private TAttacker ParseAttacker(TTInfo troop)
        {
            string data = UpCall.PageQuery(VillageID, troop.OwnerVillageUrl, null, true, true);
            if (string.IsNullOrEmpty(data))
                return null;

            string name = "", ally = "";
            int uid = 0, popu = 0;

            string pattern = @"<table.*id=""village_info"".*allianz\.php\?aid=\d+"">(.*)</a>.*spieler\.php\?uid=(\d+)"">(.*)</a>.*<td>(\d+)</td>.*</table>";
            Regex reg = new Regex(pattern, RegexOptions.Singleline);
            Match m = reg.Match(data);
            if (m.Success)
            {
                ally = m.Groups[1].Value;
                uid = int.Parse(m.Groups[2].Value);
                name = m.Groups[3].Value;
                popu = int.Parse(m.Groups[4].Value);
            }
            else
                return null;

            TPoint point = new TPoint();
            point.Z = troop.OwnerVillageZ;
            TAttacker attacker = new TAttacker
            {
                Point = point,
                Tribe = troop.Tribe,
                troops = new List<TTInfo>(),
                VileageName = troop.Owner,
                Ally = ally,
                Name = name,
                Uid = uid,
                Population = popu,
            };
            return attacker;
        }
Пример #4
0
        TAttacker ParseAttacker(TTInfo troop)
        {
            string data = UpCall.PageQuery(VillageID, troop.OwnerVillageUrl, null, true, true);
            if (string.IsNullOrEmpty(data))
                return null;

            string name = "", ally = "";
            int uid = 0, popu = 0;

            string pattern = "allianz\\.php\\?aid=\\d+\">(.*?)</a></td>"+
                "[^<]*?</tr>[^<]*?<tr>[^<]*?<th>[^<]*?</th>[^<]*?<td><a href=\"spieler\\.php\\?uid=(\\d+)\">(.*?)</a></td>"+
                "[^<]*?</tr>[^<]*?<tr>[^<]*?<th>[^<]*?</th>[^<]*?<td>(\\d+)</td>";
            Regex reg = new Regex(pattern);
            Match m = reg.Match(data);
            if (m.Success)
            {
                ally = m.Groups[1].Value;
                uid = int.Parse(m.Groups[2].Value);
                name = m.Groups[3].Value;
                popu = int.Parse(m.Groups[4].Value);
            }
            else
                return null;

            TPoint point = new TPoint();
            point.Z = troop.OwnerVillageZ;
            TAttacker attacker = new TAttacker
            {
                Point = point,
                Tribe = troop.Tribe,
                troops = new List<TTInfo>(),
                VileageName = troop.Owner,
                Ally = ally,
                Name = name,
                Uid = uid,
                Population = popu,
            };
            return attacker;
        }