Beispiel #1
0
 public function onActivate(item $item, Player $player = null)
 {
     $tile = $this->getLevel()->getTile($this);
     if ($tile instanceof FlowerPotTile) {
         if ($tile->getFlowerPotItem() === item::AIR) {
             switch ($item->getId()) {
                 case item::TALL_GRASS:
                     if ($item->getDamage() === 1) {
                         break;
                     }
                 case item::SAPLING:
                 case item::DEAD_BUSH:
                 case item::DANDELION:
                 case item::RED_FLOWER:
                 case item::BROWN_MUSHROOM:
                 case item::RED_MUSHROOM:
                 case item::CACTUS:
                     $tile->setFlowerPotData($item->getId(), $item->getDamage());
                     if ($player->isSurvival()) {
                         $item->count--;
                     }
                     return true;
                     break;
             }
         }
     }
     return false;
 }
Beispiel #2
0
 /**
  * Ruft Liste von Text-Sperren ab
  * @return array
  */
 public function getItems()
 {
     $list = $this->dbcon->fetch($this->dbcon->select($this->table), true);
     $res = array();
     foreach ($list as $item) {
         $wbItem = new item();
         if ($wbItem->createFromDbObject($item)) {
             $res[$wbItem->getId()] = $wbItem;
         }
     }
     return $res;
 }