From 2299aa4718ab869326cdc4dd155ee9d4c1886b2f Mon Sep 17 00:00:00 2001 From: Shadez Date: Sun, 20 Jun 2010 21:04:43 +0900 Subject: [PATCH] [252] Allow to search for heirloom items --- includes/classes/class.search.php | 14 ++++++++++++-- search.php | 7 +++++-- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/includes/classes/class.search.php b/includes/classes/class.search.php index 90850fff4..cabaf5bd0 100644 --- a/includes/classes/class.search.php +++ b/includes/classes/class.search.php @@ -3,7 +3,7 @@ /** * @package World of Warcraft Armory * @version Release Candidate 1 - * @revision 251 + * @revision 252 * @copyright (c) 2009-2010 Shadez * @license http://opensource.org/licenses/gpl-license.php GNU Public License * @@ -27,10 +27,11 @@ public $get_array; public $bossSearchKey; public $instanceSearchKey; + public $heirloom = false; private $boss_loot_ids; public function DoSearchItems($count = false, $findUpgrade = false) { - if(!$this->searchQuery && !$findUpgrade) { + if(!$this->searchQuery && !$findUpgrade && !$this->heirloom) { $this->Log()->writeError('%s : unable to start search: no data provided', __METHOD__); return false; } @@ -52,6 +53,9 @@ public function DoSearchItems($count = false, $findUpgrade = false) { $sql_query = sprintf("SELECT COUNT(`entry`) FROM `item_template` WHERE `class`=%d AND `subclass`=%d AND `InventoryType`=%d AND `Quality` >= %d AND `ItemLevel` >= %d", $source_item_data['class'], $source_item_data['subclass'], $source_item_data['InventoryType'], $source_item_data['Quality'], $source_item_data['ItemLevel']); $count_items = $this->wDB->selectCell($sql_query); } + elseif($this->heirloom == true) { + $count_items = $this->wDB->selectCell("SELECT COUNT(`entry`) FROM `item_template` WHERE `Quality`=7"); + } else { if($this->_loc == 0) { $count_items = $this->wDB->selectCell("SELECT COUNT(`entry`) FROM `item_template` WHERE `name` LIKE ?", '%'.$this->searchQuery.'%'); @@ -69,6 +73,9 @@ public function DoSearchItems($count = false, $findUpgrade = false) { $sql_query = sprintf("SELECT `entry` AS `id`, `name`, `ItemLevel`, `Quality` AS `rarity`, `displayid`, `bonding`, `flags`, `duration` FROM `item_template` WHERE `class`=%d AND `subclass`=%d AND `InventoryType`=%d AND `Quality` >= %d AND `ItemLevel` >= %d ORDER BY `ItemLevel` DESC LIMIT 200", $source_item_data['class'], $source_item_data['subclass'], $source_item_data['InventoryType'], $source_item_data['Quality'], $source_item_data['ItemLevel']); $items = $this->wDB->select($sql_query); } + elseif($this->heirloom == true) { + $items = $this->wDB->select("SELECT `entry` AS `id`, `name`, `ItemLevel`, `Quality` AS `rarity`, `displayid`, `bonding`, `flags`, `duration` FROM `item_template` WHERE `Quality`=7 ORDER BY `ItemLevel` DESC LIMIT 200"); + } else { if($this->_loc == 0) { $items = $this->wDB->select("SELECT `entry` AS `id`, `name`, `ItemLevel`, `Quality` AS `rarity`, `displayid`, `bonding`, `flags`, `duration` FROM `item_template` WHERE `name` LIKE ? ORDER BY `ItemLevel` DESC LIMIT 200", '%'.$this->searchQuery.'%'); @@ -97,6 +104,9 @@ public function DoSearchItems($count = false, $findUpgrade = false) { array('name' => 'itemLevel', 'value' => $item['ItemLevel']), array('name' => 'relevance', 'value' => 100) ); + if($this->heirloom == true) { + $result_data[$i]['filters'][2] = array('name' => 'source', 'value' => 'sourceType.vendor'); + } $i++; unset($result_data[$i]['data']['ItemLevel']); } diff --git a/search.php b/search.php index 2d5d583c7..80ac5dfbd 100644 --- a/search.php +++ b/search.php @@ -3,7 +3,7 @@ /** * @package World of Warcraft Armory * @version Release Candidate 1 - * @revision 243 + * @revision 252 * @copyright (c) 2009-2010 Shadez * @license http://opensource.org/licenses/gpl-license.php GNU Public License * @@ -44,7 +44,10 @@ $findGearUpgrade = true; $itemID = (int) $_GET['pi']; } -if(!isset($_GET['searchQuery']) && !isset($_GET['source']) && !isset($_GET['pi'])) { +if(isset($_GET['rrt']) && $_GET['rrt'] == 'hm') { + $search->heirloom = true; +} +if(!isset($_GET['searchQuery']) && !isset($_GET['source']) && !isset($_GET['pi']) && !isset($_GET['rrt'])) { $xml->LoadXSLT('error/error.xsl'); $xml->XMLWriter()->startElement('page'); $xml->XMLWriter()->writeAttribute('globalSearch', 1);