Esempio n. 1
0
/*
    Items tree composing example.
*/
// creates container - here it would be a depot locker (we pass ID of item to create)
$container = new OTS_Container(2590);
// now let's create depot chest
$chest = new OTS_Container(2594);
// let's put chest inside locker
$container->addItem($chest);
// now let's put something deeper - into the chest
$item1 = new OTS_Item(3015);
$chest->addItem($item1);
// and more...
$item2 = new OTS_Item(3013);
$chest->addItem($item2);
// let's set count for an item
$item2->setCount(2);
/*
Here is a tree of items which we created:

$container [depot locker]
`-- $chest [depot chest]
    |-- $item1 [first item inserted into chest]
    `-- $item2 [second item inserted into chest] count=2
*/
/*
    Items saving example.
*/
// now we simply put those items into players depot (2 is depot ID)
$player->setDepot(2, $container);