Skip to content

Commit

Permalink
Make IV OR global again in non-legacy
Browse files Browse the repository at this point in the history
  • Loading branch information
Mygod committed Sep 17, 2023
1 parent 86e4847 commit 2a4c8ef
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion server/src/models/Pokemon.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,9 @@ class Pokemon extends Model {
? Object.values(filterMap).flatMap((filter) => filter.buildApiFilter())
: []
if ((perms.iv || perms.pvp) && mem) {
filters.push(...globalFilter.buildApiFilter())
const pokemon = Object.keys(filterMap).filter(key => key.includes('-'))
pokemon.push('') // add everything else
filters.push(...globalFilter.buildApiFilter(pokemon))
if (onlyZeroIv) filters.push({ iv: [0, 0] })
if (onlyHundoIv) filters.push({ iv: [100, 100] })
}
Expand Down
4 changes: 2 additions & 2 deletions server/src/services/filters/pokemon/Backend.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ module.exports = class PkmnBackend {
* Build the API filter for Golbat
* @returns {import('../../../types').DnfFilter[]}
*/
buildApiFilter() {
buildApiFilter(pokemon = undefined) {
const {
enabled: _enabled,
size: _size,
Expand All @@ -276,7 +276,7 @@ module.exports = class PkmnBackend {
xxl,
...rest
} = this.filter
const pokemon = this.id === 'global' ? undefined : [this.id]
if (pokemon === undefined && this.id !== 'global') pokemon = [this.id]
if (this.mods.onlyLegacy) {
return dnfifyIvFilter(adv, pokemon)
}
Expand Down

0 comments on commit 2a4c8ef

Please sign in to comment.