Skip to content

Commit

Permalink
fix: avail quest filters
Browse files Browse the repository at this point in the history
  • Loading branch information
TurtIeSocks committed May 15, 2024
1 parent 359ed8c commit fb4498e
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 4 deletions.
1 change: 1 addition & 0 deletions server/src/configs/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,7 @@
"items": true,
"megaEnergy": true,
"candy": true,
"xlCandy": true,
"pokemon": true,
"invasions": false,
"allInvasions": true,
Expand Down
30 changes: 26 additions & 4 deletions server/src/services/filters/builder/pokestop.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
// @ts-check
const { log, HELPERS } = require('@rm/logger')

const BaseFilter = require('../Base')
const { Event, Db } = require('../../initialization')

Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit fb4498e

Please sign in to comment.