当前位置: 首页>>代码示例>>PHP>>正文


PHP Type::getById方法代码示例

本文整理汇总了PHP中Type::getById方法的典型用法代码示例。如果您正苦于以下问题:PHP Type::getById方法的具体用法?PHP Type::getById怎么用?PHP Type::getById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Type的用法示例。


在下文中一共展示了Type::getById方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getReactions

 /**
  * Gets the Reaction object(s) this product can be produced from.
  *
  * @return \iveeCore\Reaction[] with Reaction objects(s)
  */
 public function getReactions()
 {
     $ret = [];
     foreach ($this->productOfReactionIds as $reactionId) {
         $ret[$reactionId] = Type::getById($reactionId);
     }
     return $ret;
 }
开发者ID:Covert-Inferno,项目名称:iveeCore,代码行数:13,代码来源:ReactionProduct.php

示例2: __construct

 public function __construct($data)
 {
     if (is_array($data)) {
         $this->id = $data['gym_id'];
         $this->name = $data['gym_name'];
         $this->city = $data['gym_city'];
         $type = Type::getById(intval($data['gym_type']));
         $this->type = $type->serialize();
         $badge = Badge::getById(intval($data['gym_badge']));
         $this->badge = $badge->serialize();
     }
 }
开发者ID:EPICmynamesBG,项目名称:PokemonDB,代码行数:12,代码来源:Gym.php

示例3: __construct

 public function __construct($data)
 {
     if (is_array($data)) {
         $this->id = $data['pokemon_id'];
         $this->name = $data['pokemon_name'];
         $type1 = Type::getById(intval($data['pokemon_type1']));
         $this->type = $type1->serialize();
         $type2 = $data['pokemon_type2'];
         if ($type2 !== null) {
             $type2 = Type::getById($type2);
             $this->type2 = $type2->serialize();
         } else {
             $this->type2 = null;
         }
         $this->hp = intval($data['pokemon_hp']);
         $this->speed = intval($data['pokemon_speed']);
         $this->attack = intval($data['pokemon_attack']);
         $this->specialAttack = intval($data['pokemon_special_attack']);
         $this->defense = intval($data['pokemon_defense']);
         $this->specialDefense = intval($data['pokemon_special_defense']);
         if ($data['pokemon_before'] != null) {
             $this->previousEvolution = $data['pokemon_before'];
         } else {
             $this->previousEvolution = null;
         }
         if (intval($data['pokemon_before_evo_level']) != null) {
             $this->previousEvolutionLevel = intval($data['pokemon_before_evo_level']);
         } else {
             $this->previousEvolutionLevel = null;
         }
         if ($data['pokemon_after'] != null) {
             $this->nextEvolution = $data['pokemon_after'];
         } else {
             $this->nextEvolution = null;
         }
         if (intval($data['pokemon_after_evo_level']) != null) {
             $this->nextEvolutionLevel = intval($data['pokemon_after_evo_level']);
         } else {
             $this->nextEvolutionLevel = null;
         }
         if (array_key_exists('pokemon_level', $data)) {
             if (intval($data['pokemon_level']) != null) {
                 $this->level = intval($data['pokemon_level']);
             } else {
                 $this->level = null;
             }
         } else {
             $this->level = null;
         }
     }
 }
开发者ID:EPICmynamesBG,项目名称:PokemonDB,代码行数:51,代码来源:Pokemon.php

示例4: inventManufacture

 /**
  * Returns a ManufactureProcessData object with cascaded InventionProcessData object.
  *
  * @param \iveeCore\IndustryModifier $iMod the object with all the necessary industry modifying entities
  * @param int $relicId the ID of the Relic to be used for invention
  * @param int $decryptorId the decryptor the be used, if any
  * @param int $manuRecursionDepth defines if and how deep used materials should be manufactured recursively
  * @param int $reactionRecursionDepth defines if and how deep used materials should be gained through reaction
  * recursively
  *
  * @return \iveeCore\InventionProcessData
  * @throws \iveeCore\Exceptions\NotInventableException if a wrong relicId is given
  * @throws \iveeCore\Exceptions\WrongTypeException if decryptorId isn't a decryptor or if relicId isn't a Relic
  */
 public function inventManufacture(IndustryModifier $iMod, $relicId, $decryptorId = null, $manuRecursionDepth = 1, $reactionRecursionDepth = 0)
 {
     if (!in_array($relicId, $this->inventedFrom)) {
         self::throwException('NotInventableException', "Can't use Relic ID=" . (int) $relicId . " to invent this T3Blueprint");
     }
     $relic = Type::getById($relicId);
     if (!$relic instanceof Relic) {
         self::throwException('WrongTypeException', 'Given object is not instance of Relic');
     }
     return $relic->inventManufacture($iMod, $this->getId(), $decryptorId, $manuRecursionDepth, $reactionRecursionDepth);
 }
