Skip to content

Commit

Permalink
Merge pull request #1021 from Gattaca1/toggle-rocket-grunts-and-leaders
Browse files Browse the repository at this point in the history
[Feature Request]: Exclude rocket grunt toggle & exclude rocket leader toggle
  • Loading branch information
TurtIeSocks authored Jun 22, 2024
2 parents b7e3ed6 + 8f851ba commit c1be413
Show file tree
Hide file tree
Showing 11 changed files with 73 additions and 5 deletions.
4 changes: 3 additions & 1 deletion packages/locales/lib/human/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,8 @@
"delete": "löschen",
"name": "Name",
"only_confirmed": "nur bestätigte",
"only_exclude_grunts": "Grunzer ausschließen",
"only_exclude_leaders": "EAnführer ausschließen",
"rocket_pokemon": "Crypto-Pokemon",
"decoy": "Täusch-Rüpel",
"s2_cell_limit_0": "Sie haben versucht, mehr als 20.000 Zellen zu generieren ({{variable_0}})",
Expand Down Expand Up @@ -759,4 +761,4 @@
"locale_instructions_8": "Warte bis die Pull-Anfrage überprüft und gemerged wurde.",
"enter_translation": "Übersetzung eingeben",
"individual_filters": "Teilweise gefiltert"
}
}
4 changes: 3 additions & 1 deletion packages/locales/lib/human/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -615,6 +615,8 @@
"delete": "Delete",
"name": "Name",
"only_confirmed": "Only Confirmed",
"only_exclude_grunts": "Exclude Grunts",
"only_exclude_leaders": "Exclude Leaders",
"rocket_pokemon": "Rocket Pokémon",
"decoy": "Decoy",
"s2_cell_limit_0": "You attempted to generate more than 20,000 cells ({{variable_0}})",
Expand Down Expand Up @@ -783,4 +785,4 @@
"locale_instructions_8": "Wait for the pull request to be reviewed and merged",
"enter_translation": "Enter Translation",
"individual_filters": "Partially Filtered"
}
}
4 changes: 3 additions & 1 deletion packages/locales/lib/human/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,8 @@
"delete": "Eliminar",
"name": "Nombre",
"only_confirmed": "Solo confirmados",
"only_exclude_grunts": "Excluir gruñidos",
"only_exclude_leaders": "Excluir a los dirigentes",
"rocket_pokemon": "Pokémon del Equipo Rocket",
"decoy": "Señuelo",
"s2_cell_limit_0": "Has intentado generar más de 20,000 celdas ({{variable_0}})",
Expand Down Expand Up @@ -616,4 +618,4 @@
"hide_editor": "Ocultar Editor",
"reported_error": "Este error ha sido reportado al servidor con el identificador",
"dark_mode": "Modo Oscuro"
}
}
4 changes: 3 additions & 1 deletion packages/locales/lib/human/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,8 @@
"delete": "Supprimer",
"name": "Nom",
"only_confirmed": "Confirmé seulement",
"only_exclude_grunts": "Exclure les grognements",
"only_exclude_leaders": "Exclure les dirigeants",
"rocket_pokemon": "Pokémon Rocket",
"decoy": "Leurre",
"s2_cell_limit_0": "Vous avez essayé de générer plus de 20 000 cellules ({{variable_0}})",
Expand Down Expand Up @@ -770,4 +772,4 @@
"team_audio": "Son d’équipe",
"type_audio": "Son de type",
"weather_audio": "Son de météo"
}
}
4 changes: 3 additions & 1 deletion packages/locales/lib/human/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,8 @@
"online": "Online",
"only_available": "Dostępne",
"only_confirmed": "Tylko potwierdzone",
"only_exclude_grunts": "Wykluczyć chrząknięcia",
"only_exclude_leaders": "Wykluczyć liderów",
"only_global": "Tylko globalne",
"only_show_available": "Pokaż tylko dostępne",
"opacity_five_minutes": "Przezroczystość po 5 minutach",
Expand Down Expand Up @@ -767,4 +769,4 @@
"zero_iv": "0% IV",
"zoom_in": "Przybliż",
"zoom_out": "Oddal"
}
}
8 changes: 8 additions & 0 deletions server/src/configs/custom-environment-variables.json
Original file line number Diff line number Diff line change
Expand Up @@ -993,6 +993,14 @@
"__name": "DEFAULT_FILTERS_POKESTOPS_CONFIRMED",
"__format": "boolean"
},
"excludeGrunts": {
"__name": "DEFAULT_FILTERS_POKESTOPS_EXCLUDE_GRUNTS",
"__format": "boolean"
},
"excludeLeaders": {
"__name": "DEFAULT_FILTERS_POKESTOPS_EXCLUDE_LEADERS",
"__format": "boolean"
},
"items": {
"__name": "DEFAULT_FILTERS_POKESTOPS_ITEMS",
"__format": "boolean"
Expand Down
2 changes: 2 additions & 0 deletions server/src/configs/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,8 @@
"showcasePokemon": true,
"questSet": "both",
"confirmed": false,
"excludeGrunts": false,
"excludeLeaders": false,
"items": true,
"megaEnergy": true,
"candy": true,
Expand Down
15 changes: 15 additions & 0 deletions server/src/models/Pokestop.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ class Pokestop extends Model {
onlyEventStops,
onlyConfirmed,
onlyAreas = [],
onlyExcludeGrunts,
onlyExcludeLeaders,
},
} = args
const midnight = getUserMidnight(args)
Expand Down Expand Up @@ -573,6 +575,19 @@ class Pokestop extends Model {
)
}
})
if (onlyExcludeGrunts) {
invasion.whereNotIn(
isMad ? 'character_display' : 'character',
Event.rocketGruntIDs,
)
}

