mirror of
https://github.com/OpenDiablo2/OpenDiablo2
synced 2024-11-19 19:06:45 -05:00
5ea6ada452
* 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
31 lines
1.0 KiB
Go
31 lines
1.0 KiB
Go
package d2netpacket
|
|
|
|
import "github.com/OpenDiablo2/OpenDiablo2/d2networking/d2netpacket/d2netpackettype"
|
|
|
|
// CastPacket contains a cast command for an entity. It is sent by the server
|
|
// and instructs the client to trigger the use of the given skill on the given
|
|
// entity.
|
|
// TODO: Need to handle being on different maps
|
|
type CastPacket struct {
|
|
SourceEntityID string `json:"sourceEntityId"`
|
|
SkillID int `json:"skillId"`
|
|
TargetX float64 `json:"targetX"`
|
|
TargetY float64 `json:"targetY"`
|
|
TargetEntityID string `json:"targetEntityId"`
|
|
}
|
|
|
|
// CreateCastPacket returns a NetPacket which declares a CastPacket with the
|
|
// given skill command.
|
|
func CreateCastPacket(entityID string, skillID int, targetX, targetY float64) NetPacket {
|
|
return NetPacket{
|
|
PacketType: d2netpackettype.CastSkill,
|
|
PacketData: CastPacket{
|
|
SourceEntityID: entityID,
|
|
SkillID: skillID,
|
|
TargetX: targetX,
|
|
TargetY: targetY,
|
|
TargetEntityID: "", // TODO implement targeting entities
|
|
},
|
|
}
|
|
}
|