开发者ID:Covert-Inferno,项目名称:iveeCore,代码行数:25,代码来源:T3Blueprint.php

示例5: getProduct

 /**
  * Returns an Manufacturable object representing the item produced by this Blueprint.
  *
  * @return \iveeCore\Manufacturable
  */
 public function getProduct()
 {
     return Type::getById($this->getProductId());
 }
开发者ID:Covert-Inferno,项目名称:iveeCore,代码行数:9,代码来源:Blueprint.php

示例6: getInventableBlueprints

 /**
  * Returns an array with the inventable blueprint instances.
  *
  * @return \iveeCore\InventableBlueprint[]
  */
 public function getInventableBlueprints()
 {
     $ret = [];
     foreach ($this->getInventableBlueprintIds() as $bpId) {
         $ret[$bpId] = Type::getById($bpId);
     }
     return $ret;
 }
开发者ID:Covert-Inferno,项目名称:iveeCore,代码行数:13,代码来源:InventorBlueprint.php

示例7: getBlueprint

 /**
  * Returns blueprint object that can manufacture this item.
  *
  * @return \iveeCore\Blueprint
  */
 public function getBlueprint()
 {
     return Type::getById($this->producedFromBlueprintId);
 }
开发者ID:Covert-Inferno,项目名称:iveeCore,代码行数:9,代码来源:Manufacturable.php

示例8: printData

 /**
  * Prints data about this process.
  *
  * @param \iveeCore\IndustryModifier $buyContext for buying context
  * @param \iveeCore\IndustryModifier $sellContext for selling context, optional. If not given, $buyContext will be
  * used.
  *
  * @return void
  */
 public function printData(IndustryModifier $buyContext, IndustryModifier $sellContext = null)
 {
     $utilClass = Config::getIveeClassName('Util');
     echo "Total slot time: " . $utilClass::secondsToReadable($this->getTotalTime()) . PHP_EOL;
     //iterate over materials
     foreach ($this->getTotalMaterialMap()->getMaterials() as $typeId => $amount) {
         echo $amount . 'x ' . Type::getById($typeId)->getName() . PHP_EOL;
     }
     echo "Material cost: " . $utilClass::quantitiesToReadable($this->getTotalMaterialBuyCost($buyContext)) . "ISK" . PHP_EOL;
     echo "Slot cost: " . $utilClass::quantitiesToReadable($this->getTotalProcessCost()) . "ISK" . PHP_EOL;
     echo "Total cost: " . $utilClass::quantitiesToReadable($this->getTotalCost($buyContext)) . "ISK" . PHP_EOL;
     echo "Total profit: " . $utilClass::quantitiesToReadable($this->getTotalProfit($buyContext, $sellContext)) . "ISK" . PHP_EOL;
 }
开发者ID:Covert-Inferno,项目名称:iveeCore,代码行数:22,代码来源:ProcessData.php

示例9: addActivityMaterials

 /**
  * Computes and adds the material requirements for a process to a ProcessData object.
  * 
  * 
  * @param IndustryModifier $iMod the object that holds all the information about skills, implants, system industry
  * indices, teams, tax and assemblyLines
  * @param ProcessData $pdata to which materials shall be added
  * @param int $activityId of the activity
  * @param float $materialFactor the IndustryModifier and Blueprint ME level dependant ME bonus factor
  * @param float $numPortions the number of portions being built or researched. Note that passing a fraction will
  * make the method not use the rounding for the resulting required amounts.
  * @param bool $recursive defines if used materials should be manufactured recursively
  * 
  * @return void
  */
 protected function addActivityMaterials(IndustryModifier $iMod, ProcessData $pdata, $activityId, $materialFactor, $numPortions, $recursive)
 {
     foreach ($this->getMaterialsForActivity($activityId) as $matID => $matData) {
         //if consume flag is set to 0, add to needed mats with quantity 0
         if (isset($matData['c']) and $matData['c'] == 0) {
             $pdata->addMaterial($matID, 0);
             continue;
         }
         $mat = Type::getById($matID);
         //calculate total quantity needed, applying all modifiers
         //if number of portions is a fraction, don't ceil() amounts
         if (fmod($numPortions, 1.0) > 0.0) {
             $totalNeeded = $matData['q'] * $materialFactor * $numPortions;
         } else {
             $totalNeeded = ceil($matData['q'] * $materialFactor * $numPortions);
         }
         //at least one unit of material is required per portion
         if ($totalNeeded < $numPortions) {
             $totalNeeded = $numPortions;
         }
         //if using recursive building and material is manufacturable, recurse!
         if ($recursive and $mat instanceof Manufacturable) {
             $pdata->addSubProcessData($mat->getBlueprint()->manufacture($iMod, $totalNeeded));
         } else {
             $pdata->addMaterial($matID, $totalNeeded);
         }
     }
 }
