Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
a7795dc
Update main.go
ReuschelCGN Feb 22, 2024
f3c31eb
Update main.go
ReuschelCGN Feb 22, 2024
ff85605
Merge branch 'UnownHash:main' into main
ReuschelCGN Mar 13, 2024
f50b278
Merge branch 'UnownHash:main' into main
ReuschelCGN Apr 3, 2024
4af9bd1
Merge branch 'UnownHash:main' into main
ReuschelCGN Apr 9, 2024
637de70
Merge branch 'UnownHash:main' into main
ReuschelCGN Apr 22, 2024
2443ac8
Merge branch 'UnownHash:main' into main
ReuschelCGN May 21, 2024
8f825f0
Merge branch 'UnownHash:main' into main
ReuschelCGN Jul 2, 2024
5ee38f6
Merge branch 'UnownHash:main' into main
ReuschelCGN Sep 5, 2024
8509793
Merge branch 'UnownHash:main' into main
ReuschelCGN Sep 16, 2024
853f195
Merge branch 'UnownHash:main' into main
ReuschelCGN Sep 16, 2024
4638eea
Merge branch 'UnownHash:main' into main
ReuschelCGN Sep 18, 2024
f3c7009
Merge branch 'UnownHash:main' into main
ReuschelCGN Nov 6, 2024
d3ad94b
Merge branch 'UnownHash:main' into main
ReuschelCGN Nov 21, 2024
ba5f2a5
Merge branch 'UnownHash:main' into main
ReuschelCGN Nov 22, 2024
207d15e
Merge branch 'UnownHash:main' into main
ReuschelCGN Dec 12, 2024
92364e1
Merge branch 'UnownHash:main' into main
ReuschelCGN Dec 20, 2024
bea04ef
Merge branch 'UnownHash:main' into main
ReuschelCGN Dec 23, 2024
2d9235f
Merge branch 'UnownHash:main' into main
ReuschelCGN Jan 6, 2025
26be800
Merge branch 'UnownHash:main' into main
ReuschelCGN Jan 17, 2025
1a2b9f4
Merge branch 'UnownHash:main' into main
ReuschelCGN Feb 13, 2025
c482750
Merge branch 'UnownHash:main' into main
ReuschelCGN Feb 25, 2025
a3f98e3
Update publish.yml
ReuschelCGN Feb 25, 2025
1d39cec
Update publish.yml
ReuschelCGN Feb 25, 2025
cc39da3
Update publish.yml
ReuschelCGN Feb 25, 2025
92da3e5
Update publish.yml
ReuschelCGN Feb 25, 2025
f441404
Update publish.yml
ReuschelCGN Feb 25, 2025
5352c2c
Update publish.yml
ReuschelCGN Feb 25, 2025
26e759d
Update publish.yml
ReuschelCGN Feb 25, 2025
d0a579d
Merge branch 'UnownHash:main' into main
ReuschelCGN Mar 7, 2025
0ac8503
Merge branch 'UnownHash:main' into main
ReuschelCGN Mar 10, 2025
2c8e6ec
Merge branch 'UnownHash:main' into main
ReuschelCGN Mar 12, 2025
cbd33c2
Merge branch 'UnownHash:main' into main
ReuschelCGN Mar 17, 2025
ae5c532
Merge branch 'UnownHash:main' into main
ReuschelCGN Apr 2, 2025
37fb137
Merge branch 'UnownHash:main' into main
ReuschelCGN Apr 8, 2025
1f5db19
Merge branch 'UnownHash:main' into main
ReuschelCGN Apr 9, 2025
9b8702e
Initial station webhook
unseenmagik Jan 29, 2025
0404773
fix: webhook sending
Fabio1988 Feb 1, 2025
f9deb05
Merge branch 'UnownHash:main' into main
ReuschelCGN Apr 22, 2025
503af44
Merge pull request #43 from UnownHash/stations-wh
ReuschelCGN Apr 24, 2025
de3ff21
Update station.go
ReuschelCGN Apr 25, 2025
3866a9c
Initial station webhook
unseenmagik Jan 29, 2025
fbfc6e5
fix: webhook sending
Fabio1988 Feb 1, 2025
36c4b4e
Merge branch 'UnownHash:main' into main
ReuschelCGN May 4, 2025
d93a82c
Merge branch 'UnownHash:main' into feat-tappables-mbwh2
ReuschelCGN May 4, 2025
aee2385
Merge pull request #46 from ReuschelCGN/feat-tappables-mbwh2
ReuschelCGN May 7, 2025
776ebad
Update station.go
ReuschelCGN May 7, 2025
d9762f7
Merge pull request #47 from UnownHash/stations-wh
ReuschelCGN May 7, 2025
78a0e1c
Initial test
jfberry May 16, 2025
a7bbd6c
Only include timeslots with attendees
jfberry May 16, 2025
f3458b5
Update protos.md
jfberry May 16, 2025
0509bdf
Change order of compare
jfberry May 17, 2025
045391a
Add rsvps to raid webhook
jfberry May 20, 2025
d631886
Merge pull request #48 from UnownHash/feat-rsvp
ReuschelCGN May 21, 2025
c951c39
Clear rsvps from count proto
jfberry May 21, 2025
5bc4474
Clear rsvp data when new raid is first seen
jfberry May 21, 2025
5496201
Fix!
jfberry May 21, 2025
1ce0099
Merge pull request #49 from UnownHash/feat-rsvp
ReuschelCGN May 21, 2025
af05da4
Fix clear logic
jfberry May 23, 2025
745c9ad
Merge pull request #50 from UnownHash/feat-rsvp
ReuschelCGN May 23, 2025
0b5a73b
Merge branch 'UnownHash:main' into develop-rsvp
ReuschelCGN May 26, 2025
937b034
Merge branch 'UnownHash:main' into develop
ReuschelCGN May 26, 2025
76868d7
Merge pull request #51 from ReuschelCGN/develop-rsvp
ReuschelCGN May 26, 2025
367264f
Update README.md
ReuschelCGN May 26, 2025
9df0bab
Update README.md
ReuschelCGN May 26, 2025
b7de90f
Merge branch 'UnownHash:main' into develop
ReuschelCGN May 30, 2025
0ce121e
Merge branch 'UnownHash:main' into develop
ReuschelCGN Jun 22, 2025
93c304b
Update pokemon.go
ReuschelCGN Jun 23, 2025
3ba089e
Merge branch 'UnownHash:main' into develop
ReuschelCGN Jul 17, 2025
b9333ac
Merge branch 'UnownHash:main' into develop
ReuschelCGN Jul 27, 2025
eb29454
Merge branch 'UnownHash:main' into develop
ReuschelCGN Aug 28, 2025
a3d7654
Merge branch 'UnownHash:main' into develop
ReuschelCGN Sep 16, 2025
91d1b7c
Merge branch 'UnownHash:main' into develop
ReuschelCGN Sep 18, 2025
70690cc
Merge branch 'UnownHash:main' into develop
ReuschelCGN Oct 6, 2025
c3650bc
Update pokemon.go
ReuschelCGN Oct 15, 2025
159667c
Add files via upload
ReuschelCGN Oct 15, 2025
2257b42
Update gym.go
ReuschelCGN Oct 17, 2025
31d7c86
Update pokemon.go
ReuschelCGN Oct 17, 2025
8ff3831
Update pokemon.go
ReuschelCGN Oct 17, 2025
dacee14
Update pokestop.go
ReuschelCGN Oct 17, 2025
e2e331c
Update pogo.go
ReuschelCGN Oct 17, 2025
fb18725
Update api_pokemon_common.go
ReuschelCGN Oct 19, 2025
9f8b30a
Update api_pokemon_scan_v1.go
ReuschelCGN Oct 19, 2025
e68bb1a
Merge branch 'UnownHash:main' into develop-background
ReuschelCGN Dec 11, 2025
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
107 changes: 53 additions & 54 deletions decoder/api_pokemon_common.go
Original file line number Diff line number Diff line change
@@ -1,61 +1,60 @@
package decoder

