/** * Retrieves data for a service from the SDK's service manifest file. * * Manifest data is stored statically, so it does not need to be loaded more * than once per process. The JSON data is also cached in opcache. * * @param string $service Case-insensitive namespace or endpoint prefix of the * service for which you are retrieving manifest data. * * @return array * @throws \InvalidArgumentException if the service is not supported. */ function manifest($service = null) { // Load the manifest and create aliases for lowercased namespaces static $manifest = []; static $aliases = []; if (empty($manifest)) { $manifest = load_compiled_json(__DIR__ . '/ressources/manifest.json'); foreach ($manifest as $endpoint => $info) { $alias = strtolower($info['namespace']); if ($alias !== $endpoint) { $aliases[$alias] = $endpoint; } } } // If no service specified, then return the whole manifest. if ($service === null) { return $manifest; } // Look up the service's info in the manifest data. $service = strtolower($service); if (isset($manifest[$service])) { return $manifest[$service] + ['endpoint' => $service]; } elseif (isset($aliases[$service])) { return manifest($aliases[$service]); } else { throw new \InvalidArgumentException("The service \"{$service}\" is not provided by the VWS SDK for PHP."); } }
protected function gBossSkulls() { $skulls = []; foreach ($this->properties['bossSkulls'] as $skull) { $skulls[] = manifest()->scriptedSkull($skull); } return $skulls; }
protected function gSkulls(array $skulls) { $array = []; foreach ($skulls as $skullHash) { $array[] = manifest()->scriptedSkull($skullHash); } return $array; }
public function __construct(array $properties) { $properties['definition'] = manifest()->activity($properties['activityHash']); $properties['activityData'] = new ActivityData($properties['activityData']); if (isset($properties['extended']['rounds'])) { $rounds = []; foreach ($properties['extended']['rounds'] as $k => $round) { $round = new ArenaRound($this, $round); $round->roundNumber = $k + 1; $rounds[$round->roundNumber] = $round; } $properties['rounds'] = $rounds; } if (isset($properties['rewards'])) { $rewards = []; foreach ($properties['rewards'] as $rewardGroup) { foreach ($rewardGroup['rewardItems'] as $item) { if (!in_array($item['itemHash'], $this->skippedRewards)) { $rewards[] = new Reward($properties['activityData']->displayLevel, $item); } } } $properties['rewards'] = $rewards; } if (isset($properties['extended']['skullCategories'])) { $skulls = []; foreach ($properties['extended']['skullCategories'] as $skullCategory) { foreach ($skullCategory['skulls'] as $skull) { $skull = new SkullModifier($skull); $skull->isModifier = $skullCategory['title'] === "Modifiers"; $skulls[] = $skull; } } $properties['skulls'] = $skulls; } if (isset($properties['skullCategories'])) { $skulls = []; foreach ($properties['skullCategories'] as $skullCategory) { foreach ($skullCategory['skulls'] as $skull) { $skull = new SkullModifier($skull); $skull->isModifier = $skullCategory['title'] === "Modifiers"; $skulls[] = $skull; } } // Add heroic skull if HM if ($properties['tierDisplayName'] === "Hard") { $skulls[] = $properties['definition']->skulls->first(); } $properties['skulls'] = $skulls; $this->raid = true; } if (isset($properties['completion'])) { $properties['completion'] = new Completion($properties['completion']); } parent::__construct($properties); }
public function __construct(array $properties) { if (isset($properties['saleItems']) && is_array($properties['saleItems'])) { $items = []; foreach ($properties['saleItems'] as $saleItem) { $items[] = manifest()->inventoryItem($saleItem['item']['itemHash']); } $properties['items'] = $items; } parent::__construct($properties); }
public function __construct(Advisors $advisors, array $properties) { if (isset($properties['extended']['orders'])) { $items = []; foreach ($properties['extended']['orders'] as $order) { $items[] = manifest()->inventoryItem($order['item']['itemHash']); } $properties['weapons'] = $items; } parent::__construct($properties); }
protected function gDaily() { if (empty($this->dailyChapterHashes)) { return null; } $activity = new Advisors\Activity($this, manifest()->activity($this->dailyChapterHashes[0]), $this->dailyChapterResetDate); foreach ($this->dailyChapterHashes as $activityHash) { $activity->addLevelRewards(manifest()->activity($activityHash)); } return $activity; }
public function __construct(Character $character, array $properties) { $items = []; foreach (array_get($properties, 'items', null) as $property) { $hash = (string) $property['itemHash']; $definition = manifest()->inventoryItem($hash); $property = array_merge($property, $definition->getProperties()); $items['buckets'][$property['bucketHash']] = new InventoryItem(new InventoryBucket($this, $properties), $property); } parent::__construct($items); $this->character = $character; }
public static function getArguments() { $args = array_intersect_key(ClientResolver::getDefaultArguments(), ['service' => true, 'region' => true]); $args['region']['required'] = false; return $args + ['client_factory' => ['type' => 'config', 'valid' => ['callable'], 'doc' => 'A callable that takes an array of client' . ' configuration arguments and returns a regionalized' . ' client.', 'required' => true, 'internal' => true, 'default' => function (array $args) { $namespace = manifest($args['service'])['namespace']; $klass = "Aws\\{$namespace}\\{$namespace}Client"; $region = isset($args['region']) ? $args['region'] : null; return function (array $args) use($klass, $region) { if ($region && empty($args['region'])) { $args['region'] = $region; } return new $klass($args); }; }]]; }
public function __construct(Advisors $advisors, array $properties) { $bounties = []; foreach ($properties['bountyHashes'] as $bountyHash) { $bounties[] = manifest()->inventoryItem($bountyHash); } $properties['bounties'] = $bounties; $winDetails = []; if (isset($properties['extended']['winRewardDetails'])) { foreach ($properties['extended']['winRewardDetails'] as $winRewardDetail) { foreach ($winRewardDetail['rewardItemHashes'] as $itemHash) { $winDetails[$winRewardDetail['winCount']][] = manifest()->inventoryItem($itemHash); } } } $properties['winRewards'] = $winDetails; parent::__construct($properties); }
public function __construct(Character $character, array $properties) { $definition = manifest()->progression($properties['progressionHash']); $properties = array_merge($properties, $definition->getProperties()); parent::__construct($properties); $this->character = $character; if ($this->name == self::WEEKLY_PVE || $this->name == self::WEEKLY_PVP) { if (!$character->playedAfterWeeklyReset) { $this->level = 0; } $this->nextLevelAt = count($this->steps); $this->progressToNextLevel = $this->level; } $this->percentToNextLevel = $this->nextLevelAt ? $this->progressToNextLevel / $this->nextLevelAt * 100 : 100; $this->percentLabel = sprintf("%d / %d", $this->progressToNextLevel, $this->nextLevelAt); if ($this->isMaxed()) { $this->percentToNextLevel = 100; $this->percentLabel = 'MAX'; } }
protected function gPlace() { return manifest()->place($this->placeHash); }
protected function gDestination() { return manifest()->destination($this->display->destinationHash); }
public function __construct(ActivityLevel $level, array $properties) { parent::__construct($properties); $this->extend(manifest()->inventoryItem($this->itemHash)); $this->activityLevel = $level; }
protected function gDamage() { if (empty($this->primaryStat)) { return 0; } $stat = manifest()->stat($this->primaryStat['statHash']); if ($stat->statIdentifier == 'STAT_DAMAGE') { return $this->primaryStat['value']; } return 0; }
public function __construct(Character $character, array $activities, array $pves, array $stats) { $this->character = $character; $this->dateActivityStarted = carbon($activities['dateActivityStarted']); $lastReset = last_weekly(); $nextReset = next_weekly(); // raid, arena and nightfall completion status $raidsCompleted = []; $arenasCompleted = []; $activitiesCompleted = []; // need advisors to identify daily $this->dailyChapter = destiny()->advisors()->daily; foreach ($pves as $pve) { $activityHash = (string) $pve['activityDetails']['referenceId']; $activity = manifest()->activity($activityHash); $activityId = sha1($activity->activityName); $activityType = $activity->activityType; $completed = (bool) array_get($pve, 'values.completed.basic.value', false); $date = carbon($pve['period']); if ($activityType->isRaid()) { $activityLevel = $activity->activityLevel; if (!isset($raidsCompleted[$activityId])) { $raidsCompleted[$activityId] = null; } if ($completed && $date > $lastReset && $date < $nextReset) { if ($activityLevel > $raidsCompleted[$activityId]) { $raidsCompleted[$activityId] = $activityLevel; } } } if ($activityType->isArena()) { if (!array_key_exists($activityHash, $arenasCompleted)) { $arenasCompleted[$activityHash] = false; } if ($completed && $date > $lastReset && $date < $nextReset) { $arenasCompleted[$activityHash] = $completed; } } if ($activityType->isNightfall()) { $nightfallHash = $activity->activityType->activityTypeHash; if (!array_key_exists($nightfallHash, $activitiesCompleted)) { $activitiesCompleted[$nightfallHash] = false; } if ($completed && $date > $lastReset && $date < $nextReset) { $activitiesCompleted[$nightfallHash] = $completed; } } if ($activityHash == $this->dailyChapter->activityHash) { if (!array_key_exists($activityHash, $activitiesCompleted)) { $activitiesCompleted[$activityHash] = false; } if ($completed && $date > last_daily() && $date < next_daily()) { $activitiesCompleted[$activityHash] = $completed; } } } // stats grouped by activity hash $statsArray = []; foreach ($stats as $k => $stat) { $activityHash = (string) $stat['activityHash']; $statsArray[$activityHash] = new StatisticsCollection($stat['values']); } // build ActivityCollection foreach ($activities['available'] as $activity) { $activityHash = (string) $activity['activityHash']; $activityStats = array_get($statsArray, $activityHash); $activity = new Activity($character, $activity, $activityStats); $activityId = sha1($activity->activityName); if ($activity->isCompleted && $activity->isWeekly()) { $activity->isCompleted = $character->dateLastPlayed > last_weekly(); } $this->put($activityHash, $activity); if ($activity->isRaid()) { $activity->isCompleted = false; $activityLevelCompleted = array_get($raidsCompleted, $activityId); if (!$activityLevelCompleted) { continue; } if ($activity->activityLevel <= $activityLevelCompleted) { $activity->isCompleted = true; } } if ($activity->isArena()) { $activity->isCompleted = array_get($arenasCompleted, $activityHash, false); } if ($activity->isNightfall()) { $activity->isCompleted = array_get($activitiesCompleted, $activity->activityType->activityTypeHash, false); } if ($activityHash == $this->dailyChapter->activityHash) { $activity->isCompleted = array_get($activitiesCompleted, $activityHash, false); } } }
public function __construct(array $properties) { $definition = manifest()->specialEvent($properties['eventHash']); $properties = array_merge($properties, $definition->getProperties()); parent::__construct($properties); }
public function gFaction() { return manifest()->faction($this->factionHash); }
public function __construct(array $properties) { parent::__construct($properties); $this->definition = manifest()->sandboxPerk($this->perkHash); }
foreach ($_GPC['settings']['variables'] as $key => $value) { $temp = array(); if (!empty($_GPC['settings']['variables'][$key]) && preg_match('/^[a-z\\d]+$/i', $_GPC['settings']['variables'][$key])) { if (!empty($_GPC['settings']['description'][$key])) { $temp['variable'] = $_GPC['settings']['variables'][$key]; $temp['value'] = $_GPC['settings']['values'][$key]; $temp['desc'] = $_GPC['settings']['description'][$key]; $t['settings'][] = $temp; } } } } if ($_FILES['preview'] && $_FILES['preview']['error'] == '0' && !empty($_FILES['preview']['tmp_name'])) { $t['preview'] = $_FILES['preview']['tmp_name']; } $manifest = manifest($t); load()->func('file'); if ($_GPC['method'] == 'create') { $tpldir = IA_ROOT . '/app/themes/' . strtolower($t['template']['identifie']); if (is_dir($tpldir)) { message('模板目录' . $tpldir . '已存在,请更换模板标识还删除已存在模板'); } mkdirs($tpldir); file_put_contents("{$tpldir}/manifest.xml", $manifest); if (!empty($t['preview'])) { file_move($t['preview'], "{$tpldir}/preview.jpg"); } message('模板生成成功,请访问' . $tpldir . '目录进行查看', referer(), 'success'); exit; } if ($_GPC['method'] == 'download') {
/** * Determine the endpoint prefix from a client namespace. * * @param string $name Namespace name * * @return string * @internal * @deprecated Use the `\Aws\manifest()` function instead. */ public static function getEndpointPrefix($name) { return manifest($name)['endpoint']; }
protected function gDefinition() { return manifest()->inventoryBucket($this->bucketHash); }
protected function gDefinition() { return manifest()->activity($this->activityHash); }
<?php require dirname(__DIR__) . '/vendor/autoload.php'; ?> <!doctype html> <html class="no-js" lang=""> <head> <meta charset="utf-8"> <meta http-equiv="x-ua-compatible" content="ie=edge"> <title>this</title> <meta name="description" content=""> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="apple-touch-icon" href="apple-touch-icon.png"> <link rel="stylesheet" href="<?php echo manifest('css/app.css'); ?> "> </head> <body> this </body> </html>
protected function gDefinition() { return manifest()->historicalStats($this->statId); }
public function __construct(array $properties) { $definition = manifest()->stat($properties['statHash']); $properties = array_merge($definition->getProperties(), $properties); parent::__construct($properties); }
foreach ($_GPC['versions'] as $ver) { if (in_array($ver, $versions)) { $m['versions'][] = $ver; } } } $m['install'] = trim($_GPC['install']); $m['uninstall'] = trim($_GPC['uninstall']); $m['upgrade'] = trim($_GPC['upgrade']); if ($_FILES['icon'] && $_FILES['icon']['error'] == '0' && !empty($_FILES['icon']['tmp_name'])) { $m['icon'] = $_FILES['icon']['tmp_name']; } if ($_FILES['preview'] && $_FILES['preview']['error'] == '0' && !empty($_FILES['preview']['tmp_name'])) { $m['preview'] = $_FILES['preview']['tmp_name']; } $manifest = manifest($m); $mDefine = define_module($m); $pDefine = define_processor($m); $rDefine = define_receiver($m); $sDefine = define_site($m); $ident = strtolower($m['application']['identifie']); if ($_GPC['method'] == 'create') { $mRoot = IA_ROOT . "/source/modules/{$ident}"; if (file_exists($mRoot)) { message("目标位置 {$mRoot} 已存在, 请更换标识或删除现有内容. "); } mkdirs($mRoot); f_write("{$mRoot}/manifest.xml", $manifest); if ($mDefine) { f_write("{$mRoot}/module.php", $mDefine); }
protected function gGender() { $gender = manifest()->gender($this->genderHash); return $gender->genderName; }
protected function gDefinition() { return manifest()->grimoireCard($this->cardId); }
protected function gDefinitions() { return manifest()->grimoire(); }