otmap

package module
v0.0.0-...-106b548 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2017 License: MIT Imports: 9 Imported by: 2

README

otmap

Parses OTBM files. Getting detailed information such as:

  • Towns
  • Houses
  • Tiles

Documentation

Check otmap_test.go for examples on how to use otmap

License

otmap is made available under the MIT license

Documentation

Index

Constants

View Source
const (
	TileFlagNone           = 0
	TileFlagProtectionZone = 1 << 0
	TileFlagTrashed        = 1 << 1
	TileFlagOptionalZone   = 1 << 2
	TileFlagNoLogout       = 1 << 3
	TileFlagHardcoreZone   = 1 << 4
	TileFlagRefresh        = 1 << 5

	// internal usage
	TileFlagHouse       = 1 << 6
	TileFlagTeleport    = 1 << 17
	TileFlagMagicField  = 1 << 18
	TileFlagMailBox     = 1 << 19
	TileFlagTrashHolder = 1 << 20
	TileFlagBed         = 1 << 21
	TileFlagDepot       = 1 << 22

	TileFlagLast = 1 << 24
)
View Source
const (
	OTBMNodeRootV2    = 1
	OTBMNodeMapData   = 2
	OTBMNodeTileArea  = 4
	OTBMNodeTile      = 5
	OTBMNodeItem      = 6
	OTBMNodeTowns     = 12
	OTBMNodeTown      = 13
	OTBMNodeHouseTile = 14
	OTBMNodeWaypoints = 15
	OTBMNodeWaypoint  = 16
)
View Source
const (
	OTBMAttrDescription = 1
	OTBMAttrTileFlags   = 3
	OTBMAttrItem        = 9
	OTBMAttrSpawnFile   = 11
	OTBMAttrHouseFile   = 13
)
View Source
const (
	OTBMItemAttrActionID       = 4
	OTBMItemAttrUniqueID       = 5
	OTBMItemAttrText           = 6
	OTBMItemAttrDesc           = 7
	OTBMItemAttrTeleDest       = 8
	OTBMItemAttrItem           = 9
	OTBMItemAttrDepotID        = 10
	OTBMItemAttrRuneCharges    = 12
	OTBMItemAttrHouseDoorID    = 14
	OTBMItemAttrCount          = 15
	OTBMItemAttrDuration       = 16
	OTBMItemAttrDecayState     = 17
	OTBMItemAttrWrittenDate    = 18
	OTBMItemAttrWrittenBy      = 19
	OTBMItemAttrSleepingGUID   = 20
	OTBMItemAttrSleepStart     = 21
	OTBMItemAttrCharges        = 22
	OTBMItemAttrContainerItems = 23
)
View Source
const (
	ThingCategoryItem = iota
	ThingCategoryCreature
	ThingCategoryEffect
	ThingCategoryMissile
	ThingInvalidCategory
	ThingLastCategory
)
View Source
const (
	ItemCategoryInvalid = iota
	ItemCategoryGround
	ItemCategoryContainer
	ItemCategoryWeapon
	ItemCategoryAmmunition
	ItemCategoryArmor
	ItemCategoryCharges
	ItemCategoryTeleport
	ItemCategoryMagicField
	ItemCategoryWritable
	ItemCategoryKey
	ItemCategorySplash
	ItemCategoryFluid
	ItemCategoryDoor
	ItemCategoryDeprecated
	ItemCategoryLast
)
View Source
const (
	ItemTypeAttrFirst        = 15
	ItemTypeAttrServerID     = 16
	ItemTypeAttrClientID     = 17
	ItemTypeAttrName         = 18 // deprecated
	ItemTypeAttrDesc              //= 19   // deprecated
	ItemTypeAttrSpeed             //= 20
	ItemTypeAttrSlot              //= 21   // deprecated
	ItemTypeAttrMaxItems          //= 22   // deprecated
	ItemTypeAttrWeight            //= 23   // deprecated
	ItemTypeAttrWeapon            //= 24   // deprecated
	ItemTypeAttrAmmunition        //= 25   // deprecated
	ItemTypeAttrArmor             //= 26   // deprecated
	ItemTypeAttrMagicLevel        //= 27   // deprecated
	ItemTypeAttrMagicField        //= 28   // deprecated
	ItemTypeAttrWritable          //= 29   // deprecated
	ItemTypeAttrRotateTo          //= 30   // deprecated
	ItemTypeAttrDecay             //= 31   // deprecated
	ItemTypeAttrSpriteHash        //= 32
	ItemTypeAttrMinimapColor      //= 33
	ItemTypeAttr07                //= 34
	ItemTypeAttr08                //= 35
	ItemTypeAttrLight             //= 36
	ItemTypeAttrDecay2            //= 37   // deprecated
	ItemTypeAttrWeapon2           //= 38   // deprecated
	ItemTypeAttrAmmunition2       //= 39   // deprecated
	ItemTypeAttrArmor2            //= 40   // deprecated
	ItemTypeAttrWritable2         //= 41   // deprecated
	ItemTypeAttrLight2            //= 42
	ItemTypeAttrTopOrder          //= 43
	ItemTypeAttrWrtiable3         //= 44   // deprecated
	ItemTypeAttrWareID            //= 45
	ItemTypeAttrLast              //= 46
)
View Source
const (
	ClientVersion750    = 1
	ClientVersion755    //= 2
	ClientVersion760    //= 3
	ClientVersion770    //= 3
	ClientVersion780    //= 4
	ClientVersion790    //= 5
	ClientVersion792    //= 6
	ClientVersion800    //= 7
	ClientVersion810    //= 8
	ClientVersion811    //= 9
	ClientVersion820    //= 10
	ClientVersion830    //= 11
	ClientVersion840    //= 12
	ClientVersion841    //= 13
	ClientVersion842    //= 14
	ClientVersion850    //= 15
	ClientVersion854Old //= 16
	ClientVersion854    //= 17
	ClientVersion855    //= 18
	ClientVersion860Old //= 19
	ClientVersion860    //= 20
	ClientVersion861    //= 21
	ClientVersion862    //= 22,
	ClientVersion870    //= 23
	ClientVersion871    //= 24
	ClientVersion872    //= 25
	ClientVersion873    //= 26
	ClientVersion900    //= 27
	ClientVersion910    //= 28
	ClientVersion920    //= 29
	ClientVersion940    //= 30
	ClientVersion944v1  //= 31
	ClientVersion944v2  //= 32
	ClientVersion944v3  //= 33
	ClientVersion944v4  //= 34
	ClientVersion946    //= 35
	ClientVersion950    //= 36
	ClientVersion952    //= 37
	ClientVersion953    //= 38
	ClientVersion954    //= 39
	ClientVersion960    //= 40
	ClientVersion961    //= 41
)
View Source
const (
	EscapeChar = 0xFD
	NodeStart  = 0xFE
	NodeEnd    = 0xFF
)

