Skip to content

Commit

Permalink
[437] Remove unused method Items::GetItemDurability(). Missed Guilds:…
Browse files Browse the repository at this point in the history
…:$m_server variable assignment
  • Loading branch information
Shadez committed Dec 30, 2010
1 parent 7f55ca4 commit 901813f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 31 deletions.
10 changes: 7 additions & 3 deletions includes/classes/class.guilds.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 402
* @revision 437
* @copyright (c) 2009-2010 Shadez
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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']);
Expand Down
35 changes: 8 additions & 27 deletions includes/classes/class.items.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 436
* @revision 437
* @copyright (c) 2009-2010 Shadez
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
Expand Down Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion includes/revision_nr.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
define('ARMORY_REVISION', 436);
define('ARMORY_REVISION', 437);
define('DB_VERSION', 'armory_r434');
define('CONFIG_VERSION', '2812201001');
?>

0 comments on commit 901813f

Please sign in to comment.