开发者ID:draivsolregard,项目名称:lmeve-ci,代码行数:43,代码来源:Blueprint.php

示例10: function

});
$app->get('/trainers/:id/badges', function ($id) use($app) {
    $trainer = Trainer::getById($id);
    sendResponse($trainer->getBadges());
});
$app->get('/gyms', function () use($app) {
    sendResponse(Gym::getAll());
});
$app->get('/gyms/:id', function ($id) use($app) {
    $gym = Gym::getById($id);
    sendResponse($gym->serialize());
});
$app->get('/gyms/:id/leader', function ($id) use($app) {
    $gym = Gym::getById($id);
    sendResponse($gym->getLeader()->serialize());
});
$app->get('/types', function () use($app) {
    sendResponse(Type::getAll());
});
$app->get('/types/:id', function ($id) use($app) {
    $type = Type::getById($id);
    sendResponse($type->serialize());
});
$app->get('/badges', function () use($app) {
    sendResponse(Badge::getAll());
});
$app->get('/badges/:id', function ($id) use($app) {
    $badge = Badge::getById($id);
    sendResponse($badge->serialize());
});
$app->run();
开发者ID:EPICmynamesBG,项目名称:PokemonDB,代码行数:31,代码来源:index.php

示例11: printData

 /**
  * Prints data about this process.
  *
  * @param \iveeCore\IndustryModifier $buyContext for buying context
  * @param \iveeCore\IndustryModifier $sellContext for selling context, optional. If not given, $buyContext ist used.
  *
  * @return void
  */
 public function printData(IndustryModifier $buyContext, IndustryModifier $sellContext = null)
 {
     $utilClass = Config::getIveeClassName('Util');
     echo "Total Slot Time: " . $utilClass::secondsToReadable($this->getTotalTime()) . PHP_EOL;
     echo "Total Materials for " . $this->producesQuantity . "x " . Type::getById($this->producesTypeId)->getName() . ":" . PHP_EOL;
     //iterate over materials
     foreach ($this->getTotalMaterialMap()->getMaterials() as $typeId => $amount) {
         echo $amount . 'x ' . Type::getById($typeId)->getName() . PHP_EOL;
     }
     echo "Total Material Cost: " . $utilClass::quantitiesToReadable($this->getTotalMaterialBuyCost($buyContext)) . "ISK" . PHP_EOL;
     echo "Total Slot Cost: " . $utilClass::quantitiesToReadable($this->getTotalProcessCost()) . "ISK" . PHP_EOL;
     echo "Total Cost: " . $utilClass::quantitiesToReadable($this->getTotalCost($buyContext)) . "ISK" . PHP_EOL;
     try {
         echo "Total Profit: " . $utilClass::quantitiesToReadable($this->getTotalProfit($buyContext, $sellContext)) . "ISK" . PHP_EOL;
     } catch (Exceptions\NoPriceDataAvailableException $e) {
         echo "No profit calculation possible due to missing price data for product" . PHP_EOL;
     }
 }
开发者ID:Covert-Inferno,项目名称:iveeCore,代码行数:26,代码来源:ManufactureProcessData.php

示例12: printData

 /**
  * Prints data about this process.
  *
  * @param \iveeCore\IndustryModifier $buyContext for buying context
  * @param \iveeCore\IndustryModifier $sellContext for selling context, optional. If not given, $buyContext ist used.
  *
  * @return void
  */
 public function printData(IndustryModifier $buyContext, IndustryModifier $sellContext = null)
 {
     $utilClass = Config::getIveeClassName('Util');
     echo "Average total success times:" . PHP_EOL;
     print_r($this->getTotalSuccessTimes());
     echo "Average total success materials:" . PHP_EOL;
     foreach ($this->getTotalSuccessMaterialMap()->getMaterials() as $typeId => $amount) {
         echo $amount . 'x ' . Type::getById($typeId)->getName() . PHP_EOL;
     }
     echo "Total average success material cost: " . $utilClass::quantitiesToReadable($this->getTotalSuccessMaterialBuyCost($buyContext)) . "ISK" . PHP_EOL;
     echo "Total average success slot cost: " . $utilClass::quantitiesToReadable($this->getTotalSuccessProcessCost()) . "ISK" . PHP_EOL;
     echo "Total average success cost: " . $utilClass::quantitiesToReadable($this->getTotalSuccessCost($buyContext)) . "ISK" . PHP_EOL;
     echo "Total profit: " . $utilClass::quantitiesToReadable($this->getTotalProfit($buyContext, $sellContext)) . "ISK" . PHP_EOL;
 }
