MAD icon indicating copy to clipboard operation
MAD copied to clipboard

Send webhook when gameplay_weather changes

Open Axiangel opened this issue 4 years ago • 6 comments

There are a lot on neat things that could be done with PA amongst others if MAD could send a webhook when a weather was changed. One of the mayor usage i can think of could be the ability to get a weatherchange notification in PA before you try and catch that 100% pidgey (that no longer is a 100% due to weather change). I know weather is based on larger cells and issues might occur when your geofence contains several, but this is not always the case and sometimes (especially for smaller areas) this logic should work out just fine.

According to Legit Dongo MAD only sends weather with a boosted mon. Would it be possible to make MAD send a seperate webhook when weather changes?

Axiangel avatar May 28 '20 10:05 Axiangel

If you enable weather_webhook in the config, MAD will send general weather updates for cells to your webhook receiver (PA, Poracle, whatnot). If a mon changes its stats due to a weather change, MAD won't resend changed mons and implementing such a feature would require it do way more logic than it is doing already. So it's not a change that can be done with a few lines of code but rather a bigger rewrite.

sn0opy avatar May 28 '20 10:05 sn0opy

If Weather changed, just set endtime of the pokemon to the full hour? so we can autoimatically rescan? as a switch option...

would be nice to have in same way for event spawns, event ends at 17, so just set all scanned pokemon with start time before 17 to..end 17... surely some false...but a direct rescan...and a database reflecting the reality

ChaosEmpire avatar May 28 '20 11:05 ChaosEmpire

Ok. I was told MAD only sent the weather with the mon webhooks IF they were weatherboosted, but the way you put it leads me to believe there is always wether included in all mon webhooks (assuming weather_webhook is activated ofc). I like ChaosEmpires idea as well, but that would also require that there was a seperate thread only responsible for updating weather i assume. I don't think 'changin the endtime' is possible though. The endtime belongs to the spawnpoint, and removing the pokemon from the db is not an option either - after all it really appeared for a while.
HIding it in RM could be the middle way, but that is RM's business and does not allow MAD to rescan anything. Also i think RM needs what webhook with updated weather from MAD. UNLESS we can use a forecast from somewhere? That way we will know in advance if the mon will re-rolled.

Axiangel avatar May 28 '20 13:05 Axiangel

uhm no. There are different payloads for mon, raids, gyms and one for weather. The weather is separate. If a mon is weather boosted, it will include the weather_boosted_condition field.

Tbh, if you want a mon to be resent, MAD should actually re-scan it as well instead of just resending it while assuming the correct values for the mon just because the weather has changed.

sn0opy avatar May 28 '20 13:05 sn0opy

So MAD IS sending weather constantly if it's activated in the config? According to PA dev it wasn't. Or I got it all backwards again.. ;-)

Axiangel avatar May 28 '20 16:05 Axiangel

It does that for over a year now. Yes. It's really not that hard to read the code of MAD's webhook stuff tbh

https://github.com/Map-A-Droid/MAD/blob/master/mapadroid/webhook/webhookworker.py

sn0opy avatar May 28 '20 16:05 sn0opy