Advertisement
Guest User

Untitled

a guest
Feb 10th, 2019
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 4.12 KB | None | 0 0
  1. else if (_command.startsWith("DropListNpc"))
  2.             {              
  3.                 private static void showItemsPage(Player activeChar, int page)
  4.                 {
  5.                 final L2Object object = activeChar.getTarget();
  6.                
  7.                 int MaxItemsPerPage = 10;
  8.                 int MaxPages = _itemssize / maxItemsPerPage;
  9.                 if (_itemssize > MaxItemsPerPage * MaxPages)
  10.                     MaxPages++;
  11.                
  12.            
  13.                 if (page > MaxPages)
  14.                     page = MaxPages;
  15.                
  16.                 int ItemsStart = MaxItemsPerPage * page;
  17.                 int ItemsEnd = _itemssize();
  18.                 if (ItemsEnd - ItemsStart > MaxItemsPerPage)
  19.                     ItemsEnd = ItemsStart + MaxItemsPerPage;
  20.                
  21.                 if (object instanceof L2NpcInstance)
  22.                 {
  23.                     NpcHtmlMessage html = new NpcHtmlMessage(0);
  24.                     StringBuilder html1 = new StringBuilder("<html>");
  25.                    
  26.                     html1.append("<title>Npc Name: " + object.getName() + "</title>");
  27.                     html1.append("<body>");
  28.                     html1.append("<br>");
  29.                     html1.append("<table cellspacing=2 cellpadding=1 width=\"280\">");
  30.                    
  31.                     if (((L2NpcInstance) object).getTemplate().getDropData() != null)
  32.                     {
  33.                         for (L2DropCategory cat : ((L2NpcInstance) object).getTemplate().getDropData())
  34.                         {
  35.                             for (L2DropData drop : cat.getAllDrops())
  36.                             {
  37.                                 final L2Item item = ItemTable.getInstance().getTemplate(drop.getItemId());
  38.                                
  39.                                 if (item == null)
  40.                                     continue;
  41.                                 int mind = 0, maxd = 0;
  42.                                 String smind = null, smaxd = null;
  43.                                 String name = item.getName();
  44.                                 if (cat.isSweep())
  45.                                 {
  46.                                     mind = (int) (Config.RATE_DROP_SPOIL * drop.getMinDrop());
  47.                                     maxd = (int) (Config.RATE_DROP_SPOIL * drop.getMaxDrop());
  48.                                 }
  49.                                 else if (drop.getItemId() == 57)
  50.                                 {
  51.                                     mind = 300 * drop.getMinDrop();
  52.                                     maxd = 300 * drop.getMaxDrop();
  53.                                 }
  54.                                 else
  55.                                 {
  56.                                     mind = (int) (Config.RATE_DROP_ITEMS * drop.getMinDrop());
  57.                                     maxd = (int) (Config.RATE_DROP_ITEMS * drop.getMaxDrop());
  58.                                 }
  59.                                 if (mind > 999999)
  60.                                 {
  61.                                     DecimalFormat df = new DecimalFormat("###.#");
  62.                                     smind = df.format(((double) (mind)) / 1000000) + " KK";
  63.                                     smaxd = df.format(((double) (maxd)) / 1000000) + " KK";
  64.                                 }
  65.                                 else if (mind > 999)
  66.                                 {
  67.                                     smind = ((mind / 1000)) + " K";
  68.                                     smaxd = ((maxd / 1000)) + " K";
  69.                                 }
  70.                                
  71.                                 else
  72.                                 {
  73.                                     smind = Integer.toString(mind);
  74.                                     smaxd = Integer.toString(maxd);
  75.                                 }
  76.                                 if (name.startsWith("Common Item - "))
  77.                                 {
  78.                                     name = "(CI)" + name.substring(14);
  79.                                 }
  80.                                 if (name.length() >= 34)
  81.                                 {
  82.                                     name = name.substring(0, 30) + "...";
  83.                                 }
  84.                                 html1.append("<tr>");
  85.                                 html1.append("<td valign=top align=center height=38 width=40><img src=\"" + getIcon(item.getItemId()) + "\" height=32 width=32></td>");
  86.                                 html1.append("<td>");
  87.                                 html1.append("<table cellpadding=0 cellspacing=1 width=237>");
  88.                                 html1.append("<tr>");
  89.                                 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>");
  90.                                 html1.append("</tr>");
  91.                                 html1.append("<tr>");
  92.                                 html1.append("<td>Name: <font color=fff600>" + name + "</font> " + (maxd == 1 ? "[1]" : "[" + smind + " - " + smaxd + "]") + "</td>");
  93.                                 html1.append("</tr>");
  94.                                 html1.append("</table>");
  95.                                 html1.append("</td>");
  96.                             }
  97.                         }
  98.                     }
  99.                     for (int x = 0; x < MaxPages; x++)
  100.                     {
  101.                         int pagenr = x + 1;
  102.                         if (page == x)
  103.                         {
  104.                             pages += "<td>Page " + pagenr + "</td>";
  105.                         }
  106.                         else
  107.                         {
  108.                             pages += "<td>something " + something() + " " + x + "\">Page " + pagenr + "</a></td>";
  109.                         }
  110.                     }
  111.                     }
  112.                    
  113.                     html1.append("</tr></table>");
  114.                     html1.append("</body>");
  115.                     html1.append("</html>");
  116.                    
  117.                     html.setHtml(html1.toString());
  118.                     activeChar.sendPacket(html);
  119.                    
  120.                     html1 = null;
  121.                     html = null;
  122.                 }
  123.                
  124.             }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement