2024-06-23 05:05:57 +00:00
|
|
|
package messages7
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/teeworlds-go/go-teeworlds-protocol/chunk7"
|
|
|
|
"github.com/teeworlds-go/go-teeworlds-protocol/network7"
|
|
|
|
"github.com/teeworlds-go/go-teeworlds-protocol/packer"
|
|
|
|
)
|
|
|
|
|
|
|
|
type SvBroadcast struct {
|
|
|
|
ChunkHeader *chunk7.ChunkHeader
|
|
|
|
|
|
|
|
Message string
|
|
|
|
}
|
|
|
|
|
2024-06-23 19:18:54 +00:00
|
|
|
func (msg *SvBroadcast) MsgId() int {
|
2024-06-23 05:05:57 +00:00
|
|
|
return network7.MsgGameSvBroadcast
|
|
|
|
}
|
|
|
|
|
2024-06-23 19:18:54 +00:00
|
|
|
func (msg *SvBroadcast) MsgType() network7.MsgType {
|
2024-06-23 05:05:57 +00:00
|
|
|
return network7.TypeNet
|
|
|
|
}
|
|
|
|
|
2024-06-23 19:18:54 +00:00
|
|
|
func (msg *SvBroadcast) System() bool {
|
2024-06-23 05:05:57 +00:00
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
2024-06-23 19:18:54 +00:00
|
|
|
func (msg *SvBroadcast) Vital() bool {
|
2024-06-23 05:05:57 +00:00
|
|
|
return true
|
|
|
|
}
|
|
|
|
|
2024-06-23 19:18:54 +00:00
|
|
|
func (msg *SvBroadcast) Pack() []byte {
|
2024-06-23 05:05:57 +00:00
|
|
|
return packer.PackStr(msg.Message)
|
|
|
|
}
|
|
|
|
|
2024-06-23 19:18:54 +00:00
|
|
|
func (msg *SvBroadcast) Unpack(u *packer.Unpacker) error {
|
2024-06-25 04:19:51 +00:00
|
|
|
msg.Message, _ = u.GetString()
|
2024-06-23 19:18:54 +00:00
|
|
|
return nil
|
2024-06-23 05:05:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (msg *SvBroadcast) Header() *chunk7.ChunkHeader {
|
|
|
|
return msg.ChunkHeader
|
|
|
|
}
|
|
|
|
|
|
|
|
func (msg *SvBroadcast) SetHeader(header *chunk7.ChunkHeader) {
|
|
|
|
msg.ChunkHeader = header
|
|
|
|
}
|