public function getGatheringItemTemplateSlotHeight(Item $item)
 {
     if ($this->getGatheringItemTemplateFixedSlotHeight()) {
         return $this->getGatheringItemTemplateFixedSlotHeight();
     }
     $h = 0;
     $handles = $this->getGatheringItemTemplateFeatureHandles();
     $assignments = GatheringItemAssignment::getList($item);
     foreach ($assignments as $as) {
         if (in_array($as->getFeatureDetailHandle(), $handles)) {
             $fd = $as->getFeatureDetailObject();
             if ($fd->getGatheringItemSuggestedSlotHeight() > 0 && $fd->getGatheringItemSuggestedSlotHeight() > $h) {
                 $h = $fd->getGatheringItemSuggestedSlotHeight();
             }
         }
     }
     if ($h) {
         return $h;
     }
     $hb = $this->getGatheringItemTemplateMinimumSlotHeight($item);
     $ht = $this->getGatheringItemTemplateMaximumSlotHeight($item);
     return mt_rand($hb, $ht);
 }
Exemple #2
0
 public function getGatheringItemTemplateData(Item $item)
 {
     $assignments = GatheringItemAssignment::getList($item);
     $data = array();
     foreach ($assignments as $as) {
         $fd = $as->getFeatureDetailObject();
         $key = $as->getFeatureDetailHandle();
         if (is_array($data[$key])) {
             $data[$key][] = $fd;
         } elseif (array_key_exists($key, $data)) {
             $tmp = $data[$key];
             $data[$key] = array($tmp, $fd);
         } else {
             $data[$key] = $fd;
         }
     }
     return $data;
 }