Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- else if (_command.startsWith("DropListNpc"))
- {
- private static void showItemsPage(Player activeChar, int page)
- {
- final L2Object object = activeChar.getTarget();
- int MaxItemsPerPage = 10;
- int MaxPages = _itemssize / maxItemsPerPage;
- if (_itemssize > MaxItemsPerPage * MaxPages)
- MaxPages++;
- if (page > MaxPages)
- page = MaxPages;
- int ItemsStart = MaxItemsPerPage * page;
- int ItemsEnd = _itemssize();
- if (ItemsEnd - ItemsStart > MaxItemsPerPage)
- ItemsEnd = ItemsStart + MaxItemsPerPage;
- if (object instanceof L2NpcInstance)
- {
- NpcHtmlMessage html = new NpcHtmlMessage(0);
- StringBuilder html1 = new StringBuilder("<html>");
- html1.append("<title>Npc Name: " + object.getName() + "</title>");
- html1.append("<body>");
- html1.append("<br>");
- html1.append("<table cellspacing=2 cellpadding=1 width=\"280\">");
- if (((L2NpcInstance) object).getTemplate().getDropData() != null)
- {
- for (L2DropCategory cat : ((L2NpcInstance) object).getTemplate().getDropData())
- {
- for (L2DropData drop : cat.getAllDrops())
- {
- final L2Item item = ItemTable.getInstance().getTemplate(drop.getItemId());
- if (item == null)
- continue;
- int mind = 0, maxd = 0;
- String smind = null, smaxd = null;
- String name = item.getName();
- if (cat.isSweep())
- {
- mind = (int) (Config.RATE_DROP_SPOIL * drop.getMinDrop());
- maxd = (int) (Config.RATE_DROP_SPOIL * drop.getMaxDrop());
- }
- else if (drop.getItemId() == 57)
- {
- mind = 300 * drop.getMinDrop();
- maxd = 300 * drop.getMaxDrop();
- }
- else
- {
- mind = (int) (Config.RATE_DROP_ITEMS * drop.getMinDrop());
- maxd = (int) (Config.RATE_DROP_ITEMS * drop.getMaxDrop());
- }
- if (mind > 999999)
- {
- DecimalFormat df = new DecimalFormat("###.#");
- smind = df.format(((double) (mind)) / 1000000) + " KK";
- smaxd = df.format(((double) (maxd)) / 1000000) + " KK";
- }
- else if (mind > 999)
- {
- smind = ((mind / 1000)) + " K";
- smaxd = ((maxd / 1000)) + " K";
- }
- else
- {
- smind = Integer.toString(mind);
- smaxd = Integer.toString(maxd);
- }
- if (name.startsWith("Common Item - "))
- {
- name = "(CI)" + name.substring(14);
- }
- if (name.length() >= 34)
- {
- name = name.substring(0, 30) + "...";
- }
- html1.append("<tr>");
- html1.append("<td valign=top align=center height=38 width=40><img src=\"" + getIcon(item.getItemId()) + "\" height=32 width=32></td>");
- html1.append("<td>");
- html1.append("<table cellpadding=0 cellspacing=1 width=237>");
- html1.append("<tr>");
- html1.append("<td>" + (drop.getChance() >= 10000 ? (double) drop.getChance() / 10000 : drop.getChance() < 10000 ? (double) drop.getChance() / 10000 : "N/A") + "% is " + (drop.isQuestDrop() ? "<font color=\"00b3b3\">[Quest]</font>" : (cat.isSweep() ? "<font color=\"009900\">[Spoil]</font> " : "[Drop]")) + "</td>");
- html1.append("</tr>");
- html1.append("<tr>");
- html1.append("<td>Name: <font color=fff600>" + name + "</font> " + (maxd == 1 ? "[1]" : "[" + smind + " - " + smaxd + "]") + "</td>");
- html1.append("</tr>");
- html1.append("</table>");
- html1.append("</td>");
- }
- }
- }
- for (int x = 0; x < MaxPages; x++)
- {
- int pagenr = x + 1;
- if (page == x)
- {
- pages += "<td>Page " + pagenr + "</td>";
- }
- else
- {
- pages += "<td>something " + something() + " " + x + "\">Page " + pagenr + "</a></td>";
- }
- }
- }
- html1.append("</tr></table>");
- html1.append("</body>");
- html1.append("</html>");
- html.setHtml(html1.toString());
- activeChar.sendPacket(html);
- html1 = null;
- html = null;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement