Jump to content

Recommended Posts

Posted

Hello folks,

 

In this guide i will teach you how to put a new command named .info on your server and when u type it and hit enter it will show a htm file that there you can put w/e you want .. i suggest updates and info of server ..

 

so here we go .. i will use l2jfree IL pack , what to do ..

 

1) checkout the pack

2) go into L2_GameServer_IL\src\main\java\net\sf\l2j\gameserver\handler\voicedcommandhandlers

 

and make a new VoiceInfo.java file and put inside that

 

/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
* 
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
* 
* You should have received a copy of the GNU General Public License along with
* this program. If not, see http://www.gnu.org/licenses/
*/
package net.sf.l2j.gameserver.handler.voicedcommandhandlers;

import net.sf.l2j.Config;
import net.sf.l2j.gameserver.GameServer;
import net.sf.l2j.gameserver.cache.HtmCache;
import net.sf.l2j.gameserver.handler.IVoicedCommandHandler;
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
import net.sf.l2j.gameserver.serverpackets.NpcHtmlMessage;

/**
* @author Michiru
*
*/
public class VoiceInfo implements IVoicedCommandHandler
{
private static String[]	VOICED_COMMANDS	=
										{ "info" };

/* (non-Javadoc)
* @see net.sf.l2j.gameserver.handler.IVoicedCommandHandler#useVoicedCommand(java.lang.String, net.sf.l2j.gameserver.model.actor.instance.L2PcInstance, java.lang.String)
*/
public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
{
	String htmFile = "data/html/custom/xx.htm";
	String htmContent = HtmCache.getInstance().getHtm(htmFile);
	if (htmContent != null)
	{
		NpcHtmlMessage infoHtml = new NpcHtmlMessage(1);
		infoHtml.setHtml(htmContent);
		activeChar.sendPacket(infoHtml);
	}
	else
	{
		activeChar.sendMessage("omg lame error! where is " + htmFile + " ! blame the Server Admin");
	}
	return true;
}

public String[] getVoicedCommandList()
{
	return VOICED_COMMANDS;
}
}

 

so you see that String htmFile = "data/html/custom/xx.htm";

 

here is the path of the htm you will see IG .. you can change it as you wish ! If you forget to put the htm file it will show up this

 

"omg lame error! where is " + htmFile + " ! blame the Server Admin"

 

Fine :D change it :P

 

so what you do it to make a .htm file named it as you want and replace the number there where is xx.htm .. now we go to

 

L2_GameServer_IL\src\main\java\net\sf\l2j\gameserver\handler\

 

we open voicecommandhandlers.java and then you have to put

 

import net.sf.l2j.gameserver.handler.voicedcommandhandlers.VoiceInfo;

 

after import net.sf.l2j.gameserver.handler.voicedcommandhandlers.CastleDoors;

or as your folder is .. if u have more it will be shown different ..

 

now u go on line 54 and after this line u put

 

        registerVoicedCommandHandler(new VoiceInfo());

 

then your new voice command is register ! Compile the pack via maven and you are ready ! Have Fun

 

Credits to me .

 

PS : DONT SPAM!

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