Documentation ¶
Overview ¶
Package itemsotb reads in an items.otb file.
Top level OTB node's data represents version header, and its children represents individual items.
Index ¶
Constants ¶
const ( CLIENT_VERSION_750 = ClientVersion(1) CLIENT_VERSION_755 = ClientVersion(2) CLIENT_VERSION_760, CLIENT_VERSION_770 = ClientVersion(3), ClientVersion(3) CLIENT_VERSION_780 = ClientVersion(4) CLIENT_VERSION_790 = ClientVersion(5) CLIENT_VERSION_792 = ClientVersion(6) CLIENT_VERSION_800 = ClientVersion(7) CLIENT_VERSION_810 = ClientVersion(8) CLIENT_VERSION_811 = ClientVersion(9) CLIENT_VERSION_820 = ClientVersion(10) CLIENT_VERSION_830 = ClientVersion(11) CLIENT_VERSION_840 = ClientVersion(12) CLIENT_VERSION_841 = ClientVersion(13) CLIENT_VERSION_842 = ClientVersion(14) CLIENT_VERSION_850 = ClientVersion(15) CLIENT_VERSION_854_BAD = ClientVersion(16) CLIENT_VERSION_854 = ClientVersion(17) CLIENT_VERSION_855 = ClientVersion(18) CLIENT_VERSION_860_OLD = ClientVersion(19) CLIENT_VERSION_860 = ClientVersion(20) CLIENT_VERSION_861 = ClientVersion(21) CLIENT_VERSION_862 = ClientVersion(22) CLIENT_VERSION_870 = ClientVersion(23) )
Enumeration containing recognized protocol versions for which a particular items.otb file might be targeted.
Implementation detail: iota is not used primarily for easier referencing in case of an error.
const (
ROOT_ATTR_VERSION = 0x01
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClientVersion ¶ added in v0.0.8
type ClientVersion uint32
Enumeration containing recognized protocol versions for which a particular items.otb file might be targeted.
func (ClientVersion) String ¶ added in v0.0.8
func (v ClientVersion) String() string
String implements the stringer interface.
type Item ¶
type Item struct { Group ItemGroup Flags ItemsFlags Attributes map[ItemsAttribute]interface{} // contains filtered or unexported fields }
Item represents a single item stored in the items.otb file.
func (*Item) Article ¶ added in v0.0.8
Article returns the name of the item. This will only be sourced from XML, if loaded.
If empty, no article should be used; otherwise, in singular, prefix with article and a space.
func (*Item) ClientID ¶ added in v0.0.8
ClientID returns the item client ID for the client version for which this OTB is intended. If the item does not exist in this client version, zero is returned.
func (*Item) Description ¶ added in v0.0.8
Description returns the description of the item. This may be sourced from XML, if loaded.
If multiple descriptions are supplied, only the first one will be used.
type ItemGroup ¶
type ItemGroup int
Enumeration containing which overarching item group this item belongs to.
Useful primarily for editors.
const ( ITEM_GROUP_NONE ItemGroup = iota ITEM_GROUP_GROUND ITEM_GROUP_CONTAINER ITEM_GROUP_WEAPON // deprecated ITEM_GROUP_AMMUNITION // deprecated ITEM_GROUP_ARMOR // deprecated ITEM_GROUP_CHARGES ITEM_GROUP_TELEPORT // deprecated ITEM_GROUP_MAGICFIELD // deprecated ITEM_GROUP_WRITEABLE // deprecated ITEM_GROUP_KEY // deprecated ITEM_GROUP_SPLASH ITEM_GROUP_FLUID ITEM_GROUP_DOOR // deprecated ITEM_GROUP_DEPRECATED ITEM_GROUP_LAST )
type Items ¶
type Items struct { otb.OTB Version ItemsVersion Items []Item ClientIDToArrayIndex map[uint16]int ServerIDToArrayIndex map[uint16]int ExtantClientItemIDs []uint16 ExtantServerItemIDs []uint16 ExtantClientItemArrayIdxs []int ExtantServerItemArrayIdxs []int ServerIDToExtantClientItemArrayIDXs map[uint16]int // a strange hack allowing us to seek within ExtantClientItemArrayIdxs based on server ID MinClientID, MaxClientID uint16 MinServerID, MaxServerID uint16 }
func (*Items) ItemByClientID ¶
ItemByClientID allows lookup of an item stored in an items.otb file based on its ID used by the network protocol and associated data files.
func (*Items) ItemByServerID ¶
ItemByServerID allows lookup of an item stored in an items.otb file based on its persistent 'server' ID, which stays fixed between versions, and is used by the server-side data storage, by map files, etc.
type ItemsAttribute ¶
type ItemsAttribute uint8
const ( ITEM_ATTR_FIRST ItemsAttribute = 0x10 ITEM_ATTR_SERVERID ItemsAttribute = iota + 0x10 - 1 ITEM_ATTR_CLIENTID ITEM_ATTR_NAME // deprecated ITEM_ATTR_DESCR // deprecated ITEM_ATTR_SPEED ITEM_ATTR_SLOT // deprecated ITEM_ATTR_MAXITEMS // deprecated ITEM_ATTR_WEIGHT // deprecated ITEM_ATTR_WEAPON // deprecated ITEM_ATTR_AMU // deprecated ITEM_ATTR_ARMOR // deprecated ITEM_ATTR_MAGLEVEL // deprecated ITEM_ATTR_MAGFIELDTYPE // deprecated ITEM_ATTR_WRITEABLE // deprecated ITEM_ATTR_ROTATETO // deprecated ITEM_ATTR_DECAY // deprecated ITEM_ATTR_SPRITEHASH ITEM_ATTR_MINIMAPCOLOR ITEM_ATTR_07 ITEM_ATTR_08 ITEM_ATTR_LIGHT // 1byte aligned ITEM_ATTR_DECAY2 // deprecated ITEM_ATTR_WEAPON2 // deprecated ITEM_ATTR_AMU2 // deprecated ITEM_ATTR_ARMOR2 // deprecated ITEM_ATTR_WRITEABLE2 // deprecated ITEM_ATTR_LIGHT2 ITEM_ATTR_TOPORDER ITEM_ATTR_WRITEABLE3 // deprecated ITEM_ATTR_LAST )
Enumeration containing recognized attributes in the items.otb file.
func (ItemsAttribute) String ¶
func (a ItemsAttribute) String() string
type ItemsDataSize ¶
type ItemsDataSize uint16
type ItemsFlags ¶
type ItemsFlags uint32
const ( FLAG_BLOCK_SOLID ItemsFlags = 1 << iota FLAG_BLOCK_PROJECTILE FLAG_BLOCK_PATHFIND FLAG_HAS_HEIGHT FLAG_USEABLE FLAG_PICKUPABLE FLAG_MOVEABLE FLAG_STACKABLE FLAG_FLOORCHANGEDOWN FLAG_FLOORCHANGENORTH FLAG_FLOORCHANGEEAST FLAG_FLOORCHANGESOUTH FLAG_FLOORCHANGEWEST FLAG_ALWAYSONTOP FLAG_READABLE FLAG_ROTABLE FLAG_HANGABLE FLAG_VERTICAL FLAG_HORIZONTAL FLAG_CANNOTDECAY FLAG_ALLOWDISTREAD FLAG_UNUSED FLAG_CLIENTCHARGES // deprecated FLAG_LOOKTHROUGH FLAG_ANIMATION FLAG_WALKSTACK FLAG_LAST )
Enumeration containing possible bits in the `flags` bitmask of an item.
func (ItemsFlags) String ¶
func (f ItemsFlags) String() string
type ItemsVersion ¶
type ItemsVersion struct { MajorVersion uint32 MinorVersion ClientVersion // uint32 BuildNumber uint32 CSDVersion [128]uint8 }
ItemsVersion represents the version of the items.otb file.
MajorVersion means a revision of the file format, MinorVersion means the targeted protocol version, BuildNumber is an arbitrary number representing the revision of the file, and CSDVersion is a byte array with a C-style null-terminated string.
func (ItemsVersion) CSDVersionAsString ¶
func (v ItemsVersion) CSDVersionAsString() string
CSDVersionAsString formats null-terminated C-style string `CSDArray` from a byte array into usual Go string.