POT
POT
POT
Main menu

Download

Forum

SVN

Class: OTS_ItemsList

Source Location: /classes/OTS_ItemsList.php

Class OTS_ItemsList

Class Overview

Implements interfaces:

  • IteratorAggregate (internal interface)
  • Countable (internal interface)
  • ArrayAccess (internal interface)

Items list loader.

Items list loader.

Located in /classes/OTS_ItemsList.php [line 28]

OTS_FileLoader
   |
   --OTS_ItemsList
Author(s):
API Tags:
Property-read:  int $otbVersion: OTB file version.
Property-read:  int $clientVersion: Dedicated client version.
Property-read:  int $buildVersion: File build version.

Information Tags:
Tutorial:  data/ directory resources
Version:  0.0.8
Version:  0.1.6
Since:  0.0.8

Methods

[ Top ]
Inherited Properties, Constants, and Methods
Inherited Properties Inherited Methods Inherited Constants

Inherited From OTS_FileLoader

OTS_FileLoader::$cache
OTS_FileLoader::$root

Inherited From OTS_FileLoader

OTS_FileLoader::loadFile()
Opens file.
OTS_FileLoader::setCacheDriver()
Sets cache handler.
OTS_FileLoader::__clone()
Creates clone of object.
OTS_FileLoader::__set()
Magic PHP5 method.
OTS_FileLoader::__set_state()
Magic PHP5 method.
OTS_FileLoader::__sleep()
Magic PHP5 method.

Inherited From OTS_FileLoader

OTS_FileLoader::ESCAPE_CHAR
OTS_FileLoader::NODE_END
OTS_FileLoader::NODE_START

[ Top ]
Constant Summary
CLIENT_VERSION_750   Tibia client 7.
CLIENT_VERSION_755   Tibia client 7.
CLIENT_VERSION_760   Tibia client 7.
CLIENT_VERSION_770   Tibia client 7.
CLIENT_VERSION_780   Tibia client 7.
CLIENT_VERSION_790   Tibia client 7.
CLIENT_VERSION_792   Tibia client 7.
CLIENT_VERSION_800   Tibia client 8.
CLIENT_VERSION_810   Tibia client 8.
CLIENT_VERSION_811   Tibia client 8.
CLIENT_VERSION_820   Tibia client 8.
CLIENT_VERSION_830   Tibia client 8.
CLIENT_VERSION_840   Tibia client 8.
ITEM_ATTR_CLIENTID   Client ID.
ITEM_ATTR_LIGHT2   Light.
ITEM_ATTR_SERVERID   Server ID.
ITEM_ATTR_SPEED   Speed.
ITEM_ATTR_TOPORDER   Always-on-top order.
ROOT_ATTR_VERSION   Root file attribute.

[ Top ]
Method Summary
int   count()   Returns amount of items loaded.
string   current()  
int   getBuildVersion()   Returns build version.
int   getClientVersion()   Returns client version.
OTS_ItemType   getItemType()   Returns given item type.
int   getItemTypeId()   Finds item type by it's name.
array   getItemTypesList()  
ArrayIterator   getIterator()   Returns iterator handle for loops.
int   getOTBVersion()   Returns OTB file version.
bool   hasItemType()   Checks if given item type exists on list.
bool   hasItemTypeId()   Checks if given type ID exists on list.
int   key()  
void   loadItems()   Loads items.
void   next()  
bool   offsetExists()   Checks if given element exists.
OTS_ItemType|int   offsetGet()   Returns item from given position.
void   offsetSet()   This method is implemented for ArrayAccess interface.
void   offsetUnset()   This method is implemented for ArrayAccess interface.
void   rewind()  
bool   valid()  
mixed   __get()   Magic PHP5 method.
string   __toString()   Returns string representation of object.
void   __wakeup()   Magic PHP5 method.

[ Top ]
Methods
count  [line 538]

  int count( )

Returns amount of items loaded.

Returns amount of items loaded.


API Tags:
Return:  Count of types.
Access:  public

