Ejemplo n.º 1
0
func (p *Player) netSendCreatureMove(_creature interfaces.ICreature, _from position.Position, _to position.Position, _teleport bool) {
	msg := netmsg.NewWalkMessage(_creature)
	msg.From = _from
	msg.To = _to
	msg.Teleport = _teleport

	p.txChan <- msg
}
Ejemplo n.º 2
0
func (cw *ConnectionWrapper) processPacket(_packet pnet.IPacket) {
	header, err := _packet.ReadUint8()
	if err != nil {
		return
	}

	var netmessage pnet.INetMessageReader
	if header == pnet.HEADER_WALK {
		netmessage = netmsg.NewWalkMessage(nil)
		netmessage.ReadPacket(_packet)
	} else {
		log.Warning("ConnectionWrapper", "processPacket", "Received packet with unknown header: %d", header)
	}

	// Push netmessage on rxChan
	if netmessage != nil {
		cw.rxChan <- netmessage
	}
}