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

check_awarded_badges being called but equip_badge is not #4522

Closed
duttonw opened this issue Aug 22, 2016 · 6 comments
Closed

check_awarded_badges being called but equip_badge is not #4522

duttonw opened this issue Aug 22, 2016 · 6 comments

Comments

@duttonw
Copy link
Contributor

duttonw commented Aug 22, 2016

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
Copy link
Contributor Author

duttonw commented Aug 22, 2016

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

@duttonw
Copy link
Contributor Author

duttonw commented Aug 22, 2016

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
Copy link
Contributor Author

duttonw commented Aug 22, 2016

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
Copy link
Contributor Author

duttonw commented Aug 24, 2016

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
Copy link
Contributor

@duttonw Can we close?

@duttonw
Copy link
Contributor Author

duttonw commented Aug 28, 2016

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

@duttonw duttonw closed this as completed Aug 28, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants