Skip to content

Commit

Permalink
add missing pokealarm fields in quest webhook when using poracle flav…
Browse files Browse the repository at this point in the history
…or (#1235)
  • Loading branch information
Pontiky authored May 8, 2022
1 parent dbdf67c commit 89aebdb
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions mapadroid/webhook/webhookworker.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def __prepare_quest_data(self, quest_data):
return ret

def __construct_quest_payload(self, quest):
if self.__args.quest_webhook_flavor == "default":
if self.__args.quest_webhook_flavor == "default": # used by PokeAlarm
return {
"pokestop_id": quest["pokestop_id"],
"latitude": quest["latitude"],
Expand Down Expand Up @@ -306,6 +306,24 @@ def __construct_quest_payload(self, quest):
"target": quest["quest_target"],
"updated": quest["timestamp"],
"quest_task": quest["quest_task"],
"quest_type": quest["quest_type"],
"quest_type_raw": quest["quest_type_raw"],
"item_type": quest["item_type"],
"name": quest["name"].replace('"', '\\"').replace("\n", "\\n"),
"url": quest["url"],
"timestamp": quest["timestamp"],
"quest_reward_type": quest["quest_reward_type"],
"quest_reward_type_raw": quest["quest_reward_type_raw"],
"quest_reward_raw": quest['quest_reward_raw'].replace("'", '"').lower(),
"quest_target": quest["quest_target"],
"pokemon_id": int(quest["pokemon_id"]),
"pokemon_form": int(quest.get("pokemon_form", '0')),
"pokemon_costume": int(quest.get("pokemon_costume", '0')),
"item_amount": quest["item_amount"],
"item_id": quest["item_id"],
"quest_condition": quest["quest_condition"].replace("'", '"').lower(),
"quest_template": quest["quest_template"],
"is_ar_scan_eligible": quest["is_ar_scan_eligible"],
}

def __prepare_weather_data(self, weather_data):
Expand Down Expand Up @@ -491,10 +509,7 @@ def __prepare_mon_data(self, mon_data):

if mon["weather_boosted_condition"] is not None \
and mon["weather_boosted_condition"] > 0:
if self.__args.quest_webhook_flavor == "default":
mon_payload["boosted_weather"] = mon["weather_boosted_condition"]
if self.__args.quest_webhook_flavor == "poracle":
mon_payload["weather"] = mon["weather_boosted_condition"]
mon_payload["weather"] = mon["weather_boosted_condition"]

if mon["seen_type"] in ("nearby_stop", "lure_wild", "lure_encounter"):
mon_payload["pokestop_id"] = mon["fort_id"]
Expand Down

0 comments on commit 89aebdb

Please sign in to comment.