go-tibia: badc0de.net/pkg/go-tibia/gameworld Index | Files

package gameworld

import "badc0de.net/pkg/go-tibia/gameworld"

Package gameworld provides a gameworld protocol server.


Package Files

compositor.go doc.go gameworld.go map.go playermove.go procedural_map.go stubs.go test_using_otb_map.go


var (
    ItemNotFound     error
    CreatureNotFound error

func CompositeMap Uses

func CompositeMap(m MapDataSource, th *things.Things, x, y uint16, floorTop, floorBottom uint8, width, height int, tileW, tileH int) image.Image

func LoadOTBForTest Uses

func LoadOTBForTest(t *testing.T) *itemsotb.Items

func LoadThingsForTest Uses

func LoadThingsForTest(t *testing.T) *things.Things

func MapDescriptionEncoding_Test Uses

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.

type ChaseMode Uses

type ChaseMode uint8
const (
    ChaseModeStand ChaseMode = iota

func (ChaseMode) String Uses

func (m ChaseMode) String() string

type Creature Uses

type Creature interface {
    GetPos() tnet.Position
    SetPos(tnet.Position) error
    GetID() CreatureID
    GetName() string
    GetDir() things.CreatureDirection // TODO: move to tnet? or move tnet.Position to things?
    SetDir(things.CreatureDirection) error

type CreatureID Uses

type CreatureID uint32

func NewCreatureID Uses

func NewCreatureID() CreatureID

TODO(ivucica): Move this to map data source

type FightMode Uses

type FightMode uint8
const (
    FightModeUnknown FightMode = iota

func (FightMode) String Uses

func (m FightMode) String() string

type GameworldConnection Uses

type GameworldConnection struct {
    // contains filtered or unexported fields

func (*GameworldConnection) PlayerID Uses

func (c *GameworldConnection) PlayerID() (CreatureID, error)

type GameworldConnectionID Uses

type GameworldConnectionID CreatureID

type GameworldServer Uses

type GameworldServer struct {
    LameDuckText string // error to serve during lame duck mode
    // contains filtered or unexported fields

func NewServer Uses

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 Uses

func (c *GameworldServer) Serve(conn net.Conn, initialMessage *tnet.Message) error

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 Uses

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 Uses

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 Uses

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 Light Uses

type Light struct {
    Center    image.Point
    LightInfo dat.LightInfo

type MapDataSource Uses

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 Uses

func NewMapDataSource() MapDataSource

type MapItem Uses

type MapItem interface {
    GetServerType() uint16
    GetCount() uint16

type MapTile Uses

type MapTile interface {
    GetItem(idx int) (MapItem, error)
    AddCreature(creature Creature) error
    GetCreature(idx int) (Creature, error)
    RemoveCreature(Creature) error

type MapTileEventSubscriber Uses

type MapTileEventSubscriber interface {

type Skill Uses

type Skill byte
const (
    SkillFist Skill = iota // 0

    SkillFirst = SkillFist
    SkillLast  = SkillFishing

Package gameworld imports 23 packages (graph) and is imported by 3 packages. Updated 2020-10-27. Refresh now. Tools for package owners.