import (
"github.com/UnownHash/gohbem"
"github.com/UnownHash/gohbem"
)

func buildApiPokemonResult(pokemon *Pokemon) ApiPokemonResult {
return ApiPokemonResult{
Id: pokemon.Id,
PokestopId: pokemon.PokestopId,
SpawnId: pokemon.SpawnId,
Lat: pokemon.Lat,
Lon: pokemon.Lon,
Weight: pokemon.Weight,
Size: pokemon.Size,
Height: pokemon.Height,
ExpireTimestamp: pokemon.ExpireTimestamp,
Updated: pokemon.Updated,
PokemonId: pokemon.PokemonId,
Move1: pokemon.Move1,
Move2: pokemon.Move2,
Gender: pokemon.Gender,
Cp: pokemon.Cp,
AtkIv: pokemon.AtkIv,
DefIv: pokemon.DefIv,
StaIv: pokemon.StaIv,
Iv: pokemon.Iv,
Form: pokemon.Form,
Level: pokemon.Level,
Weather: pokemon.Weather,
Costume: pokemon.Costume,
FirstSeenTimestamp: pokemon.FirstSeenTimestamp,
Changed: pokemon.Changed,
CellId: pokemon.CellId,
ExpireTimestampVerified: pokemon.ExpireTimestampVerified,
DisplayPokemonId: pokemon.DisplayPokemonId,
IsDitto: pokemon.IsDitto,
SeenType: pokemon.SeenType,
Shiny: pokemon.Shiny,
Username: pokemon.Username,
Pvp: func() map[string][]gohbem.PokemonEntry {
if ohbem != nil {
pvp, err := ohbem.QueryPvPRank(int(pokemon.PokemonId),
int(pokemon.Form.ValueOrZero()),
int(pokemon.Costume.ValueOrZero()),
int(pokemon.Gender.ValueOrZero()),
int(pokemon.AtkIv.ValueOrZero()),
int(pokemon.DefIv.ValueOrZero()),
int(pokemon.StaIv.ValueOrZero()),
float64(pokemon.Level.ValueOrZero()))
if err != nil {
return nil
}
return pvp
}
return nil
}(),
}
return ApiPokemonResult{
Id: pokemon.Id,
PokestopId: pokemon.PokestopId,
SpawnId: pokemon.SpawnId,
Lat: pokemon.Lat,
Lon: pokemon.Lon,
Weight: pokemon.Weight,
Size: pokemon.Size,
Height: pokemon.Height,
ExpireTimestamp: pokemon.ExpireTimestamp,
Updated: pokemon.Updated,
PokemonId: pokemon.PokemonId,
Move1: pokemon.Move1,
Move2: pokemon.Move2,
Gender: pokemon.Gender,
Cp: pokemon.Cp,
AtkIv: pokemon.AtkIv,
DefIv: pokemon.DefIv,
StaIv: pokemon.StaIv,
Iv: pokemon.Iv,
Form: pokemon.Form,
Level: pokemon.Level,
Weather: pokemon.Weather,
Costume: pokemon.Costume,
FirstSeenTimestamp: pokemon.FirstSeenTimestamp,
Changed: pokemon.Changed,
CellId: pokemon.CellId,
ExpireTimestampVerified: pokemon.ExpireTimestampVerified,
DisplayPokemonId: pokemon.DisplayPokemonId,
IsDitto: pokemon.IsDitto,
SeenType: pokemon.SeenType,
Shiny: pokemon.Shiny,
Background: pokemon.Background,
Username: pokemon.Username,
Pvp: func() map[string][]gohbem.PokemonEntry {
if ohbem != nil {
pvp, err := ohbem.QueryPvPRank(int(pokemon.PokemonId),
int(pokemon.Form.ValueOrZero()),
int(pokemon.Costume.ValueOrZero()),
int(pokemon.Gender.ValueOrZero()),
int(pokemon.AtkIv.ValueOrZero()),
int(pokemon.DefIv.ValueOrZero()),
int(pokemon.StaIv.ValueOrZero()),
float64(pokemon.Level.ValueOrZero()))
if err != nil {
return nil
}
return pvp
}
return nil
}(),
}
}


