Пример #1
0
 /**
  * Returns a MaterialMap object representing the reprocessing materials of the item.
  *
  * @param \iveeCore\IndustryModifier $iMod for reprocessing context
  * @param int $batchSize number of items being reprocessed, needs to be multiple of portionSize
  *
  * @return \iveeCore\MaterialMap
  * @throws \iveeCore\Exceptions\NotReprocessableException if item is not reprocessable
  * @throws \iveeCore\Exceptions\InvalidParameterValueException if batchSize is not multiple of portionSize
  */
 public function getReprocessingMaterialMap(IndustryModifier $iMod, $batchSize)
 {
     if (!$this->isReprocessable()) {
         self::throwException('NotReprocessableException', $this->name . ' is not reprocessable');
     }
     if ($batchSize % $this->portionSize != 0) {
         self::throwException('InvalidParameterValueException', 'Reprocessing batch size needs to be multiple of ' . $this->portionSize);
     }
     //get station for reprocessing at
     $station = $iMod->getBestReprocessingStation();
     //the CharacterModifier
     $charMod = $iMod->getCharacterModifier();
     //if (compressed) ore or ice
     if ($this->getCategoryId() == 25) {
         //Reprocessing, Reprocessing Efficiency and specific Processing skills
         $yield = $station->getReprocessingEfficiency() * (1 + 0.03 * $charMod->getSkillLevel(3385)) * (1 + 0.02 * $charMod->getSkillLevel(3389)) * (1 + 0.02 * $charMod->getSkillLevel($this->getReprocessingSkillId())) * $charMod->getReprocessingImplantYieldFactor();
     } else {
         //Apply Scrapmetal Processing skill
         $yield = $station->getReprocessingEfficiency() * (1 + 0.02 * $charMod->getSkillLevel(12196));
     }
     $materialsClass = Config::getIveeClassName('MaterialMap');
     $rmat = new $materialsClass();
     $numPortions = $batchSize / $this->portionSize;
     foreach ($this->getMaterials() as $typeId => $quantity) {
         $rmat->addMaterial($typeId, round($quantity * $yield * $numPortions * $charMod->getReprocessingTaxFactor($station->getCorporationId())));
     }
     return $rmat;
 }
Пример #2
0
 public function testReaction()
 {
     $reactionProduct = Type::getByName('Platinum Technite');
     $this->assertTrue($reactionProduct instanceof ReactionProduct);
     //test correct handling of reaction products that can result from alchemy + refining
     $this->assertTrue($reactionProduct->getReactionIDs() == array(17952, 32831));
     //test handling of alchemy reactions with refining + feedback
     $iMod = IndustryModifier::getBySystemIdForPos(30000119);
     $rpd = Type::getByName('Unrefined Platinum Technite Reaction')->react($iMod, 24 * 30, true, true);
     $inTarget = new MaterialMap();
     $inTarget->addMaterial(16640, 72000);
     $inTarget->addMaterial(16644, 7200);
     $this->assertTrue($rpd->getMaterialMap()->getMaterials() == $inTarget->getMaterials());
     $outTarget = new MaterialMap();
     $outTarget->addMaterial(16662, 14400);
     $this->assertTrue($rpd->getOutputMaterialMap()->getMaterials() == $outTarget->getMaterials());
 }