world

package
v0.0.0-...-b9d6643 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 7, 2024 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
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

View Source
var ErrCannotReadHeader = errors.New("cannot read opcode")

Functions

func MemUsage

func MemUsage() string

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 PacketHandler struct {
	Opcode  wow.OpCode
	Handler any
}

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) Clients

func (ws *Server) Clients() map[string]wow.PayloadSender

func (*Server) CreateCharacter

func (ws *Server) CreateCharacter(account string, character *player.Player) error

CreateCharacter saves a new character into the database.

func (*Server) Disconnected

func (ws *Server) Disconnected(gc *WorldSession, reason string)

func (*Server) GetAuthSession

func (ws *Server) GetAuthSession(account string) *auth.Session

GetAuthSession retrives the auth session from login (auth) server.

func (*Server) GetCharacters

func (ws *Server) GetCharacters(account string, characters *player.Players) error

GetCharacters fetches the character list (with full character info) from the store.

func (*Server) Run

func (ws *Server) Run()

func (*Server) StartServer

func (ws *Server) StartServer(worldStore store.WorldRepo, charStore store.CharacterRepo) error

func (*Server) Stats

func (ws *Server) Stats()

type ServerOption

type ServerOption func(s *Server) error

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 Updater

type Updater struct {
	UpdateData []any
	// contains filtered or unexported fields
}

func (*Updater) BuildUpdateObject

func (upd *Updater) BuildUpdateObject(player *player.Player) *wow.Packet

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()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL