diff --git a/includes/classes/class.guilds.php b/includes/classes/class.guilds.php index 224f5d185..d08279dd2 100644 --- a/includes/classes/class.guilds.php +++ b/includes/classes/class.guilds.php @@ -3,7 +3,7 @@ /** * @package World of Warcraft Armory * @version Release Candidate 1 - * @revision 402 + * @revision 437 * @copyright (c) 2009-2010 Shadez * @license http://opensource.org/licenses/gpl-license.php GNU Public License * @@ -133,8 +133,12 @@ public function InitGuild($serverType) { return false; } $this->guildId = $this->armory->cDB->selectCell("SELECT `guildid` FROM `guild` WHERE `name`='%s' LIMIT 1", $this->guildName); - if($serverType <= 0 || $serverType > SERVER_TRINITY) { + if($serverType < SERVER_MANGOS || $serverType > SERVER_TRINITY) { $this->armory->Log()->writeError('%s : unknown server type (%d). Set m_server to SERVER_MANGOS (%d)', __METHOD__, $serverType, SERVER_MANGOS); + $this->m_server = SERVER_MANGOS; + } + else { + $this->m_server = $serverType; } if($this->guildId) { return true; @@ -300,7 +304,7 @@ public function BuildGuildBankItemList() { $count_items = count($items_list); for($i = 0; $i < $count_items; $i++) { $item_data = $this->armory->wDB->selectRow("SELECT `RandomProperty`, `RandomSuffix` FROM `item_template` WHERE `entry` = %d LIMIT 1", $items_list[$i]['id']); - $tmp_durability = Items::GetItemDurabilityByItemGuid($items_list[$i]['seed']); + $tmp_durability = Items::GetItemDurabilityByItemGuid($items_list[$i]['seed'], $this->m_server); $items_list[$i]['durability'] = (int) $tmp_durability['current']; $items_list[$i]['maxDurability'] = (int) $tmp_durability['max']; $items_list[$i]['icon'] = Items::GetItemIcon($items_list[$i]['id']); diff --git a/includes/classes/class.items.php b/includes/classes/class.items.php index eb1c45ca9..bad6348cd 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 436 + * @revision 437 * @copyright (c) 2009-2010 Shadez * @license http://opensource.org/licenses/gpl-license.php GNU Public License * @@ -796,47 +796,28 @@ public function GetItemSocketInfo($guid, $item, $socketNum, $item_guid = 0, $ser return false; } - /** - * Returns array with current/max item durability for selected ($guid) character - * @category Items class - * @access public - * @param int $guid - * @param int $item - * @return array - **/ - public function GetItemDurability($guid, $item) { - switch($this->armory->currentRealmInfo['type']) { - case 'mangos': - $durability['current'] = self::GetItemDataField(ITEM_FIELD_DURABILITY, 0, $guid, $item); - $durability['max'] = self::GetItemDataField(ITEM_FIELD_MAXDURABILITY, 0, $guid, $item); - break; - case 'trinity': - $durability['current'] = $this->armory->cDB->selectCell("SELECT `durability` FROM `item_instance` WHERE `owner_guid`=%d AND `guid`=%d", $guid, $item); - $durability['max'] = self::GetItemInfo($item, 'durability'); - break; - } - return $durability; - } - /** * Returns max/current item durability by item guid * @category Items class * @access public * @param int $item_guid + * @param int $serverType * @return array **/ - public function GetItemDurabilityByItemGuid($item_guid) { + public function GetItemDurabilityByItemGuid($item_guid, $serverType) { $durability = array('current' => 0, 'max' => 0); - switch($this->armory->currentRealmInfo['type']) { - case 'mangos': + switch($serverType) { + case SERVER_MANGOS: $durability['current'] = self::GetItemDataField(ITEM_FIELD_DURABILITY, 0, 0, $item_guid); $durability['max'] = self::GetItemDataField(ITEM_FIELD_MAXDURABILITY, 0, 0, $item_guid); break; - case 'trinity': + case SERVER_TRINITY: $durability['current'] = $this->armory->cDB->selectCell("SELECT `durability` FROM `item_instance` WHERE `guid`=%d", $item_guid); $itemEntry = self::GetItemEntryByGUID($item_guid); $durability['max'] = self::GetItemInfo($itemEntry, 'durability'); break; + default: + break; } return $durability; } diff --git a/includes/revision_nr.php b/includes/revision_nr.php index deb7ad8d9..aa5d705aa 100644 --- a/includes/revision_nr.php +++ b/includes/revision_nr.php @@ -1,5 +1,5 @@ \ No newline at end of file