Jump to content

Question

Posted

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

3 answers to this question

Recommended Posts

  • 0
Posted (edited)

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.


×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock