/** * Returns array with data for item placed in $slot['slot'] * @category Character class * @access public * @param array $slot * @return array **/ public function GetCharacterItemInfo($slot) { if (!$this->guid) { Armory::Log()->writeError('%s : player guid not provided', __METHOD__); return false; } if (!isset($this->m_items[$slot['slotid']])) { Armory::Log()->writeError('%s : slot %d is empty (nothing equipped?)', __METHOD__, $slot['slotid']); return false; } $item = $this->m_items[$slot['slotid']]; $gems = array('g0' => $item->GetSocketInfo(1), 'g1' => $item->GetSocketInfo(2), 'g2' => $item->GetSocketInfo(3)); $durability = $item->GetItemDurability(); $item_data = Armory::$wDB->selectRow("SELECT `name`, `displayid`, `ItemLevel`, `Quality` FROM `item_template` WHERE `entry`=%d", $item->GetEntry()); $enchantment = $item->GetEnchantmentId(); $originalSpell = 0; $enchItemData = array(); $enchItemDisplayId = 0; if ($enchantment > 0) { $originalSpell = Armory::$aDB->selectCell("SELECT `id` FROM `ARMORYDBPREFIX_spellenchantment` WHERE `Value`=%d", $enchantment); if ($originalSpell > 0) { $enchItemData = Armory::$wDB->selectRow("SELECT `entry`, `displayid` FROM `item_template` WHERE `spellid_1`=%d LIMIT 1", $originalSpell); if ($enchItemData) { // Item $enchItemDisplayId = Armory::$aDB->selectCell("SELECT `icon` FROM `ARMORYDBPREFIX_icons` WHERE `displayid`=%d", $enchItemData['displayid']); } else { // Spell $spellEnchData = Items::GenerateEnchantmentSpellData($originalSpell); } } } $item_info = array('displayInfoId' => $item_data['displayid'], 'durability' => $durability['current'], 'icon' => Items::GetItemIcon($item->GetEntry(), $item_data['displayid']), 'id' => $item->GetEntry(), 'level' => $item_data['ItemLevel'], 'maxDurability' => $durability['max'], 'name' => Armory::GetLocale() == 'en_gb' || Armory::GetLocale() == 'en_us' ? $item_data['name'] : Items::GetItemName($item->GetEntry()), 'permanentenchant' => $enchantment, 'pickUp' => 'PickUpLargeChain', 'putDown' => 'PutDownLArgeChain', 'randomPropertiesId' => 0, 'rarity' => $item_data['Quality'], 'seed' => $item->GetGUID(), 'slot' => $slot['slotid']); if (is_array($gems)) { for ($i = 0; $i < 3; $i++) { if ($gems['g' . $i]['item'] > 0) { $item_info['gem' . $i . 'Id'] = $gems['g' . $i]['item']; $item_info['gemIcon' . $i] = $gems['g' . $i]['icon']; } } } if (is_array($enchItemData) && isset($enchItemData['entry'])) { $item_info['permanentEnchantIcon'] = $enchItemDisplayId; $item_info['permanentEnchantItemId'] = $enchItemData['entry']; } elseif (isset($spellEnchData) && is_array($spellEnchData) && isset($spellEnchData['name'])) { $item_info['permanentEnchantIcon'] = 'trade_engraving'; $item_info['permanentEnchantSpellName'] = $spellEnchData['name']; $item_info['permanentEnchantSpellDesc'] = $spellEnchData['desc']; } return $item_info; }
public function PerformAdvancedItemsSearch($count = false) { if ($this->itemSearchSkip == true) { return false; } if ((!$this->get_array || !is_array($this->get_array)) && !$this->searchQuery) { Armory::Log()->writeError('%s : start failed', __METHOD__); return false; } if (!isset($this->get_array['source'])) { Armory::Log()->writeError('%s : get_array[source] not defined', __METHOD__); return false; } $allowedDungeon = false; // Get item IDs first (if $this->searchQuery is defined) $item_id_string = null; if ($this->searchQuery) { if (Armory::GetLoc() == 0) { // No SQL injection - already escaped in search.php $_item_ids = Armory::$wDB->select("SELECT `entry` FROM `item_template` WHERE `name` LIKE '%s'", '%' . $this->searchQuery . '%'); } else { $_item_ids = Armory::$wDB->select("SELECT `entry` FROM `item_template` WHERE `name` LIKE '%s' OR `entry` IN (SELECT `entry` FROM `locales_item` WHERE `name_loc%d` LIKE '%s')", '%' . $this->searchQuery . '%', Armory::GetLoc(), '%' . $this->searchQuery . '%'); } if (is_array($_item_ids)) { $tmp_count_ids = count($_item_ids); for ($i = 0; $i < $tmp_count_ids; $i++) { if ($i) { $item_id_string .= ', ' . $_item_ids[$i]['entry']; } else { $item_id_string .= $_item_ids[$i]['entry']; } } unset($tmp_count_ids, $_item_ids); } } switch ($this->get_array['source']) { case 'all': $global_sql_query = $this->HandleItemFilters($item_id_string); break; case 'quest': $tmp_quest_query = "SELECT `item` FROM `ARMORYDBPREFIX_source` WHERE `source`='sourceType.questReward'"; if ($item_id_string != '') { $tmp_quest_query .= sprintf(" AND `item` IN (%s)", $item_id_string); } $tmp_quest_query .= " ORDER BY `item` DESC LIMIT 200"; $_quest_items = Armory::$aDB->select($tmp_quest_query); if (!$_quest_items) { return false; } $quest_id_string = ''; $qCount = count($_quest_items); for ($i = 0; $i < $qCount; $i++) { if ($i) { $quest_id_string .= ', ' . $_quest_items[$i]['item']; } else { $quest_id_string .= $_quest_items[$i]['item']; } } unset($_quest_items, $qCount); $global_sql_query = $this->HandleItemFilters($quest_id_string); break; case 'dungeon': if (!isset($this->get_array['dungeon'])) { $this->get_array['dungeon'] = 'all'; } if (!isset($this->get_array['difficulty'])) { $this->get_array['difficulty'] = 'all'; } if (!isset($this->get_array['boss'])) { $this->get_array['boss'] = 'all'; } if (self::IsExtendedCost()) { Armory::Log()->writeLog('%s : current ExtendedCost key: %s', __METHOD__, $this->get_array['dungeon']); $item_extended_cost = Armory::$aDB->selectCell("SELECT `item` FROM `ARMORYDBPREFIX_item_sources` WHERE `key`='%s' LIMIT 1", $this->get_array['dungeon']); if (!$item_extended_cost) { Armory::Log()->writeError('%s : this->get_array[dungeon] is ExtendedCost key (%s) but data for this key is missed in `armory_item_sources`', __METHOD__, $this->get_array['dungeon']); return false; } $extended_cost = Armory::$aDB->select("SELECT `id` FROM `ARMORYDBPREFIX_extended_cost` WHERE `item1`=%d OR `item2`=%d OR `item3`=%d OR `item4`=%d OR `item5`=%d", $item_extended_cost, $item_extended_cost, $item_extended_cost, $item_extended_cost, $item_extended_cost); if (!$extended_cost) { Armory::Log()->writeError('%s : this->get_array[dungeon] is ExtendedCost (key: %s, id: %d) but data for this id is missed in `armory_extended_cost`', __METHOD__, $this->get_array['dungeon'], $item_extended_cost); return false; } $cost_ids = array(); foreach ($extended_cost as $cost) { $cost_ids[] = $cost['id']; } $ex_cost_ids = null; $mytmpcount = count($cost_ids); for ($i = 0; $i < $mytmpcount; $i++) { if ($i) { $ex_cost_ids .= ', ' . $cost_ids[$i] . ', -' . $cost_ids[$i]; } else { $ex_cost_ids .= $cost_ids[$i] . ', -' . $cost_ids[$i]; } } $global_sql_query = $this->HandleItemFilters($item_id_string, $ex_cost_ids); } else { $allowedDungeon = true; $instance_data = Utils::GetDungeonData($this->get_array['dungeon']); if (!is_array($instance_data) || !isset($instance_data['difficulty'])) { return false; } switch ($this->get_array['difficulty']) { case 'normal': switch ($instance_data['difficulty']) { case 2: // 25 Man (icc/toc) $sql_query = "SELECT `lootid_2`, `type` FROM `ARMORYDBPREFIX_instance_data`"; break; default: // 10 Man (icc/toc) / all others $sql_query = "SELECT `lootid_1`, `type` FROM `ARMORYDBPREFIX_instance_data`"; break; } $difficulty = 'n'; break; case 'heroic': switch ($instance_data['difficulty']) { // instance diffuclty, not related to get_array['difficulty'] case 1: // 10 Man (icc/toc) $sql_query = "SELECT `lootid_3`, `type` FROM `ARMORYDBPREFIX_instance_data`"; break; case 2: // 25 Man (icc/toc) $sql_query = "SELECT `lootid_4`, `type` FROM `ARMORYDBPREFIX_instance_data`"; break; default: // All others $sql_query = "SELECT `lootid_2`, `type` FROM `ARMORYDBPREFIX_instance_data`"; break; } $difficulty = 'h'; break; // All // All default: $difficulty = null; switch ($instance_data['difficulty']) { case 1: // 10 Man if ($instance_data['is_heroic'] == 1) { $sql_query = "SELECT `lootid_1`, `lootid_3`, `type` FROM `ARMORYDBPREFIX_instance_data`"; } else { $sql_query = "SELECT `lootid_1`, `type` FROM `ARMORYDBPREFIX_instance_data`"; } break; case 2: // 25 Man if ($instance_data['is_heroic'] == 1) { $sql_query = "SELECT `lootid_2`, `lootid_4`, `type` FROM `ARMORYDBPREFIX_instance_data`"; } else { $sql_query = "SELECT `lootid_2`, `type` FROM `ARMORYDBPREFIX_instance_data`"; } break; default: if ($instance_data['is_heroic'] == 1) { $sql_query = "SELECT `lootid_1`, `lootid_2`, `lootid_3`, `lootid_4`, `type` FROM `ARMORYDBPREFIX_instance_data`"; } else { $sql_query = "SELECT `lootid_1`, `lootid_2`, `type` FROM `ARMORYDBPREFIX_instance_data`"; } break; } break; } if (isset($this->get_array['dungeon']) && $this->get_array['dungeon'] != 'all' && !empty($this->get_array['dungeon'])) { $instance_id = Utils::GetDungeonId($this->get_array['dungeon']); $sql_query .= sprintf(" WHERE `instance_id`=%d", $instance_id); } if (isset($this->get_array['boss']) && $this->get_array['boss'] != 'all' && !empty($this->get_array['boss'])) { if (is_numeric($this->get_array['boss'])) { $sql_query .= sprintf(" AND (`id`=%d OR `lootid_1`=%d OR `lootid_2`=%d OR `lootid_3`=%d OR `lootid_4`=%d)", $this->get_array['boss'], $this->get_array['boss'], $this->get_array['boss'], $this->get_array['boss'], $this->get_array['boss']); } else { $sql_query .= sprintf(" AND `key`='%s'", $this->get_array['boss']); } } $boss_lootids = Armory::$aDB->select($sql_query); if (!$boss_lootids) { Armory::Log()->writeLog('%s : unable to find loot IDs for boss %s (instance: %s)', __METHOD__, $this->get_array['boss'], $this->get_array['dungeon']); return false; } $loot_table = '-1'; foreach ($boss_lootids as $loot_id) { for ($i = 1; $i < 5; $i++) { if (isset($loot_id['lootid_' . $i])) { if ($i) { $loot_table .= ', ' . $loot_id['lootid_' . $i]; } else { $loot_table .= $loot_id['lootid_' . $i]; } } } } $global_sql_query = $this->HandleItemFilters($item_id_string, $loot_table); } break; case 'reputation': if (!isset($this->get_array['faction'])) { $this->get_array['faction'] = 'all'; } $global_sql_query = $this->HandleItemFilters($item_id_string, $this->get_array['faction']); break; case 'pvpAlliance': case 'pvpHorde': if (!isset($this->get_array['pvp'])) { $this->get_array['pvp'] = 'all'; } if ($this->get_array['pvp'] == 'all' || $this->get_array['pvp'] == -1) { $pvpVendorsId = Armory::$aDB->select("SELECT `item` FROM `ARMORYDBPREFIX_item_sources` WHERE `key` IN ('wintergrasp', 'arena8', 'arena7', 'arena6', 'arena5', 'arena4', 'arena3', 'arena2', 'arena1', 'honor', 'ab', 'av', 'wsg', 'halaa', 'honorhold', 'terrokar', 'zangarmarsh', 'thrallmar')"); if (!$pvpVendorsId) { Armory::Log()->writeError('%s : unable to get data for pvpVendors from armory_item_sources', __METHOD__); return false; } } else { $pvpVendorsId = Armory::$aDB->select("SELECT `item` FROM `ARMORYDBPREFIX_item_sources` WHERE `key`='%s'", $this->get_array['pvp']); if (!$pvpVendorsId) { Armory::Log()->writeError('%s : unable to get data for pvpVendors from armory_item_sources (faction: %s, key: %s)', __METHOD__, $this->get_array['source'], $this->get_array['pvp']); return false; } } $countVendors = count($pvpVendorsId); $string_vendors = null; for ($i = 0; $i < $countVendors; $i++) { $tmpVendID = explode('/', $pvpVendorsId[$i]['item']); if (is_array($tmpVendID) && isset($tmpVendID[0]) && isset($tmpVendID[1])) { if ($this->get_array['source'] == 'pvpAlliance') { $vendors_id = $tmpVendID[0]; } else { $vendors_id = $tmpVendID[1]; } } else { $vendors_id = $pvpVendorsId[$i]['item']; } if ($i) { $string_vendors .= ', ' . $vendors_id; } else { $string_vendors .= $vendors_id; } } $global_sql_query = $this->HandleItemFilters($item_id_string, $string_vendors); break; } if (!isset($global_sql_query) || !$global_sql_query) { Armory::Log()->writeError('%s : SQL query was not created (probably "%s" is unknown source).', __METHOD__, $this->get_array['source']); return false; } $items_query = Armory::$wDB->select($global_sql_query); if (!$items_query) { Armory::Log()->writeError('%s : unable to execute SQL query "%s"', __METHOD__, $global_sql_query); unset($global_sql_query); return false; } $items_result = array(); $exists_items = array(); $source_items = self::GetItemSourceArray($items_query); $i = 0; $icons_to_add = array(); $names_to_add = array(); $icons_holder = array(); $names_holder = array(); foreach ($items_query as $tmp_item) { $icons_to_add[] = $tmp_item['displayid']; $names_to_add[] = $tmp_item['id']; } $tmp_icons_holder = Armory::$aDB->select("SELECT `displayid`, `icon` FROM `ARMORYDBPREFIX_icons` WHERE `displayid` IN (%s)", $icons_to_add); foreach ($tmp_icons_holder as $icon) { $icons_holder[$icon['displayid']] = $icon['icon']; } if (Armory::GetLoc() == 0) { $tmp_names_holder = Armory::$wDB->select("SELECT `entry`, `name` AS `name` FROM `item_template` WHERE `entry` IN (%s)", $names_to_add); } else { $tmp_names_holder = Armory::$wDB->select("SELECT `entry`, `name_loc%d` AS `name` FROM `locales_item` WHERE `entry` IN (%s)", Armory::GetLoc(), $names_to_add); } foreach ($tmp_names_holder as $name) { if ($name['name'] == null) { $name['name'] = Items::GetItemName($name['entry']); } $names_holder[$name['entry']] = $name['name']; } unset($tmp_icons_holder, $tmp_names_holder, $names_to_add, $icons_to_add); foreach ($items_query as $item) { if (isset($exists_items[$item['id']])) { continue; // Do not add the same items to result array } if ($i >= 200) { if ($count) { return count($exists_items); } else { return $items_result; } } elseif (!$count) { $tmp_src = isset($source_items[$item['id']]) ? $source_items[$item['id']] : null; $items_result[$i]['data'] = array(); $items_result[$i]['filters'] = array(); $items_result[$i]['data']['id'] = $item['id']; if (!isset($names_holder[$item['id']])) { $items_result[$i]['data']['name'] = Items::GetItemName($item['id']); } else { $items_result[$i]['data']['name'] = $names_holder[$item['id']]; } if (self::CanAuction($item)) { $items_result[$i]['data']['canAuction'] = 1; } $items_result[$i]['data']['rarity'] = $item['rarity']; if (!isset($icons_holder[$item['displayid']])) { $items_result[$i]['data']['icon'] = Items::GetItemIcon($item['id'], $item['displayid']); } else { $items_result[$i]['data']['icon'] = $icons_holder[$item['displayid']]; } $items_result[$i]['filters'][0] = array('name' => 'itemLevel', 'value' => $item['ItemLevel']); $items_result[$i]['filters'][1] = array('name' => 'relevance', 'value' => 100); // TODO: add relevance calculation for items // Add some filters (according with item source) if ($tmp_src != null) { if ($tmp_src['source'] == 'sourceType.dungeon' && $tmp_src['areaKey'] != null && $tmp_src['areaUrl'] != null) { $items_result[$i]['filters'][] = array('areaId' => $tmp_src['areaId'], 'areaKey' => $tmp_src['areaKey'], 'areaName' => $tmp_src['areaName'], 'name' => 'source', 'value' => 'sourceType.creatureDrop'); } else { $items_result[$i]['filters'][] = array('name' => 'source', 'value' => $tmp_src['source']); } } else { switch ($this->get_array['source']) { case 'reputation': $items_result[$i]['filters'][] = array('name' => 'source', 'value' => 'sourceType.factionReward'); break; case 'quest': $items_result[$i]['filters'][] = array('name' => 'source', 'value' => 'sourceType.questReward'); break; case 'pvpAlliance': case 'pvpHorde': $items_result[$i]['filters'][2] = array('name' => 'source', 'value' => 'sourceType.vendor'); break; } } } $exists_items[$item['id']] = $item['id']; $i++; } if ($count == true) { return count($exists_items); } return $items_result; }
/** * 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 guild bank logs * @category Guilds class * @category Guilds class * @access public * @return array **/ public function BuildGuildBankLogList() { if (!$this->guildId) { Armory::Log()->writeError('%s : guildId not defined', __METHOD__); return false; } $log_list = Armory::$cDB->select("SELECT `LogGuid` AS `logId`, `TabId` AS `obag`, `EventType` AS `type`,\n\t\t`DestTabId` AS `dbag`, (SELECT `name` FROM `characters` WHERE `guid`=`PlayerGuid`) AS `player`,\t\n\t\t(SELECT `guild_rank`.`rname` FROM `guild_rank` WHERE `guildid`=%d AND `rid`=`guild_member`.`rank`) AS `rname`,\n\t\t`guild_member`.`rank`, `ItemOrMoney` AS `entry`, `ItemStackCount` AS `quantity`, `TimeStamp` AS `ts`\n\t\tFROM `guild_bank_eventlog` AS `guild_bank_eventlog`\n\t\tLEFT JOIN `guild_member` AS `guild_member` ON `guild_member`.`guid`=`guild_bank_eventlog`.`PlayerGuid` AND `guild_member`.`guildid`=%d\n\t\tWHERE `guild_bank_eventlog`.`guildid`=%d ORDER BY `ts` DESC LIMIT 500;", $this->guildId, $this->guildId, $this->guildId); $count_logs = count($log_list); for ($i = 0; $i < $count_logs; $i++) { $log_list[$i]['ts'] = date('Y-m-d H:i:s', $log_list[$i]['ts']); switch ($log_list[$i]['type']) { case 1: //deposit $log_list[$i]['item'] = 1; $log_list[$i]['dbag'] = $log_list[$i]['obag']; $log_list[$i]['obag'] = ''; break; case 2: //withdraw $log_list[$i]['item'] = 1; $log_list[$i]['dbag'] = ''; break; case 3: //move //move case 7: //move $log_list[$i]['item'] = 1; break; case 4: case 5: case 6: //repair //repair case 8: case 9: //buytab //buytab default: $log_list[$i]['item'] = 0; $log_list[$i]['dbag'] = ''; $log_list[$i]['obag'] = ''; $log_list[$i]['money'] = $log_list[$i]['entry']; break; } if ($log_list[$i]['item']) { $log_list[$i]['icon'] = Items::GetItemIcon($log_list[$i]['entry']); $log_list[$i]['name'] = Items::GetItemName($log_list[$i]['entry']); $log_list[$i]['qi'] = Items::GetItemInfo($log_list[$i]['entry'], 'quality'); } } return $log_list; }
/** * Search items with $query name. If $num == true, function will return only number of * @category Utils/Armory class * @example Utils::SearchItems('ashes of al'ar') * @return array, int **/ public function SearchItems($query, $num = false) { if ($num == true) { $Q = $this->wDB->selectPage($itemsNum, "SELECT `entry` FROM `item_template` WHERE `name` LIKE ? LIMIT 200", '%' . $query . '%'); $QQ = $this->wDB->selectPage($itemsNumRuRU, "SELECT `entry` FROM `locales_item` WHERE `name_loc8` LIKE ? LIMIT 200", '%' . $query . '%'); $rNum = $itemsNum + $itemsNumRuRU; if ($rNum > 200) { $rNum = 200; } return $rNum; } $searchResults = $this->wDB->select("\n SELECT `entry`, `Quality`, `ItemLevel`\n FROM `item_template`\n WHERE `name` LIKE ? OR `entry` IN \n (\n SELECT `entry`\n FROM `locales_item`\n WHERE `name_loc8` LIKE ?\n )\n LIMIT 200", '%' . $query . '%', '%' . $query . '%'); if (!$searchResults) { return false; } $countItems = count($searchResults); for ($i = 0; $i < $countItems; $i++) { $searchResults[$i]['name'] = Items::GetItemName($searchResults[$i]['entry']); $searchResults[$i]['icon'] = Items::GetItemIcon($searchResults[$i]['entry']); } return $searchResults; }
/** * Return array with loot info: dropped by, contained in, disenchating to, reagent for, etc. * @category Items class * @example Items::BuildLootTable(35000, 'vendor') * @todo Currency for * @return array **/ public function BuildLootTable($item, $vendor, $data = false) { $lootTable = ''; switch ($vendor) { case 'vendor': $VendorLoot = $this->wDB->select("\n\t\t\t\tSELECT `entry`\n\t\t\t\t\tFROM `npc_vendor`\n\t\t\t\t\t\tWHERE `item`=?", $item); if (!empty($VendorLoot)) { $i = 0; foreach ($VendorLoot as $vItem) { $lootTable[$i] = array('name' => Mangos::GetNpcName($vItem['entry']), 'level' => Mangos::GetNpcInfo($vItem['entry'], 'level'), 'map' => Mangos::GetNpcInfo($vItem['entry'], 'map')); $i++; } } break; case 'boss': $BossLoot = $this->wDB->select("\n\t\t\t\tSELECT `entry`, `ChanceOrQuestChance`\n\t\t\t\t\tFROM `creature_loot_template`\n\t\t\t\t\t\tWHERE `item`=?", $item); if (!empty($BossLoot)) { $i = 0; foreach ($BossLoot as $bItem) { $map_npc = Mangos::GetNpcInfo($bItem['entry'], 'map'); if (!empty($map_npc)) { $lootTable[$i] = array('entry' => $bItem['entry'], 'name' => Mangos::GetNpcName($bItem['entry']), 'level' => Mangos::GetNpcInfo($bItem['entry'], 'level'), 'boss' => Mangos::GetNpcInfo($bItem['entry'], 'isBoss'), 'map' => $map_npc, 'difficult' => Mangos::GetNpcInfo($bItem['entry'], 'dungeonlevel'), 'drop_percent' => Mangos::DropPercent($bItem['ChanceOrQuestChance']), 'makro' => '1'); $i++; } } } break; case 'chest': $ChestLoot = $this->wDB->select("\n\t\t\t\tSELECT `entry`, `ChanceOrQuestChance`\n\t\t\t\t\tFROM `gameobject_loot_template`\n\t\t\t\t\t\tWHERE `item`=?", $item); if (!empty($ChestLoot)) { $i = 0; foreach ($ChestLoot as $cItem) { $map_chest = Mangos::GameobjectInfo($cItem['entry'], 'map'); if (!empty($map_chest)) { $lootTable[$i] = array('name' => Mangos::GameobjectInfo($cItem['entry'], 'name'), 'map' => $map_chest, 'difficult' => ' ', 'drop_percent' => Mangos::DropPercent($cItem['ChanceOrQuestChance'])); $i++; } } } break; case 'questreward': $QuestLoot = $this->wDB->select("\n\t\t\t\tSELECT `entry`, `MinLevel`\n\t\t\t\t\tFROM `quest_template`\n\t\t\t\t\t\tWHERE `RewChoiceItemId1` = ? OR `RewChoiceItemId2` = ? OR `RewChoiceItemId3` = ? OR \n\t\t\t\t\t\t`RewChoiceItemId4` = ? OR `RewChoiceItemId5` = ? OR `RewChoiceItemId6` = ?", $item, $item, $item, $item, $item, $item); if (!empty($QuestLoot)) { $i = 0; foreach ($QuestLoot as $qItem) { $lootTable[$i] = array('title' => Mangos::QuestInfo($qItem['entry'], 'title'), 'reqlevel' => $qItem['MinLevel'], 'map' => Mangos::QuestInfo($qItem['entry'], 'map')); $i++; } } break; case 'queststart': $QuestStart = $this->wDB->selectCell("SELECT `startquest` FROM `item_template` WHERE `entry`=?", $item); if (!$QuestStart) { return false; } $lootTable[0] = array('title' => Mangos::QuestInfo($QuestStart, 'title'), 'reqlevel' => Mangos::QuestInfo($QuestStart, 'reqlevel'), 'map' => Mangos::QuestInfo($QuestStart, 'map')); break; case 'providedfor': $QuestInfo = $this->wDB->select("SELECT `entry`, `MinLevel` FROM `quest_template` WHERE `SrcItemId`=?", $item); if (!$QuestInfo) { return false; } $i = 0; foreach ($QuestInfo as $quest) { $lootTable[$i] = array('title' => Mangos::QuestInfo($quest['entry'], 'title'), 'reqlevel' => $quest['MinLevel'], 'map' => Mangos::QuestInfo($quest['entry'], 'map')); } break; case 'objectiveof': $QuestInfo = $this->wDB->select("\n SELECT `entry`, `MinLevel`\n FROM `quest_template`\n WHERE `ReqItemId1`=? OR `ReqItemId2`=? OR `ReqItemId3`=?\n OR `ReqItemId4`=? OR `ReqItemId5`=?", $item, $item, $item, $item, $item); if (!$QuestInfo) { return false; } $i = 0; foreach ($QuestInfo as $quest) { $lootTable[$i] = array('title' => Mangos::QuestInfo($quest['entry'], 'title'), 'reqlevel' => $quest['MinLevel'], 'map' => Mangos::QuestInfo($quest['entry'], 'map')); } break; case 'item': $ItemLoot = $this->wDB->select("\n SELECT `entry`, `ChanceOrQuestChance`\n FROM `item_loot_template`\n WHERE `item`=?", $item); if (!empty($ItemLoot)) { $i = 0; foreach ($ItemLoot as $iItem) { $lootTable[$i] = array('name' => Items::GetItemName($iItem['entry']), 'drop_percent' => Mangos::DropPercent($iItem['ChanceOrQuestChance'])); $i++; } } break; case 'disenchant': $DisenchantLoot = $this->wDB->select("\n SELECT `item`, `ChanceOrQuestChance`, `maxcount`\n FROM `disenchant_loot_template`\n WHERE `entry`=?", $item); if (!empty($DisenchantLoot)) { $i = 0; foreach ($DisenchantLoot as $dItem) { $lootTable[$i] = array('entry' => $dItem['item'], 'name' => $this->GetItemName($dItem['item']), 'drop_percent' => Mangos::DropPercent($dItem['ChanceOrQuestChance']), 'count' => $dItem['maxcount'], 'icon' => $this->GetItemIcon($dItem['item'])); $i++; } } break; case 'craft': $CraftLoot = $this->aDB->select("\n SELECT `Reagent_1`, `Reagent_2`, `Reagent_3`, `Reagent_4`, `Reagent_5`, `Reagent_6`, `Reagent_7`, `Reagent_8`,\n `ReagentCount_1`, `ReagentCount_2`, `ReagentCount_3`, `ReagentCount_4`, `ReagentCount_5`, `ReagentCount_6`, \n `ReagentCount_7`, `ReagentCount_8`, `EffectItemType_1`, `EffectItemType_2`, `EffectItemType_3`,\n `SpellName`\n FROM `armory_spell`\n WHERE `EffectItemType_1` =? OR `EffectItemType_2`=? OR `EffectItemType_3`=?", $item, $item, $item); if (!empty($CraftLoot)) { $i = 0; foreach ($CraftLoot as $craftItem) { $lootTable[$i]['name'] = $craftItem['SpellName']; for ($o = 1; $o < 9; $o++) { if ($craftItem['Reagent_' . $o] > 0) { $lootTable[$i]['entry_reagent_' . $o] = $craftItem['Reagent_' . $o]; $lootTable[$i]['name_reagent_' . $o] = $this->GetItemName($craftItem['Reagent_' . $o]); $lootTable[$i]['icon_reagent_' . $o] = $this->GetItemIcon($craftItem['Reagent_' . $o]); $lootTable[$i]['count_reagent_' . $o] = $craftItem['ReagentCount_' . $o]; } } for ($j = 1; $j < 4; $j++) { if ($craftItem['EffectItemType_' . $j] > 0) { $lootTable[$i]['item_name_' . $j] = $this->GetItemName($craftItem['EffectItemType_' . $j]); $lootTable[$i]['item_entry_' . $j] = $craftItem['EffectItemType_' . $j]; $lootTable[$i]['item_icon_' . $j] = $this->GetItemIcon($craftItem['EffectItemType_' . $j]); $lootTable[$i]['item_quality_' . $j] = $this->GetItemInfo($craftItem['EffectItemType_' . $j], 'quality'); } } $i++; } } break; case 'currency': return false; break; case 'reagent': $ReagentLoot = $this->aDB->select("\n SELECT `Reagent_1`, `Reagent_2`, `Reagent_3`, `Reagent_4`, `Reagent_5`, `Reagent_6`, `Reagent_7`, `Reagent_8`,\n `ReagentCount_1`, `ReagentCount_2`, `ReagentCount_3`, `ReagentCount_4`, `ReagentCount_5`, `ReagentCount_6`, \n `ReagentCount_7`, `ReagentCount_8`, `EffectItemType_1`, `EffectItemType_2`, `EffectItemType_3`,\n `SpellName`\n FROM `armory_spell`\n WHERE `Reagent_1`=? OR `Reagent_2`=? OR `Reagent_3`=? OR `Reagent_4`=? OR \n `Reagent_5`=? OR `Reagent_6`=? OR `Reagent_7`=? OR `Reagent_8`=?", $item, $item, $item, $item, $item, $item, $item, $item); if ($ReagentLoot) { $i = 0; foreach ($ReagentLoot as $ReagentItem) { for ($j = 1; $j < 4; $j++) { if ($ReagentItem['EffectItemType_' . $j] > 0) { $lootTable[$i]['item_entry'] = $ReagentItem['EffectItemType_' . $j]; $lootTable[$i]['item_name'] = $this->getItemName($ReagentItem['EffectItemType_' . $j]); $lootTable[$i]['item_icon'] = $this->getItemIcon($ReagentItem['EffectItemType_' . $j]); $lootTable[$i]['item_quality'] = $this->GetItemInfo($ReagentItem['EffectItemType_' . $j], 'quality'); } } for ($o = 1; $o < 9; $o++) { if ($ReagentItem['Reagent_' . $o] > 0) { $lootTable[$i]['Reagent_' . $o] = $ReagentItem['Reagent_' . $o]; $lootTable[$i]['ReagentIcon_' . $o] = $this->getItemIcon($ReagentItem['Reagent_' . $o]); $lootTable[$i]['ReagentCount_' . $o] = $ReagentItem['ReagentCount_' . $o]; } } $i++; } } break; } return $lootTable; }