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
24 changes: 12 additions & 12 deletions decoder/gym.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,15 +173,15 @@ func calculatePowerUpPoints(fortData *pogo.PokemonFortProto) (null.Int, null.Int

func (gym *Gym) updateGymFromFort(fortData *pogo.PokemonFortProto, cellId uint64) *Gym {
type pokemonDisplay struct {
Form int `json:"form,omitempty"`
Costume int `json:"costume,omitempty"`
Gender int `json:"gender"`
Shiny bool `json:"shiny,omitempty"`
TempEvolution int `json:"temp_evolution,omitempty"`
TempEvolutionFinishMs int64 `json:"temp_evolution_finish_ms,omitempty"`
Alignment int `json:"alignment,omitempty"`
Badge int `json:"badge,omitempty"`
LocationCard int `json:"location_card,omitempty"`
Form int `json:"form,omitempty"`
Costume int `json:"costume,omitempty"`
Gender int `json:"gender"`
Shiny bool `json:"shiny,omitempty"`
TempEvolution int `json:"temp_evolution,omitempty"`
TempEvolutionFinishMs int64 `json:"temp_evolution_finish_ms,omitempty"`
Alignment int `json:"alignment,omitempty"`
Badge int `json:"badge,omitempty"`
Background *int64 `json:"background,omitempty"`
}
gym.Id = fortData.FortId
gym.Lat = fortData.Latitude //fmt.Sprintf("%f", fortData.Latitude)
Expand All @@ -200,7 +200,7 @@ func (gym *Gym) updateGymFromFort(fortData *pogo.PokemonFortProto, cellId uint64
TempEvolutionFinishMs: fortData.GuardPokemonDisplay.TemporaryEvolutionFinishMs,
Alignment: int(fortData.GuardPokemonDisplay.Alignment),
Badge: int(fortData.GuardPokemonDisplay.PokemonBadge),
LocationCard: util.ExtractLocationCardFromDisplay(fortData.GuardPokemonDisplay),
Background: util.ExtractBackgroundFromDisplay(fortData.GuardPokemonDisplay),
})
gym.GuardingPokemonDisplay = null.StringFrom(string(display))
}
Expand Down Expand Up @@ -331,7 +331,7 @@ func (gym *Gym) updateGymFromGymInfoOutProto(gymData *pogo.GymGetInfoOutProto) *
TempEvolutionFinishMs int64 `json:"temp_evolution_finish_ms,omitempty"`
Alignment int `json:"alignment,omitempty"`
Badge int `json:"badge,omitempty"`
LocationCard int `json:"location_card,omitempty"`
Background *int64 `json:"background,omitempty"`
DeployedMs int64 `json:"deployed_ms,omitempty"`
DeployedTime int64 `json:"deployed_time,omitempty"`
BattlesWon int32 `json:"battles_won"`
Expand Down Expand Up @@ -364,7 +364,7 @@ func (gym *Gym) updateGymFromGymInfoOutProto(gymData *pogo.GymGetInfoOutProto) *
TempEvolutionFinishMs: pokemonDisplay.TemporaryEvolutionFinishMs,
Alignment: int(pokemonDisplay.Alignment),
Badge: int(pokemonDisplay.PokemonBadge),
LocationCard: util.ExtractLocationCardFromDisplay(pokemonDisplay),
Background: util.ExtractBackgroundFromDisplay(pokemonDisplay),
Shiny: pokemonDisplay.Shiny,
MotivationNow: util.RoundedFloat4(motivatedPokemon.MotivationNow),
CpNow: motivatedPokemon.CpNow,
Expand Down
8 changes: 4 additions & 4 deletions decoder/pokestop.go
Original file line number Diff line number Diff line change
Expand Up @@ -454,8 +454,8 @@ func (stop *Pokestop) updatePokestopFromQuestProto(questProto *pogo.FortSearchOu
if display.Shiny {
infoData["shiny"] = display.Shiny
}
if locationCard := util.ExtractLocationCardFromDisplay(display); locationCard != 0 {
infoData["location_card"] = locationCard
if background := util.ExtractBackgroundFromDisplay(display); background != nil {
infoData["background"] = background
}
if breadMode := int(display.BreadModeEnum); breadMode != 0 {
infoData["bread_mode"] = breadMode
Expand Down Expand Up @@ -609,7 +609,7 @@ func (stop *Pokestop) updatePokestopFromGetPokemonSizeContestEntryOutProto(conte
TempEvolutionFinishMs int64 `json:"temp_evolution_finish_ms"`
Alignment int `json:"alignment"`
Badge int `json:"badge"`
LocationCard int `json:"location_card"`
Background *int64 `json:"background,omitempty"`
}
type contestJson struct {
TotalEntries int `json:"total_entries"`
Expand Down Expand Up @@ -637,7 +637,7 @@ func (stop *Pokestop) updatePokestopFromGetPokemonSizeContestEntryOutProto(conte
TempEvolutionFinishMs: entry.GetPokemonDisplay().TemporaryEvolutionFinishMs,
Alignment: int(entry.GetPokemonDisplay().Alignment),
Badge: int(entry.GetPokemonDisplay().PokemonBadge),
LocationCard: util.ExtractLocationCardFromDisplay(entry.PokemonDisplay),
Background: util.ExtractBackgroundFromDisplay(entry.PokemonDisplay),
})

}
Expand Down
7 changes: 4 additions & 3 deletions util/pogo.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@ var IncidentTypeToName = map[int8]string{
9: "showcase",
}

func ExtractLocationCardFromDisplay(display *pogo.PokemonDisplayProto) int {
func ExtractBackgroundFromDisplay(display *pogo.PokemonDisplayProto) *int64 {
if display.LocationCard == nil {
return 0
return nil
}
return int(display.LocationCard.LocationCard)
result := int64(display.LocationCard.LocationCard)
return &result
}