otbm

package
v1.20.0 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NodeMapData   = 2
	NodeTileArea  = 4
	NodeTile      = 5
	NodeItem      = 6
	NodeTowns     = 12
	NodeTown      = 13
	NodeHouseTile = 14
	NodeWaypoints = 15
	NodeWaypoint  = 16
)
View Source
const (
	AttrDescription    = 1
	AttrExtFile        = 2
	AttrTileFlags      = 3
	AttrActionID       = 4
	AttrUniqueID       = 5
	AttrText           = 6
	AttrDesc           = 7
	AttrTeleDest       = 8
	AttrItem           = 9
	AttrDepotID        = 10
	AttrSpawnFile      = 11
	AttrRuneCharges    = 12
	AttrHouseFile      = 13
	AttrDoorID         = 14
	AttrCount          = 15
	AttrDuration       = 16
	AttrDecayState     = 17
	AttrWrittenDate    = 18
	AttrWrittenBy      = 19
	AttrSleeperGUID    = 20
	AttrSleepStart     = 21
	AttrCharges        = 22
	AttrContainerItems = 23
	AttrAttrMap        = 128
)
View Source
const (
	TileFlagProtectionZone = 0x0001
	TileFlagNoPVP          = 0x0004
	TileFlagNoLogout       = 0x0008
	TileFlagPVPZone        = 0x0010
	TileFlagRefresh        = 0x0020
)

Variables

This section is empty.

Functions

func EncodeItemsBlob added in v1.18.0

func EncodeItemsBlob(items []uint16) []byte

func PackPos

func PackPos(x, y uint16, z uint8) uint64

Types

type FloorBounds

type FloorBounds struct {
	MinX, MinY, MaxX, MaxY uint16
}

type GameMap

type GameMap struct {
	Version      uint32
	Width        uint16
	Height       uint16
	Descriptions []string
	SpawnFile    string
	HouseFile    string
	Tiles        map[uint64]*MapTile
	MinX, MinY   uint16
	MaxX, MaxY   uint16
	Floors       []uint8
	Towns        []Town
	Waypoints    []Waypoint
	FloorBounds  map[uint8]*FloorBounds
}

func ParseOTBM

func ParseOTBM(path string) (*GameMap, error)

type ItemAttrValue added in v1.20.0

type ItemAttrValue struct {
	Type    uint8 // 1=string, 2=int32, 3=float, 4=bool
	Str     string
	Int     int32
	Float   float32
	Boolean bool
}

type MapItem added in v1.17.0

type MapItem struct {
	ID          uint16
	ActionID    uint16
	UniqueID    uint16
	TeleDest    *TeleportDest
	DoorID      uint8
	DepotID     uint16
	Text        string
	Description string
	Charges     uint16
	RuneCharges uint8
	Count       uint8
	Duration    uint32
	WrittenDate uint32
	WrittenBy   string
	SleeperGUID uint32
	SleepStart  uint32
	CustomAttrs map[string]ItemAttrValue
	SubItems    []MapItem
}

type MapTile

type MapTile struct {
	Items     []uint16
	RichItems []MapItem
	Flags     uint32
	HouseID   uint32
}

type Node

type Node struct {
	Type     uint8
	Data     []byte
	Children []*Node
	// contains filtered or unexported fields
}

func ParseFile

func ParseFile(path string) (*Node, error)

func (*Node) GetFloat32 added in v1.20.0

func (n *Node) GetFloat32() (float32, error)

func (*Node) GetLongString added in v1.20.0

func (n *Node) GetLongString() (string, error)

func (*Node) GetString

func (n *Node) GetString() (string, error)

func (*Node) GetU8

func (n *Node) GetU8() (uint8, error)

func (*Node) GetU16

func (n *Node) GetU16() (uint16, error)

func (*Node) GetU32

func (n *Node) GetU32() (uint32, error)

func (*Node) Remaining

func (n *Node) Remaining() int

func (*Node) ResetPos

func (n *Node) ResetPos()

func (*Node) Skip

func (n *Node) Skip(count int) error

type OTB

type OTB struct {
	ServerToClient map[uint16]uint16
}

func ParseOTB

func ParseOTB(path string) (*OTB, error)

type TeleportDest added in v1.17.0

type TeleportDest struct {
	X, Y uint16
	Z    uint8
}

type Town

type Town struct {
	ID   uint32
	Name string
	X, Y uint16
	Z    uint8
}

type Waypoint added in v1.17.0

type Waypoint struct {
	Name string
	X, Y uint16
	Z    uint8
}

type WorldData added in v1.18.0

type WorldData struct {
	Tiles     []gamedata.MapTile
	Spawns    []gamedata.Spawn
	Houses    []gamedata.House
	Towns     []gamedata.Town
	Waypoints []gamedata.Waypoint
}

func LoadWorld added in v1.18.0

func LoadWorld(otbmPath string, opts ...WorldOption) (*WorldData, error)

type WorldOption added in v1.18.0

type WorldOption func(*worldConfig)

func WithHouses added in v1.18.0

func WithHouses(path string) WorldOption

func WithSpawns added in v1.18.0

func WithSpawns(path string) WorldOption

Jump to

Keyboard shortcuts

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