开发者ID:Covert-Inferno,项目名称:iveeCore,代码行数:22,代码来源:InventionProcessData.php

示例13: react

 /**
  * Produces an ReactionProcessData object detailing a reaction process for a given number of reaction cycles.
  *
  * @param \iveeCore\IndustryModifier $iMod as industry context
  * @param int|float $cycles defines the number of reaction cycles to be calculated. One cycle takes 1h to complete.
  * @param bool $reprocess defines reprocessable reaction outputs should be reprocessed in the process. Applies to
  * alchemy reaction.
  * @param bool $feedback defines if materials occuring in both input and output should be subtracted in the
  * possible numbers, thus showing the effective input/output materials. Applies to alchemy reactions.
  * @param int $recursionDepth defines the maximum number of reaction recursions
  *
  * @return \iveeCore\ReactionProcessData
  */
 public function react(IndustryModifier $iMod, $cycles = 1, $reprocess = true, $feedback = true, $recursionDepth = 0)
 {
     $reactionProcessDataClass = Config::getIveeClassName('ReactionProcessData');
     $materialMapClass = Config::getIveeClassName('MaterialMap');
     //get material input and output maps for one cycle
     $imm = $this->getCycleInputMaterialMap();
     $omm = $this->getCycleOutputMaterialMap();
     //if refine flag set, replace the refinable output materials by their refined materials
     if ($reprocess) {
         $omm->reprocessMaterials($iMod);
     }
     //if feedback flag set, subtract materials occurring in both input and output from each other, respecting
     //quantities. This gives the effective required and resulting materials.
     if ($feedback) {
         $materialMapClass::symmetricDifference($imm, $omm);
     }
     //multiply amounts by cycles as factor
     $imm->multiply($cycles);
     $omm->multiply($cycles);
     $rpd = new $reactionProcessDataClass($this->id, $imm, $omm, $iMod->getSolarSystem()->getId(), $cycles, $this->isAlchemy and $reprocess, $this->isAlchemy and $feedback);
     //if we are doing reaction recursion, replace ReactionProducts in input by their equivalent ReactionProcessData
     if ($recursionDepth > 0) {
         foreach ($imm->getMaterials() as $typeId => $quantity) {
             $mat = Type::getById($typeId);
             if ($mat instanceof ReactionProduct) {
                 $rpd->addSubProcessData($mat->doBestReaction($iMod, $quantity, $recursionDepth - 1));
                 $imm->subtractMaterial($typeId, $quantity);
             }
         }
     }
     return $rpd;
 }
开发者ID:Covert-Inferno,项目名称:iveeCore,代码行数:45,代码来源:Reaction.php

示例14: getMaterialSellValue

 /**
  * Returns material sell value, considering specific taxes. The best station (lowest tax) in system will be
  * chosen for that unless another preferred station is set on the IndustryModifier object.
  * Items that are not on the market will be ignored.
  *
  * @param \iveeCore\IndustryModifier $sellContext for market context
  *
  * @return float
  * @throws \iveeCore\Exceptions\PriceDataTooOldException if $maxPriceDataAge is exceeded by any of the materials
  */
 public function getMaterialSellValue(IndustryModifier $sellContext)
 {
     $sum = 0;
     foreach ($this->getMaterials() as $typeId => $amount) {
         $type = Type::getById($typeId);
         if (!$type->onMarket()) {
             continue;
         }
         if ($amount > 0) {
             $sum += $type->getMarketPrices($sellContext->getSolarSystem()->getRegionId(), $sellContext->getMaxPriceDataAge())->getSellPrice($sellContext->getMaxPriceDataAge()) * $amount * $sellContext->getSellTaxFactor();
         }
     }
     return $sum;
 }
开发者ID:Covert-Inferno,项目名称:iveeCore,代码行数:24,代码来源:MaterialMap.php


注:本文中的Type::getById方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。