Information Tags:
Version:  0.0.8
Since:  0.0.8

Implementation of:
Countable::count

[ Top ]
current  [line 547]

  string current( )


API Tags:
Return:  Item name.
Deprecated:  0.1.0 Use getIterator().
Access:  public

Information Tags:
Version:  0.0.8
Since:  0.0.8

[ Top ]
getBuildVersion  [line 439]

  int getBuildVersion( )

Returns build version.

Returns build version.


API Tags:
Return:  Build version.
Access:  public

Information Tags:
Version:  0.0.8
Since:  0.0.8

[ Top ]
getClientVersion  [line 429]

  int getClientVersion( )

Returns client version.

Returns client version.


API Tags:
Return:  Client version.
Access:  public

Information Tags:
Version:  0.0.8
Since:  0.0.8

[ Top ]
getItemType  [line 474]

  OTS_ItemType getItemType( int $id  )

Returns given item type.

Returns given item type.

Parameters:
int   $id:  Item type (server) ID.

API Tags:
Return:  Returns item type of given ID.
Access:  public

Information Tags:
Version:  0.1.3
Version:  0.0.8
Throws:  OutOfBoundsException If not exists.
Since:  0.0.8

[ Top ]
getItemTypeId  [line 509]

  int getItemTypeId( string $name  )

Finds item type by it's name.

Finds item type by it's name. Note: If there are more then one items with same name this function will return first found server ID. It doesn't also mean that it will be the lowest ID - item types are ordered in order that they were loaded from items.xml file.

Parameters:
string   $name:  Item type name.

API Tags:
Return:  Returns item type (server) ID.
Access:  public

Information Tags:
Version:  0.1.3
Version:  0.0.8
Throws:  OutOfBoundsException If not found.
Since:  0.0.8

[ Top ]
getItemTypesList  [line 528]

  array getItemTypesList( )


API Tags:
Return:  List of item types.
Deprecated:  0.1.0 Use this class object as array for iterations, counting and methods for field fetching.
Access:  public

Information Tags:
Version:  0.0.8
Since:  0.0.8

[ Top ]
getIterator  [line 593]

  ArrayIterator getIterator( )

Returns iterator handle for loops.

Returns iterator handle for loops.


API Tags:
Return:  Items list iterator.
Access:  public

Information Tags:
Version:  0.1.0
Version:  0.0.8
Since:  0.0.8
Since:  0.1.0

Implementation of:
IteratorAggregate::getIterator

[ Top ]
getOTBVersion  [line 419]

  int getOTBVersion( )

Returns OTB file version.

Returns OTB file version.


API Tags:
Return:  OTB format version.
Access:  public

Information Tags:
Version:  0.0.8
Since:  0.0.8

[ Top ]
hasItemType  [line 452]

  bool hasItemType( string $name  )

Checks if given item type exists on list.

Checks if given item type exists on list.

Parameters:
string   $name:  Name.

API Tags:
Return:  If item type is set then true.
Access:  public

Information Tags:
Version:  0.1.3
Version:  0.0.8
Since:  0.0.8
Since:  0.1.3

[ Top ]
hasItemTypeId  [line 492]

  bool hasItemTypeId( int $id  )

Checks if given type ID exists on list.

Checks if given type ID exists on list.

Parameters:
int   $id:  ID.

API Tags:
Return:  If item type is set then true.
Access:  public

Information Tags:
Version:  0.1.3
Version:  0.0.8
Since:  0.0.8
Since:  0.1.3

[ Top ]
key  [line 564]

  int key( )


API Tags:
Return:  Current position key.
Deprecated:  0.1.0 Use getIterator().
Access:  public

Information Tags:
Version:  0.0.8
Since:  0.0.8

[ Top ]
loadItems  [line 177]

  void loadItems( string $path  )

Loads items.

Loads items.xml and items.otb files. This method loads both items.xml and items.otb files. Both of them has to be in given directory.

Parameters:
string   $path:  Path to data/items directory.

API Tags:
Access:  public