Variables

This section is empty.

Functions

func HasLevel

func HasLevel(levels []uint8, l uint8) bool

HasLevel checks if the slice contains l

Types

type House

type House struct {
	ID    uint32
	Tiles []Tile
}

func (House) GenerateMinimapImage

func (h House) GenerateMinimapImage(savepath string) error

GenerateMinimapImage generates minimap image of the given house

type Item

type Item struct {
	ID    uint16
	Count uint16
	Attr  map[uint8]interface{}
	// contains filtered or unexported fields
}

type Map

type Map struct {
	Root              Node
	Width             uint16
	Height            uint16
	Header            uint32
	Property          uint8
	MajorItemsVersion uint32
	MinorItemsVersion uint32
	Description       string
	SpawnFile         string
	HouseFile         string
	Towns             []Town
	Tiles             []Tile
	Houses            []*House
}

Map struct used to save all map information

func Parse

func Parse(filepath string, townsOnly bool) (*Map, error)

Parse parses the given OTBM file

type Node

type Node struct {
	// contains filtered or unexported fields
}

Node struct used for binary tree nodes

func (*Node) Parse

func (n *Node) Parse(reader *bufio.Reader) error

Parse parses and creates a new node

func (*Node) ReadPosition

func (n *Node) ReadPosition() (Position, error)

ReadPosition reads the current buffer map position

func (*Node) ReadString

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

ReadString reads a string from the buffer

type Position

type Position struct {
	X uint16
	Y uint16
	Z uint8
}

Position struct used to save map positions

type Tile

type Tile struct {
	Position Position
	Items    []Item
	// contains filtered or unexported fields
}

type Town

type Town struct {
	ID             uint32
	Name           string
	TemplePosition Position
}

Town struct used to save map towns

Jump to

Keyboard shortcuts

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