Armax / Pokemon-GO-node-api

Pokemon GO api node.js library
MIT License
875 stars 198 forks source link

How to transfer Pokemon #194

Open moxiaohu opened 8 years ago

moxiaohu commented 8 years ago

when i try to transfer a pokemon, i use the code in the project, i give the pokemonId get from the function self.GetInventory, but it seems not working.

self.TransferPokemon = function (pokemonId, callback) { var _self$playerInfo3 = self.playerInfo; var apiEndpoint = _self$playerInfo3.apiEndpoint; var accessToken = _self$playerInfo3.accessToken;

var transferPokemon = new RequestEnvelop.TransferPokemonMessage({
  'PokemonId': pokemonId
});

var req = new RequestEnvelop.Requests(112, transferPokemon.encode().toBuffer());

api_req(apiEndpoint, accessToken, req, function (err, f_ret) {
  if (err) {
    return callback(err);
  } else if (!f_ret || !f_ret.payload || !f_ret.payload[0]) {
    return callback('No result');
  }
  try {
    var catchPokemonResponse = ResponseEnvelop.TransferPokemonResponse.decode(f_ret.payload[0]);
    callback(null, catchPokemonResponse);
  } catch (err) {
    callback(err, null);
  }
});

};

falazar commented 8 years ago

message Pokemon { optional fixed64 id = 1;

and then use releasePokemon api call

cymonbr commented 7 years ago

I was having trouble with the pokemon id, after searching on various websites, I ended up finding a solution that exists within the own project. I used the "long", a module that is already in the project, to convert my pokemon id and it worked.

I called the file beginning Long var = require ("long");

And to use the id utilized var id = new Long (low, high, unsigned);


Eu estava tendo o problema com o pokemon id, após pesquisar em diversos sites, acabei encontrando uma solução que existe dentro do proprio projeto. Eu usei o "long", um modulo que já se encontra no projeto, para converter meu pokemon id e funcionou.

Eu chamei no inicio do arquivo var Long = require("long");

E para usar o id utilizei var id = new Long(low, high, unsigned);