1
1
mirror of https://github.com/OpenDiablo2/OpenDiablo2 synced 2024-06-15 12:10:49 +00:00
OpenDiablo2/d2networking/d2netpacket/packet_move_player.go
danhale-git 5ea6ada452
D2networking resolve lint issues (#492)
* Added automap.go stub

* Handle errors in original AutoMap.txt file

* Completed AutoMapRecord struct and comments

* AutoMap loader implemented

* Update from base repo

* Comments added to d2netpacket and d2netpackettype.

Note, the Overview for d2netpacket is in net_packet.go. It could be placed in a doc.go file but net_packet.go seemed appropriate in this case.

* Comments added to d2server

* client_connection.go missed from previous commit

* Comments added to d2client

* Doc.go added to d2networking and other corrections
2020-06-29 17:01:26 -04:00

30 lines
928 B
Go

package d2netpacket
import "github.com/OpenDiablo2/OpenDiablo2/d2networking/d2netpacket/d2netpackettype"
// MovePlayerPacket contains a movement command for a specific player entity.
// It is sent by the server to move a player entity on a client.
// TODO: Need to handle being on different maps
type MovePlayerPacket struct {
PlayerId string `json:"playerId"`
StartX float64 `json:"startX"`
StartY float64 `json:"startY"`
DestX float64 `json:"destX"`
DestY float64 `json:"destY"`
}
// CreateMovePlayerPacket returns a NetPacket which declares a MovePlayerPacket
// with the given ID and movement command.
func CreateMovePlayerPacket(playerId string, startX, startY, destX, destY float64) NetPacket {
return NetPacket{
PacketType: d2netpackettype.MovePlayer,
PacketData: MovePlayerPacket{
PlayerId: playerId,
StartX: startX,
StartY: startY,
DestX: destX,
DestY: destY,
},
}
}