Beispiel #1
0
 public function setTranslatorUrl($url)
 {
     $this->translator->setUrl($url);
 }
Beispiel #2
0
 /**
  * @return bool
  * @throws Helpers\Network\BungieOfflineException
  */
 public function getXurData()
 {
     $key = 'xur';
     if (Cache::has($key)) {
         return Cache::get($key);
     } else {
         $url = Constants::$xurData;
         $json = $this->getJson($url);
         if (!isset($json['Response']['data'])) {
             return false;
             // no xur data
         } else {
             $translator = new Hashes();
             $translator->setUrl($url);
             $items = '<strong>Xur Items</strong><br/><br />';
             foreach ($json['Response']['data']['saleItemCategories'] as $category) {
                 if ($category['categoryTitle'] == "Exotic Gear") {
                     foreach ($category['saleItems'] as $item) {
                         if (isset($item['item']['stats']) && count($item['item']['stats']) > 0) {
                             $items .= "<strong>" . $translator->map($item['item']['itemHash'], true) . '</strong>' . ' - <a href="' . $this->getItemUrl($item['item']['itemHash']) . '">url' . '</a><br />';
                             foreach ($item['item']['stats'] as $stat) {
                                 if ($stat['value'] != 0) {
                                     $items .= '  -->' . $translator->map($stat['statHash'], true) . ": " . number_format($stat['value']) . "<br />";
                                 }
                             }
                             $items .= '<br />';
                         }
                     }
                 }
             }
             Cache::put($key, $items, 120);
             return $items;
         }
     }
 }