Пример #1
0
        private CQ SetFilters(string token)
        {
            var url =
                "https://sv36.tribalwars.se/game.php?village=2145&screen=event_crest&action=set_filters&h=" + token;
            var postData = "filter%5Bhide_friends%5D=on&filter%5Bhide_crestless%5D=on";

            var req  = _requestManager.GeneratePOSTRequest(url, postData, null, null, true);
            var res  = _requestManager.GetResponse(req);
            CQ  html = RequestManager.GetResponseStringFromResponse(res);

            return(html);
        }
Пример #2
0
        public bool CancelBuildingUpgradeFromActiveQueue(string id, string csrfToken, int currentVillage)
        {
            var cancelOrderUrl = CancelOrderUrl
                                 .Replace("__village__", currentVillage.ToString())
                                 .Replace("__type__", "main")
                                 .Replace("__csrfToken__", csrfToken);

            var url      = $"{BaseUrl}{cancelOrderUrl}";
            var postData = $"id={id}&destroy=0";

            var resNotParsed = _reqManager.GeneratePOSTRequest(url, postData, null, null, true);
            var res          = _reqManager.GetResponse(resNotParsed);
            var html         = RequestManager.GetResponseStringFromResponse(res);

            return(html.Contains("success\":true"));
        }
Пример #3
0
        private string SendAttackInit(RequestManager requestManager, PlanedAttack planedAttack, int villageNr)
        {
            var url      = $"https://sv36.tribalwars.se/game.php?village={villageNr}&screen=place&try=confirm";
            var postData =
                "22c2d931d74cd8a06d92b4=e6c57ef722c2d9" +
                "&template_id=" +
                $"&source_village={villageNr}" +
                $"&{UnitHelper.GetUnitQueryStringFromUnitDict(planedAttack.Units)}" +
                $"&x={planedAttack.EnemyVillageXCord}" +
                $"&y={planedAttack.EnemyVillageYCord}" +
                "&target_type=coord" +
                "&input=&attack=Attack";
            var req = requestManager.GeneratePOSTRequest(url, postData, null, null, true);
            var res = requestManager.GetResponse(req);

            var str         = RequestManager.GetResponseStringFromResponse(res);
            CQ  html        = str;
            var formElement = html.Select("#command-data-form");
            var inputs      = formElement.Children("input").Where(ele => ele.Type == "hidden").ToList();

            var queryString = inputs.Aggregate("", (current, input) => current + $"{input.Name}={input.Value}&");

            return(queryString);
        }