From 32df5e9bcfc5180a6afa4b5a14b6b69d7a1237b6 Mon Sep 17 00:00:00 2001 From: Derick M <58572875+TurtIeSocks@users.noreply.github.com> Date: Tue, 9 Jan 2024 23:36:31 -0500 Subject: [PATCH] feat: show event stop markers if no quests/invasions --- server/src/configs/default.json | 6 ++ src/components/markers/usePokestopMarker.js | 68 +++++++++++++++++++-- src/services/Icons.js | 2 +- 3 files changed, 71 insertions(+), 5 deletions(-) diff --git a/server/src/configs/default.json b/server/src/configs/default.json index 8cc3581d6..bf1df25bc 100644 --- a/server/src/configs/default.json +++ b/server/src/configs/default.json @@ -956,6 +956,12 @@ "md": 1, "lg": 2, "xl": 3 + }, + "event": { + "sm": 20, + "md": 40, + "lg": 60, + "xl": 80 } } }, diff --git a/src/components/markers/usePokestopMarker.js b/src/components/markers/usePokestopMarker.js index 2d64fc1d5..af4718869 100644 --- a/src/components/markers/usePokestopMarker.js +++ b/src/components/markers/usePokestopMarker.js @@ -57,10 +57,11 @@ export default function usePokestopMarker({ }, basicEqualFn) const filters = useStore((s) => s.filters.pokestops.filter) - const [invasionMod, pokestopMod, rewardMod] = Icons.getModifiers( + const [invasionMod, pokestopMod, rewardMod, eventMod] = Icons.getModifiers( 'invasion', 'pokestop', 'reward', + 'event', ) let popupYOffset = 1.3 @@ -71,6 +72,8 @@ export default function usePokestopMarker({ const invasionSizes = [] const questIcons = [] const questSizes = [] + const showcaseIcons = [] + const showcaseSizes = [] if (hasInvasion) { invasions.forEach((invasion) => { @@ -185,7 +188,34 @@ export default function usePokestopMarker({ popupY += rewardMod.popupY }) } - + if (hasEvent && !hasInvasion && !hasQuest) { + events.forEach((event) => { + if (event.display_type === 8) { + showcaseIcons.unshift({ + url: Icons.getPokemon(352), + }) + showcaseSizes.unshift(Icons.getSize('event', filters.b7?.size)) + } else if (event.display_type === 9) { + showcaseIcons.unshift({ + url: Icons.getPokemon( + event.showcase_pokemon_id, + event.showcase_pokemon_form_id, + ), + }) + showcaseSizes.unshift( + Icons.getSize( + 'event', + filters[ + `f${event.showcase_pokemon_id}-${event.showcase_pokemon_form_id}` + ]?.size, + ), + ) + } + popupYOffset += rewardMod.offsetY - 1 + popupX += rewardMod.popupX + popupY += rewardMod.popupY + }) + } const totalQuestSize = questSizes.reduce((a, b) => a + b, 0) const totalInvasionSize = invasionSizes.reduce((a, b) => a + b, 0) @@ -284,7 +314,6 @@ export default function usePokestopMarker({ .map( (invasion, i) => /* html */ ` ${invasion.icon} + + `, + ) + .join('')} + `, }) } diff --git a/src/services/Icons.js b/src/services/Icons.js index 0530771e4..fa57437c0 100644 --- a/src/services/Icons.js +++ b/src/services/Icons.js @@ -207,7 +207,7 @@ class UAssets { * @param {'sm' | 'md' | 'lg' | 'xl'} [size] */ getSize(category, size = 'md') { - const baseSize = this.sizes[category][size] + const baseSize = this.sizes[category]?.[size] || 20 return this.modifiers[category] ? baseSize * this.modifiers[category].sizeMultiplier : baseSize