Skip to content

Commit 3354ef7

Browse files
authored
feat: background support in popups (#1152)
also refactor: gym defender layout
1 parent 8798ea1 commit 3354ef7

File tree

21 files changed

+1213
-499
lines changed

21 files changed

+1213
-499
lines changed

AGENTS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ Build, test, and development commands - `yarn install` installs workspace depend
44

55
Coding style and naming conventions - Prettier governs formatting (2-space indent, single quotes in JS, semicolons off); never hand-format conflicting styles. Prefer functional React components, PascalCase for components, camelCase for helpers, and `use` prefixes for hooks.
66

7+
Spacing discipline - DO NOT introduce or adjust margins, padding, gaps, line-height, or other spacing-related styles anywhere in the repo without explicit written permission from the user.
8+
79
Testing guidelines - No dedicated Jest suite today; rely on `yarn lint`, type checks from editor tooling, and manual verification in a local dev session. When adding backend features, exercise relevant GraphQL/REST paths via the dev server and document sanity checks in the PR description.
810

911
Commit and pull request guidelines - Use Conventional Commits (`type(scope): summary`), matching existing history (e.g. `feat(map): add weather overlays`). Each PR should describe scope, link related issues, list testing steps, and include screenshots or GIFs for UI changes. Re-run `yarn lint`, `yarn build`, and integration steps touched by the change before requesting review.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@
174174
"source-map": "^0.7.4",
175175
"suncalc": "^1.9.0",
176176
"supercluster": "^8.0.1",
177-
"uicons.js": "2.1.0",
177+
"uicons.js": "2.2.0",
178178
"zustand": "4.4.6"
179179
},
180180
"devDependencies": {

packages/locales/lib/human/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@
128128
"feedback_form": "Feedback Form",
129129
"unknown_pokestop": "Unknown PokéStop Name",
130130
"unknown_gym": "Unknown Gym Name",
131+
"unknown_background_with_id": "Unknown Background #{{id}}",
131132
"exclude": "Exclude",
132133
"exclude_quest": "Exclude Quest",
133134
"exclude_invasion": "Exclude Invasion",

packages/masterfile/lib/index.d.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,14 @@ export interface MasterfileWeather {
6868
types: number[]
6969
}
7070

71+
export interface MasterfileLocationCard {
72+
proto: string
73+
formatted: string
74+
cardType?: string
75+
imageUrl?: string
76+
vfxAddress?: string
77+
}
78+
7179
export interface Masterfile {
7280
pokemon: Record<string, MasterfilePokemon>
7381
types: MasterfileObject
@@ -78,6 +86,8 @@ export interface Masterfile {
7886
weather: Record<string, MasterfileWeather>
7987
teams: (typeof mfjson)['teams']
8088
raids: (typeof mfjson)['raids']
89+
routeTypes: (typeof mfjson)['routeTypes']
90+
locationCards: Record<string, MasterfileLocationCard>
8191
}
8292

8393
export declare function generate(

packages/types/lib/scanner.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,7 @@ export interface Pokemon {
244244
def_iv: number
245245
sta_iv: number
246246
weather: number
247+
background?: number
247248
capture_1: number
248249
capture_2: number
249250
capture_3: number

packages/types/lib/server.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ export interface DbContext {
4848
hasShowcaseType: boolean
4949
hasStationedGmax: boolean
5050
hasBattlePokemonStats: boolean
51+
hasPokemonBackground: boolean
5152
hasPokemonShinyStats?: boolean
5253
connection?: number
5354
}

server/src/filters/pokemon/Backend.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,7 @@ class PkmnBackend {
432432
display_pokemon_id: pokemon.display_pokemon_id,
433433
seen_type: pokemon.seen_type,
434434
changed: !!pokemon.changed,
435+
background: pokemon.background,
435436
}
436437
if (!result.seen_type) {
437438
if (result.spawn_id === null) {

server/src/graphql/typeDefs/scanner.graphql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ type Pokemon {
179179
def_iv: Int
180180
sta_iv: Int
181181
weather: Int
182+
background: Int
182183
capture_1: Float
183184
capture_2: Float
184185
capture_3: Float

server/src/models/Pokemon.js

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,16 @@ class Pokemon extends Model {
132132
static async getAll(perms, args, ctx) {
133133
const { iv: ivs, pvp, areaRestrictions } = perms
134134
const { onlyIvOr, onlyHundoIv, onlyZeroIv, onlyAreas = [] } = args.filters
135-
const { hasSize, hasHeight, isMad, mem, secret, httpAuth, pvpV2 } = ctx
135+
const {
136+
hasSize,
137+
hasHeight,
138+
hasPokemonBackground,
139+
isMad,
140+
mem,
141+
secret,
142+
httpAuth,
143+
pvpV2,
144+
} = ctx
136145
const { filterMap, globalFilter } = this.getFilters(perms, args, ctx)
137146

138147
let queryPvp = config
@@ -175,7 +184,14 @@ class Pokemon extends Model {
175184
if (isMad) {
176185
Pokemon.getMadSql(query)
177186
} else {
178-
query.select(['*', hasSize && !hasHeight ? 'size AS height' : 'size'])
187+
const selectColumns = [
188+
'*',
189+
hasSize && !hasHeight ? 'size AS height' : 'size',
190+
]
191+
if (hasPokemonBackground) {
192+
selectColumns.push('background')
193+
}
194+
query.select(selectColumns)
179195
}
180196
query.where(
181197
isMad ? 'disappear_time' : 'expire_timestamp',

server/src/services/DbManager.js

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -131,14 +131,16 @@ class DbManager extends Logger {
131131
* @returns {Promise<import("@rm/types").DbContext>}
132132
*/
133133
static async schemaCheck(schema) {
134-
const [isMad, pvpV2, hasSize, hasHeight] = await schema('pokemon')
135-
.columnInfo()
136-
.then((columns) => [
137-
'cp_multiplier' in columns,
138-
'pvp' in columns,
139-
'size' in columns,
140-
'height' in columns,
141-
])
134+
const [isMad, pvpV2, hasSize, hasHeight, hasPokemonBackground] =
135+
await schema('pokemon')
136+
.columnInfo()
137+
.then((columns) => [
138+
'cp_multiplier' in columns,
139+
'pvp' in columns,
140+
'size' in columns,
141+
'height' in columns,
142+
'background' in columns,
143+
])
142144
const [
143145
hasRewardAmount,
144146
hasPowerUp,
@@ -220,6 +222,7 @@ class DbManager extends Logger {
220222
hasBattlePokemonStats,
221223
hasShortcode,
222224
hasPokemonShinyStats,
225+
hasPokemonBackground,
223226
}
224227
}
225228

@@ -237,7 +240,6 @@ class DbManager extends Logger {
237240
: {
238241
mem: this.endpoints[i].endpoint,
239242
secret: this.endpoints[i].secret,
240-
// Add support for HTTP authentication
241243
httpAuth: this.endpoints[i].httpAuth,
242244
pvpV2: true,
243245
}

0 commit comments

Comments
 (0)