public static function getDisplay($tableRowId, $itemId, $itemDamage, $qty, $enchantments) { // load html $outputs = RenderHTML::LoadHTML('display.php'); if (!is_array($outputs)) { echo 'Failed to load html!'; exit; } // render enchantments $enchOutput = ''; $nameOutput = ''; $loreOutput = ''; foreach ($enchantments as $key => $value) { if (!(isset($key) || isset($value))) { continue; } // custom name if (strcasecmp("<NAME>", $key) == 0) { $nameOutput = $outputs['custom name']; $tags = array('name' => $value); RenderHTML::RenderTags($nameOutput, $tags); unset($tags); continue; } // lore if (strcasecmp("<LORE>", $key) == 0) { $loreOutput = ''; foreach (explode("\\\\n", trim($value)) as $line) { if (!empty($loreOutput)) { $loreOutput .= $outputs['lore split']; } $tags = array('line' => $line); $tmp = $outputs['lore line']; RenderHTML::RenderTags($tmp, $tags); $loreOutput .= $tmp; unset($tmp, $tags); } continue; } // enchantment $tmp = $outputs['enchantment']; $enchId = (int) $key; $level = (int) $value; $tags = array('ench id' => $enchId, 'ench name' => self::getEnchantmentTitle($enchId), 'ench title' => self::getEnchantmentTitle($enchId), 'ench level' => numberToRoman($level)); RenderHTML::RenderTags($tmp, $tags); if (!empty($enchOutput)) { $enchOutput .= $outputs['enchantment split']; } $enchOutput .= $tmp; unset($tmp, $tags); } // render item block $output = $outputs['item']; $tags = array('table row id' => $tableRowId, 'item id' => $itemId, 'item damage' => self::getDamagedChargedStr($itemId, $itemDamage), 'item qty' => $qty, 'custom name' => $nameOutput, 'lore' => $loreOutput, 'enchantments' => $enchOutput, 'item name' => self::getItemName($itemId, $itemDamage), 'item title' => self::getItemTitle($itemId, $itemDamage), 'item image url' => self::getItemImageUrl($itemId, $itemDamage), 'market price each' => "--", 'market price total' => "--"); $itemType = self::getItemType($itemId); if ($itemType != 'tool') { $tags['enchantments'] = ''; } RenderHTML::RenderTags($output, $tags); RenderHTML::Block($output, 'has damage', !empty($tags['item damage'])); RenderHTML::Block($output, 'has custom name', !empty($tags['custom name'])); RenderHTML::Block($output, 'has lore', !empty($tags['lore'])); RenderHTML::Block($output, 'has enchantments', !empty($tags['enchantments'])); return $output; }