-
Notifications
You must be signed in to change notification settings - Fork 331
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
Fight in Gym - always fail #252
Comments
i had this issue when i had dead pokemon in my attacking team, need to add some checks to it at some point. |
My all pokemons in team have max stamina. I still have a problem. |
I'm seeing the same issue. |
I tried the code in
|
im not using this api/bot because im a c# guy, but i think we have the same issue. If you look at the IDs of you attacker Team - they are ulong and something like "6068907423423435111511". It could be that this is an issue of pogoprotos.dll |
Are you talking about the ID of the gym pokemon when the battle start request is sent? This API is sending the UID of the defending pokemon just fine AFAICT. |
From my testing, when building with the java api, you should get a different status_code in the ResponseEnvelope. @Grover-c13 told me that he succeed for sending that packet, any more info ? |
My apologies guys, i must of modified the proto when developing it and forgot to submit a PR to AeonLucids, if you change the defender_id to fixed64 this will work correctly. AeonLucid/POGOProtos#97 |
@Grover-c13 I fixed the proto locally, and now I'm getting ERROR_INVALID_DEFENDER. It looks like the logic for selecting the first defender is working correctly, so I'm not sure what's going wrong. |
hmmm, i was assuming the defenders that are on gyms are sorted on the server, but maybe i was lucky and we should sort for the lowest defender CP first before selecting the initial defender ID (which has to be the lowest CP defender pretty sure) |
It looks like it is selecting the lowest CP defender, that was the first thing I checked. |
Is it an offensive attack (team vs another team) or a training attack (same team vs same team)? |
If you asked me, this problem is in attack and trening too. |
This is an offensive attack |
Seems to be working this morning, but I didn't change anything. It's possible my account was soft banned. Now I'm getting |
Yes, you should check on how work battling, since the parameters are actually super important on the result of the action, read this dump and try to understand how it works, its not easy i warn you : http://pastebin.com/enDzFvUN |
That's just what I was looking for - thanks! |
did anyone manage to do this yet? |
So my issue with this is that it works for me sometimes... (I have applied the fixed64 proto fix to defender). it seems like it fails if the defender_id is larger than an int64 but smaller than uint64. I had the same exact issue when capturing Incense generated Pokemon. Perhaps it's a python 2.7 issue on my end or something stupid. |
Any updates on this? I've fixed the proto manually but attacking an enemy gym still does not work. My attacks are not being registered. I can see my pokemon's health going down but the enemy's health stays exactly the same (even though I have a higher CP) meaning my attacks aren't registered. I followed the code in the example provided. |
So is this gym attack thing working and what does it do? |
at the moment i think that's not usable, but i can be wrong. i got timeout during attack |
yeah gym battles are complicated and this deff needs more work |
Timeouts for me after half a Minute battling |
any idea how to set a team (mystic, instinct etc.) automatically? I did try the gym battle out, and it actually succeeded. I check in the PokemonGo app and in the badge part, it shows I won one gym battle, but team isn't set, and since the app doesn't work where I stay, I can't check if it actually worked. |
@sarbajitsaha can you post example code you used? I dont know if its possile to set your Team via the API, i dont think this is implemented yet. |
try {
List<Pokemon> pokemons = PokeMaticApplication.pogo.getInventories().getPokebank().getPokemons();
Pokemon[] attackers = new Pokemon[6];
str = "Pokemons being used:\n";
for (int i = 0; i < 6; i++) {
attackers[i] = pokemons.get(i);
str+=(attackers[i].getOwnerName()+" CP: "+attackers[i].getCp()+"\n");
}
result = true;
publishProgress();
Log.e("result",str);
List<Gym> gyms = PokeMaticApplication.pogo.getMap().getGyms();
Log.e("gyms", String.valueOf(gyms.size()));
for (Gym gym : gyms) {
PokeMaticApplication.pogo.setLocation(gym.getLatitude(),gym.getLongitude(),20);
if (gym.isAttackable()) {
Battle battle = gym.battle(attackers);
// start the battle
StartGymBattleResponseOuterClass.StartGymBattleResponse.Result result = battle.start();
if (result == StartGymBattleResponseOuterClass.StartGymBattleResponse.Result.SUCCESS) {
// started battle successfully
str += "\nGym Battle Started";
Log.e("result",str);
publishProgress();
// loop while battle is not finished
while (!battle.isConcluded()) {
results+="Attack:" + battle.attack(5)+"\n";
Log.e("result",results);
publishProgress();
Thread.sleep(500);
}
results+="Battle result:" + battle.getOutcome()+"\n";
Log.e("result",results);
publishProgress();
} else {
results+="Failed:" + result+"\n";
Log.e("result",results);
}
}
}
result = true;
} catch (Exception e) {
e.printStackTrace();
result = false;
} This is in an Async task for an android app. I did not get the battle conclusion and it also reported INVALID_ATTACK_OPTIONS a few times in the log, but I was kinda surprised to see that I have won a gym battle in the app. Also note this is with the latest version; earlier I was getting UNSET, and you also need to change your location close to the gym to start the battle or else it will show out of range. |
@sarbajitsaha Great Work ! |
well, battle doesn't definitely work.... they 'randomly' work :) as you say, sometimes you got errors. the problem it's that with the current code config, you can play only with pokemon that have move1 of time 500ms i think. anyway, we should wait for @Grover-c13 support i presume :) |
I had it working pretty consistently with the below code prior to the api change. This includes joining a team if you never did as well as adding a pokemon to a friendly gym. My test account was rather weak and my local gym rather strong so everything ended in a defeated status but it never threw any errors and everything flowed consistently. I got the basic logic from the FightGymExample.java file.
|
Are you only getting this today? If so, all API's are broken right now is probably why you are getting this. Niantic changed the way requests need to be sent. Wait until there is a fix for that and see if this problem still exists then |
Using any of the above code, I get FAILED:UNSET or ERROR_INVALID_ATTACK_ACTIONS |
I haven't tried it since the api change but I'll take a look in a bit. I just gave it a try and it appears to be working: Adding 183 - DROWZEE - 41 @ 42.299666, -74.002315 - BLUE If you're getting UNSET it means you're passing a null value somewhere. I'd double check your pokemon list. |
IT IS VERY IMPORTANT THAT YOU:
|
That's a good point. My find highest CP method only returns available full health, not fainted pokemon. That's also why I run it again if gym join was successful. Also make sure that if it's a friendly gym that you only have 1 attacker instead of 6. |
Although my messsages appear to be alright, my pkmn in good shape and not in gym, i still get success=0 without even an error. does somebody have a hint? |
Current code in Battle is wrong and does not work correctly.
to get correct time for "simple" pokemon attack...
more critical: also, ACTION_ATTACK is just simple one... we need at least 2 more: the SPECIAL_ATTACK is required ".setTargetPokemonId(value)" With Best Regards @vmarchaud: Would be nice to get more BATTLEs for current "0.33.0" version. |
@firexball does it work for you? I'm writing my own battle bot and am finding that I don't need to set "activePokemonId", or the "DamageWindow..." or "AttackerIndex" when attacking. The server replies with SUCCESS result without these... however, I seem to take damage while the defender takes no damage currently... |
@Nostrademous I have the same result - the server "accepts" all my requests, but I essentially sit there and take attacks without executing any of my own. |
Never mind, I got it working (though I really need to get better pokemon lol). The opponent finally takes damage. |
@firebolt55439 are you sending any extra info besides "target_index", "duration_ms", "action_start_ms" and "type"? If not, then I'm guessing it's a timing thing on my side. |
@Nostrademous I don't send |
@firebolt55439 thank you, that fixed it for me too. Doing damage now. How does Dodging work? I send dodge actions but I still seem to take damage... I figured a bot would be able to dodge perfectly by adding a dodge_action between the damage window of the defending pokemon for every one of their attacks, no? Perhaps special attacks cannot be dodged? |
@Nostrademous Still haven't figured out why I can't really dodge anything - I just stick to doing fast attacks and the occasional special attack. |
I have an iPhone and can't disable the SSL cert pinning - by any chance, do any of you have access to a recent MITM log for a gym battle? I know there's one posted here earlier, but it's pre-unknown6 and not entirely accurate. It would be very much appreciated :) |
@firebolt55439 nope, that's the only one I know of. |
@Nostrademous I'm going to jailbreak it just for PoGo now haha (the things I do for love...) |
@firebolt55439 Thanks for your help here, what you posted will fix most peoples problems, i now have Attack Gyms working in C# ( I only recently seen this page. ). Legend 👍 |
@FaezeOner No problem - happy to help :). On Thu, Aug 25, 2016 at 4:50 AM, FaezeOner [email protected] wrote:
-Sumer |
@FaezeOner Hi, can you share the C# code for Attack Gyms? I like to play with it. Thanks a lot! |
I've been working on a fixed and improved Battle class, but I'm getting the same problem that a few others have gotten. The defender doesn't take any damage. (Although, in my case, it does occasionally) I'm currently sending You can see the updated Battle class here: https://github.com/gegy1000/PokeGOAPI-Java/commit/d7802bdb663685a5f9ad09efe9784637c1b22e70 @firebolt55439 From what you've said above, it looks like the only fields that need to be set on the Thanks. EDIT: Okay, I made a silly mistake. I was performing special attacks when I didn't have enough energy and normal attacks when I did. My problem now is that after my first pokemon faints, the server will continue to send this faint action. |
hi @BadChoicesZ I am working on fixing Gymbattle in Rocket API C# too. Hope you can share your experience to solve the issue, for you I learn how to do delay between 2 action since I debug and GymAttack work, but when run without debug it got BAD request, I believe that we need delay properly. Thanks |
If you have any clues how to use ACTION_SWAP_POKEMON it will be great to know that to. What i'll do i've got always the same result: ERROR_INVALID_ATTACK_ACTIONS |
Description:
When I start battle, status of start battle is always UNSET
Steps to reproduce:
Expected behavior:
Status should be SUCCESS
Actual behavior:
Status always is UNSET
Version:
Last commit ee28406
The text was updated successfully, but these errors were encountered: