/** * * @param string $id * @return \Arnapou\Toolbox\Http\Response */ public function routeImageGuild($id) { try { $client = SimpleClient::getInstance(); $guild = new Guild($client, $id); $url = $guild->getIconLinkGw2Png(); if ($url) { return FileVault::getVaultEmblems()->getResponse($url); } } catch (Exception $e) { } }
/** * * @param string $accesToken * @return GwAccount */ public static function getInstance($accesToken) { $lang = Translator::getInstance()->getLang(); $client = SimpleClient::getInstance($lang); $account = new self($client, $accesToken); if (!$account->hasPermission(self::PERMISSION_ACCOUNT)) { throw new MissingPermissionException(self::PERMISSION_ACCOUNT); } if (!$account->hasPermission(self::PERMISSION_CHARACTERS)) { throw new MissingPermissionException(self::PERMISSION_CHARACTERS); } return $account; }
/** * * @param integer $id * @param string $infusions * @param string $upgrades * @param string $skin * @param string $count * @return string */ public function routeTooltipItem($id, $infusions, $upgrades, $skin, $count) { return $this->routeTooltip('item', function () use($id, $infusions, $upgrades, $skin, $count) { $client = SimpleClient::getInstance($this->lang); $data = ['id' => $id]; if ($infusions) { $data['infusions'] = explode('-', substr($infusions, 5)); } if ($upgrades) { $data['upgrades'] = explode('-', substr($upgrades, 5)); } if ($skin) { $data['skin'] = substr($skin, 5); } if ($count) { $data['count'] = substr($count, 5); } $item = new InventorySlot($client, $data); return ['item' => $item]; }); }
<?php /* * This file is part of the Arnapou FileStore package. * * (c) Arnaud Buathier <*****@*****.**> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ include_once __DIR__ . '/../vendor/autoload.php'; Arnapou\GW2Tools\Service::getInstance(); use Arnapou\GW2Api\Core\RequestManager; use Arnapou\GW2Api\Model\Character; use Arnapou\GW2Tools\User; use Arnapou\GW2Tools\SimpleClient; use Arnapou\GW2Tools\Translator; /* * FORCE CACHE CHECKS */ foreach (Translator::getInstance()->getLangs() as $lang) { echo date('Y-m-d H:i:s') . ' ----- ' . $lang . " -----\n"; $simpleClient = SimpleClient::getInstance($lang, false); $simpleClient->getClientV2()->getRequestManager()->getEventListener()->bind(RequestManager::onRequest, function ($event) { echo date('Y-m-d H:i:s') . ' ' . round($event['time'], 3) . "s " . $event['uri'] . " \n"; }); foreach (['v2_colors', 'v2_currencies', 'v2_files', 'v2_items', 'v2_maps', 'v2_materials', 'v2_quaggans', 'v2_recipes', 'v2_skins', 'v2_specializations', 'v2_traits', 'v2_worlds'] as $api) { $ids = $simpleClient->{$api}(); $simpleClient->{$api}($ids); } }