Skip to content

Commit

Permalink
Remove player public profile decoding
Browse files Browse the repository at this point in the history
  • Loading branch information
na-ji committed Jun 26, 2023
1 parent b80056c commit c754970
Showing 1 changed file with 2 additions and 21 deletions.
23 changes: 2 additions & 21 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -351,14 +351,8 @@ func decodeGetFriendDetails(payload []byte) string {

for _, friend := range getFriendDetailsOutProto.GetFriend() {
player := friend.GetPlayer()
publicData, publicDataErr := decodePlayerPublicProfile(player.GetPublicData())

if publicDataErr != nil {
failures++
continue
}

updatePlayerError := decoder.UpdatePlayerRecordWithPlayerSummary(dbDetails, player, publicData, "", player.GetPlayerId())
updatePlayerError := decoder.UpdatePlayerRecordWithPlayerSummary(dbDetails, player, player.PublicData, "", player.GetPlayerId())
if updatePlayerError != nil {
failures++
}
Expand Down Expand Up @@ -388,27 +382,14 @@ func decodeSearchPlayer(proxyRequestProto pogo.ProxyRequestProto, payload []byte
}

player := searchPlayerOutProto.GetPlayer()
publicData, publicDataError := decodePlayerPublicProfile(player.GetPublicData())

if publicDataError != nil {
return fmt.Sprintf("Failed to parse %s", publicDataError)
}

updatePlayerError := decoder.UpdatePlayerRecordWithPlayerSummary(dbDetails, player, publicData, searchPlayerProto.GetFriendCode(), "")
updatePlayerError := decoder.UpdatePlayerRecordWithPlayerSummary(dbDetails, player, player.PublicData, searchPlayerProto.GetFriendCode(), "")
if updatePlayerError != nil {
return fmt.Sprintf("Failed update player %s", updatePlayerError)
}

return fmt.Sprintf("1 player decoded from SearchPlayerProto")
}

func decodePlayerPublicProfile(publicProfile []byte) (*pogo.PlayerPublicProfileProto, error) {
var publicData pogo.PlayerPublicProfileProto
publicDataErr := proto.Unmarshal(publicProfile, &publicData)

return &publicData, publicDataErr
}

func decodeFortDetails(ctx context.Context, sDec []byte) string {
decodedFort := &pogo.FortDetailsOutProto{}
if err := proto.Unmarshal(sDec, decodedFort); err != nil {
Expand Down

0 comments on commit c754970

Please sign in to comment.