コード例 #1
0
        public UnovaBattle StartWildBattle(int pokeId, int level, int mapId, int type, int x = 20, int y = 20)
        {
            var nvc = new NameValueCollection {
                { "token_pokemon", Convert.ToBase64String(Encoding.UTF8.GetBytes($"{pokeId}|{(type == 0 ? string.Empty : (type).ToString())}|{level}|{mapId}")) },
                { "id_pokemon", pokeId.ToString() },
                { "level", level.ToString() },
                { "id_map", mapId.ToString() },
                { "x", x.ToString() },
                { "y", y.ToString() }
            };

            if (type != 0)
            {
                nvc.Add("shiny", type.ToString());
            }

            byte[] resp = Web.UploadValues(Urls.UrlBattleWild, nvc);

            return(UnovaBattle.FromHtml(this, Encoding.UTF8.GetString(resp), pokeId, level, mapId));
        }
コード例 #2
0
        public UnovaBattle StartTrainerBattle(long tid)
        {
            string resp = Web.DownloadString(Urls.UrlBattleTrainer + "&tid=" + tid);

            return(UnovaBattle.FromHtml(this, resp, tid: tid));
        }