66 lines
1.4 KiB
Go
66 lines
1.4 KiB
Go
package main
|
|
|
|
import (
|
|
"bytes"
|
|
"encoding/binary"
|
|
)
|
|
|
|
const (
|
|
AdminPacketAdminJoin uint8 = 0
|
|
AdminPacketAdminQuit
|
|
AdminPacketAdminUpdateFrequency
|
|
AdminPacketAdminPoll
|
|
AdminPacketAdminChat
|
|
AdminPacketAdminRCon
|
|
AdminPacketAdminGamescript
|
|
AdminPacketAdminPing
|
|
AdminPacketServerFull = 100
|
|
AdminPacketServerBanned
|
|
AdminPacketServerError
|
|
AdminPacketServerProtocol
|
|
AdminPacketServerWelcome
|
|
AdminPacketServerNewgame
|
|
AdminPacketServerShutdown
|
|
AdminPacketServerDate
|
|
AdminPacketServerClientJoin
|
|
AdminPacketServerClientInfo
|
|
AdminPacketServerClientUpdate
|
|
AdminPacketServerClientQuit
|
|
AdminPacketServerClientError
|
|
AdminPacketServerCompanyNew
|
|
AdminPacketServerCompanyInfo
|
|
AdminPacketServerCompanyUpdate
|
|
AdminPacketServerCompanyRemove
|
|
AdminPacketServerCompanyEconomy
|
|
AdminPacketServerCompanyStats
|
|
AdminPacketServerChat
|
|
AdminPacketServerRCon
|
|
AdminPacketServerConsole
|
|
AdminPacketServerCmdNames
|
|
AdminPacketServerCmdLogging
|
|
AdminPacketServerGamescript
|
|
AdminPacketServerRConEnd
|
|
AdminPacketServerPong
|
|
InvalidAdminPacket = 0xFF
|
|
)
|
|
|
|
type Packet struct {
|
|
PLength uint16
|
|
PType uint8
|
|
}
|
|
|
|
type PacketAdminJoin struct {
|
|
Packet
|
|
Password []byte
|
|
AppName []byte
|
|
AppVersion []byte
|
|
}
|
|
|
|
func (p *PacketAdminJoin) Bytes() []byte {
|
|
buf := new(bytes.Buffer)
|
|
p.PLength = uint16(binary.Size(p))
|
|
err := binary.Write(buf, binary.LittleEndian, p)
|
|
logErrorDebug(err, "binary.Write")
|
|
return buf.Bytes()
|
|
}
|