Skip to content

Commit

Permalink
[265] Properly display itemset pieces (with currently equipped on cha…
Browse files Browse the repository at this point in the history
…racter); replaced Blizzard`s item placeholders with actual itemset pieces IDs
  • Loading branch information
Shadez committed Jun 24, 2010
1 parent 940443f commit e9ceb90
Show file tree
Hide file tree
Showing 4 changed files with 245 additions and 12 deletions.
6 changes: 3 additions & 3 deletions includes/armory_loader.php
Expand Up @@ -3,7 +3,7 @@
/**
* @package World of Warcraft Armory
* @version Release Candidate 1
* @revision 263
* @revision 265
* @copyright (c) 2009-2010 Shadez
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
Expand All @@ -30,8 +30,8 @@
if(!@include('classes/class.connector.php')) {
die('<b>Error:</b> can not load connector class!');
}
define('DB_VERSION', 'armory_r263');
define('ARMORY_REVISION', 263);
define('DB_VERSION', 'armory_r265');
define('ARMORY_REVISION', 265);
$armory = new Connector();
/* Check DbVersion */
$dbVersion = $armory->aDB->selectCell("SELECT `version` FROM `armory_db_version`");
Expand Down
31 changes: 30 additions & 1 deletion includes/classes/class.characters.php
Expand Up @@ -3,7 +3,7 @@
/**
* @package World of Warcraft Armory
* @version Release Candidate 1
* @revision 258
* @revision 265
* @copyright (c) 2009-2010 Shadez
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
Expand Down Expand Up @@ -148,6 +148,11 @@
**/
private $raceText = false;

/**
* Equipped item IDs
**/
private $equipmentCache = false;

/**
* Database handler
**/
Expand Down Expand Up @@ -208,6 +213,7 @@ public function BuildCharacter($name, $realmId = 1) {
`characters`.`power1`,
`characters`.`power2`,
`characters`.`power3`,
`characters`.`equipmentCache`,
`guild_member`.`guildid` AS `guild_id`,
`guild`.`name` AS `guild_name`
FROM `characters` AS `characters`
Expand Down Expand Up @@ -302,6 +308,19 @@ public function BuildCharacter($name, $realmId = 1) {
$this->realmName = $realm_info['name'];
$this->realmID = $realm_info['id'];
unset($realm_info);
$this->__HandleEquipmentCacheData();
return true;
}

private function __HandleEquipmentCacheData() {
if(!$this->equipmentCache) {
return false;
}
$itemscache = explode(' ', $this->equipmentCache);
if(!$itemscache) {
return false;
}
$this->equipmentCache = $itemscache;
return true;
}

Expand Down Expand Up @@ -2289,5 +2308,15 @@ public function GetActivePetData($full = false) {
}
return $data;
}

public function IsItemEquipped($itemID) {
if(!is_array($this->equipmentCache)) {
return false;
}
if(in_array($itemID, $this->equipmentCache)) {
return true;
}
return false;
}
}
?>
36 changes: 28 additions & 8 deletions includes/classes/class.items.php
Expand Up @@ -3,7 +3,7 @@
/**
* @package World of Warcraft Armory
* @version Release Candidate 1
* @revision 264
* @revision 265
* @copyright (c) 2009-2010 Shadez
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
Expand Down Expand Up @@ -1589,15 +1589,35 @@ private function CreateAdditionalItemTooltip($itemID, XMLHandler $xml, Character
$xml->XMLWriter()->endElement(); //itemLevel
if($data['itemset'] > 0) {
$xml->XMLWriter()->startElement('setData');
$setdata = $this->aDB->selectRow("SELECT * FROM `armory_itemsetinfo` WHERE `id`=?", $data['itemset']);
$itemsetName = $this->aDB->selectCell("SELECT `name_" . $this->_locale ."` FROM `armory_itemsetinfo` WHERE `id`=?", $data['itemset']);
$xml->XMLWriter()->startElement('name');
$xml->XMLWriter()->text($setdata['name_'.$this->_locale]);
$xml->XMLWriter()->text($itemsetName);
$xml->XMLWriter()->endElement();
for($i=1;$i<11;$i++) {
if($setdata['item'.$i] > 0 && Items::IsItemExists($setdata['item'.$i])) {
$xml->XMLWriter()->startElement('item');
$xml->XMLWriter()->writeAttribute('name', Items::getItemName($setdata['item'.$i]));
$xml->XMLWriter()->endElement(); //item
$setdata = $this->aDB->selectRow("SELECT * FROM `armory_itemsetinfo` WHERE `id`=?", $data['itemset']);
// t9/t10 Onyxia trinkets
if($data['itemset'] >= 843 && $data['itemset'] != 881 && $data['itemset'] != 882) {
// Get itemset info from other table (armory_itemsetdata)
$currentSetData = $this->aDB->selectRow("SELECT * FROM `armory_itemsetdata` WHERE `original`=? AND (`item1`=? OR `item2`=? OR `item3`=? OR `item4`=? OR `item5`=?)", $data['itemset'], $itemID, $itemID, $itemID, $itemID, $itemID);
if($currentSetData) {
for($i=1;$i<6;$i++) {
if(Items::IsItemExists($currentSetData['item'.$i])) {
$xml->XMLWriter()->startElement('item');
$xml->XMLWriter()->writeAttribute('name', Items::getItemName($currentSetData['item'.$i]));
if($characters->IsItemEquipped($currentSetData['item'.$i])) {
$xml->XMLWriter()->writeAttribute('equipped', 1);
}
$xml->XMLWriter()->endElement(); //item
}
}
}
}
else {
for($i=1;$i<10;$i++) {
if(isset($setdata['item'.$i]) && Items::IsItemExists($setdata['item'.$i])) {
$xml->XMLWriter()->startElement('item');
$xml->XMLWriter()->writeAttribute('name', Items::getItemName($setdata['item'.$i]));
$xml->XMLWriter()->endElement(); //item
}
}
}
$itemsetbonus = Items::GetItemSetBonusInfo($setdata);
Expand Down

0 comments on commit e9ceb90

Please sign in to comment.