Skip to content

Commit

Permalink
Process/handle XL candy reward (async) (#1366)
Browse files Browse the repository at this point in the history
* Process candy xl reward type

* Process xl candy reward type

* Process xl candy reward type

* Process xl candy reward type

* Add XL candy image
  • Loading branch information
wraythex authored Dec 15, 2023
1 parent c7ce801 commit 0d2a41c
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 0 deletions.
3 changes: 3 additions & 0 deletions mapadroid/db/DbPogoProtoSubmit.py
Original file line number Diff line number Diff line change
Expand Up @@ -700,6 +700,9 @@ async def quest(self, session: AsyncSession, quest_proto: dict, quest_gen: Quest
if reward_type == 4:
item_amount = reward.get('candy', {}).get('amount', 0)
pokemon_id = reward.get('candy', {}).get('pokemon_id', 0)
if reward_type == 9:
item_amount = reward.get('xl_candy', {}).get('amount', 0)
pokemon_id = reward.get('xl_candy', {}).get('pokemon_id', 0)
elif reward_type == 12:
item_amount = reward.get('mega_resource', {}).get('amount', 0)
pokemon_id = reward.get('mega_resource', {}).get('pokemon_id', 0)
Expand Down
7 changes: 7 additions & 0 deletions mapadroid/utils/questGen.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ def __init__(self):
4: _("Candy"),
3: _("Stardust"),
7: _("Pokemon"),
9: _("XL Candy"),
12: _("Energy")
}

Expand Down Expand Up @@ -123,6 +124,12 @@ async def generate_quest(self, stop: Pokestop, quest: TrsQuest):
elif quest_reward_type == _('Experience'):
item_type = quest_reward_type
item_amount = quest.quest_item_amount
elif quest_reward_type == _('XL Candy'):
item_amount = quest.quest_item_amount
item_type = quest_reward_type
pokemon_id = quest.quest_pokemon_id
pokemon_name = await i8ln(await self.pokemonname(str(pokemon_id)))


if not quest.quest_task:
quest_task = await self.questtask(
Expand Down
9 changes: 9 additions & 0 deletions static/madmin/static/js/madmin.js
Original file line number Diff line number Diff line change
Expand Up @@ -1277,6 +1277,11 @@ new Vue({
var size = [30, 30]
var anchor = [30, 30]
break;
case 9:
var image = `static/quest/reward_xl_candy.png`;
var size = [30, 30]
var anchor = [30, 30]
break;
case 12:
var image = 'https://raw.githubusercontent.com/whitewillem/PogoAssets/resized/icons_large/rewards/reward_mega_energy.png'
var size = [30, 30]
Expand Down Expand Up @@ -1325,6 +1330,10 @@ new Vue({
var rewardtext = quest_pokemon_name;
var size = "150%";
break;
case 9:
var image = `static/quest/reward_xl_candy.png`;
var rewardtext = `${quest_item_amount} ${quest_pokemon_name} XL Candy`;
break;
case 12:
var image = 'https://raw.githubusercontent.com/whitewillem/PogoAssets/resized/icons_large/rewards/reward_mega_energy.png'
var rewardtext = `${quest_item_amount} ${quest_item_type} ${quest_pokemon_name}`;
Expand Down
Binary file added static/madmin/static/quest/reward_xl_candy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions static/madmin/templates/quests.html
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,9 @@
var url = `${iconBasePath}/pokemon_icon_${String.prototype.padStart.call(quest_pokemon_id, 3, 0)}_${quest_pokemon_form_id}${costume}.png`;
var image = `<img class="mr-3" src="${url}" width="50">`;
break;
case 9:
var image = '<img class="mr-3" src="static/quest/reward_xl_candy.png" width="50">';
break;
case 12:
var url = 'https://raw.githubusercontent.com/whitewillem/PogoAssets/resized/icons_large/rewards/reward_mega_energy.png'
var image = `<img class="mr-3" src="${url}" width="50">`;
Expand Down

0 comments on commit 0d2a41c

Please sign in to comment.