Documentation ¶
Overview ¶
Package gameworld provides a gameworld protocol server.
Index ¶
- Variables
- func CompositeMap(m MapDataSource, th *things.Things, x, y uint16, floorTop, floorBottom uint8, ...) image.Image
- func LoadOTBForTest(t *testing.T) *itemsotb.Items
- func LoadThingsForTest(t *testing.T) *things.Things
- func MapDescriptionEncoding_Test(t *testing.T, ds1, ds2 MapDataSource)
- type ChaseMode
- type Creature
- type CreatureID
- type FightMode
- type GameworldConnection
- type GameworldConnectionID
- type GameworldServer
- type InventorySlot
- type Light
- type MapDataSource
- type MapItem
- type MapTile
- type MapTileEventSubscriber
- type Skill
Constants ¶
This section is empty.
Variables ¶
var ( ItemNotFound error CreatureNotFound error )
Functions ¶
func CompositeMap ¶
func LoadOTBForTest ¶
func MapDescriptionEncoding_Test ¶
func MapDescriptionEncoding_Test(t *testing.T, ds1, ds2 MapDataSource)
This test code is here because to load the map, we need to import OTBM loader.
But OTBM loader imports gameworld, due to some map types being here.
So the actual test is invoked from OTBM loader.
Types ¶
type CreatureID ¶
type CreatureID uint32
type GameworldConnection ¶
type GameworldConnection struct {
// contains filtered or unexported fields
}
func (*GameworldConnection) PlayerID ¶
func (c *GameworldConnection) PlayerID() (CreatureID, error)
type GameworldConnectionID ¶
type GameworldConnectionID CreatureID
type GameworldServer ¶
type GameworldServer struct { LameDuckText string // error to serve during lame duck mode // contains filtered or unexported fields }
func NewServer ¶
func NewServer(pk *rsa.PrivateKey) (*GameworldServer, error)
NewServer creates a new GameworldServer which decodes the initial login message using the passed private key.
func (*GameworldServer) Serve ¶
Serve begins serving the gameworld protocol on the accepted network connection.
User of this method needs to bring their own listening schema and accept the connection, then pass on the control to this method.
User also needs to transmit the initial gameworld message which the server sends.
func (*GameworldServer) SetMapDataSource ¶
func (c *GameworldServer) SetMapDataSource(ds MapDataSource) error
SetMapDataSource sets the data source for map information such as tiles, items on tiles, creatures present, etc.
func (*GameworldServer) SetThings ¶
func (c *GameworldServer) SetThings(t *things.Things) error
SetThings sets the thing registry to the passed value. It's used to refer to a combination of items.otb, Tibia.dat and Tibia.spr from the gameworld.
It's not constructed by GameworldServer as the same registry may be used for other servers (such as a web server).
type InventorySlot ¶
type InventorySlot byte
const ( InventorySlotUnknown InventorySlot = iota // 0 InventorySlotHead // 1 InventorySlotNecklace // 2 InventorySlotBackpack // 3 InventorySlotArmor // 4 InventorySlotRight // 5 InventorySlotLeft // 6 InventorySlotLegs // 7 InventorySlotFeet // 8 InventorySlotRing // 9 InventorySlotAmmo // A InventorySlotFirst = InventorySlotHead InventorySlotLast = InventorySlotAmmo )
type MapDataSource ¶
type MapDataSource interface { GetMapTile(x, y uint16, floor uint8) (MapTile, error) GetCreatureByIDBytes(id [4]byte) (Creature, error) GetCreatureByID(CreatureID) (Creature, error) AddCreature(creature Creature) error RemoveCreatureByID(CreatureID) error Private_And_Temp__DefaultPlayerSpawnPoint(CreatureID) tnet.Position }
func NewMapDataSource ¶
func NewMapDataSource() MapDataSource
type MapTileEventSubscriber ¶
type MapTileEventSubscriber interface { }