go-teeworlds-protocol/messages7/cl_start_info.go

82 lines
2.2 KiB
Go
Raw Normal View History

2024-06-19 04:59:43 +00:00
package messages7
2024-06-18 05:08:56 +00:00
2024-06-19 04:13:57 +00:00
import (
"slices"
2024-06-18 05:08:56 +00:00
2024-06-19 04:13:57 +00:00
"github.com/teeworlds-go/teeworlds/packer"
)
type ClStartInfo struct {
2024-06-18 05:08:56 +00:00
Name string
Clan string
Country int
Body string
Marking string
Decoration string
Hands string
Feet string
Eyes string
CustomColorBody bool
CustomColorMarking bool
CustomColorDecoration bool
CustomColorHands bool
CustomColorFeet bool
CustomColorEyes bool
ColorBody int
ColorMarking int
2024-06-19 04:13:57 +00:00
ColorDecoration int
2024-06-18 05:08:56 +00:00
ColorHands int
ColorFeet int
ColorEyes int
}
2024-06-19 04:13:57 +00:00
func (info *ClStartInfo) Pack() []byte {
return slices.Concat(
packer.PackStr(info.Name),
packer.PackStr(info.Clan),
packer.PackInt(info.Country),
packer.PackStr(info.Body),
packer.PackStr(info.Marking),
packer.PackStr(info.Decoration),
packer.PackStr(info.Hands),
packer.PackStr(info.Feet),
packer.PackStr(info.Eyes),
packer.PackBool(info.CustomColorBody),
packer.PackBool(info.CustomColorMarking),
packer.PackBool(info.CustomColorDecoration),
packer.PackBool(info.CustomColorHands),
packer.PackBool(info.CustomColorFeet),
packer.PackBool(info.CustomColorEyes),
packer.PackInt(info.ColorBody),
packer.PackInt(info.ColorMarking),
packer.PackInt(info.ColorDecoration),
packer.PackInt(info.ColorHands),
packer.PackInt(info.ColorFeet),
packer.PackInt(info.ColorEyes),
)
}
func (info *ClStartInfo) Unpack(u *packer.Unpacker) {
2024-06-18 05:08:56 +00:00
info.Name = u.GetString()
info.Clan = u.GetString()
info.Country = u.GetInt()
info.Body = u.GetString()
info.Marking = u.GetString()
info.Decoration = u.GetString()
info.Hands = u.GetString()
info.Feet = u.GetString()
info.Eyes = u.GetString()
info.CustomColorBody = u.GetInt() != 0
info.CustomColorMarking = u.GetInt() != 0
info.CustomColorDecoration = u.GetInt() != 0
info.CustomColorHands = u.GetInt() != 0
info.CustomColorFeet = u.GetInt() != 0
info.CustomColorEyes = u.GetInt() != 0
info.ColorBody = u.GetInt()
info.ColorMarking = u.GetInt()
2024-06-19 04:13:57 +00:00
info.ColorDecoration = u.GetInt()
2024-06-18 05:08:56 +00:00
info.ColorHands = u.GetInt()
info.ColorFeet = u.GetInt()
info.ColorEyes = u.GetInt()
}