Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inventory parameter of GetInventory is null #253

Open
NelsonGaldeman opened this issue Aug 24, 2016 · 1 comment
Open

Inventory parameter of GetInventory is null #253

NelsonGaldeman opened this issue Aug 24, 2016 · 1 comment

Comments

@NelsonGaldeman
Copy link

I've been trying to get inventory items, but the second parameter of GetInventory returns:

{ success: null, inventory_delta: null }

What am I doing wrong? Here is full code.

'use strict';

var PokemonGO = require('./poke.io.js');
var pogo = new PokemonGO.Pokeio();

var location = {
    type: 'coords',
    coords: {
        latitude: -34.60537813731424,
        longitude: -58.366670608520508
    }
};

var username = 'user';
var password = 'password';
var provider = 'ptc';

pogo.init(username, password, location, provider, function(err) {
    if (err) throw err;

    console.log('Current location: ' + pogo.playerInfo.locationName);
    console.log('lat/long/alt: : ' + pogo.playerInfo.latitude + ' ' + pogo.playerInfo.longitude + ' ' + pogo.playerInfo.altitude);

    pogo.GetProfile(function(err, profile) {
        if (err) throw err;

        console.log('Username: ' + profile.username);

        var currency = {};
        for (var i in profile.currency){
            var type = profile.currency[i].type;
            var amount = profile.currency[i].amount;
            if (!amount){
                amount = 0;
            }
            currency[type] = amount;
        }
        console.log('Stardust: ' + currency['STARDUST']);
    });

    pogo.GetInventory(function(err, inventory){
        if (err) throw err;
        var cleanedInventory = { player_stats: null, eggs : [], pokemon: [], items: [] };
        console.log(inventory);
        callback(cleanedInventory);
    });
});
@ameyer
Copy link

ameyer commented Aug 27, 2016

If it is always null I'm guessing they banned you. But when my account was working I was having issues where it would come back null at times. So I just put this in there just in case:

        if(inventory == null) return;
        if(inventory.inventory_delta == null) return;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants