本文整理汇总了PHP中Extension::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Extension::get方法的具体用法?PHP Extension::get怎么用?PHP Extension::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Extension
的用法示例。
在下文中一共展示了Extension::get方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: generate
public function generate($ext, $upool)
{
// Creation by daemon
// Generate content
$ext_obj = Extension::get($ext);
if ($ext_obj == null) {
$this->tournament->say("Extension {$ext} not found in booster generation");
return false;
}
$this->fullcontent = $ext_obj->booster($upool);
$this->summarize();
$this->insert();
}
示例2: register
/**
* Register component
*/
public function register($base_path)
{
if (!file_exists($base_path) && !is_dir($base_path)) {
throw new ExtensionException(sprintf('path %s not exists', $base_path));
}
if (!isset($this->base_path)) {
$this->base_path = $base_path;
}
$this->component = basename($base_path);
$this->component_name = $this->component;
$this->registerLanguage();
$this->registerFiles(['model', 'view', 'controller', 'table'], $base_path);
$this->registerRoutes();
$this->includeInitialize();
if ($this->base_path == $base_path) {
$pluginArchitecture = Extension::get('plugin');
$pluginArchitecture->register($this->base_path);
}
$hmvc_base_path = $base_path . DIRECTORY_SEPARATOR . 'components';
if (file_exists($hmvc_base_path) && is_dir($hmvc_base_path)) {
$this->register($hmvc_base_path);
}
}
示例3: booster
public function booster(&$upool)
{
$this->get_cards();
$nb_c = $this->get_data('c', 0);
$nb_u = $this->get_data('u', 0);
$nb_r = $this->get_data('r', 0);
$nb_l = $this->get_data('l', 0);
$result = array();
// Booster is generated in reverse order, as foils or transform take a common slot
// land
if (array_key_exists('L', $this->cards_rarity)) {
for ($i = 0; $i < $nb_l; $i++) {
$this->rand_card($this->cards_rarity['L'], $result, $upool);
}
} else {
$nb_c += $nb_l;
}
// foil (break unicity)
global $proba_foil;
if ($nb_c > 0 && !$this->get_data('uniq', false) && rand(1, $proba_foil) == 1) {
$nb_c--;
$this->rand_card($this->cards, $result, $upool);
}
// timeshifted (for TSP)
if ($nb_c > 0 && $this->get_data('timeshift', false)) {
$ext = Extension::get('TSB');
$ext->get_cards();
if (array_key_exists('S', $ext->cards_rarity)) {
$nb_c--;
$this->rand_card($ext->cards_rarity['S'], $result, $upool);
} else {
echo "No timeShift found";
}
}
// transformable (for ISD/DKA)
if ($nb_c > 0 && $this->get_data('transform', false)) {
$r = '';
// Transform rarity
$n = rand(1, 14);
if ($n > 13) {
$r = Extension::r_or_m($this->cards_tr);
} elseif ($n > 10) {
$r = 'U';
} else {
$r = 'C';
}
if (array_key_exists($r, $this->cards_tr)) {
$nb_c--;
$this->rand_card($this->cards_tr[$r], $result, $upool);
}
}
// rare or mythic
if (array_key_exists('R', $this->cards_rarity) || array_key_exists('M', $this->cards_rarity)) {
for ($i = 0; $i < $nb_r; $i++) {
$this->rand_card($this->cards_rarity[Extension::r_or_m($this->cards_rarity)], $result, $upool);
}
} else {
$nb_c += $nb_r;
}
// uncommons
if (array_key_exists('U', $this->cards_rarity)) {
for ($i = 0; $i < $nb_u; $i++) {
$this->rand_card($this->cards_rarity['U'], $result, $upool);
}
} else {
$nb_c += $nb_u;
}
// commons (after all other exceptions have been managed)
if (array_key_exists('C', $this->cards_rarity) && count($this->cards_rarity['C']) >= $nb_c) {
for ($i = 0; $i < $nb_c; $i++) {
$this->rand_card($this->cards_rarity['C'], $result, $upool);
}
} else {
if ($nb_c > 0) {
echo 'Not enough commons leftin ext ' . $ext . " ({$nb_c}/" . count($cards['C']) . ")\n";
}
}
return $result;
}
示例4: begin
public function begin()
{
// Launch first step for tournament (draft, build ...)
// DB
shuffle($this->players);
// Give random numbers to players
foreach ($this->players as $i => $player) {
$player->insert($i);
}
// And store them now we're sure to start
// TS3
if ($this->observer->ts3) {
ts3_co();
$cid = ts3_chan('Tournament ' . $this->id, $this->name);
// Create chan
ts3_invite($this->players, $cid);
// Move each tournament's player to chan
ts3_disco();
}
// Unicity
$upool = array();
// All cards in current tournament's players pools
//that comes from a "uniq" extension
switch ($this->format) {
case 'draft':
$number = 0;
foreach ($this->data->boosters as $ext) {
$number++;
// Number of current booster in draft for player
//$booster = null ;
foreach ($this->players as $player) {
//if ( ( $booster == null ) || ! $this->data->clone_sealed ) {
$booster = new Booster($this, $player->order, $number);
$booster->generate($ext, $upool);
/*} else {
$boost = new Booster($this, $player->order, $number) ;
$boost->get_content($booster->content) ;
$boost->insert() ;
}*/
$this->boosters[] = $booster;
}
}
$this->set_status(3);
$this->timer_goon(Tournament::draft_time());
$this->log('', 'draft', '');
break;
case 'sealed':
foreach ($this->data->boosters as $ext) {
$ext_obj = Extension::get($ext);
if ($ext_obj == null) {
$this->say("Extension {$ext} not found in sealed generation");
continue;
}
$booster = null;
foreach ($this->players as $player) {
if ($booster == null || !$this->data->clone_sealed) {
$booster = $ext_obj->booster($upool);
}
// Only need object in memory for sealed
foreach ($booster as $card) {
$player->pick($card);
}
}
}
foreach ($this->players as $player) {
$player->summarize(true);
}
$this->build();
break;
default:
$this->start();
}
}
示例5: fill_cache
static function fill_cache()
{
Card::$cache = array();
global $db_cards;
$raw = $db_cards->select("SELECT * FROM `card` ORDER BY `id` DESC");
$links = 0;
foreach ($raw as $card) {
$card = new Card($card);
foreach ($card->extensions as $ext) {
$links++;
$extension = Extension::get($ext->se);
if ($extension == null) {
echo "Extension {$ext->se} not found for {$card->name}\n";
} else {
$extension->add_card($card, $ext->rarity);
}
}
Card::$cache[] = $card;
}
return $links;
}