-
Notifications
You must be signed in to change notification settings - Fork 445
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
rpc_api.py -> _build_subrequests needs more code #175
Comments
I would like to have it implemented :) |
@Nostrademous can u past part of code where u call AttackGymMessage ? |
Let me know when Unknown6 is resolved and I will work on fixing any of the broken code... couldn't test it without solving the issue mentioned in this "issue" (which I can fix probably with code I suggested although @tejado would do it more eloquently probably) and then the Unknown6 issue happened. @tejado - I moved the "decode_raw()" function to pgoapi/utilities.py so that I can invoke it when trouble shooting a specific API call by passing a debugflag through the "call()". Perhaps it's generally a good idea rather then keeping it in rpc_api.py exclusively.
|
wow that looks awesome and really promissing Or is it untested yet? Looks awesome! Nice work |
@Nostrademous Thank you |
Looks like this is resolved and can be closed. |
@elliottcarlson how is this resolved? I posted theoretical code that I cannot test currently until I get the signatures working. Additionally, even if by some miracle the code I posted is 100% accurate it still needs to be accepted. |
You are correct, I lost track of the original ticket. Sorry about that. On Aug 8, 2016 8:24 AM, "Nostrademous" [email protected] wrote:
|
Able to commence testing... however, of interest, I think I figured out a better way to deal with repeated request message parameters than what I suggested. We'll test soon. |
@Nostrademous thank you. I'm looking forward to see this better way. I wasn't able to make it work (I tried your suggestions and other different things) |
@Nihisil so protobufs by design have an "add()" for any field labelled as repeated. That's my better way for dealing with lists that I want to try. At work currently so can't test for a bit. |
@Nostrademous yeah, I tried This is first time when I'm working with protobuf, so there is a big chance that I didn't get something essential. I hope you will handle it in your free time :) good luck! |
Getting ERROR_INVALID_ATTACK_ACTION reponses on my attacks... so glue is working, just need to fix the values I'm passing. |
@Nostrademous any news here? Can you, please, share your fix? So, I will try to make a correct attack action. |
Got first wave of "attacking" working... to a result SUCCESS when submitting my attacks, my pokemon took some dmg, etc... but then when submitting next round of attacks got an ERROR_INVALID_ATTACK_ACTIONS. So need some more tweaking. |
Tested PR here with a simple start battle and quit, seems to work |
Anyone succeeded in actually defeating a Pokemon in a battle? Using the fix #214 for the nested types works fine for sending the attack_actions in attack_gym and I see my generated actions appearing in ["responses"]["ATTACK_GYM"]["battle_log"]. However, despite tying various different settings the ["current_health"] of the attacked Pokemon never changed from its max value while mine lowered eventually leading to a faint (depending how long the battle lasts). These are my findings so far:
To me it appears, that the major goal of all this timing is to make the communication between app and server highly asynchronous with even several seconds lag still resulting in proper real-time feeling for the battle. What I am not sure about is why the server accepts and displays the battle actions in its battle_log while they do not seem to have any effect on the battle, no matter what times etc. are supplied. Just ACTION_PLAYER_QUIT (Type = 7) seems to be interpreted correctly as it results in a defeat without further changes to "current_health" of the attacking pokemon. It looks like I am still missing something here. If anyone has a log from a real battle it would probably help figuring out the missing bits -- tts been a while since I used MITM... . |
I kill pokemon in gyms... You have to send active_pokemon_id, damage_window_start_timestamp_mss, damage_window_end_timestamp_mss as well. start timestamp is action_start_ms+duration_ms-200 also yes, you have to set time for all these to be after last server_ms from battle_log, then queue about 1.5 seconds worth of fight via battle actions, then send the attack_gym after sleeping for 1.5 sec to make sure you are not in future. make sure you set the 'last_retrieved_action' to the last action you saw in battle log (this tells the server where you are in the order of actions of the battle) DODGING is a 500ms action. |
Ok - others I guess :-) So something is wrong with my timings? Or do you supply other fields than Do you use the damage_windows_start/end_timestamp ? And blank first attack is required, I guess (it is for me)? NOTE: this all is explained in Nostrademous answer... |
I answered in my response ... yes I set 3 other fields.. See code below... "dws" is my "dodge window" to dodge incoming attacks... a tuple of size 2 with (start, end) of dmg window
|
Just got it basically working -- many thanks for the hints! Trick was getting the duration_ms right as they depend on the individual Pokemons. Any error in that results in ERROR_INVALID_ATTACK_ACTIONS and sometimes a new battle can not be started for some minutes... If I would have more time it could be great fun to work on high-level strategies now -- or let the software learn and figure out the best moves to make or how to optimally take a gym :-) |
@HyperPeek yeah, I made a JSON file for all move attacks for all pokemon... |
Taking data from monitoring them in fights...? ;) |
no, databases are out there |
...getting off-topic -- issue can be closed, I guess -- but strange finding: if battling against own team Pokemon change after a few battles (~5) results in failure of start_gym_battle (empty response). Same after potion is used. Blackout time seems to be ~10 min. After that timespan all good again :) update: the problem above can be avoided if the pokemon is battling until its fainted; in that case it can be "potioned" and start the next battle immediately... . |
@Nostrademous : any chance to get this JSON file you are talking about? |
Might not be 100% complete, but a good start.
|
You can then use info here: https://www.vg247.com/2016/07/27/pokemon-go-battle-type-strengths-and-weaknesses-explained/ |
Many thanks, this helps. I am still struggling to setup AttackGym request correctly. Most of the times, I receive "status_code: 3" back, but sometimes I get an ATTACK_SUCCESS and my head pokemon dies. |
Hey DBa2016, look at this : http://pastebin.com/enDzFvUN That is a dump from someone playing the game live, so those packets are exactly how the structure should be handled. Granted you have to alter things based on pokemon etc and the ms variables are particularly finicky. I still haven't implemented the fix provided yet myself but I am able to successfully send packets and get responses, my actions just don't play out properly. |
@domeops that's from a pre 0.33 patch. It's not exactly correct. Code I pasted above works. |
Tried to implement it in C#... Does not exactly work. I get status_code 3 for around 50% of requests... |
Okay, playing around with timings etc. did the trick.. I still get "invalid actions" every now and then, but it's better now. |
Hmmm... About every 3rd AttackGym request results in "invalid actions", but a recreated request works then... Also - when one defending pokemon is killed, the State field switches to Victory, even though more pokemons are waiting to get a beating. Any idea how to get past this? |
@DBa2016 IIRC, you start a new gym battle with the next defending pokemon's ID.
|
@firebolt55439 : tried it, I get an "UNSET" response when I tryy to call StartGymBattle in that state... |
@DBa2016 Make sure you sent a last |
@firebolt55439 "StartGymBattle" does not have any last battle ction as a parameter. |
@DBa2016 I mean you have to send a last AttackGym request w/ the last On Sun, Aug 21, 2016 at 1:40 AM, DBa2016 [email protected] wrote:
-Sumer |
@firebolt55439 - okay, will try this later, thanks... By the way: I saw the action with the ACTION_VICTORY has "BattleData" element, with in turn a "nextDefenderPokemonId" element. However, this is signed long and sometimes negative, I did not find out when it is really negative. Might be useful. |
@DBa2016 that nextdefenderpokemonid element is rarely correct (something to do with fixed64/int64 or signedness) - just save the defender ID's at the beginning
|
I know nobody has written on here in a long time, but I don't know where else to post (if somebody could hint me to a forum or something...) I'm trying to get a battle to work using the code, but I can't seem to execute a move. When sending an 'ATTACK_GYM' request, I get following warning for the BattleAction and last_action:
The actions I'm trying to send out never appear in the battle log, therefore, this should be the source of my problem right?
Also, I can't seem to get the last_action into the message either.
Should I try making a BattleAction out of the last_action dictionary and then pass it to protobuf_to_dict in order to pass it to api.attack_gym()? Please somebody help :( |
@ConstiZ Read this thread: Grover-c13/PokeGOAPI-Java#252 It should contain all necessary information to fix it. |
For AttackGym - we need to be able to send repeated BattleAction objects/classes. Currently rpc_api.py only handles "repeated" base-types (i.e., ints, longs, strings) by accepting a "list" and iterating over it and then appending to the necessary attribute. Need improvement to support AttackGym protobuf.
Something like: NOTE - COMPLETELY UNTESTED CODE (also, I'm using old protobuf file structure)
There are probably much sexier python methods to do this
The text was updated successfully, but these errors were encountered: