This commit is contained in:
shoopea 2020-06-15 14:28:42 +02:00
parent c027fd458b
commit eb39d757f4
2 changed files with 28 additions and 0 deletions

20
main.go
View File

@ -87,6 +87,20 @@ func main() {
UpdateFrequency: AdminFrequencyAutomatic,
}
_, err = conn.Write(px.Bytes())
px = PacketAdminUpdateFrequency{
Packet: Packet{PType: AdminPacketAdminUpdateFrequency},
UpdateType: AdminUpdateChat,
UpdateFrequency: AdminFrequencyAutomatic,
}
_, err = conn.Write(px.Bytes())
px = PacketAdminUpdateFrequency{
Packet: Packet{PType: AdminPacketAdminUpdateFrequency},
UpdateType: AdminUpdateConsole,
UpdateFrequency: AdminFrequencyAutomatic,
}
_, err = conn.Write(px.Bytes())
case AdminPacketServerDate:
sp := PacketAdminServerDate{
Packet: p,
@ -111,6 +125,12 @@ func main() {
}
sp.Read(b[:p.PLength])
logInfoDebug("AdminPacketServerClientError :\n- ClientID: %d\n- ErrorID: %d", sp.ClientID, sp.ErrorID)
case AdminPacketServerClientQuit:
sp := PacketAdminServerClientQuit{
Packet: p,
}
sp.Read(b[:p.PLength])
logInfoDebug("AdminPacketServerClientError :\n- ClientID: %d", sp.ClientID)
default:
logInfoDebug("Packet fully read : len : %d / type : %d", p.PLength, p.PType)
}

View File

@ -240,3 +240,11 @@ func (p *PacketAdminServerClientError) Read(b []byte) {
c, _ := r.ReadByte()
p.ErrorID = uint8(c)
}
func (p *PacketAdminServerClientQuit) Read(b []byte) {
r := bufio.NewReader(bytes.NewReader(b))
r.Discard(3)
bs := make([]byte, 4)
_, _ = r.Read(bs)
p.ClientID = binary.LittleEndian.Uint32(bs[0:])
}