update /say

This commit is contained in:
shoopea
2021-11-13 13:56:55 +08:00
parent 40a0b5e800
commit 4169b1f3e5
3 changed files with 32 additions and 30 deletions

View File

@@ -95,11 +95,6 @@ type PacketAdminJoin struct {
AppVersion string
}
type PacketAdminRCon struct {
Packet
Command string
}
type PacketAdminChat struct {
Packet
ActionType uint8
@@ -108,6 +103,11 @@ type PacketAdminChat struct {
Message string
}
type PacketAdminRCon struct {
Packet
Command string
}
type PacketServerProtocol struct {
Packet
ProtocolVersion uint8
@@ -265,21 +265,6 @@ func (p *PacketAdminRCon) Bytes() []byte {
return buf.Bytes()
}
func (p *PacketAdminChat) Bytes() []byte {
buf := new(bytes.Buffer)
p.PLength = uint16(len(p.Message) + 10)
binary.Write(buf, binary.LittleEndian, p.PLength)
binary.Write(buf, binary.LittleEndian, p.ActionType)
binary.Write(buf, binary.LittleEndian, p.DestinationType)
binary.Write(buf, binary.LittleEndian, p.DestinationID)
buf.WriteString(p.Message)
buf.WriteByte(0)
return buf.Bytes()
}
func (p *PacketAdminUpdateFrequency) Bytes() []byte {
buf := new(bytes.Buffer)
p.PLength = 7
@@ -520,6 +505,22 @@ func (p *PacketServerChat) Read(b []byte) {
p.Amount = binary.LittleEndian.Uint64(bs[0:])
}
func (p *PacketServerChat) Bytes() []byte {
buf := new(bytes.Buffer)
p.PLength = uint16(len(p.Message) + 17)
binary.Write(buf, binary.LittleEndian, p.PLength)
binary.Write(buf, binary.LittleEndian, p.ActionID)
binary.Write(buf, binary.LittleEndian, p.DestinationID)
binary.Write(buf, binary.LittleEndian, p.ClientID)
buf.WriteString(p.Message)
buf.WriteByte(0)
binary.Write(buf, binary.LittleEndian, p.Amount)
return buf.Bytes()
}
func (p *PacketServerConsole) Read(b []byte) {
r := bufio.NewReader(bytes.NewReader(b))
r.Discard(3)