/** * Returns guild bank items * @category Guilds class * @category Guilds class * @access public * @return array **/ public function BuildGuildBankItemList() { if (!$this->guildId) { Armory::Log()->writeError('%s : guildId not defined', __METHOD__); return false; } $items_list = Armory::$cDB->select("SELECT `item_entry` AS `id`, `item_guid` AS `seed`, `SlotId` AS `slot`, `TabId` AS `bag` FROM `guild_bank_item` WHERE `guildid`=%d", $this->guildId); $count_items = count($items_list); for ($i = 0; $i < $count_items; $i++) { $item_data = 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'], $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']); $items_list[$i]['name'] = Items::GetItemName($items_list[$i]['id']); $items_list[$i]['qi'] = Items::GetItemInfo($items_list[$i]['id'], 'quality'); if ($this->m_server == SERVER_MANGOS) { $items_list[$i]['quantity'] = Items::GetItemDataField(ITEM_FIELD_STACK_COUNT, 0, 0, $items_list[$i]['seed']); } elseif ($this->m_server == SERVER_TRINITY) { $items_list[$i]['quantity'] = Armory::$cDB->selectCell("SELECT `count` FROM `item_instance` WHERE `guid`=%d", $items_list[$i]['seed']); } //TODO: Find correct random property/suffix for items in guild vault. $items_list[$i]['randomPropertiesId'] = Items::GetRandomPropertiesData($items_list[$i]['id'], 0, $items_list[$i]['seed'], true, $this->m_server, null, $item_data); $tmp_classinfo = Items::GetItemSubTypeInfo($items_list[$i]['id']); $items_list[$i]['subtype'] = null; $items_list[$i]['subtypeLoc'] = $tmp_classinfo['subclass_name']; $items_list[$i]['type'] = $tmp_classinfo['key']; $items_list[$i]['slot']++; } return $items_list; }
/** * Returns list of items that stored in guild bank * @category Guilds class * @example Guilds::BuildGuildBankItemList() * @return array **/ public function BuildGuildBankItemList() { if (!$this->guildId) { $this->Log()->writeError('%s : guildId not defined', __METHOD__); return false; } $items_list = $this->cDB->select("SELECT `item_entry` AS `id`, `item_guid` AS `seed`, `SlotId` AS `slot`, `TabId` AS `bag` FROM `guild_bank_item` WHERE `guildid`=?", $this->guildId); $count_items = count($items_list); for ($i = 0; $i < $count_items; $i++) { $tmp_durability = Items::GetItemDurabilityByItemGuid($items_list[$i]['seed']); $items_list[$i]['durability'] = $tmp_durability['current']; $items_list[$i]['maxDurability'] = $tmp_durability['max']; unset($tmp_durability); $items_list[$i]['icon'] = Items::getItemIcon($items_list[$i]['id']); $items_list[$i]['name'] = Items::getItemName($items_list[$i]['id']); $items_list[$i]['qi'] = Items::GetItemInfo($items_list[$i]['id'], 'quality'); $items_list[$i]['quantity'] = Items::GetItemDataField(ITEM_FIELD_STACK_COUNT, 0, 0, $items_list[$i]['seed']); $items_list[$i]['randomPropertiesId'] = 0; $tmp_classinfo = Items::GetItemSubTypeInfo($items_list[$i]['id']); $items_list[$i]['subtype'] = ''; $items_list[$i]['subtypeLoc'] = $tmp_classinfo['subclass_name']; $items_list[$i]['type'] = $tmp_classinfo['key']; $items_list[$i]['slot']++; } return $items_list; }
/** * Generates array with guild bank contents. * @category Guilds class * @example Guilds::showGuildBankContents() * @todo Manage rights to access some GB tabs * @return array **/ public function showGuildBankContents() { if (!$this->guildId) { return false; } $GuildBankContents = ''; $GB = ''; $j = 0; for ($bank = 0; $bank < 7; $bank++) { $x = 0; for ($i = 0; $i < 14; $i++) { if ($x > 97) { return $GuildBankContents; } for ($j = 0; $j < 7; $j++) { $GuildBankContents[$bank][$i]['slot_' . $j]['item_entry'] = $this->cDB->selectCell("SELECT `item_entry` FROM `guild_bank_item` WHERE `SlotId`=? AND `TabId`=?", $x, $bank); $GuildBankContents[$bank][$i]['slot_' . $j]['item_icon'] = Items::GetItemIcon($GuildBankContents[$bank][$i]['slot_' . $j]['item_entry']); $GuildBankContents[$bank][$i]['slot_' . $j]['item_count'] = Items::GetItemDataField(14, $this->cDB->selectCell("SELECT `item_guid` FROM `guild_bank_item` WHERE `SlotId`=? AND `TabId`=?", $x, $bank)); $x++; } } } return $GuildBankContents; }