From 7f55ca4987cf8dc3082f887af03be8d7a3f3d211 Mon Sep 17 00:00:00 2001 From: Shadez Date: Fri, 31 Dec 2010 04:13:46 +0800 Subject: [PATCH] [436] Restore items displaying on Trinity Core realms. Use more correct way to get item durability data --- includes/classes/class.item.php | 4 ++-- includes/classes/class.items.php | 9 +++++++-- includes/revision_nr.php | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/includes/classes/class.item.php b/includes/classes/class.item.php index 709332c84..83847eab6 100644 --- a/includes/classes/class.item.php +++ b/includes/classes/class.item.php @@ -3,7 +3,7 @@ /** * @package World of Warcraft Armory * @version Release Candidate 1 - * @revision 432 + * @revision 436 * @copyright (c) 2009-2010 Shadez * @license http://opensource.org/licenses/gpl-license.php GNU Public License * @@ -103,7 +103,7 @@ public function LoadFromDB($data, $owner_guid, $db) { if(isset($this->tc_data['enchantments'])) { $this->tc_ench = explode(' ', $this->tc_data['enchantments']); } - $this->entry = (isset($this->tc_data['itemEntry'])) ? $this->tc_data['itemEntry'] : (isset($this->tc_data['item_template'])) ? $this->tc_data['item_template'] : 0; + $this->entry = $this->tc_data['itemEntry']; $this->tc_data['maxdurability'] = $this->armory->wDB->selectCell("SELECT `MaxDurability` FROM `item_template` WHERE `entry`=%d", $this->entry); } else { diff --git a/includes/classes/class.items.php b/includes/classes/class.items.php index 1191968e6..eb1c45ca9 100644 --- a/includes/classes/class.items.php +++ b/includes/classes/class.items.php @@ -3,7 +3,7 @@ /** * @package World of Warcraft Armory * @version Release Candidate 1 - * @revision 434 + * @revision 436 * @copyright (c) 2009-2010 Shadez * @license http://opensource.org/licenses/gpl-license.php GNU Public License * @@ -1702,6 +1702,11 @@ private function CreateAdditionalItemTooltip($itemID, XMLHandler $xml, Character if($item) { $proto = $item->GetProto(); } + else { + // Wrong item, nothing to do here. + $this->armory->Log()->writeError('%s : wrong item handler for itemID #%d, character GUID: %d', __METHOD__, $itemID, $characters->GetGUID()); + return false; + } } if(!$proto) { // Maybe we haven't any character? Let's find itemproto by entry. @@ -2101,7 +2106,7 @@ private function CreateAdditionalItemTooltip($itemID, XMLHandler $xml, Character $xml->XMLWriter()->endElement(); //socketData // Durability if($isCharacter) { - $item_durability = self::GetItemDurability($characters->GetGUID(), $characters->GetEquippedItemGuidBySlot($itemSlotName)); + $item_durability = $item->GetItemDurability(); } else { $item_durability = array('current' => $proto->MaxDurability, 'max' => $proto->MaxDurability); diff --git a/includes/revision_nr.php b/includes/revision_nr.php index 72af6c8d8..deb7ad8d9 100644 --- a/includes/revision_nr.php +++ b/includes/revision_nr.php @@ -1,5 +1,5 @@ \ No newline at end of file