go-teeworlds-protocol/messages7/cl_start_info.go

111 lines
2.8 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
"github.com/teeworlds-go/go-teeworlds-protocol/chunk7"
"github.com/teeworlds-go/go-teeworlds-protocol/network7"
"github.com/teeworlds-go/go-teeworlds-protocol/packer"
2024-06-19 04:13:57 +00:00
)
type ClStartInfo struct {
2024-06-21 01:50:46 +00:00
ChunkHeader *chunk7.ChunkHeader
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
}
func (msg *ClStartInfo) MsgId() int {
2024-06-20 03:08:52 +00:00
return network7.MsgGameClStartInfo
}
func (msg *ClStartInfo) MsgType() network7.MsgType {
2024-06-20 03:08:52 +00:00
return network7.TypeNet
}
func (msg *ClStartInfo) System() bool {
2024-06-20 03:08:52 +00:00
return false
}
func (msg *ClStartInfo) Vital() bool {
2024-06-20 03:08:52 +00:00
return true
}
func (msg *ClStartInfo) Pack() []byte {
2024-06-19 04:13:57 +00:00
return slices.Concat(
packer.PackStr(msg.Name),
packer.PackStr(msg.Clan),
packer.PackInt(msg.Country),
packer.PackStr(msg.Body),
packer.PackStr(msg.Marking),
packer.PackStr(msg.Decoration),
packer.PackStr(msg.Hands),
packer.PackStr(msg.Feet),
packer.PackStr(msg.Eyes),
packer.PackBool(msg.CustomColorBody),
packer.PackBool(msg.CustomColorMarking),
packer.PackBool(msg.CustomColorDecoration),
packer.PackBool(msg.CustomColorHands),
packer.PackBool(msg.CustomColorFeet),
packer.PackBool(msg.CustomColorEyes),
packer.PackInt(msg.ColorBody),
packer.PackInt(msg.ColorMarking),
packer.PackInt(msg.ColorDecoration),
packer.PackInt(msg.ColorHands),
packer.PackInt(msg.ColorFeet),
packer.PackInt(msg.ColorEyes),
2024-06-19 04:13:57 +00:00
)
}
func (msg *ClStartInfo) Unpack(u *packer.Unpacker) error {
msg.Name, _ = u.GetString()
msg.Clan, _ = u.GetString()
msg.Country = u.GetInt()
msg.Body, _ = u.GetString()
msg.Marking, _ = u.GetString()
msg.Decoration, _ = u.GetString()
msg.Hands, _ = u.GetString()
msg.Feet, _ = u.GetString()
msg.Eyes, _ = u.GetString()
msg.CustomColorBody = u.GetInt() != 0
msg.CustomColorMarking = u.GetInt() != 0
msg.CustomColorDecoration = u.GetInt() != 0
msg.CustomColorHands = u.GetInt() != 0
msg.CustomColorFeet = u.GetInt() != 0
msg.CustomColorEyes = u.GetInt() != 0
msg.ColorBody = u.GetInt()
msg.ColorMarking = u.GetInt()
msg.ColorDecoration = u.GetInt()
msg.ColorHands = u.GetInt()
msg.ColorFeet = u.GetInt()
msg.ColorEyes = u.GetInt()
return nil
2024-06-18 05:08:56 +00:00
}
func (msg *ClStartInfo) Header() *chunk7.ChunkHeader {
2024-06-21 01:50:46 +00:00
return msg.ChunkHeader
}
func (msg *ClStartInfo) SetHeader(header *chunk7.ChunkHeader) {
2024-06-21 01:50:46 +00:00
msg.ChunkHeader = header
}