Information Tags:
Version:  0.1.3
Version:  0.0.8
Throws:  E_OTS_FileLoaderError When error occurs during file operation.
Since:  0.0.8
Throws:  DOMException On DOM operation error.

[ Top ]
next  [line 555]

  void next( )


API Tags:
Deprecated:  0.1.0 Use getIterator().
Access:  public

Information Tags:
Version:  0.0.8
Since:  0.0.8

[ Top ]
offsetExists  [line 606]

  bool offsetExists( string|int $offset  )

Checks if given element exists.

Checks if given element exists.

Parameters:
string|int   $offset:  Array key.

API Tags:
Return:  True if it's set.
Access:  public

Information Tags:
Version:  0.1.0
Version:  0.0.8
Since:  0.0.8
Since:  0.1.0

Implementation of:
ArrayAccess::offsetExists

[ Top ]
offsetGet  [line 626]

  OTS_ItemType|int offsetGet( string|int $offset  )

Returns item from given position.

Returns item from given position.

Parameters:
string|int   $offset:  Array key.

API Tags:
Return:  If key is an integer (type-sensitive!) then returns item type instance. If it's a string then return associated ID found by type name.
Access:  public

Information Tags:
Version:  0.1.3
Version:  0.0.8
Since:  0.0.8
Since:  0.1.0

Implementation of:
ArrayAccess::offsetGet

[ Top ]
offsetSet  [line 647]

  void offsetSet( string|int $offset, mixed $value  )

This method is implemented for ArrayAccess interface.

This method is implemented for ArrayAccess interface. In fact you can't write/append to items list. Any call to this method will cause E_OTS_ReadOnly raise.

Parameters:
string|int   $offset:  Array key.
mixed   $value:  Field value.

API Tags:
Access:  public

Information Tags:
Version:  0.1.0
Version:  0.0.8
Throws:  E_OTS_ReadOnly Always - this class is read-only.
Since:  0.1.0
Since:  0.0.8

Implementation of:
ArrayAccess::offsetSet

[ Top ]
offsetUnset  [line 660]

  void offsetUnset( string|int $offset  )

This method is implemented for ArrayAccess interface.

This method is implemented for ArrayAccess interface. In fact you can't write/append to items list. Any call to this method will cause E_OTS_ReadOnly raise.

Parameters:
string|int   $offset:  Array key.

API Tags:
Access:  public

Information Tags:
Version:  0.1.0
Version:  0.0.8
Throws:  E_OTS_ReadOnly Always - this class is read-only.
Since:  0.1.0
Since:  0.0.8

Implementation of:
ArrayAccess::offsetUnset

[ Top ]
rewind  [line 581]

  void rewind( )


API Tags:
Deprecated:  0.1.0 Use getIterator().
Access:  public

Information Tags:
Version:  0.0.8
Since:  0.0.8

[ Top ]
valid  [line 573]

  bool valid( )


API Tags:
Return:  If iterator has anything more.
Deprecated:  0.1.0 Use getIterator().
Access:  public

Information Tags:
Version:  0.0.8
Since:  0.0.8

[ Top ]
__get  [line 674]

  mixed __get( string $name  )

Magic PHP5 method.

Magic PHP5 method.

Parameters:
string   $name:  Property name.

API Tags:
Return:  Property value.
Access:  public

Information Tags:
Version:  0.1.0
Version:  0.0.8
Throws:  OutOfBoundsException For non-supported properties.
Since:  0.1.0
Since:  0.0.8

[ Top ]
__toString  [line 699]

  string __toString( )

Returns string representation of object.

Returns string representation of object. If any display driver is currently loaded then it uses it's method.


API Tags:
Return:  String representation of object.
Access:  public

Information Tags:
Version:  0.1.3
Version:  0.0.8
Since:  0.0.8
Since:  0.1.3

[ Top ]
__wakeup  [line 159]

  void __wakeup( )

Magic PHP5 method.

Magic PHP5 method. Allows object unserialisation.


API Tags:
Access:  public

