Williams Posted December 4, 2019 Posted December 4, 2019 Hello I already did everything and can not solve what I did wrong? Code : private void showRaidBossDrop(Player player, int bossId, int pageId) { final NpcTemplate npc = NpcData.getInstance().getTemplate(bossId); if (npc == null) return; final List<DropCategory> list = new ArrayList<>(); npc.getDropData().forEach(c -> list.add(c)); Collections.reverse(list); final int limit = Config.RAID_BOSS_DROP_PAGE_LIMIT; final int max = list.size() / limit + (list.size() % limit == 0 ? 0 : 1); list.subList((pageId - 1) * limit, Math.min(pageId * limit, list.size())); final StringBuilder sb = new StringBuilder(); for (DropCategory cat : list) { for (DropData drop : cat.getAllDrops()) { sb.append("<html>"); sb.append("<center>"); sb.append("<body>"); sb.append("<table width=\"256\">"); sb.append("<tr><td width=\"256\" align=\"center\">%name%</td></tr>"); sb.append("</table>"); sb.append("<br>"); sb.append("<table width=\"256\">"); sb.append("<tr><td width=\"256\" align=\"left\">" + _messages[1][Rnd.get(_messages.length)].replace("%boss%", npc.getName()) + "</td></tr>"); sb.append("</table>"); sb.append("<br>"); sb.append("<table width=\"224\" bgcolor=\"000000\">"); sb.append("<tr><td width=\"224\" align=\"center\">Raid Boss Drops</td></tr>"); sb.append("</table>"); sb.append("<br>"); final Item item = ItemTable.getInstance().getTemplate(drop.getItemId()); String name = item.getName(); if (name.length() >= 43) name = name.substring(0, 40) + "..."; sb.append("<table width=280 bgcolor=000000><tr>"); sb.append("<td width=44 height=41 align=center><table bgcolor=FFFFFF cellpadding=6 cellspacing=\"-5\"><tr><td><button width=32 height=32 back=" + item.getIcon() + " fore=" + item.getIcon() + "></td></tr></table></td>"); sb.append("<td width=236>" + name + "</td>"); sb.append("</tr></table><img src=L2UI.SquareGray width=280 height=1>"); sb.append("<br>"); sb.append("<table width=\"64\" cellspacing=\"2\">"); sb.append("<tr>"); for (int x = 0; x < max; x++) { final int pageNr = x + 1; if (pageId == pageNr) sb.append("<td align=\"center\">" + pageNr + "</td>"); else sb.append("<td align=\"center\"><a action=\"bypass -h npc_%objectId%_RaidBossDrop " + bossId + " " + pageNr + "\">" + pageNr + "</a></td>"); } sb.append("</tr>"); sb.append("</table>"); sb.append("<br>"); sb.append("<table width=\"160\" cellspacing=\"2\">"); sb.append("<tr>"); sb.append("<td width=\"160\" align=\"center\"><a action=\"bypass -h npc_%objectId%_RaidBossInfo " + _lastPage.get(player.getObjectId()) + "\">Return</a></td>"); sb.append("</tr>"); sb.append("</table>"); sb.append("<br>"); sb.append("<table width=\"256\">"); sb.append("<tr><td width=\"256\" align=\"center\">L2EUA</td></tr>"); sb.append("</table>"); sb.append("</center>"); sb.append("</body>"); sb.append("</html>"); final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId()); html.setHtml(sb.toString()); html.replace("%name%", getName()); html.replace("%objectId%", getObjectId()); player.sendPacket(html); } } } Quote
0 StinkyMadness Posted December 4, 2019 Posted December 4, 2019 You have added whole html on loop not only the item table take the rest html out of the loop Quote
0 DenArt Designs Posted December 5, 2019 Posted December 5, 2019 did you build this code? i think you need help to understand how many times this code is printed Quote
Question
Williams
Hello I already did everything and can not solve what I did wrong?
Code :
2 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.