PokemonGoF / PokemonGo-Bot

The Pokemon Go Bot, baking with community.
MIT License
3.86k stars 1.54k forks source link

check_awarded_badges being called but equip_badge is not #4522

Closed duttonw closed 8 years ago

duttonw commented 8 years ago

Short Description

The client application is storing what badges it has shown to the user so that if they log into new device they are not spammed all of the badges. This is very similar to level up api call.

Possible solution

Have another task created like CollectLevelUpReward which will peridoically check what badges are avialable and if they have been collected by the user. if not go and equip the badge.

https://github.com/tejado/pgoapi/wiki/check_awarded_badges https://github.com/tejado/pgoapi/wiki/equip_badge

How it would help others

This may reduce the glaring possibility that when an account is used solely by the bot and not logged into the native app once and a while, the number of badges for distance walked and pokemon captured might be flagging the account to be deleted even with slow walking and capturing enabled. This was also very similar to how CollectLevelUpReward which after logged in at level 15 it would collect all 15 levels of loot at once.

duttonw commented 8 years ago

This is a feature request but i don't know how to add that label to this.

duttonw commented 8 years ago

Also relates to #4114.

I'm not a python programmer (mostly java/php) but i'll give it a crack in the coming days if no one else picks this up.

duttonw commented 8 years ago

This looks like what we need to do, this is the java version found in https://github.com/Grover-c13/PokeGOAPI-Java/blob/Development/library/src/main/java/com/pokegoapi/api/player/PlayerProfile.java#L171

This code has no waits so it will show its a bot as it takes about 2-10seconds between badge collects to display to the user and i would take a guess that it equips badges when it displays the animation.

    /**
     * Check and equip badges.
     *
     * @throws LoginFailedException  when the auth is invalid
     * @throws RemoteServerException When a buffer exception is thrown
     */

    public void checkAndEquipBadges() throws LoginFailedException, RemoteServerException {
        CheckAwardedBadgesMessage msg = CheckAwardedBadgesMessage.newBuilder().build();
        ServerRequest serverRequest = new ServerRequest(RequestType.CHECK_AWARDED_BADGES, msg);
        api.getRequestHandler().sendServerRequests(serverRequest);
        CheckAwardedBadgesResponse response;
        try {
            response = CheckAwardedBadgesResponse.parseFrom(serverRequest.getData());
        } catch (InvalidProtocolBufferException e) {
            throw new RemoteServerException(e);
        }
        if (response.getSuccess()) {
            for (int i = 0; i < response.getAwardedBadgesCount(); i++) {
                EquipBadgeMessage msg1 = EquipBadgeMessage.newBuilder()
                        .setBadgeType(response.getAwardedBadges(i))
                        .setBadgeTypeValue(response.getAwardedBadgeLevels(i)).build();
                ServerRequest serverRequest1 = new ServerRequest(RequestType.EQUIP_BADGE, msg1);
                api.getRequestHandler().sendServerRequests(serverRequest1);
                EquipBadgeResponseOuterClass.EquipBadgeResponse response1;
                try {
                    response1 = EquipBadgeResponseOuterClass.EquipBadgeResponse.parseFrom(serverRequest1.getData());
                    badge = response1.getEquipped();
                } catch (InvalidProtocolBufferException e) {
                    throw new RemoteServerException(e);
                }
            }
        }
    }
duttonw commented 8 years ago

it seem the check awarded badges is called after every pokemon capture, 1-5 seconds after capture (when you cancel out of the success screen maybe) and displays the badge you earned, e.g. you captured 10 water pokemon etc). it might be very easy for them to tell if its a bot if the distance walked badges are not being collected as well as rattata and a couple of others which is in the internal player data. It seems its also called after post login but we don't really want to replicate the behavour of having it collect all medals at once, as this may flag the account has being run incorrectly.

mjmadsen commented 8 years ago

@duttonw Can we close?

duttonw commented 8 years ago

we do know that there is 3 levels per badge. i've only testing to level 1,2. since level 3 takes a while to do on a real account. They may only equip at max level but i don't have enough information to conclude that. For now i'll close it, but we need more information and maybe a phone running the app that crosses the lvl 3 threshold and checking if the player_data equiped_badges gets updated.

@mjmadsen