49 lines
1.2 KiB
Go
49 lines
1.2 KiB
Go
package donnees
|
|
|
|
import (
|
|
"ConspiracyDecoder/binary"
|
|
"fmt"
|
|
)
|
|
|
|
type InfoJoueur struct {
|
|
Id int
|
|
Pseudo string
|
|
AvatarId int64
|
|
|
|
Grade byte
|
|
Fiabilite int32
|
|
DateCreation int32
|
|
|
|
EloClassic int16
|
|
RankingClasic int32
|
|
EloGunboat int16
|
|
RankingGunboat int32
|
|
|
|
Bloque bool
|
|
}
|
|
|
|
func ReadInfoJoueur(bytes []byte, s *int) (*InfoJoueur, error) {
|
|
joueur := new(InfoJoueur)
|
|
readSize := 0
|
|
|
|
joueur.Id = int(binary.BinaryGetInt(bytes, *s, 4)); *s += 4
|
|
joueur.Pseudo, readSize = binary.BinaryGetString(bytes, *s); *s += readSize
|
|
joueur.AvatarId = binary.BinaryGetInt(bytes, *s, 8); *s += 8
|
|
joueur.Grade = bytes[*s]; *s++
|
|
joueur.Fiabilite = int32(binary.BinaryGetInt(bytes, *s,4)); *s += 4
|
|
joueur.DateCreation = int32(binary.BinaryGetInt(bytes, *s,4)); *s += 4
|
|
|
|
joueur.EloClassic = int16(binary.BinaryGetInt(bytes, *s,2)); *s += 2
|
|
joueur.RankingClasic = int32(binary.BinaryGetInt(bytes, *s,4)); *s += 4
|
|
joueur.EloGunboat = int16(binary.BinaryGetInt(bytes, *s,2)); *s += 2
|
|
joueur.RankingGunboat = int32(binary.BinaryGetInt(bytes, *s,4)); *s += 4
|
|
|
|
joueur.Bloque = binary.BinaryGetBool(bytes, 1); *s++
|
|
|
|
fmt.Printf("%+v\n", *joueur)
|
|
|
|
*s += 3 // Octets de séparation ?
|
|
|
|
return joueur, nil
|
|
}
|