From fb4498e94f25f670cbac5e16f1878bac2985cf51 Mon Sep 17 00:00:00 2001 From: Derick M <58572875+TurtIeSocks@users.noreply.github.com> Date: Wed, 15 May 2024 14:42:31 -0400 Subject: [PATCH] fix: avail quest filters --- server/src/configs/default.json | 1 + .../src/services/filters/builder/pokestop.js | 30 ++++++++++++++++--- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/server/src/configs/default.json b/server/src/configs/default.json index 791e9023a..0e3524d38 100644 --- a/server/src/configs/default.json +++ b/server/src/configs/default.json @@ -485,6 +485,7 @@ "items": true, "megaEnergy": true, "candy": true, + "xlCandy": true, "pokemon": true, "invasions": false, "allInvasions": true, diff --git a/server/src/services/filters/builder/pokestop.js b/server/src/services/filters/builder/pokestop.js index d9837fff4..251c449d3 100644 --- a/server/src/services/filters/builder/pokestop.js +++ b/server/src/services/filters/builder/pokestop.js @@ -1,4 +1,6 @@ // @ts-check +const { log, HELPERS } = require('@rm/logger') + const BaseFilter = require('../Base') const { Event, Db } = require('../../initialization') @@ -56,12 +58,32 @@ function buildPokestops(perms, defaults) { if (perms.quests) { if (avail.startsWith('q')) { quests[avail] = new BaseFilter(defaults.items) - } - if (avail.startsWith('d')) { + } else if (avail.startsWith('d')) { quests[avail] = new BaseFilter(defaults.stardust.enabled) - } - if (avail.startsWith('u')) { + } else if (avail.startsWith('u')) { quests[avail] = new BaseFilter(defaults.rewardTypes) + } else if (avail.startsWith('p')) { + quests[avail] = new BaseFilter(defaults.xp.enabled) + } else if (avail.startsWith('c')) { + quests[avail] = new BaseFilter(defaults.candy) + } else if (avail.startsWith('x')) { + quests[avail] = new BaseFilter(defaults.xlCandy) + } else if (avail.startsWith('m')) { + quests[avail] = new BaseFilter(defaults.megaEnergy) + } else if ( + !avail.startsWith('i') && + !avail.startsWith('l') && + !avail.startsWith('a') && + !avail.startsWith('b') && + !avail.startsWith('f') && + !avail.startsWith('h') && + !Number.isInteger(+avail.charAt(0)) + ) { + log.warn( + HELPERS.available, + `Unknown quest type: ${avail} probably should open a PR or issue`, + ) + quests[avail] = new BaseFilter(true) } } if (perms.invasions) {