trydis / FIFA-Ultimate-Team-Toolkit

FIFA Ultimate Team Toolkit
MIT License
237 stars 111 forks source link

PlayerSearch AuctionInfo Count 0 #226

Closed rmanning-dotnet closed 8 years ago

rmanning-dotnet commented 8 years ago

I've just started using this api - thanks for the all the work

I have the 2 step login working, next step is the player search.

I keep getting 0 results for the AuctionInfo - using the exact sample from the readme.

Anyone else getting this or know what i might be doing wrong? I've had a search through the closed issues but can't find any similar issues.

Thanks

rmanning-dotnet commented 8 years ago

Ah i also forgot to add that the JSON response from ea has no AuctionInfo results.

jvianafec commented 8 years ago

Show your cose

Enviado do meu iPhone

Em 14 de fev de 2016, às 3:09 PM, ross-ukdev notifications@github.com escreveu:

Ah i also forgot to add that the JSON response from ea has no AuctionInfo results.

— Reply to this email directly or view it on GitHub.

rmanning-dotnet commented 8 years ago

It's in test/hack mode at the moment, will refactor when i get the api calls working.

Here's the player search call:

        public async Task<AuctionResponse> PlayerSearch(FutClient client)
        {
            var searchParameters = new PlayerSearchParameters
            {
                Page = 1,
                Level = Level.Gold,
                ChemistryStyle = ChemistryStyle.Sniper,
                League = League.BarclaysPremierLeague,
                Nation = Nation.England,
                Position = Position.Striker,
                Team = Team.ManchesterUnited
            };
            var auction = await client.SearchAsync(searchParameters);

            var list = new List<AuctionInfo>();
            foreach (var auctionInfo in auction.AuctionInfo)
            {
                list.Add(auctionInfo);
            }
            return auction;
        }

and here's the code that hooks it all up from an MVC action:

       // GET: Home
        public async Task<ActionResult> Index()
        {
            var client = new FutClient();

            await Login(client);
            var auctionTask = Task.Factory.StartNew(() => PlayerSearch(client));

            var list = new List<AuctionInfo>();
            foreach (var auctionInfo in auctionTask.Result.Result.AuctionInfo)
            {
                list.Add(auctionInfo);
            }

            var viewModel = new WebAppViewModel
            {
                AuctionResponse = auctionTask.Result.Result
            };

            return View(viewModel);
        }`

       public async Task Login(FutClient client)
        {
            var loginDetails = new LoginDetails("email", "password, "secret", Platform.Pc);

            try
            {
                ITwoFactorCodeProvider provider = new TwoFactorCodeProvider();
                var loginResponse = await client.LoginAsync(loginDetails, provider);
            }
            catch (JsonSerializationException)
            {

            };
        }`
jvianafec commented 8 years ago

Your account is new? it may be that the market is unavailable for your account.

I recommend checking out the web app if the market is available.

If so, please post the response the search call. (Fiddler)

rmanning-dotnet commented 8 years ago

I've been using the webapp/playing FUT for around 6 months.

Just checked the web app and all looks fine, im wondering if it could that my ea PC account is linked to my PS3 account. Used to play fifa on the PS3 years ago.

Here's the request headers and response using the code above: Request POST https://utas.s2.fut.ea.com/ut/game/fifa16/transfermarket?start=0&num=13&maskedDefId=0&type=player HTTP/1.1 Connection: keep-alive,Keep-Alive X-HTTP-Method-Override: GET X-UT-PHISHING-TOKEN: 19847773651426438 X-UT-Embed-Error: true X-UT-SID: aae22661-h45f-12h4-e5tt-4kl3hee9t134 Accept-Encoding: gzip, deflate, sdch Accept-Language: en-US, en; q=0.8 Accept: application/json Referer: http://www.easports.com/iframe/fut/bundles/futweb/web/flash/FifaUltimateTeam.swf User-Agent: Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.62 Safari/537.36 Content-Type: text/plain; charset=utf-8 Host: utas.s2.fut.ea.com Content-Length: 1

Response { "errorState":null, "credits":33082, "auctionInfo":[], "duplicateItemIdList":null, "bidTokens":{}, "currencies":[{"name":"COINS","funds":33082,"finalFunds":33082}, {"name":"DRAFT_TOKEN","funds":1,"finalFunds":1}] }

Thanks for your help!

Lululuz commented 8 years ago

Your response looks ok. Maybe there is no "Rooney" with chemstyle sniper on the market, remove some filters and try again.

rmanning-dotnet commented 8 years ago

Lululuz, i've tried with no search params too with no luck.

I have found the issue, i noticed that the webapp doesnt post maskedDefId=0, so i removed it from my request and now i'm instantly getting the correct Auction Info back!

Is this isolated to just me!?

Slightly off topic, is there a way i can BIN via this client? Rather than BID?

Thanks

Lululuz commented 8 years ago

Just wanted to post the same thing :P I changed the PlayerSearchParameters like this

if (ResourceId != 0)
            {
                if (ResourceId <= 16777216)
                    uriString += "&maskedDefId=" + ResourceId.CalculateBaseId();
                else
                    uriString += "&definitionId=" + ResourceId;
            }

Regarding your question: Yes you can bid instead of bin. Just check out the readme:

Place bid

Passing the amount explicitly:

var auctionResponse = await client.PlaceBidAsync(auctionInfo, 150);

Place the next valid bid amount:

var auctionResponse = await client.PlaceBidAsync(auctionInfo);

edit:

lol read your question wrong :) here you go:

 var auctionResponse = await client.PlaceBidAsync(auctionInfo, auctionInfo.BuyNowPrice);
rmanning-dotnet commented 8 years ago

haha this has been driving me mad trying to figure it out, i'll go with your change (mine was just commenting it out)

ah but i would like to BIN/Buy it now, do i just pass the exact buy it now price?

e.g. var auctionResponse = await client.PlaceBidAsync(auctionInfo, butItNowPriceHere);

Thanks for your help!

edit:

Just seen your edit, thank you!