Jump to content
  • 0

HTML Edit


InFocus

Question

How i can set L2Npc.Java for add %playername& to add this in texts?

I have edited this method 

public void showChatWindow(L2PcInstance player, String filename)
	{
		// Send a Server->Client NpcHtmlMessage containing the text of the L2NpcInstance to the L2PcInstance
		final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
		html.setFile(player.getHtmlPrefix(), filename);
		html.replace("%objectId%", String.valueOf(getObjectId()));
		html.replace("%exp%", String.valueOf((Config.RATE_XP)));
		html.replace("%sp%", String.valueOf((Config.RATE_SP)));
		html.replace("%drop%", String.valueOf((Config.RATE_DEATH_DROP_AMOUNT_MULTIPLIER)));
		html.replace("%type%", String.valueOf(player.isPremium() ? "Premium" : "Normal"));
		player.sendPacket(html);
		
		// Send a Server->Client ActionFailed to the L2PcInstance in order to avoid that the client wait another packet
		player.sendPacket(ActionFailed.STATIC_PACKET);
	}

and in game html says %exp% not the exp rate

 

 

Link to comment
Share on other sites

Recommended Posts

  • 0

Truth aside. You don't have to use the String cast

 

html.replace("%exp%", String.valueOf((Config.RATE_XP)));

=>

html.replace("%exp%", Config.RATE_XP);

 

and so on with other lines. Use the cast, only when Eclipse throw an error, but normally the replace method supports other types.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

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...

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