Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 38 additions & 3 deletions config/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@
"quests": false,
"raids": true,
"nests": false,
"stations": false
"stations": false,
"tappables": false
},
"dataRequestLimits": {
"categories": {
Expand All @@ -76,7 +77,8 @@
"portals": 0,
"routes": 0,
"weather": 0,
"stations": 0
"stations": 0,
"tappables": 0
},
"time": 60
},
Expand All @@ -89,7 +91,8 @@
"spawnpoints": 10000,
"nests": 2500,
"scanCells": 5000,
"stations": 5000
"stations": 5000,
"tappables": 5000
},
"pvp": {
"leagues": [
Expand Down Expand Up @@ -158,6 +161,7 @@
"gyms",
"nests",
"pokestops",
"tappables",
"stations",
"pokemon",
"routes",
Expand Down Expand Up @@ -266,6 +270,7 @@
"enablePokestopPopupCoordsSelector": false,
"enablePortalPopupCoordsSelector": false,
"enableStationPopupCoordsSelector": false,
"enableTappablePopupCoordsSelector": false,
"customFloatingIcons": [],
"expandAllScanAreas": false,
"enableRouteDownload": false
Expand Down Expand Up @@ -299,6 +304,10 @@
"stations": {
"zoomLevel": 14,
"forcedLimit": 2500
},
"tappables": {
"zoomLevel": 14,
"forcedLimit": 2500
}
},
"messageOfTheDay": {
Expand Down Expand Up @@ -389,6 +398,17 @@
"opacityFiveMinutes": 0.5,
"opacityOneMinute": 0.25
},
"tappables": {
"clustering": true,
"tappableTimers": false,
"interactionRanges": false,
"spacialRendRange": false,
"tappablesOpacity": true,
"enableTappablePopupCoords": false,
"opacityTenMinutes": 0.75,
"opacityFiveMinutes": 0.5,
"opacityOneMinute": 0.25
},
"pokemon": {
"clustering": true,
"pokemonTimers": false,
Expand Down Expand Up @@ -537,6 +557,10 @@
"enabled": true
}
},
"tappables": {
"enabled": false,
"items": true
},
"pokemon": {
"enabled": false,
"easyMode": true,
Expand Down Expand Up @@ -791,6 +815,11 @@
"trialPeriodEligible": false,
"roles": []
},
"tappables": {
"enabled": true,
"trialPeriodEligible": false,
"roles": []
},
"lures": {
"enabled": true,
"trialPeriodEligible": false,
Expand Down Expand Up @@ -1018,6 +1047,12 @@
"md": 25,
"lg": 35,
"xl": 45
},
"tappable": {
"sm": 15,
"md": 25,
"lg": 35,
"xl": 45
}
}
},
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@
"source-map": "^0.7.4",
"suncalc": "^1.9.0",
"supercluster": "^8.0.1",
"uicons.js": "2.0.3",
"uicons.js": "2.1.0",
"zustand": "4.4.6"
},
"devDependencies": {
Expand Down
6 changes: 6 additions & 0 deletions packages/locales/lib/human/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -805,11 +805,17 @@
"exclude_battle": "Exclude Max Battle",
"station": "Power Spot",
"stations": "Power Spots",
"tappables": "Tappables",
"tappable_type_breakfast": "Zygarde Cell",
"tappable_type_hat": "Party Hat",
"tappable_type_maple": "Apple",
"tappable_type_pokeball": "Poké Ball",
"stations_filters": "Power Spots Filter Settings",
"stations_options": "Power Spot Options",
"all_stations": "All Power Spots",
"gmax_stationed": "Gigantamax Placed",
"search_battles": "Search Max Battles",
"search_tappables": "Search Tappables",
"started": "Started",
"ended": "Ended",
"search_stations": "Search Power Spots",
Expand Down
15 changes: 15 additions & 0 deletions packages/types/lib/scanner.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import SpawnpointModel = require('server/src/models/Spawnpoint')
import WeatherModel = require('server/src/models/Weather')
import RouteModel = require('server/src/models/Route')
import StationModel = require('server/src/models/Station')
import TappableModel = require('server/src/models/Tappable')

import { S2Polygon } from './general'

Expand Down Expand Up @@ -276,6 +277,20 @@ export interface Portal {

export type FullPortal = FullModel<Portal, PortalModel.Portal>

export interface Tappable {
id: string
lat: number
lon: number
type: string
item_id: number
count: number | null
expire_timestamp: number | null
expire_timestamp_verified: boolean
updated: number
}

export type FullTappable = FullModel<Tappable, TappableModel.Tappable>

export interface ScanCell {
id?: string
level?: number
Expand Down
3 changes: 3 additions & 0 deletions packages/types/lib/server.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import type {
RmModelKeys,
ModelKeys,
Station,
Tappable,
Backup,
Nest,
NestSubmission,
Expand Down Expand Up @@ -71,6 +72,7 @@ export interface Available {
pokestops: ModelReturn<typeof Pokestop, 'getAvailable'>
nests: ModelReturn<typeof Nest, 'getAvailable'>
stations: ModelReturn<typeof Station, 'getAvailable'>
tappables: ModelReturn<typeof Tappable, 'getAvailable'>
}

export interface ApiEndpoint {
Expand Down Expand Up @@ -205,6 +207,7 @@ export type AdvCategories =
| 'pokestops'
| 'nests'
| 'stations'
| 'tappables'

export type UIObject = ReturnType<
(typeof import('server/src/ui/drawer'))['drawer']
Expand Down
9 changes: 9 additions & 0 deletions server/src/filters/builder/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const { state } = require('../../services/state')
const { buildPokemon } = require('./pokemon')
const { buildPokestops } = require('./pokestop')
const { buildGyms } = require('./gym')
const { buildTappables } = require('./tappable')
const { BaseFilter } = require('../Base')
const { PokemonFilter } = require('../pokemon/Frontend')

Expand Down Expand Up @@ -111,6 +112,14 @@ function buildDefaultFilters(perms) {
},
}
: undefined,
tappables:
perms.tappables && state.db.models.Tappable
? {
enabled: defaultFilters.tappables.enabled,
standard: new BaseFilter(),
filter: buildTappables(perms, defaultFilters.tappables),
}
: undefined,
stations:
stationReducer && state.db.models.Station
? {
Expand Down
29 changes: 29 additions & 0 deletions server/src/filters/builder/tappable.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// @ts-check
const { state } = require('../../services/state')
const { BaseFilter } = require('../Base')

/**
* @param {import('@rm/types').Permissions} perms
* @param {import('@rm/types').Config['defaultFilters']['tappables']} defaults
* @returns {Record<string, BaseFilter>}
*/
function buildTappables(perms, defaults) {
const filters = { q0: new BaseFilter() }
if (!perms.tappables) {
return filters
}

Object.keys(state.event.masterfile.items).forEach((itemId) => {
filters[`q${itemId}`] = new BaseFilter(defaults.items)
})

state.event.getAvailable('tappables').forEach((key) => {
if (!filters[key]) {
filters[key] = new BaseFilter(defaults.items)
}
})

return filters
}

module.exports = { buildTappables }
8 changes: 8 additions & 0 deletions server/src/graphql/resolvers.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ const resolvers = {
}),
availableStations: (_, _args, { Event, perms }) =>
perms?.dynamax ? Event.available.stations : [],
availableTappables: (_, _args, { Event, perms }) =>
perms?.tappables ? Event.available.tappables : [],
backup: (_, args, { req, perms, Db }) => {
if (perms?.backups && req?.user?.id) {
return Db.models.Backup.getOne(args.id, req?.user?.id)
Expand Down Expand Up @@ -526,6 +528,12 @@ const resolvers = {
}
return []
},
tappables: (_, args, { perms, Db }) => {
if (perms?.tappables) {
return Db.query('Tappable', 'getAll', perms, args)
}
return []
},
submissionCells: async (_, args, { req, perms, Db }) => {
const { submissionZoom } = config.getMapConfig(req).general
if (perms?.submissionCells && args.zoom >= submissionZoom - 1) {
Expand Down
8 changes: 8 additions & 0 deletions server/src/graphql/typeDefs/index.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ type Query {
availableGyms: [String]
availableNests: [String]
availableStations: [String]
availableTappables: [String]
badges: [Badge]
backup(id: ID): Backup
backups: [Backup]
Expand Down Expand Up @@ -67,6 +68,13 @@ type Query {
filters: JSON
): [Station]
stationPokemon(id: ID): [StationPokemon]
tappables(
minLat: Float
maxLat: Float
minLon: Float
maxLon: Float
filters: JSON
): [Tappable]
s2cells(
minLat: Float
maxLat: Float
Expand Down
12 changes: 12 additions & 0 deletions server/src/graphql/typeDefs/scanner.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,18 @@ type Portal {
updated: Int
}

type Tappable {
id: ID
lat: Float
lon: Float
type: String
item_id: Int
count: Int
expire_timestamp: Int
expire_timestamp_verified: Boolean
updated: Int
}

type ScanCell {
id: ID
level: Int
Expand Down
Loading
Loading