Ejemplo n.º 1
0
 public function parse($name)
 {
     global $phpbb_root_path, $phpEx;
     if (trim($name) == '') {
         return false;
     }
     if (!class_exists('bbtips_cache')) {
         require $phpbb_root_path . 'includes/bbdkp/bbtips/dbal.' . $phpEx;
     }
     $cache = new bbtips_cache();
     if (!($result = $cache->getObject($name, 'achievement', $this->lang))) {
         // not in cache
         if (is_numeric($name)) {
             $result = $this->_getAchievementByID($name);
         } else {
             $result = $this->_getAchievementByName($name);
         }
         if (!$result) {
             // not found
             return $this->NotFound('achievement', $name);
         } else {
             $cache->saveObject($result);
             return $this->_generateHTML($result, 'achievement');
         }
     } else {
         return $this->_generateHTML($result, 'achievement');
     }
 }
Ejemplo n.º 2
0
 /**
  * Parses information
  * @access public
  **/
 function parse($name)
 {
     global $phpbb_root_path, $phpEx;
     if (trim($name) == '') {
         return false;
     }
     if (!class_exists('bbtips_cache')) {
         require $phpbb_root_path . 'includes/bbdkp/bbtips/dbal.' . $phpEx;
     }
     $cache = new bbtips_cache();
     $rank = !array_key_exists('rank', $this->args) ? '' : $this->args['rank'];
     if (!($result = $cache->getObject($name, 'spell', $this->lang, $rank))) {
         if (is_numeric($name)) {
             $result = $this->_getSpellByID($name);
         } else {
             $result = $this->_getSpellByName($name, $rank);
         }
         if (!$result) {
             return $this->NotFound('spell', $name);
         } else {
             $cache->saveObject($result);
             return $this->_generateHTML($result, 'spell', '');
         }
     } else {
         return $this->_generateHTML($result, 'spell', '', $rank);
     }
 }
Ejemplo n.º 3
0
 /**
  * Parses Items
  *
  * @access public
  **/
 public function parse($name)
 {
     global $config, $phpEx, $phpbb_root_path;
     if (trim($name) == '') {
         return false;
     }
     if (!class_exists('bbtips_cache')) {
         require $phpbb_root_path . 'includes/bbdkp/bbtips/dbal.' . $phpEx;
     }
     $cache = new bbtips_cache();
     // check if its already in the cache
     if (!($result = $cache->getObject($name, $this->type, $this->lang, '', $this->size))) {
         //xmlsearch
         $bonus_args = '';
         if (array_key_exists('bonus', $this->args)) {
             $bonus_args = '&bonus=' . $this->args['bonus'];
         }
         $result = $this->_getItembyXML($name . $bonus_args);
         //if no result, try scraping json
         if (!$result) {
             //json search
             $result = $this->_getItemByName($name);
             if (!$result) {
                 //try without enchant
                 $pattern = "( of the)[ A-Za-z0123456789]";
                 $unenchanted = split($pattern, $name);
                 if ($unenchanted) {
                     $result = $this->_getItemByName($unenchanted[0]);
                 }
             }
         }
         if (!$result) {
             // item not found
             return $this->NotFound($this->type, $name);
         } else {
             //insert
             $cache->saveObject($result);
             if (array_key_exists('gems', $this->args) || array_key_exists('enchant', $this->args)) {
                 $enhance = $this->_buildEnhancement($this->args);
                 return $this->_generateHTML($result, $enhance);
             } else {
                 return $this->_generateHTML($result);
             }
         }
     } else {
         $this->name = (string) $result['name'];
         $this->search_name = (string) $result['search_name'];
         $this->itemid = (string) $result['itemid'];
         $this->quality = (string) $result['quality'];
         $this->icon = (string) $result['icon'];
         // already in db
         if (array_key_exists('gems', $this->args) || array_key_exists('enchant', $this->args)) {
             $enhance = $this->_buildEnhancement($this->args);
             return $this->_generateHTML($result, $enhance);
         } else {
             return $this->_generateHTML($result);
         }
     }
 }