Skip to content

Commit

Permalink
rework showcase and add logs for second pokemon type
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabio1988 committed Feb 20, 2024
1 parent 164c40d commit 687d307
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions decoder/pokestop.go
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,8 @@ func (stop *Pokestop) updatePokestopFromGetContestDataOutProto(contest *pogo.Con
// Focus does not populate. We can only store 1 atm, so this just grabs the first
// if there is one and falls back to Focus if Focuses is empty, just in case.
var focussedPokemon *pogo.ContestPokemonFocusProto
var focussedPokemonType *pogo.ContestFocusProto
var focussedPokemonType *pogo.ContestPokemonTypeFocusProto
var focussedBuddy *pogo.ContestBuddyFocusProto

if focuses := contest.GetFocuses(); len(focuses) > 0 {
var numPokemon int
Expand All @@ -582,7 +583,12 @@ func (stop *Pokestop) updatePokestopFromGetContestDataOutProto(contest *pogo.Con

if pokType := focus.GetType(); pokType != nil {
if focussedPokemonType == nil {
focussedPokemonType = focus
focussedPokemonType = pokType
}
}
if buddy := focus.GetBuddy(); buddy != nil {
if focussedBuddy == nil {
focussedBuddy = buddy
}
}
}
Expand All @@ -593,6 +599,8 @@ func (stop *Pokestop) updatePokestopFromGetContestDataOutProto(contest *pogo.Con
}
} else {
focussedPokemon = contest.GetFocus().GetPokemon()
focussedPokemonType = contest.GetFocus().GetType()
focussedBuddy = contest.GetFocus().GetBuddy()
}

if focussedPokemon == nil {
Expand All @@ -610,8 +618,14 @@ func (stop *Pokestop) updatePokestopFromGetContestDataOutProto(contest *pogo.Con
if focussedPokemonType == nil {
stop.ShowcasePokemonType = null.IntFromPtr(nil)
} else {
stop.ShowcasePokemonType = null.IntFrom(int64(focussedPokemonType.GetType().GetPokemonType1()))
//TODO there is also a Type2 in the Proto
type2 := int64(focussedPokemonType.GetPokemonType2())
if type2 != 0 {
log.Warnf("SHOWCASE: Stop: '%s' with Focussed Pokemon Type 2: %d", stop.Id, type2)
}
stop.ShowcasePokemonType = null.IntFrom(int64(focussedPokemonType.GetPokemonType1()))
}
//TODO add logic for buddy
}

func (stop *Pokestop) updatePokestopFromGetPokemonSizeContestEntryOutProto(contestData *pogo.GetPokemonSizeLeaderboardEntryOutProto) {
Expand Down

0 comments on commit 687d307

Please sign in to comment.