Jump to content

Create Your Voiced Command In Java


Recommended Posts

http://prntscr.com/j77h2z

this is how you start this will open a window.

you register also the voiced command on the voiced handler, this is an example of what you ask the rest is up to the brain.

Link to comment
Share on other sites

13 hours ago, Nightw0lf said:

http://prntscr.com/j77h2z

this is how you start this will open a window.

you register also the voiced command on the voiced handler, this is an example of what you ask the rest is up to the brain.

i think you understand me wrong mate , because i think my english is little bad .... i want to make an command for example ( .gatekeeper ) and when i use that command in chat i want to open gatekeper html just that only 

Link to comment
Share on other sites

17 minutes ago, Prostyle1990 said:

i think you understand me wrong mate , because i think my english is little bad .... i want to make an command for example ( .gatekeeper ) and when i use that command in chat i want to open gatekeper html just that only 

the answer is in nightw0lf's link. try to understand what you have to change.

 

Btw, learn some basics before you continue...

Link to comment
Share on other sites

i am not sure if is working but i think that you need i make you a code open html .gatekeeper can use more chat like .pageGk and can teleport and stay in same page with .tele like .tele pageId and teleId from teleports.xml list

 

/*
 * 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 java.util.StringTokenizer;

import net.sf.l2j.gameserver.data.xml.TeleportLocationData;
import net.sf.l2j.gameserver.handler.IVoicedCommandHandler;
import net.sf.l2j.gameserver.model.actor.instance.PcInstance;
import net.sf.l2j.gameserver.model.location.TeleportLocation;
import net.sf.l2j.gameserver.model.zone.ZoneId;
import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;

public class gatekeeperCmd implements IVoicedCommandHandler
{
	private static final String[] VOICED_COMMANDS =
	{
		"gatekeeper",
		"PageGk",
		"tele"
	};
	
	@Override
	public boolean useVoicedCommand(final String command, final PcInstance activeChar, final String target)
	{
		final StringTokenizer st = new StringTokenizer(command, " ");
		int page = 0;
		int locId = 0;
		if (command.startsWith("gatekeeper"))
		{
			mainHtm(activeChar, page);
		}
		else if (command.startsWith("PageGk"))
		{
			if (st.hasMoreTokens())
			{
				page = Integer.parseInt(st.nextToken());
			}
			mainHtm(activeChar, page);
		}
		else if (command.startsWith("tele"))
		{
			if (st.hasMoreTokens())
			{
				page = Integer.parseInt(st.nextToken());
				locId = Integer.parseInt(st.nextToken());
			}
			final TeleportLocation list = TeleportLocationData.getInstance().getTeleportLocation(locId);
			Teleport(activeChar, page, list);
		}
		return true;
	}
	
	@Override
	public String[] getVoicedCommandList()
	{
		return VOICED_COMMANDS;
	}
	
	public boolean mainHtm(final PcInstance activeChar, int page)
	{
		if (activeChar == null)
		{
			return false;
		}
		
		else if (!activeChar.isInsideZone(ZoneId.TOWN) || !activeChar.isInsideZone(ZoneId.PEACE))
		{
			activeChar.sendMessage("You can't use this command out of town or peace zone.");
			return false;
		}
		else
		{
			NpcHtmlMessage html = new NpcHtmlMessage(0);
			html.setFile("data/html/gatekeeper/customTele" + (page == 0 ? "" : "-" + page) + ".htm");
			activeChar.sendPacket(html);
			return true;
		}
	}
	
	public boolean Teleport(final PcInstance activeChar, int page, TeleportLocation list)
	{
		if (activeChar == null)
		{
			return false;
		}
		
		NpcHtmlMessage html = new NpcHtmlMessage(0);
		html.setFile("data/html/gatekeeper/customTele" + (page == 0 ? "" : "-" + page) + ".htm");
		activeChar.teleToLocation(list, 20);
		activeChar.sendPacket(html);
		return true;
		
	}
}

 

Link to comment
Share on other sites

9 hours ago, tazerman2 said:

i am not sure if is working but i think that you need i make you a code open html .gatekeeper can use more chat like .pageGk and can teleport and stay in same page with .tele like .tele pageId and teleId from teleports.xml list

 


/*
 * 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 java.util.StringTokenizer;

import net.sf.l2j.gameserver.data.xml.TeleportLocationData;
import net.sf.l2j.gameserver.handler.IVoicedCommandHandler;
import net.sf.l2j.gameserver.model.actor.instance.PcInstance;
import net.sf.l2j.gameserver.model.location.TeleportLocation;
import net.sf.l2j.gameserver.model.zone.ZoneId;
import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;

public class gatekeeperCmd implements IVoicedCommandHandler
{
	private static final String[] VOICED_COMMANDS =
	{
		"gatekeeper",
		"PageGk",
		"tele"
	};
	
	@Override
	public boolean useVoicedCommand(final String command, final PcInstance activeChar, final String target)
	{
		final StringTokenizer st = new StringTokenizer(command, " ");
		int page = 0;
		int locId = 0;
		if (command.startsWith("gatekeeper"))
		{
			mainHtm(activeChar, page);
		}
		else if (command.startsWith("PageGk"))
		{
			if (st.hasMoreTokens())
			{
				page = Integer.parseInt(st.nextToken());
			}
			mainHtm(activeChar, page);
		}
		else if (command.startsWith("tele"))
		{
			if (st.hasMoreTokens())
			{
				page = Integer.parseInt(st.nextToken());
				locId = Integer.parseInt(st.nextToken());
			}
			final TeleportLocation list = TeleportLocationData.getInstance().getTeleportLocation(locId);
			Teleport(activeChar, page, list);
		}
		return true;
	}
	
	@Override
	public String[] getVoicedCommandList()
	{
		return VOICED_COMMANDS;
	}
	
	public boolean mainHtm(final PcInstance activeChar, int page)
	{
		if (activeChar == null)
		{
			return false;
		}
		
		else if (!activeChar.isInsideZone(ZoneId.TOWN) || !activeChar.isInsideZone(ZoneId.PEACE))
		{
			activeChar.sendMessage("You can't use this command out of town or peace zone.");
			return false;
		}
		else
		{
			NpcHtmlMessage html = new NpcHtmlMessage(0);
			html.setFile("data/html/gatekeeper/customTele" + (page == 0 ? "" : "-" + page) + ".htm");
			activeChar.sendPacket(html);
			return true;
		}
	}
	
	public boolean Teleport(final PcInstance activeChar, int page, TeleportLocation list)
	{
		if (activeChar == null)
		{
			return false;
		}
		
		NpcHtmlMessage html = new NpcHtmlMessage(0);
		html.setFile("data/html/gatekeeper/customTele" + (page == 0 ? "" : "-" + page) + ".htm");
		activeChar.teleToLocation(list, 20);
		activeChar.sendPacket(html);
		return true;
		
	}
}

 

you just helped him to raise to many questions that he dont even know how to ask he has to start from the basics good luck on that complex way to start

Link to comment
Share on other sites

On 4/19/2018 at 11:16 PM, tazerman2 said:

i am not sure if is working but i think that you need i make you a code open html .gatekeeper can use more chat like .pageGk and can teleport and stay in same page with .tele like .tele pageId and teleId from teleports.xml list

 


/*
 * 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 java.util.StringTokenizer;

import net.sf.l2j.gameserver.data.xml.TeleportLocationData;
import net.sf.l2j.gameserver.handler.IVoicedCommandHandler;
import net.sf.l2j.gameserver.model.actor.instance.PcInstance;
import net.sf.l2j.gameserver.model.location.TeleportLocation;
import net.sf.l2j.gameserver.model.zone.ZoneId;
import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;

public class gatekeeperCmd implements IVoicedCommandHandler
{
	private static final String[] VOICED_COMMANDS =
	{
		"gatekeeper",
		"PageGk",
		"tele"
	};
	
	@Override
	public boolean useVoicedCommand(final String command, final PcInstance activeChar, final String target)
	{
		final StringTokenizer st = new StringTokenizer(command, " ");
		int page = 0;
		int locId = 0;
		if (command.startsWith("gatekeeper"))
		{
			mainHtm(activeChar, page);
		}
		else if (command.startsWith("PageGk"))
		{
			if (st.hasMoreTokens())
			{
				page = Integer.parseInt(st.nextToken());
			}
			mainHtm(activeChar, page);
		}
		else if (command.startsWith("tele"))
		{
			if (st.hasMoreTokens())
			{
				page = Integer.parseInt(st.nextToken());
				locId = Integer.parseInt(st.nextToken());
			}
			final TeleportLocation list = TeleportLocationData.getInstance().getTeleportLocation(locId);
			Teleport(activeChar, page, list);
		}
		return true;
	}
	
	@Override
	public String[] getVoicedCommandList()
	{
		return VOICED_COMMANDS;
	}
	
	public boolean mainHtm(final PcInstance activeChar, int page)
	{
		if (activeChar == null)
		{
			return false;
		}
		
		else if (!activeChar.isInsideZone(ZoneId.TOWN) || !activeChar.isInsideZone(ZoneId.PEACE))
		{
			activeChar.sendMessage("You can't use this command out of town or peace zone.");
			return false;
		}
		else
		{
			NpcHtmlMessage html = new NpcHtmlMessage(0);
			html.setFile("data/html/gatekeeper/customTele" + (page == 0 ? "" : "-" + page) + ".htm");
			activeChar.sendPacket(html);
			return true;
		}
	}
	
	public boolean Teleport(final PcInstance activeChar, int page, TeleportLocation list)
	{
		if (activeChar == null)
		{
			return false;
		}
		
		NpcHtmlMessage html = new NpcHtmlMessage(0);
		html.setFile("data/html/gatekeeper/customTele" + (page == 0 ? "" : "-" + page) + ".htm");
		activeChar.teleToLocation(list, 20);
		activeChar.sendPacket(html);
		return true;
		
	}
}

 

man thank you for you answer , but i already lost 1 week without any succes :( maybe can you make for me just an command like .gatekeeper and when i press .gatekeeper i want to open _bbsgatekeper html page please ? i want to use that commmand in l2mythras file witch is shared here on mxc please 

Link to comment
Share on other sites

2 hours ago, SweeTs said:

I don't get it. Why would I use .gatekeeper rather than pressing directly ALT+G? I wonder.

alt + g + 1 click = 2 buttons 1 click
tele = 4 buttons
true why?????? well maybe is some old server with default cb xD somebody opens official server again!

Link to comment
Share on other sites

1 hour ago, Tony360 said:

Maybe you mean Alt + B to send Board package?
Alt + G is Admin package...

Also i'm sure that this command will be not his only problem if he run server with this knowledge.

You have right alt+g its only for admin  ! now i will explain why i want to make this commands , just because i adapted this shortcuts to my interface and when i press each button just appear in chat .buffer .gatekeeper .shop etc....because commands are not implemented in java :D to open the html page for each button 

 

 

here is the pic ---------> https://ibb.co/gBW1rx <--------------

Link to comment
Share on other sites

7 hours ago, Tony360 said:

Maybe you mean Alt + B to send Board package?
Alt + G is Admin package...

Also i'm sure that this command will be not his only problem if he run server with this knowledge.

yes alt+b oh i did not know alt + g is "admin package" can you tell us more about it? what it does?

 

6 hours ago, Prostyle1990 said:

You have right alt+g its only for admin  ! now i will explain why i want to make this commands , just because i adapted this shortcuts to my interface and when i press each button just appear in chat .buffer .gatekeeper .shop etc....because commands are not implemented in java :D to open the html page for each button 

 

 

here is the pic ---------> https://ibb.co/gBW1rx <--------------

but you have the code and i gave you an example you have the tools you have the materials USE them now its like having a naked lady in your bed and asking the crowd how to fuck her. ffs.

Link to comment
Share on other sites

2 hours ago, Nightw0lf said:

yes alt+b oh i did not know alt + g is "admin package" can you tell us more about it? what it does?

 

Dude he said something about community and I though you and SweeTs mistakly said “G”and not “B” stop be toxic.

Link to comment
Share on other sites

guys what i want to do its only to create a command for my buttons when i press button gatekeper to open "bypass _bbsgatekeeper" page but right now when i press button with gatekeper only appear in chat .gatekeeper because i have no voicedcommands maybe someone can make for me an example ? files what i use its shared here L2Mythras file  https://ibb.co/gBW1rx 

Link to comment
Share on other sites

well finally i did this working for me but now i have another problem for example when i type .gk open me gatekeeper page but not in corectly dimension and open in dialog dimension that mean my original gatekeper html page its 780x512 and when i press .gk it open in 289x359 how i can fix that ?any can help ?

Link to comment
Share on other sites

guys my code look like that but i dont know why in game when i use .gatekeeper appear me gk page but in a small window and not on original window maybe someone can help me please ???? 

 

 


 

package l2f.gameserver.handler.voicecommands.impl;

import l2f.gameserver.handler.voicecommands.IVoicedCommandHandler;
import l2f.gameserver.model.Player;
import l2f.gameserver.network.serverpackets.NpcHtmlMessage;

public class gatekeeper implements IVoicedCommandHandler
{

    @Override
    public boolean useVoicedCommand(String command, Player activeChar, String target)
    {
        if (!target.isEmpty())
        {


        }
        showMainPage(activeChar);
        return true;
    }


    private static void showMainPage(Player activeChar)
    {
        activeChar.sendPacket(new NpcHtmlMessage(0).setFile("scripts/services/communityPVP/gatekeeper/main.htm"));
    }

    @Override
    public String[] getVoicedCommandList()
    {
        return new String[]
        {
            "gatekeeper"
        };
    }

}


 

Edited by Prostyle1990
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.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

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




  • Posts

    • Helly everyone . I use L2jmobius interlude , i did everything , installed the db compiled the Build in eclipse Gameserver seems to lead OK , but it fails to connect to loginserver When i click to start the loginserver it says  "Loginserver terminated abnormally" This is wheat gameserver shows me :    [05/10 17:25:12] LoginServerThread: Connecting to login on 127.0.0.1:9014 [05/10 17:25:12] LoginServerThread: LoginServer not available, trying to reconnect... [05/10 17:25:17] LoginServerThread: Connecting to login on 127.0.0.1:9014 [05/10 17:25:17] LoginServerThread: LoginServer not available, trying to reconnect... [05/10 17:25:22] LoginServerThread: Connecting to login on 127.0.0.1:9014 [05/10 17:25:22] LoginServerThread: LoginServer not available, trying to reconnect...   And This is my login config file:   # --------------------------------------------------------------------------- # Login Server Settings # --------------------------------------------------------------------------- # This is the server configuration file. Here you can set up the connection information for your server. # This was written with the assumption that you are behind a router. # Dumbed Down Definitions... # LAN (LOCAL area network) - typically consists of computers connected to the same router as you. # WAN (WIDE area network) - typically consists of computers OUTSIDE of your router (ie. the internet). # x.x.x.x - Format of an IP address. Do not include the x'es into settings. Must be real numbers. # --------------------------------------------------------------------------- # Networking # --------------------------------------------------------------------------- # Bind ip of the LoginServer, use 0.0.0.0 to bind on all available IPs # WARNING: <u><b><font color="red">Please don't change default IPs here if you don't know what are you doing!</font></b></u> # WARNING: <u><b><font color="red">External/Internal IPs are now inside "ipconfig.xml" file.</font></b></u> # Default: 0.0.0.0 LoginserverHostname = 0.0.0.0 # Default: 2106 LoginserverPort = 2106 # The address on which login will listen for GameServers, use * to bind on all available IPs # WARNING: <u><b><font color="red">Please don't change default IPs here if you don't know what are you doing!</font></b></u> # WARNING: <u><b><font color="red">External/Internal IPs are now inside "ipconfig.xml" file.</font></b></u> # Default: 127.0.0.1 LoginHostname = 127.0.0.1 # The port on which login will listen for GameServers # Default: 9014 LoginPort = 9014 # --------------------------------------------------------------------------- # Database # --------------------------------------------------------------------------- # Specify the JDBC driver class for your database. # Default: org.mariadb.jdbc.Driver Driver = org.mariadb.jdbc.Driver # Database URL # Default: jdbc:mariadb://localhost/l2jmobiusinterlude?useUnicode=true&characterEncoding=utf-8&useSSL=false&connectTimeout=10000&interactiveClient=true&sessionVariables=wait_timeout=600,interactive_timeout=600&autoReconnect=true URL = jdbc:mariadb://localhost/l2jmobiusinterlude?useUnicode=true&characterEncoding=utf-8&useSSL=false&connectTimeout=10000&interactiveClient=true&sessionVariables=wait_timeout=600,interactive_timeout=600&autoReconnect=true # Database user info. Default is "root" but it's not recommended. Login = root # Database user password, leave empty for no password. Password = root # Maximum number of database connections to maintain in the pool. # Default: 5 MaximumDatabaseConnections = 5 # Determine whether database connections should be tested for availability. # Default: False TestDatabaseConnections = False # --------------------------------------------------------------------------- # Automatic Database Backup Settings # --------------------------------------------------------------------------- # Generate database backups when server restarts or shuts down.  BackupDatabase = False # Path to MySQL bin folder. Only necessary on Windows. MySqlBinLocation = C:/xampp/mysql/bin/ # Path where MySQL backups are stored. BackupPath = ../backup/ # Maximum number of days that backups will be kept. # Old files in backup folder will be deleted. # Set to 0 to disable. BackupDays = 30 # --------------------------------------------------------------------------- # Thread Configuration # --------------------------------------------------------------------------- # Defines the number of threads in the scheduled thread pool. # If set to -1, this will be determined by available processors divided by 2. ScheduledThreadPoolSize = 2 # Defines the number of threads in the instant thread pool. # If set to -1, this will be determined by available processors divided by 2. InstantThreadPoolSize = 2 # --------------------------------------------------------------------------- # Security # --------------------------------------------------------------------------- # How many times you can provide an invalid account/pass before the IP gets banned. # Default: 5 LoginTryBeforeBan = 5 # Time you won't be able to login back again after LoginTryBeforeBan tries to login. # Default: 900 (15 minutes) LoginBlockAfterBan = 900 # If set to True any GameServer can register on your login's free slots # Default: True AcceptNewGameServer = True # Flood Protection. All values are in milliseconds. # Default: True EnableFloodProtection = True # Default: 15 FastConnectionLimit = 15 # Default: 700 NormalConnectionTime = 700 # Default: 350 FastConnectionTime = 350 # Default: 50 MaxConnectionPerIP = 50 # --------------------------------------------------------------------------- # Misc Login Settings # --------------------------------------------------------------------------- # If False, the license (after the login) will not be shown. # Default: True ShowLicence = True # Default: True AutoCreateAccounts = True # Datapack root directory. # Defaults to current directory from which the server is started. DatapackRoot = . # --------------------------------------------------------------------------- # Scheduled Login Restart # --------------------------------------------------------------------------- # Enable disable scheduled login restart. # Default: False LoginRestartSchedule = False # Time in hours. # Default: 24 LoginRestartTime = 24    
    • or at least to tell you an update that sorry but still not at home.. 10 days is suspisious.. but he is long time offline from discord indeed... maybe something happened?
    • I never had problems with him. Again, Im not sure if he scammed or not. But 10+ days without answering after we already paid, its a bit sus. If you know you wouldnt be able to answer for a few days, after receiving and confirming the amount, why dont keep in touch? or just say "hey, dont send now because I will only be available after day x.".  
    • i used to ask him for stuff etc, i dont think he scammed ... if he does i will be suprised...
  • Topics

×
×
  • Create New...