Skip to content

Commit

Permalink
[252] Allow to search for heirloom items
Browse files Browse the repository at this point in the history
  • Loading branch information
Shadez committed Jun 20, 2010
1 parent c0c0cb2 commit 2299aa4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
14 changes: 12 additions & 2 deletions includes/classes/class.search.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand All @@ -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;
}
Expand All @@ -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.'%');
Expand All @@ -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.'%');
Expand Down Expand Up @@ -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']);
}
Expand Down
7 changes: 5 additions & 2 deletions search.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 2299aa4

Please sign in to comment.