func (m *CreatureTurnMessage) ReadPacket(_packet pnet.IPacket) error {
	direction, err := _packet.ReadUint16()
	if err != nil {
		return err
	}
	m.Direction = int(direction)

	return nil
}
Ejemplo n.º 2
0
// ReadPacket reads all data from a packet and puts it in the object
func (m *LoginMessage) ReadPacket(_packet pnet.IPacket) error {
	var err error
	if m.Username, err = _packet.ReadString(); err != nil {
		return err
	}
	if m.Password, err = _packet.ReadString(); err != nil {
		return err
	}
	clientVersion, err := _packet.ReadUint16()
	if err != nil {
		return err
	}
	m.ClientVersion = int(clientVersion)

	return nil
}
Ejemplo n.º 3
0
// ReadPacket reads all data from a packet and puts it in the object
func (m *WalkMessage) ReadPacket(_packet pnet.IPacket) (err error) {
	direction, err := _packet.ReadUint16()
	if err != nil {
		return
	}
	m.Direction = int(direction)

	sendMap, err := _packet.ReadUint16()
	if err != nil {
		return err
	}

	if sendMap == 1 {
		m.SendMap = true
	}

	return nil
}
Ejemplo n.º 4
0
func (m *ChatMessage) ReadPacket(_packet pnet.IPacket) (err error) {
	speaktype, err := _packet.ReadUint8()
	if err != nil {
		return
	}
	m.SpeakType = int(speaktype)

	channelId, err := _packet.ReadUint16()
	if err != nil {
		return
	}
	m.ChannelId = int(channelId)

	if m.Receiver, err = _packet.ReadString(); err != nil {
		return
	}
	if m.Text, err = _packet.ReadString(); err != nil {
		return
	}

	return nil
}