示例#1
0
 /**
  * Get the estimated finishing time in days or hours.
  *
  * @param boolean $format
  *
  * @return string|integer
  */
 public function getEstimatedFinishingTime($format = true)
 {
     $talentPoints = $this->getTotalTalentPoints();
     $time = 0;
     foreach ($this->blueprint->getMaterialList() as $material) {
         switch ($material['talent']) {
             case 'blacksmith':
                 $charHandicap = $this->character->getBlacksmith() - $this->getHandicap();
                 break;
             case 'bowMaking':
                 $charHandicap = $this->character->getBowMaking() - $this->getHandicap();
                 break;
             case 'precisionMechanics':
                 $charHandicap = $this->character->getPrecisionMechanics() - $this->getHandicap();
                 break;
             case 'woodworking':
                 $charHandicap = $this->character->getWoodworking() - $this->getHandicap();
                 break;
             case 'leatherworking':
                 $charHandicap = $this->character->getLeatherworking() - $this->getHandicap();
                 break;
             case 'tailoring':
                 $charHandicap = $this->character->getTailoring() - $this->getHandicap();
                 break;
         }
         if ($charHandicap <= 0) {
             $charHandicap = 1;
         }
         $time += $talentPoints / $charHandicap * ($this->blueprint->getTimeUnits() * $this->timeUnitSeconds);
     }
     switch ($this->blueprint->getItemType()->getType()) {
         case 'meleeWeapon':
             $charHandicap = $this->character->getBlacksmith() - $this->getHandicap();
             break;
         case 'rangedWeapon':
             $charHandicap = $this->character->getBowMaking() - $this->getHandicap();
             break;
         case 'shield':
             break;
         case 'armor':
             break;
         case 'projectile':
             break;
     }
     if ($format) {
         return $this->formatProductionTime($time);
     }
     return $time;
 }