if (onlyExcludeLeaders) {
invasion.whereNotIn(
isMad ? 'character_display' : 'character',
Event.rocketLeaderIDs,
)
}
})
} else {
stops.orWhere((invasion) => {
Expand Down
17 changes: 17 additions & 0 deletions server/src/services/EventManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,23 @@ class EventManager {
try {
const newInvasions = await fetch(endpoint).then((res) => res.json())
if (newInvasions) {
this.rocketGruntIDs = Object.keys(newInvasions)
.filter(
(key) =>
newInvasions[key].grunt &&
newInvasions[key].grunt.includes('Grunt'),
)
.map(Number)

this.rocketLeaderIDs = Object.keys(newInvasions)
.filter(
(key) =>
newInvasions[key].grunt &&
(newInvasions[key].grunt.includes('Executive') ||
newInvasions[key].grunt.includes('Giovanni')),
)
.map(Number)

this.invasions = newInvasions
}
} catch (e) {
Expand Down
6 changes: 6 additions & 0 deletions server/src/services/filters/builder/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,12 @@ function buildDefaultFilters(perms) {
confirmed: perms.invasions
? defaultFilters.pokestops.confirmed
: undefined,
excludeGrunts: perms.invasions
? defaultFilters.pokestops.excludeGrunts
: undefined,
excludeLeaders: perms.invasions
? defaultFilters.pokestops.excludeLeaders
: undefined,
invasions: perms.invasions
? defaultFilters.pokestops.invasions
: undefined,
Expand Down
10 changes: 10 additions & 0 deletions src/features/drawer/pokestops/Invasions.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,16 @@ const BaseInvasion = () => {
label="only_confirmed"
/>
)}
<BoolToggle
inset
field="filters.pokestops.excludeGrunts"
label="only_exclude_grunts"
/>
<BoolToggle
inset
field="filters.pokestops.excludeLeaders"
label="only_exclude_leaders"
/>
{confirmedEnabled || hasConfirmed ? (
<MultiSelectorList tabKey="invasions">
<SelectorListMemo
Expand Down

0 comments on commit c1be413

Please sign in to comment.