Esempio n. 1
0
        public bool ClickAdd(string token, string lid, string x, string y)
        {
            _getParams.Clear();

            var postParams = new Dictionary <string, string>
            {
                { "cmd", "raidList" },
                { "action", "ActionAddSlotForm" },
                { "listId", lid },
                { "x", "" },
                { "y", "" },
                { "context", "rallyPoint" },
                { "ajaxToken", token }
            };

            if (!HTTP.PostAjaxRequest("https://" + _server + "/ajax.php?cmd=raidList", _server, null, _getParams,
                                      postParams, ref cookies))
            {
                return(false);
            }

            string[] defaultType = new string[9]
            {
                "0", "0", "0", "0", "0", "0", "0", "0", "0"
            };

            defaultType[_farmlistTroopType] = TroopInfo.Amount;

            postParams = new Dictionary <string, string>
            {
                { "cmd", "raidList" },
                { "action", "ActionAddSlot" },
                { "listId", lid },
                { "x", x },
                { "y", y },
                { "t1", defaultType[0] },
                { "t2", defaultType[1] },
                { "t3", defaultType[2] },
                { "t5", defaultType[3] },
                { "t6", defaultType[4] },
                { "t7", defaultType[5] },
                { "t8", defaultType[6] },
                { "t9", defaultType[7] },
                { "t10", defaultType[8] },
                { "ajaxToken", token }
            };
            if (!HTTP.PostAjaxRequest("https://" + _server + "/ajax.php?cmd=raidList", _server, null, _getParams,
                                      postParams, ref cookies))
            {
                return(false);
            }
            postParams["action"] = "ActionAddSlot";
            return(HTTP.PostAjaxRequest("https://" + _server + "/ajax.php?cmd=raidList", _server, null, _getParams, postParams, ref cookies));
        }
Esempio n. 2
0
        public bool Npc(Dictionary <string, string> resourceParams, string ajaxToken)
        {
            _getParams.Clear();
            var postParams = resourceParams;

            if (!HTTP.PostAjaxRequest("https://" + _server + "/ajax.php?cmd=exchangeResources", _server, cookies,
                                      _getParams, postParams, ref cookies))
            {
                return(true);
            }

            htmlCrawler = new HtmlCrawler(Info.ResponseBody);
            var did = htmlCrawler.GetDid();

            postParams = new Dictionary <string, string>
            {
                { "cmd", "exchangeResources" },
                { "did", did },
                { "desired[0]", postParams["defaultValues[r1]"] },
                { "desired[1]", postParams["defaultValues[r2]"] },
                { "desired[2]", postParams["defaultValues[r3]"] },
                { "desired[3]", postParams["defaultValues[r4]"] },
                { "ajaxToken", ajaxToken }
            };

            if (!HTTP.PostAjaxRequest("https://" + _server + "/ajax.php?cmd=exchangeResources", _server, cookies,
                                      _getParams, postParams, ref cookies))
            {
                return(true);
            }

            htmlCrawler = new HtmlCrawler(Info.ResponseBody);
            postParams  = htmlCrawler.GetExchangeParams(did, ajaxToken);

            return(HTTP.PostAjaxRequest("https://" + _server + "/ajax.php?cmd=premiumFeature",
                                        _server,
                                        cookies,
                                        _getParams,
                                        postParams,
                                        ref cookies));
        }
Esempio n. 3
0
        public bool BuyAnimals()
        {
            _getParams.Clear();

            if (!HTTP.GetRequest("http://" + _server + "/build.php", _getParams, _server, true))
            {
                return(false);
            }

            htmlCrawler = new HtmlCrawler(Info.ResponseBody);
            string token;

            token = htmlCrawler.GetAjaxToken();

            var postParams = new Dictionary <string, string>
            {
                { "", "" },
                { "cmd", "paymentWizard" },
                { "goldProductId", "" },
                { "goldProductLocation", "" },
                { "location", "" },
                { "activeTab", "buyGold" },
                { "ajaxToken", token }
            };

            CookieCollection t = new CookieCollection();

            if (!HTTP.PostAjaxRequest("https://" + _server + "/ajax.php?cmd=paymentWizard", _server, cookies,
                                      _getParams, postParams, ref t))
            {
                return(false);
            }

            if (Bot.GetErrorMessage(Info.ResponseBody))
            {
                return(false);
            }

            postParams["activeTab"] = "paymentFeatures";

            if (!HTTP.PostAjaxRequest("https://" + _server + "/ajax.php?cmd=paymentWizard", _server, cookies,
                                      _getParams, postParams, ref t))
            {
                return(false);
            }

            if (Bot.GetErrorMessage(Info.ResponseBody))
            {
                return(false);
            }

            postParams = new Dictionary <string, string>
            {
                { "cmd", "premiumFeature" },
                { "featureKey", "buyAnimal5" },
                { "context", "paymentWizard" },
                { "ajaxToken", token }
            };

            if (!HTTP.PostAjaxRequest("https://" + _server + "/ajax.php?cmd=premiumFeature", _server, cookies,
                                      _getParams, postParams, ref t))
            {
                return(false);
            }

            if (Bot.GetErrorMessage(Info.ResponseBody))
            {
                return(false);
            }

            postParams = new Dictionary <string, string>
            {
                { "cmd", "getGoldAmount" },
                { "ajaxToken", token }
            };
            if (HTTP.PostAjaxRequest("https://" + _server + "/ajax.php?cmd=getGoldAmount", _server, cookies, _getParams, postParams, ref t))
            {
                // Hata mesajı varsa false döndürür
                return(!Bot.GetErrorMessage(Info.ResponseBody));
            }
            return(false);
        }