Documentation ¶
Index ¶
- Constants
- Variables
- func MemUsage() string
- type CharacterCreateRequest
- type CharacterCreateResult
- type ClientAuthSessionPacket
- type ExternalPacketFunc
- type ObjectManager
- type ObjectUpdateFlags
- type ObjectUpdateType
- type PacketHandler
- type Server
- func (ws *Server) AddClient(gc *WorldSession)
- func (ws *Server) Clients() map[string]wow.PayloadSender
- func (ws *Server) CreateCharacter(account string, character *player.Player) error
- func (ws *Server) Disconnected(gc *WorldSession, reason string)
- func (ws *Server) GetAuthSession(account string) *auth.Session
- func (ws *Server) GetCharacters(account string, characters *player.Players) error
- func (ws *Server) Run()
- func (ws *Server) StartServer(worldStore store.WorldRepo, charStore store.CharacterRepo) error
- func (ws *Server) Stats()
- type ServerOption
- type SessionManager
- type Updater
- type WorldSession
- func (gc *WorldSession) AuthSessionHandler(data wow.PacketData)
- func (gc *WorldSession) Close() error
- func (gc *WorldSession) CreateCharacter(data wow.PacketData)
- func (gc *WorldSession) Handle(pkt *wow.Packet)
- func (gc *WorldSession) HandleRealmSplit(data wow.PacketData)
- func (gc *WorldSession) PingHandler(pkt *wow.Packet)
- func (gc *WorldSession) RegisterHandlers(handlers ...PacketHandler)
- func (gc *WorldSession) SendCharacterEnum()
Constants ¶
const ServerPacketHeaderSize = 6
ServerPacketHeaderSize size of the server's packet header in bytes. 2 bytes of length in big endian and 4bytes of opcode in little endian byte order.
Variables ¶
var ErrCannotReadHeader = errors.New("cannot read opcode")
Functions ¶
Types ¶
type CharacterCreateRequest ¶
type CharacterCreateRequest struct { Race wow.PlayerRace Class wow.PlayerClass Gender wow.PlayerGender Skin uint8 Face uint8 HairStyle uint8 HairColor uint8 FacialHair uint8 OutfitID uint8 }
type CharacterCreateResult ¶
type CharacterCreateResult uint8
type ClientAuthSessionPacket ¶
type ClientAuthSessionPacket struct { ClientBuild uint32 ServerID uint32 AccountName string LoginServerType uint32 // ClientSeed seed or maybe better name as local challenge, sent by the client to verify the hash. ClientSeed []byte RegionID uint32 BattleGroupID uint32 RealmID uint32 DOSResponse uint64 // ? don't really know whats this // Digest20 bytes long SHA1 hash Digest []byte AddonInfo []byte }
func (*ClientAuthSessionPacket) Bytes ¶
func (cas *ClientAuthSessionPacket) Bytes() []byte
func (*ClientAuthSessionPacket) ReadPacket ¶
func (cas *ClientAuthSessionPacket) ReadPacket(reader *wow.PacketReader)
func (*ClientAuthSessionPacket) String ¶
func (cas *ClientAuthSessionPacket) String() string
type ExternalPacketFunc ¶
type ExternalPacketFunc = func(*WorldSession, wow.OpCode, []byte)
ExternalPacketFunc register packet for external processing.
type ObjectManager ¶
type ObjectManager struct{}
func (*ObjectManager) CreateUpdatePacketFor ¶
func (*ObjectManager) CreateUpdatePacketFor(*player.Player)
type ObjectUpdateFlags ¶
type ObjectUpdateFlags uint16
const ( UpdateFlagNone ObjectUpdateFlags = 0x0000 UpdateFlagSelf ObjectUpdateFlags = 0x0001 UpdateFlagTransport ObjectUpdateFlags = 0x0002 UpdateFlagHasTarget ObjectUpdateFlags = 0x0004 UpdateFlagUnknown ObjectUpdateFlags = 0x0008 UpdateFlagLowGUID ObjectUpdateFlags = 0x0010 UpdateFlagLiving ObjectUpdateFlags = 0x0020 UpdateFlagStationaryPosition ObjectUpdateFlags = 0x0040 UpdateFlagVehicle ObjectUpdateFlags = 0x0080 UpdateFlagPosition ObjectUpdateFlags = 0x0100 UpdateFlagRotation ObjectUpdateFlags = 0x0200 )
type ObjectUpdateType ¶
type ObjectUpdateType int
const ( ObjectUpdateTypeValues ObjectUpdateType = 0 ObjectUpdateTypeMovement ObjectUpdateType = 1 ObjectUpdateTypeCreateObject ObjectUpdateType = 2 ObjectUpdateTypeCreateObject2 ObjectUpdateType = 3 ObjectUpdateTypeOutOfRangeObjects ObjectUpdateType = 4 ObjectUpdateTypeNearObjects ObjectUpdateType = 5 )
type PacketHandler ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func NewServer ¶
func NewServer(opts ...ServerOption) (*Server, error)
func (*Server) AddClient ¶
func (ws *Server) AddClient(gc *WorldSession)
func (*Server) CreateCharacter ¶
CreateCharacter saves a new character into the database.
func (*Server) Disconnected ¶
func (ws *Server) Disconnected(gc *WorldSession, reason string)
func (*Server) GetAuthSession ¶
GetAuthSession retrives the auth session from login (auth) server.
func (*Server) GetCharacters ¶
GetCharacters fetches the character list (with full character info) from the store.
func (*Server) StartServer ¶
type ServerOption ¶
func WithAuthManagement ¶
func WithAuthManagement(ms auth.ManagementService) ServerOption
WithAuthManagement set management service. There are two types:
- auth.ManagementClient: gRPC based (remote)
- auth.ManagementService: local implementation
func WithBabySocket ¶
func WithBabySocket() ServerOption
WithBabySocket can set the babysocket server if needed. The babysocket is socket based custom packet handler.
func WithEndpoint ¶
func WithEndpoint(listenAddress string) ServerOption
WithEndpoint sets the gameserver listen address. For example: 127.0.0.1:8129
func WithStaticBaseData ¶
func WithStaticBaseData() ServerOption
type SessionManager ¶
type SessionManager interface { // AddClient adds client to the connection set. AddClient(gc *WorldSession) // Removes and finalizes the connection. Disconnected(gc *WorldSession, reason string) // GetAuthSession retrives the auth session from login (auth) server. GetAuthSession(account string) *auth.Session // GetCharacters fetches the character list (with full character info) from the store. GetCharacters(account string, characters *player.Players) error // CreateCharacter saves a new character into the database. CreateCharacter(account string, character *player.Player) error }
type WorldSession ¶
type WorldSession struct { ID string // These is comes from the login (auth) server AccountName string SessionKey *big.Int // contains filtered or unexported fields }
func NewWorldSession ¶
func NewWorldSession(n net.Conn, ws SessionManager, handlers ...PacketHandler) *WorldSession
func (*WorldSession) AuthSessionHandler ¶
func (gc *WorldSession) AuthSessionHandler(data wow.PacketData)
AuthSessionHandler handling auth session, exchanging session token from logon server and checks for auth proof, then initializes the wowcrypt two way packet header encryption.
func (*WorldSession) Close ¶
func (gc *WorldSession) Close() error
func (*WorldSession) CreateCharacter ¶
func (gc *WorldSession) CreateCharacter(data wow.PacketData)
func (*WorldSession) Handle ¶
func (gc *WorldSession) Handle(pkt *wow.Packet)
func (*WorldSession) HandleRealmSplit ¶
func (gc *WorldSession) HandleRealmSplit(data wow.PacketData)
func (*WorldSession) PingHandler ¶
func (gc *WorldSession) PingHandler(pkt *wow.Packet)
PingHandler handles player ping packets.
func (*WorldSession) RegisterHandlers ¶
func (gc *WorldSession) RegisterHandlers(handlers ...PacketHandler)
func (*WorldSession) SendCharacterEnum ¶
func (gc *WorldSession) SendCharacterEnum()