}
$tp->assign('reward', $rewardTP);
// Disenchant
if ($itemData['DisenchantID']) {
    $de = $mysql->getRows("SELECT item_template.name,item_template.entry,item_template.Quality,disenchant_loot_template.item,disenchant_loot_template.ChanceOrQuestChance,disenchant_loot_template.mincountOrRef,disenchant_loot_template.maxcount\n\t        FROM `disenchant_loot_template`,`item_template`\n\t        WHERE disenchant_loot_template.item = item_template.entry and disenchant_loot_template.entry = ?1 limit 20", $itemData['DisenchantID'], 'world');
    if ($de) {
        $deTP = '<div class="rel-tab"><p class="rel-de"/><h3>Disenchants into:</h3></div>
		<div class="data" style="clear: both;"  id="big-results">
		<table class="data-table"><thead><tr class="masthead"><td><a class="noLink">Name</a></td><td align="center"><a class="noLink">Drop Chance</a></td><td align="center"><a class="noLink">Count</a></td></tr></thead><tbody>';
        foreach ($de as $mob) {
            $ids .= $mob['entry'] . ',';
        }
        $cc = $mysql->getRows("select itemnumber,itemicon,itemhtml from itemicon where itemnumber in (?1-1)", $ids, 'armory');
        if ($cc) {
            foreach ($cc as $icon) {
                $icons[$icon['itemnumber']] = $icon;
            }
        }
        foreach ($de as $mob) {
            $icons[$mob['entry']] = validate_icon($icons[$mob['entry']], $mob['entry']);
            $deTP .= '<tr><td><strong><a onMouseOver="setTipText(\'' . system::htmlcode($icons[$mob['entry']]['itemhtml']) . '\')" href="item-info.php?i=' . $mob['entry'] . '" class="staticTip rarity' . $mob['Quality'] . '">
			<img align="middle" border="0" height="48" alt="" src="images/icon48/' . $icons[$mob['entry']]['itemicon'] . '.png"> ' . $mob['name'] . '</a></strong></td><td class="centeralign">' . round($mob['ChanceOrQuestChance'], 2) . '%</td>
			<td>' . ($mob['mincountOrRef'] == $mob['maxcount'] ? $mob['maxcount'] : $mob['mincountOrRef'] . '-' . $mob['maxcount']) . '</td></tr>';
        }
        $deTP .= '</tbody></table></div>';
    }
}
$tp->assign('de', $deTP);
$c->assign('content', $tp->output);
$c->display();
$_SYSTEM->printFooter();
 function start()
 {
     global $config, $SQL, $mysql, $_SYSTEM;
     $il = $this->per_page;
     $st = $this->per_page * $this->page;
     $LIMIT = 'LIMIT ' . $st . ', ' . $il;
     $data = array();
     $d = $mysql->getRows("SELECT name,displayid,ItemLevel,entry,Flags,RequiredLevel,class,subclass,Quality FROM `item_template` WHERE name LIKE '%?1%'\n\t\t" . ($this->ItemClass != -1 ? 'and class = ' . $this->ItemClass : '') . " " . ($this->ItemSubClass != -1 ? 'and subclass = ' . $this->ItemSubClass : '') . " ORDER BY ItemLevel DESC {$LIMIT}", $this->name, 'world');
     $this->count = mysql_result($mysql->query("SELECT count(*) FROM `item_template` WHERE name LIKE '%" . $this->name . "%' " . ($this->ItemClass != -1 ? 'and class = ' . $this->ItemClass : '') . " " . ($this->ItemSubClass != -1 ? 'and subclass = ' . $this->ItemSubClass : ''), 'world'), 0) or $this->count = 0;
     if (!$d) {
         return;
     }
     foreach ($d as $dat) {
         $ids .= $dat['entry'] . ',';
     }
     $c = $mysql->getRows("select itemnumber,itemicon,itemhtml from itemicon where itemnumber in (?1-1)", $ids, 'armory');
     if ($c) {
         foreach ($c as $icon) {
             $icons[$icon['itemnumber']] = $icon;
         }
     }
     foreach ($d as $key => $dat) {
         $icons[$dat['entry']] = validate_icon($icons[$dat['entry']], $dat['entry']);
         $d[$key]['icon'] = $icons[$dat['entry']]['itemicon'];
         $d[$key]['tooltip'] = system::htmlcode($icons[$dat['entry']]['itemhtml']);
     }
     $quest = $mysql->getRows("SELECT `SrcItemId` as id FROM `quest_template` WHERE `SrcItemId` IN (?1-1)", $ids, 'world');
     $vendor = $mysql->getRows("SELECT `item` as id FROM `npc_vendor` WHERE `item` IN (?1-1)", $ids, 'world');
     $chest = $mysql->getRows("SELECT `gameobject_loot_template`.`item` as id FROM `gameobject_loot_template`,`gameobject_template` WHERE gameobject_template.entry = gameobject_loot_template.entry `item`  IN (?1-1)", $ids, 'world');
     $drop = $mysql->getRows("SELECT `item` as id FROM `creature_loot_template` WHERE `item` IN (?1-1)", $ids, 'world');
     $quest_rew = $mysql->getRows("SELECT RewChoiceItemId1,RewChoiceItemId2,RewChoiceItemId3,RewChoiceItemId4,RewChoiceItemId5,RewChoiceItemId6,\n        RewItemId1,RewItemId2,RewItemId3,RewItemId4\n        FROM `quest_template` WHERE `RewChoiceItemId1`IN (?1-1) OR `RewChoiceItemId2`IN (?1-1)\n\tOR `RewChoiceItemId3`IN (?1-1) OR `RewChoiceItemId4`IN (?1-1) OR `RewChoiceItemId5`IN (?1-1) OR `RewChoiceItemId6`IN (?1-1)\n\tOR `RewItemId1`IN (?1-1) OR `RewItemId2`IN (?1-1) OR `RewItemId3`IN (?1-1) OR `RewItemId4`IN (?1-1)", $ids, 'world');
     foreach ($d as $key => $dat) {
         $id = $dat['entry'];
         $d[$key]['source'] = '';
         if ($quest) {
             foreach ($quest as $q) {
                 if (in_array($id, $q)) {
                     $d[$key]['source'] .= 'Quest Item, ';
                     break;
                 }
             }
         }
         if ($vendor) {
             foreach ($vendor as $q) {
                 if (in_array($id, $q)) {
                     if ($dat['Flags'] & 32768 == 32768) {
                         $d[$key]['source'] .= 'PVP Reward, ';
                         break;
                     } else {
                         $d[$key]['source'] .= 'Vendor, ';
                         break;
                     }
                 }
             }
         }
         if ($chest) {
             foreach ($chest as $q) {
                 if (in_array($id, $q)) {
                     $d[$key]['source'] .= 'Chest Drop, ';
                     break;
                 }
             }
         }
         if ($drop) {
             foreach ($drop as $q) {
                 if (in_array($id, $q)) {
                     $d[$key]['source'] .= 'Drop, ';
                     break;
                 }
             }
         }
         if ($quest_rew) {
             foreach ($quest_rew as $q) {
                 if (in_array($id, $q)) {
                     $d[$key]['source'] .= 'Quest Reward, ';
                     break;
                 }
             }
         }
         if (!$d[$key]['source']) {
             $d[$key]['source'] = 'Created, ';
         }
         $d[$key]['source'] = substr($d[$key]['source'], 0, -2);
     }
     $data = $d;
     return $data;
 }