コード例 #1
0
ファイル: UnitService.cs プロジェクト: Zexuz/TribalWarsBot
        public bool CancelOrderFromActiveQueue(RequestManager reqManager, int orderNr, string token, int village)
        {
            var url =
                $"https://sv36.tribalwars.se/game.php?village={village}&screen=train&ajaxaction=cancel&h={token}";
            var postData = $"id={orderNr}";
            var res      = reqManager.SendPOSTRequest(url, postData, null, null, true);
            var jsonRes  = RequestManager.GetResponseStringFromResponse(res);

            return(jsonRes.Contains("success:true"));
        }
コード例 #2
0
ファイル: UnitService.cs プロジェクト: Zexuz/TribalWarsBot
        public bool AddOrderToActiveQueue(RequestManager reqManager, Dictionary <Units, int> units, string token,
                                          int village)
        {
            var url =
                $"https://sv36.tribalwars.se/game.php?village={village}&screen=train&ajaxaction=train&mode=train&h={token}";
            var postData = "";

            foreach (var unitKeyPair in units)
            {
                var unitName = UnitHelper.GetNameForType(unitKeyPair.Key);
                postData += $"units%5B{unitName}%5D={unitKeyPair.Value}&";
            }

            var res     = reqManager.SendPOSTRequest(url, postData, null, null, true);
            var jsonRes = RequestManager.GetResponseStringFromResponse(res);

            return(jsonRes.Contains("success:true"));
        }
コード例 #3
0
ファイル: AttackService.cs プロジェクト: Zexuz/TribalWarsBot
 private void SendAttackConfirm(RequestManager requestManager, string postData, string token, int village)
 {
     var url          = $"https://sv36.tribalwars.se/game.php?village={village}&screen=place&action=command&h={token}";
     var res          = requestManager.SendPOSTRequest(url, postData, null, null, true);
     var htmlResponse = RequestManager.GetResponseStringFromResponse(res);
 }