2 changes: 2 additions & 0 deletions decoder/api_pokemon_scan_v1.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ type ApiPokemonResult struct {
IsDitto bool `json:"is_ditto"`
SeenType null.String `json:"seen_type"`
Shiny null.Bool `json:"shiny"`
Background null.Int `json:"background"`
Username null.String `json:"username"`
Capture1 null.Float `json:"capture_1"`
Capture2 null.Float `json:"capture_2"`
Expand Down Expand Up @@ -308,6 +309,7 @@ func GetPokemonInArea(retrieveParameters ApiPokemonScan) []*ApiPokemonResult {
IsDitto: pokemon.IsDitto,
SeenType: pokemon.SeenType,
Shiny: pokemon.Shiny,
Background: pokemon.Background,
Username: pokemon.Username,
Pvp: func() map[string][]gohbem.PokemonEntry {
if ohbem != nil {
Expand Down
17 changes: 13 additions & 4 deletions decoder/pokemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"encoding/json"
"errors"
"fmt"
"golbat/util"
"strconv"
"strings"
"sync"
Expand Down Expand Up @@ -68,6 +69,7 @@ type Pokemon struct {
IsDitto bool `db:"is_ditto" json:"is_ditto"`
SeenType null.String `db:"seen_type" json:"seen_type"`
Shiny null.Bool `db:"shiny" json:"shiny"`
Background null.Int `db:"background" json:"background"`
Username null.String `db:"username" json:"username"`
Capture1 null.Float `db:"capture_1" json:"capture_1"`
Capture2 null.Float `db:"capture_2" json:"capture_2"`
Expand Down Expand Up @@ -109,6 +111,7 @@ type Pokemon struct {
//`display_pokemon_id` smallint unsigned DEFAULT NULL,
//`seen_type` enum('wild','encounter','nearby_stop','nearby_cell') DEFAULT NULL,
//`shiny` tinyint(1) DEFAULT '0',
//`background` smallint unsigned DEFAULT NULL,
//`username` varchar(32) DEFAULT NULL,
//`capture_1` double(18,14) DEFAULT NULL,
//`capture_2` double(18,14) DEFAULT NULL,
Expand Down Expand Up @@ -148,7 +151,7 @@ func getPokemonRecord(ctx context.Context, db db.DbDetails, encounterId uint64)
"SELECT id, pokemon_id, lat, lon, spawn_id, expire_timestamp, atk_iv, def_iv, sta_iv, golbat_internal, iv, "+
"move_1, move_2, gender, form, cp, level, strong, weather, costume, weight, height, size, "+
"display_pokemon_id, is_ditto, pokestop_id, updated, first_seen_timestamp, changed, cell_id, "+
"expire_timestamp_verified, shiny, username, pvp, is_event, seen_type "+
"expire_timestamp_verified, shiny, background, username, pvp, is_event, seen_type "+
"FROM pokemon WHERE id = ?", strconv.FormatUint(encounterId, 10))

statsCollector.IncDbQuery("select pokemon", err)
Expand Down Expand Up @@ -211,6 +214,7 @@ func hasChangesPokemon(old *Pokemon, new *Pokemon) bool {
old.IsDitto != new.IsDitto ||
old.SeenType != new.SeenType ||
old.Shiny != new.Shiny ||
old.Background != new.Background ||
old.IsEvent != new.IsEvent ||
!floatAlmostEqual(old.Lat, new.Lat, floatTolerance) ||
!floatAlmostEqual(old.Lon, new.Lon, floatTolerance) ||
Expand Down Expand Up @@ -315,12 +319,12 @@ func savePokemonRecordAsAtTime(ctx context.Context, db db.DbDetails, pokemon *Po
"spawn_id, expire_timestamp, atk_iv, def_iv, sta_iv, golbat_internal, iv, move_1, move_2,"+
"gender, form, cp, level, strong, weather, costume, weight, height, size,"+
"display_pokemon_id, is_ditto, pokestop_id, updated, first_seen_timestamp, changed, cell_id,"+
"expire_timestamp_verified, shiny, username, %s is_event, seen_type) "+
"expire_timestamp_verified, shiny, background, username, %s is_event, seen_type) "+
"VALUES (\"%d\", :pokemon_id, :lat, :lon, :spawn_id, :expire_timestamp, :atk_iv, :def_iv, :sta_iv,"+
":golbat_internal, :iv, :move_1, :move_2, :gender, :form, :cp, :level, :strong, :weather, :costume,"+
":weight, :height, :size, :display_pokemon_id, :is_ditto, :pokestop_id, :updated,"+
":first_seen_timestamp, :changed, :cell_id, :expire_timestamp_verified, :shiny, :username, %s :is_event,"+
":seen_type)", pvpField, pokemon.Id, pvpValue), pokemon)
":first_seen_timestamp, :changed, :cell_id, :expire_timestamp_verified, :shiny, :background, :username,"+
"%s :is_event, :seen_type)", pvpField, pokemon.Id, pvpValue), pokemon)

statsCollector.IncDbQuery("insert pokemon", err)
if err != nil {
Expand Down Expand Up @@ -369,6 +373,7 @@ func savePokemonRecordAsAtTime(ctx context.Context, db db.DbDetails, pokemon *Po
"is_ditto = :is_ditto, "+
"seen_type = :seen_type, "+
"shiny = :shiny, "+
"background = :background, "+
"username = :username, "+
"%s"+
"is_event = :is_event "+
Expand Down Expand Up @@ -476,6 +481,7 @@ func createPokemonWebhooks(ctx context.Context, db db.DbDetails, old *Pokemon, n
"capture_2": new.Capture2.ValueOrZero(),
"capture_3": new.Capture3.ValueOrZero(),
"shiny": new.Shiny,
"background": new.Background,
"username": new.Username,
"display_pokemon_id": new.DisplayPokemonId,
"is_event": new.IsEvent,
Expand Down Expand Up @@ -775,6 +781,7 @@ func (pokemon *Pokemon) setDittoAttributes(mode string, isDitto bool, old, new *
pokemon.IsDitto = true
pokemon.DisplayPokemonId = null.IntFrom(int64(pokemon.PokemonId))
pokemon.PokemonId = int16(pogo.HoloPokemonId_DITTO)
pokemon.Form = null.IntFrom(0)
} else {
log.Debugf("[POKEMON] %d: %s not Ditto found %s -> %s", pokemon.Id, mode, old, new)
}
Expand Down Expand Up @@ -1243,6 +1250,7 @@ func (pokemon *Pokemon) setPokemonDisplay(pokemonId int16, display *pogo.Pokemon
if oldId != pokemonId || pokemon.Form != null.IntFrom(int64(display.Form)) ||
pokemon.Costume != null.IntFrom(int64(display.Costume)) ||
pokemon.Gender != null.IntFrom(int64(display.Gender)) ||
pokemon.Background != null.IntFromPtr(util.ExtractBackgroundFromDisplay(display)) ||
pokemon.IsStrong.ValueOrZero() != display.IsStrongPokemon {
log.Debugf("Pokemon %d changed from (%d,%d,%d,%d,%t) to (%d,%d,%d,%d,%t)", pokemon.Id, oldId,
pokemon.Form.ValueOrZero(), pokemon.Costume.ValueOrZero(), pokemon.Gender.ValueOrZero(),
Expand All @@ -1266,6 +1274,7 @@ func (pokemon *Pokemon) setPokemonDisplay(pokemonId int16, display *pogo.Pokemon
pokemon.Gender = null.IntFrom(int64(display.Gender))
pokemon.Form = null.IntFrom(int64(display.Form))
pokemon.Costume = null.IntFrom(int64(display.Costume))
pokemon.Background = null.IntFromPtr(util.ExtractBackgroundFromDisplay(display))
if !pokemon.isNewRecord() {
pokemon.repopulateIv(int64(display.WeatherBoostedCondition), display.IsStrongPokemon)
}
Expand Down
2 changes: 2 additions & 0 deletions sql/50_pokemon_background.up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ALTER TABLE pokemon
add `background` smallint unsigned DEFAULT NULL AFTER `shiny`;