This commit is contained in:
shoopea 2020-06-15 14:14:40 +02:00
parent f6d57c116e
commit 2d86eb4335

View File

@ -109,6 +109,27 @@ type PacketAdminServerDate struct {
Date uint32
}
type PacketAdminServerClientJoin struct {
Packet
ClientID uint32
}
type PacketAdminServerClientInfo struct {
Packet
ClientID uint32
Address string
Name string
Lang uint8
Date uint32
CompanyID uint8
}
type PacketAdminServerClientError struct {
Packet
ClientID uint32
ErrorID uint8
}
func (p *PacketAdminJoin) Bytes() []byte {
buf := new(bytes.Buffer)
p.PLength = uint16(len(p.Password) + len(p.AppName) + len(p.AppVersion) + 6)
@ -184,3 +205,38 @@ func (p *PacketAdminServerDate) Read(b []byte) {
p.Date = binary.LittleEndian.Uint32(bs[0:])
}
func (p *PacketAdminServerClientJoin) 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:])
}
func (p *PacketAdminServerClientInfo) 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:])
p.Address, _ = r.ReadString(0)
p.Name, _ = r.ReadString(0)
c, _ := r.ReadByte()
p.Lang = uint8(c)
bs := make([]byte, 4)
_, _ = r.Read(bs)
p.Date = binary.LittleEndian.Uint32(bs[0:])
c, _ = r.ReadByte()
p.CompanyID = uint8(c)
}
func (p *PacketAdminServerClientError) 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:])
c, _ = r.ReadByte()
p.ErrorID = uint8(c)
}