Documentation ¶
Overview ¶
Package dat implements a parser for Tibia dataset files (Tibia.dat), describing items, creatures, etc.
Index ¶
Constants ¶
const ( CLIENT_VERSION_UNKNOWN = iota CLIENT_VERSION_854 )
Enumeration of versions that are 'actively' supported.
(Values may change between versions of the package and have no meaning.)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Dataset ¶
type Dataset struct { Header // contains filtered or unexported fields }
Dataset represents a set of items, outfits, effects and distance effects read from a Tibia dataset file ('things' or 'dataset entries').
func NewDataset ¶
NewDataset reads the dataset file from the passed io.Reader and returns the Dataset object.
func (Dataset) ClientVersion ¶
ClientVersion returns which version of the game this data file comes from.
Currently supported is only 8.54.
type DatasetEntry ¶
type DatasetEntry interface {
GetGraphics() *Graphics
}
DatasetEntry interface represents an entry in the dataset.
It exposes a method to get a description of graphics for a particular 'thing', but is primarily intended to make it easier to abstract representing 'any entry' in the type system.
All dataset entries have graphics attached to them.
type DistanceEffect ¶
type DistanceEffect struct { DatasetEntry Graphics Id int LightInfo }
DistanceEffect represents an in-game effect which moves from one tile to another over a period of time, then diappears.
func (*DistanceEffect) GetGraphics ¶
func (d *DistanceEffect) GetGraphics() *Graphics
GetGraphics returns sprites associated with this distance effect.
func (DistanceEffect) String ¶
func (d DistanceEffect) String() string
String returns a string representation for a distance effect.
type Effect ¶
type Effect struct { DatasetEntry Graphics Id int LightInfo }
Effect represents a temporarily-appearing in-game effect, such as a poof of smoke, then disappears.
func (*Effect) GetGraphics ¶
GetGraphics returns sprites associated with this effect.
type Graphics ¶
type Graphics struct { // WxH. Separated into a struct for easier reading. GraphicsDimensions // How many pixels should each sprite's tile take on screen? Usually 32. RenderSize uint8 // Details on how to render each of the WxH sprite blocks (animations, variations, etc.) // Separated into a struct for easier reading. GraphicsDetails // Which sprites are used when rendering. Sprites []uint16 }
Graphics describes sprites associated with a particular thing, and how they should be drawn.
type GraphicsDetails ¶
type GraphicsDetails struct { // How many WxH blocks will be drawn one on top of the other. BlendFrames uint8 // How many variations does this sprite have based on its position on the map. XDiv, YDiv, ZDiv uint8 // How many blocks of WxHxBlendFramesxXdivxYdivxZdiv does this sprite use as animation frames. AnimCount uint8 }
GraphicsDetails represents various points detailing how many individual sprites compose a thing, and how should they be drawn.
This includes number of animation frames, number of sprites that should be layered one on top of the other, etc.
type GraphicsDimensions ¶
type GraphicsDimensions struct {
// How many on-screen tiles will this sprite take, when drawn.
Width, Height uint8
}
GraphicsDimensions represents size of an item expressed in tiles.
It's extracted as a type so it can more easily be read from the binary file.
type Item ¶
type Item struct { DatasetEntry Graphics Id int GroundSpeed uint16 SortOrder uint16 Container bool Stackable bool AlwaysUsed bool Usable bool Rune bool Readable bool Writable bool MaxRWLen uint16 FluidContainer bool Splash bool BlockingPlayer bool Immobile bool BlockingMissiles bool BlockingMonsters bool Equipable bool Hangable bool HorizontalItem bool VerticalItem bool RotatableItem bool LightInfo OffsetInfo PlayerOffset uint16 LargeOffset bool IdleAnim bool MapColor uint16 LookThrough bool }
Item represents a dataset entry describing an in-game item.
Items range from ground tiles, through wall tiles, to inventory items such as apples or swords.
func (*Item) GetGraphics ¶
GetGraphics returns sprites associated with this item.
type LightInfo ¶
type LightInfo struct {
Strength, Color uint16
}
LightInfo represents a recurring structure in the binary format of the data file concerning the strength and color of the light emitted client-side.
type OffsetInfo ¶
type OffsetInfo struct {
X, Y uint16
}
OffsetInfo represents how far the object should be drawn offset to its usual drawing location.
type Outfit ¶
type Outfit struct { DatasetEntry Graphics Id int OffsetInfo IdleAnim bool LightInfo }
Outfit represents a dataset entry describing a possible appearance for an in-game character, whether NPC or player.
func (*Outfit) GetGraphics ¶
GetGraphics returns sprites associated with this outfit.