/* * Patch for filter_var() */ if(!function_exists('filter_var')){ define('FILTER_VALIDATE_IP', 'ip'); define('FILTER_FLAG_IPV4', 'ipv4'); define('FILTER_FLAG_IPV6', 'ipv6'); define('FILTER_VALIDATE_EMAIL', 'email'); define('FILTER_FLAG_EMAIL_UNICODE', 'unicode'); function filter_var($variable, $filter, $option = false){ if($filter == 'ip'){ if($option == 'ipv4'){ if(preg_match("/(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/", $variable, $matches)){ $variable = $matches[1]; return $variable; } } if($option == 'ipv6'){ if(preg_match("/\s*(([:.]{0,7}[0-9a-fA-F]{0,4}){1,8})\s*/", $variable, $matches)){ $variable = $matches[1]; return $variable; } } } if($filter == 'email'){ if($option == 'unicode' || $option == false){ if(preg_match("/\s*(\S*@\S*\.\S*)\s*/", $variable, $matches)){ $variable = $matches[1]; return $variable; } } } } }
data\scripts\handlers\usercommandhandlers
/*
* 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 handlers.usercommandhandlers;
import net.sf.l2j.gameserver.handler.IUserCommandHandler;
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;
public class ServerInfo implements IUserCommandHandler
{
private static final int[] COMMAND_IDS =
{
121
};
[quote]a,[b]serverinfo[/b]\0[/quote]
/**
*
* @see net.sf.l2j.gameserver.handler.IUserCommandHandler#useUserCommand(int, net.sf.l2j.gameserver.model.actor.instance.L2PcInstance)
*/
public boolean useUserCommand(int id, L2PcInstance activeChar)
{
if (id != COMMAND_IDS[0])
return false;
NpcHtmlMessage npcHtmlMessage = new NpcHtmlMessage(0);
npcHtmlMessage.setHtml("<html><head><title>Title</title></head><body>Tu wpisz Twój text jak będzie miał się pojawić w oknie po wywołaniu komendy !</body></html>");
activeChar.sendPacket(npcHtmlMessage);
return true;
}
/**
*
* @see net.sf.l2j.gameserver.handler.IUserCommandHandler#getUserCommandList()
*/
public int[] getUserCommandList()
{
return COMMAND_IDS;
}
}
if (id != COMMAND_IDS[0])
return false;
NpcHtmlMessage npcHtmlMessage = new NpcHtmlMessage(0);}
npcHtmlMessage.setHtml("<html><head><title>Title</title></head><body>Your Text Here</body></html>");
activeChar.sendPacket(npcHtmlMessage);
return true;
/**
*
* @see net.sf.l2j.gameserver.handler.IUserCommandHandler#getUserCommandList()
*/
public int[] getUserCommandList()
{
return COMMAND_IDS;
}
}
/*
* 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 handlers.usercommandhandlers;
import net.sf.l2j.gameserver.handler.IUserCommandHandler;
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;
/**
* Support for /serverinfo command
* Added by Matim & Impos89 !
*/
public class ServerInfo implements IUserCommandHandler
{
private static final int[] COMMAND_IDS =
{
121
};
/**
*
* @see net.sf.l2j.gameserver.handler.IUserCommandHandler#useUserCommand(int, net.sf.l2j.gameserver.model.actor.instance.L2PcInstance)
*/
public boolean useUserCommand(int id, L2PcInstance activeChar)
{
if (id != COMMAND_IDS[0])
return false;
NpcHtmlMessage npcHtmlMessage = new NpcHtmlMessage(0);
npcHtmlMessage.setHtml("<html><head><title>Title</title></head><body>Tutaj podajesz Twoj text..</body></html>");
activeChar.sendPacket(npcHtmlMessage);
return true;
}
/**
*
* @see net.sf.l2j.gameserver.handler.IUserCommandHandler#getUserCommandList()
*/
public int[] getUserCommandList()
{
return COMMAND_IDS;
}
}
\data\scripts\handlers
import handlers.usercommandhandlers.ChannelDelete;
import handlers.usercommandhandlers.ChannelLeave;
import handlers.usercommandhandlers.ChannelListUpdate;
import handlers.usercommandhandlers.ClanPenalty;
import handlers.usercommandhandlers.ClanWarsList;
import handlers.usercommandhandlers.DisMount;
import handlers.usercommandhandlers.Escape;
import handlers.usercommandhandlers.InstanceZone;
import handlers.usercommandhandlers.Loc;
import handlers.usercommandhandlers.Mount;
import handlers.usercommandhandlers.OlympiadStat;
import handlers.usercommandhandlers.PartyInfo;
import handlers.usercommandhandlers.Time;
import handlers.usercommandhandlers.ServerInfo;
private static void loadUserHandlers()
{
UserCommandHandler.getInstance().registerUserCommandHandler(new ClanPenalty());
UserCommandHandler.getInstance().registerUserCommandHandler(new ClanWarsList());
UserCommandHandler.getInstance().registerUserCommandHandler(new DisMount());
UserCommandHandler.getInstance().registerUserCommandHandler(new Escape());
UserCommandHandler.getInstance().registerUserCommandHandler(new InstanceZone());
UserCommandHandler.getInstance().registerUserCommandHandler(new Loc());
UserCommandHandler.getInstance().registerUserCommandHandler(new Mount());
UserCommandHandler.getInstance().registerUserCommandHandler(new PartyInfo());
UserCommandHandler.getInstance().registerUserCommandHandler(new Time());
UserCommandHandler.getInstance().registerUserCommandHandler(new OlympiadStat());
UserCommandHandler.getInstance().registerUserCommandHandler(new ChannelLeave());
UserCommandHandler.getInstance().registerUserCommandHandler(new ChannelDelete());
UserCommandHandler.getInstance().registerUserCommandHandler(new ChannelListUpdate());
UserCommandHandler.getInstance().registerUserCommandHandler(new ServerInfo());
_log.config("Loaded " + UserCommandHandler.getInstance().size() + " UserHandlers");
}
UserCommandHandler.getInstance().registerUserCommandHandler(new ServerInfo());