本文整理汇总了PHP中Type::getGroupID方法的典型用法代码示例。如果您正苦于以下问题:PHP Type::getGroupID方法的具体用法?PHP Type::getGroupID怎么用?PHP Type::getGroupID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Type
的用法示例。
在下文中一共展示了Type::getGroupID方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getBestTeamForActivity
/**
* Gets the best compatible Team for the activity and Type.
* Bonuses are ranked as material bonus > time bonus > cost bonus
*
* @param int $activityID the ID of the activity to get Team for
* @param Type $type It's always the final output item that needs to be given. This means that for manufacturing,
* its the Blueprint product; for copying its the Blueprint itself; for invention it is the product of the
* invented blueprint.
*
* @return Team|null
*/
public function getBestTeamForActivity($activityID, Type $type)
{
$bestTeam = null;
$bestModifier = null;
try {
//get available teams for the wanted activity
$teams = $this->getTeamsForActivity($activityID);
} catch (Exceptions\ActivityIdNotFoundException $e) {
return null;
}
foreach ($teams as $candidateTeam) {
//skip teams incompatible with output groupID
if (!$candidateTeam->isGroupIDCompatible($type->getGroupID())) {
continue;
} elseif (is_null($bestTeam)) {
$bestTeam = $candidateTeam;
$bestModifier = $candidateTeam->getModifiersForGroupID($type->getGroupID());
} else {
$candidateModifier = $candidateTeam->getModifiersForGroupID($type->getGroupID());
//Modifiers are ranked with priority order for material, time then cost modifiers (lower is better!)
if ($bestModifier['m'] < $candidateModifier['m']) {
continue;
} elseif ($bestModifier['m'] > $candidateModifier['m']) {
$bestTeam = $candidateTeam;
$bestModifier = $candidateModifier;
} elseif ($bestModifier['t'] < $candidateModifier['t']) {
continue;
} elseif ($bestModifier['t'] > $candidateModifier['t']) {
$bestTeam = $candidateTeam;
$bestModifier = $candidateModifier;
} elseif ($bestModifier['c'] < $candidateModifier['c']) {
continue;
} elseif ($bestModifier['c'] > $candidateModifier['c']) {
$bestTeam = $candidateTeam;
$bestModifier = $candidateModifier;
}
}
}
return $bestTeam;
}
示例2: isTypeCompatible
/**
* Checks if the Team gives bonus to given Type
*
* @param \iveeCore\Type $type to be checked
*
* @return bool
*/
public function isTypeCompatible(Type $type)
{
return $this->isGroupIDCompatible($type->getGroupID());
}
示例3: isTypeCompatible
/**
* Checks if a Type is compatible with the AssemblyLine. The passed Type should be the final product of the process.
* This means that for manufacturing, its the Blueprint product; for copying its the Blueprint itself; for invention
* it is the product of the invented blueprint.
*
* @param Type $type the item to be checked
*
* @return bool
*/
public function isTypeCompatible(Type $type)
{
//the type is compatible if its groupID or categoryID is listet in the modifiers array
return isset($this->groupModifiers[$type->getGroupID()]) or isset($this->categoryModifiers[$type->getCategoryID()]);
}