Skip to content

Dropdata Error

Featured Replies

Hello i'm trying to make a html that show the drops from the mob the problem is that it give error... here's the code

final L2NpcTemplate mob = NpcTable.getInstance().getTemplateByName(name);
		
		

		final StringBuilder html = StringUtil.startAppend(6000, "<html><body><br><br>" + "<table border=0 width=610><tr><td width=10></td><td width=600 align=left>" +
		
		 "<a action=\"bypass _bbshome\"></a> > " + "<a action=\"bypass _bbsclan_clanlist\"> MOB " + mob.getName() + " </a>  > "+ 
		 
		 "<a action=\"bypass _bbsclan_clanhome;", String.valueOf(5), "\"> &$802; </a>" + "</td></tr>" + "</table>");
		
		html.append("<img src=\"L2UI.SquareBlank\" width=\"610\" height=\"2\">" + "<table cellpadding=0 cellspacing=2 border=0><tr><br><br><br>");
		
		StringUtil.append(html, "<table border=0 width=610><tr><td width=10></td><td width=600 align=left>");
		StringUtil.append(html, "<tr><td fixwidth=610> Monster Name: " + mob.getName() + "<br>");
		StringUtil.append(html, "<tr><td fixwidth=610> Monster Level: " + mob.getLevel() + "<br>");	
		StringUtil.append(html, "<tr><td fixwidth=610> Monster Race: " + mob.getRace() + "<br><br>");	
		StringUtil.append(html, "<tr><td fixwidth=610> Drop List below:<br>");
		
		
			try
			{
			for (L2DropData drop : mob.getAllDropData())
			{		
				final L2Item item = ItemTable.getInstance().getTemplate(drop.getItemId());
				
				if (!item.isDestroyable())
				{
					StringUtil.append(html, "Drop: " + drop);
				}
			}
			}
			catch (final Exception ex)
			{
				activeChar.sendMessage("Error.");
			}

Avoid to use + concatenation, while you already StringBuilder... Otherwise you build internal StringBuilder.

 

On startAppend, simply merge all =       "a " + "b"    >     "a b"

On StringUtil.append use , delimiter =    "<tr>" + blabla.getName()    >    "<tr>", blabla.getName()

Edited by Tryskell

Guest
This topic is now closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.