| Prev | Next |
Players are essential part of OTServ. They have the most additional things from all kind of objects and are connected with many other resources. Players belongs to accounts, groups, might belongs to guilds.
OTS_Player class contains everything you need to work with skills. You can get and set both skill values and skill advance tries. It is done with four methods:
There are also methods to manage custom storage values: getStorage() and setStorage(). Sotrage values are custom integer values that are assigned to player - they act like flags.
POT provides also objective way for browsing/editing player items (body slots and depot items with all containers). You have OTS_Item and OTS_Container classes for that. OTS_Item represents single item, OTS_Container can contain sub-items (either OTS_Item objects, or next level OTS_Container objects).
There is important thing to mention - you have to have global items list resource loaded. POT reads item info for every item loaded from player.
Detailed API for managing items tree you will find in documentation of those classes. Here are examples of how you use slot and depot items fetching and saving:
Important thing - OTS_Container class is subclass of OTS_Item. Each container is also an item.
One part that is important to describe separately is deleting items from tree. If you wan't to delete item from container you have to pass it's instance to removeItem() method. It's instance! It means a reference to exacly same object - there might be more then one similar objects within container, you must point exacly which one you want to remove.
| Prev | Up | Next |
| Accounts | DAO objects | Guilds |