Information Tags:
Version:  0.0.8
Since:  0.0.8

[ Top ]
Constants
CLIENT_VERSION_750 = 1 [line 38]

Tibia client 7.

Tibia client 7.5 version.

Information Tags:
Version:  0.0.8
Since:  0.0.8

[ Top ]
CLIENT_VERSION_755 = 2 [line 42]

Tibia client 7.

Tibia client 7.55 version.

Information Tags:
Version:  0.0.8
Since:  0.0.8

[ Top ]
CLIENT_VERSION_760 = 3 [line 46]

Tibia client 7.

Tibia client 7.6 version.

Information Tags:
Version:  0.0.8
Since:  0.0.8

[ Top ]
CLIENT_VERSION_770 = 3 [line 50]

Tibia client 7.

Tibia client 7.7 version.

Information Tags:
Version:  0.0.8
Since:  0.0.8

[ Top ]
CLIENT_VERSION_780 = 4 [line 54]

Tibia client 7.

Tibia client 7.8 version.

Information Tags:
Version:  0.0.8
Since:  0.0.8

[ Top ]
CLIENT_VERSION_790 = 5 [line 58]

Tibia client 7.

Tibia client 7.9 version.

Information Tags:
Version:  0.0.8
Since:  0.0.8

[ Top ]
CLIENT_VERSION_792 = 6 [line 62]

Tibia client 7.

Tibia client 7.92 version.

Information Tags:
Version:  0.0.8
Since:  0.0.8

[ Top ]
CLIENT_VERSION_800 = 7 [line 66]

Tibia client 8.

Tibia client 8.0 version.

Information Tags:
Version:  0.0.8
Since:  0.0.8

[ Top ]
CLIENT_VERSION_810 = 8 [line 73]

Tibia client 8.

Tibia client 8.1 version.

Information Tags:
Version:  0.1.6
Version:  0.0.8
Since:  0.0.8
Since:  0.1.6

[ Top ]
CLIENT_VERSION_811 = 9 [line 80]

Tibia client 8.

Tibia client 8.1.1 version.

Information Tags:
Version:  0.1.6
Version:  0.0.8
Since:  0.0.8
Since:  0.1.6

[ Top ]
CLIENT_VERSION_820 = 10 [line 87]

Tibia client 8.

Tibia client 8.2 version.

Information Tags:
Version:  0.1.6
Version:  0.0.8
Since:  0.0.8
Since:  0.1.6

[ Top ]
CLIENT_VERSION_830 = 11 [line 94]

Tibia client 8.

Tibia client 8.3 version.

Information Tags:
Version:  0.1.6
Version:  0.0.8
Since:  0.0.8
Since:  0.1.6

[ Top ]
CLIENT_VERSION_840 = 12 [line 101]

Tibia client 8.

Tibia client 8.4 version.

Information Tags:
Version:  0.1.6
Version:  0.0.8
Since:  0.0.8
Since:  0.1.6

[ Top ]
ITEM_ATTR_CLIENTID = 17 [line 110]

Client ID.

Client ID.

Information Tags:
Version:  0.0.8
Since:  0.0.8

[ Top ]
ITEM_ATTR_LIGHT2 = 42 [line 118]

Light.

Light.

Information Tags:
Version:  0.0.8
Since:  0.0.8

[ Top ]
ITEM_ATTR_SERVERID = 16 [line 106]

Server ID.

Server ID.

Information Tags:
Version:  0.0.8
Since:  0.0.8

[ Top ]
ITEM_ATTR_SPEED = 20 [line 114]

Speed.

Speed.

Information Tags:
Version:  0.0.8
Since:  0.0.8

[ Top ]
ITEM_ATTR_TOPORDER = 43 [line 122]

Always-on-top order.

Always-on-top order.

Information Tags:
Version:  0.0.8
Since:  0.0.8

[ Top ]
ROOT_ATTR_VERSION = 1 [line 33]

Root file attribute.

Root file attribute.

Information Tags:
Version:  0.0.8
Since:  0.0.8

[ Top ]