mirror of
https://github.com/OpenDiablo2/OpenDiablo2
synced 2024-09-06 19:44:15 -04:00
* WIP refactor of d2map stuff * more d2map refactor adding realm init to game client passing map engine from client and server into realm at init change `generate map packet` to have act and level index as data * client explodes, but getting there * realm now initializes, networking works, but map generators dont currently do anything * changed the way that level type records are loaded * fixed funcs for level data lookups * started implementing level generator, currently crashing * client no longer exploding * d2networking refactor put exports into d2client.go and d2server.go kept GameClient and GameServer methods into their respective files made methods for packet handlers instead of the giant switch statements * bugfix: getting first level id by act * minor refactor of gamescreen for readability * towns now generate on server start, create player takes act and level id as args, levels have their own map engine
36 lines
1.2 KiB
Go
36 lines
1.2 KiB
Go
package d2netpacket
|
|
|
|
import (
|
|
"github.com/OpenDiablo2/OpenDiablo2/d2common/d2enum"
|
|
"github.com/OpenDiablo2/OpenDiablo2/d2core/d2hero"
|
|
"github.com/OpenDiablo2/OpenDiablo2/d2core/d2inventory"
|
|
"github.com/OpenDiablo2/OpenDiablo2/d2networking/d2netpacket/d2netpackettype"
|
|
)
|
|
|
|
type AddPlayerPacket struct {
|
|
Id string `json:"id"`
|
|
Name string `json:"name"`
|
|
X int `json:"x"`
|
|
Y int `json:"y"`
|
|
Act int `json:"act"`
|
|
HeroType d2enum.Hero `json:"hero"`
|
|
Equipment d2inventory.CharacterEquipment `json:"equipment"`
|
|
Stats d2hero.HeroStatsState `json:"heroStats"`
|
|
}
|
|
|
|
func CreateAddPlayerPacket(id, name string, act, x, y int, heroType d2enum.Hero, stats d2hero.HeroStatsState, equipment d2inventory.CharacterEquipment) NetPacket {
|
|
return NetPacket{
|
|
PacketType: d2netpackettype.AddPlayer,
|
|
PacketData: AddPlayerPacket{
|
|
Id: id,
|
|
Name: name,
|
|
Act: act,
|
|
X: x,
|
|
Y: y,
|
|
HeroType: heroType,
|
|
Equipment: equipment,
|
|
Stats: stats,
|
|
},
|
|
}
|
|
}
|