Jump to content
  • 0

html content was to long


Question

Posted

Hello I already did everything and can not solve what I did wrong?

 

uEA6hPu.png

 

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);
			}
		}
	}

 

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.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...