Maome / ingress-bot

48 stars 31 forks source link

Error #7

Open vavoluk opened 10 years ago

vavoluk commented 10 years ago

Have an error after starting the bot:

Exception in thread "main" java.lang.NullPointerException at ClientWrapper.getObjectsInCells(ClientWrapper.java:151) at ClientWrapper.newLocation(ClientWrapper.java:323) at LocationRunner.run(LocationRunner.java:20) at Pygress.main(Pygress.java:30) make: *\ [run] Error 1

Maome commented 10 years ago

I'm guessing there was an error parsing your locations file. If you were going to try to figure out why I would look at LocationRunner.Java:16-19

        String curLine = br.readLine();
        String[] firstLocation = curLine.split(",");
        currentLocation = S2LatLng.fromDegrees(Double.parseDouble(firstLocation[0]),Double.parseDouble(firstLocation[1]));

Good chance currentLocation is coming out null.

vavoluk commented 10 years ago

Bot works few day ago with my location file, but now I have an error. I already trying few times to run bot with new locations file and have the same error. Of course I check my locations file and found no errors there. Then I take a new google/ingress account and test it again and have the same problem again. I look at LocationRunner.Java:16-19. "," uses as splitter and my locations file use "," as splitter too. I don't know where problem is...

Maome commented 10 years ago

Sorry I think I was wrong your null is probably in responseEnergyGlobGuids

If the ingress server doesn't respond with a json array of energyGlobGuids in the gameBasket I'm fairly certain the bot would create a null object for responseEnergyGlobGuids. There's a couple reasons it could fail to return this object in the gameBasket.

I think the most likely possibility is that your login token is expired or something similar, still possible but less likely is a change in their message protocols. After that I'm not sure but if you figure it out feel free to post the solution.

lecaros commented 10 years ago

this is response example

  {
    "result": "0",
    "gameBasket": {
        "gameEntities": [],
        "playerEntity": [
            "c5ff0OBFUSCATED6.c",
            138OBFUSCATED23,
            {
                "controllingTeam": {
                    "team": "TEAM_NAME"
                },
                "avatar": {
                    "foreground": {
                        "layerId": "foreground7",
                        "tintColor": 9812963,
                        "imageUrl": "http://lh5.ggpht.com/vALLxYknp-2a7lCkJgPsVH9Putnf7eXUMYmXmYsnR8dk47M7taZ7CEo2pu4z6460NhMoaQy8yGP6t2ZJRU81Y4NmNfIZhA8"
                    },
                    "background": {
                        "layerId": "background4",
                        "tintColor": 2172251,
                        "imageUrl": "http://lh3.ggpht.com/8iY4hVjR0GvkNhqTp_UdaNLQewDsrjXamYF9HIV2SD2AoC0DW44hsxvgnYjahaLcSZ4DwexDatiIaxh2r_rbH0QSZeg76O2b"
                    }
                },
                "playerPersonal": {
                    "ap": "1",
                    "energy": 3072,
                    "allowNicknameEdit": false,
                    "allowFactionChoice": false,
                    "clientLevel": 36,
                    "mediaHighWaterMarks": {
                        "General": 155,
                        "RESISTANCE": 99,
                        "ALIENS": 2
                    },
                    "energyState": "XM_OK",
                    "notificationSettings": {
                        "shouldSendEmail": false,
                        "maySendPromoEmail": true,
                        "shouldPushNotifyForAtPlayer": true,
                        "shouldPushNotifyForPortalAttacks": true,
                        "shouldPushNotifyForInvitesAndFactionInfo": true
                    },
                    "profileSettings": {
                        "areMetricsPublic": false
                    },
                    "verificationState": "EXEMPT"
                }
            }
        ],
        "apGains": [],
        "inventory": [],
        "deletedEntityGuids": []
    }
}

So,

Maome commented 10 years ago

gameBasket is the container object for most of the things there (everything except result : 0, I think) so it's not empty but you are right that energyGlobGuids doesn't exist. Because I haven't been looking at the game information I'm not sure if the name of syntax of the information energyGlobGuids held is different now but if it isn't then I think the only thing you would need to do is wrap the loop that references responseEnergyGlobGuids in an if(responseEnergyGlobGuids) statement. But it's been a while since I used this so I could be wrong.

lecaros commented 10 years ago

yeah, I corrected my comment. gameEntities is the empty object, not gameBasket :)

lecaros commented 10 years ago

However, having the gameEntities empty, means that you have no hackable portals :) so, if you avoid the exception, you'll still have that issue

Maome commented 10 years ago

Afaik it should handle empty arrays fine because creating an list object from a json object [] should create an empty list object (instead of a null object) which should just not do anything when a for each is called on that list. So that would probably be fine, absolutely correct me if I'm wrong here, though.

Maertuerer commented 10 years ago

Yeah we got the same issue, trying to resolve it. Good thing: you haven't been banned ;)

Maertuerer commented 10 years ago

But indeed, the server doesn't send the gameEntities array anymore, even if there are portals in range.

duplicat commented 10 years ago

I replaced the gameEntities content with one provided by findNearbyPortals method and at least it is discovering portals, but still can not get an energyGlobGuid array anywhere, they either changed it for the serverBlob data or have it somewhere else.. can't also get dropped objects along the way :(

lecaros commented 10 years ago

@duplicat is that an API call? could you please provide more details?

duplicat commented 10 years ago

Yes, this is what I have been testing so far..

/rpc/gameplay/findNearbyPortals params.put("continuationToken", null); params.put("maxPortals", numberOfPortalsToRequest); params.put("energyGlobGuids", energyGlobGuids); params.put("playerLocation", S2Wrapper.encodeLocation(this.currentLocation)); params.put("knobSyncTimestamp", this.syncTimestamp); params.put("location",S2Wrapper.encodeLocation(this.currentLocation)); main.put("params", params);

duplicat commented 10 years ago

The big issue here now is the energyGlobGuids (or alternate mechanism) to keep feeding the machine without recycling its inventory. Any ideas?

Maertuerer commented 10 years ago

I got my client working again, thanks! How are you getting the coockie from within java?

Regards

On Thu, Jan 9, 2014 at 12:42 AM, duplicat notifications@github.com wrote:

The big issue here now is the energyGlobGuids (or alternate mechanism) to keep feeding the machine without recycling its inventory. Any ideas?

— Reply to this email directly or view it on GitHubhttps://github.com/Maome/ingress-bot/issues/7#issuecomment-31888731 .

vavoluk commented 10 years ago

Maertuerer, I don't know how to do this in Java. I'm using php script for getting cookies. If you want I can publish my solution, but this solution works only under linux. P.S. Can you publish your fixes for client?

swil85 commented 10 years ago

Hi, i have the same problem, someone have a solution ?

eelf commented 10 years ago

It seems that original client uses the same API call, i.e. /rpc/gameplay/getObjectsInCells but with param "clientBasket": {"clientBlob": "some binary data base64 encoded"} and server response contains energyBlobGuids as well The question is What is needed to be specified in that param?

swil85 commented 10 years ago

Hi eelf, can you paste here the trame ?