Merged with released L2J-Unity files.
This commit is contained in:
@@ -1,128 +1,128 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* 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.admincommandhandlers;
|
||||
|
||||
import java.util.NoSuchElementException;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.gameserver.ThreadPoolManager;
|
||||
import com.l2jmobius.gameserver.datatables.SkillData;
|
||||
import com.l2jmobius.gameserver.handler.IAdminCommandHandler;
|
||||
import com.l2jmobius.gameserver.model.L2Object;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.MagicSkillUse;
|
||||
|
||||
/**
|
||||
* @version $Revision: 1.2 $ $Date: 2004/06/27 08:12:59 $
|
||||
*/
|
||||
public class AdminTest implements IAdminCommandHandler
|
||||
{
|
||||
private static final String[] ADMIN_COMMANDS =
|
||||
{
|
||||
"admin_stats",
|
||||
"admin_skill_test",
|
||||
"admin_known"
|
||||
};
|
||||
|
||||
@Override
|
||||
public boolean useAdminCommand(String command, L2PcInstance activeChar)
|
||||
{
|
||||
if (command.equals("admin_stats"))
|
||||
{
|
||||
for (String line : ThreadPoolManager.getInstance().getStats())
|
||||
{
|
||||
activeChar.sendMessage(line);
|
||||
}
|
||||
}
|
||||
else if (command.startsWith("admin_skill_test"))
|
||||
{
|
||||
try
|
||||
{
|
||||
final StringTokenizer st = new StringTokenizer(command);
|
||||
st.nextToken();
|
||||
final int id = Integer.parseInt(st.nextToken());
|
||||
if (command.startsWith("admin_skill_test"))
|
||||
{
|
||||
adminTestSkill(activeChar, id, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
adminTestSkill(activeChar, id, false);
|
||||
}
|
||||
}
|
||||
catch (NumberFormatException e)
|
||||
{
|
||||
activeChar.sendMessage("Command format is //skill_test <ID>");
|
||||
}
|
||||
catch (NoSuchElementException nsee)
|
||||
{
|
||||
activeChar.sendMessage("Command format is //skill_test <ID>");
|
||||
}
|
||||
}
|
||||
else if (command.equals("admin_known on"))
|
||||
{
|
||||
Config.CHECK_KNOWN = true;
|
||||
}
|
||||
else if (command.equals("admin_known off"))
|
||||
{
|
||||
Config.CHECK_KNOWN = false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param activeChar
|
||||
* @param id
|
||||
* @param msu
|
||||
*/
|
||||
private void adminTestSkill(L2PcInstance activeChar, int id, boolean msu)
|
||||
{
|
||||
L2Character caster;
|
||||
final L2Object target = activeChar.getTarget();
|
||||
if (!(target instanceof L2Character))
|
||||
{
|
||||
caster = activeChar;
|
||||
}
|
||||
else
|
||||
{
|
||||
caster = (L2Character) target;
|
||||
}
|
||||
|
||||
final Skill _skill = SkillData.getInstance().getSkill(id, 1);
|
||||
if (_skill != null)
|
||||
{
|
||||
caster.setTarget(activeChar);
|
||||
if (msu)
|
||||
{
|
||||
caster.broadcastPacket(new MagicSkillUse(caster, activeChar, id, 1, _skill.getHitTime(), _skill.getReuseDelay()));
|
||||
}
|
||||
else
|
||||
{
|
||||
caster.doCast(_skill);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getAdminCommandList()
|
||||
{
|
||||
return ADMIN_COMMANDS;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* 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.admincommandhandlers;
|
||||
|
||||
import java.util.NoSuchElementException;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.gameserver.ThreadPoolManager;
|
||||
import com.l2jmobius.gameserver.data.xml.impl.SkillData;
|
||||
import com.l2jmobius.gameserver.handler.IAdminCommandHandler;
|
||||
import com.l2jmobius.gameserver.model.L2Object;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.MagicSkillUse;
|
||||
|
||||
/**
|
||||
* @version $Revision: 1.2 $ $Date: 2004/06/27 08:12:59 $
|
||||
*/
|
||||
public class AdminTest implements IAdminCommandHandler
|
||||
{
|
||||
private static final String[] ADMIN_COMMANDS =
|
||||
{
|
||||
"admin_stats",
|
||||
"admin_skill_test",
|
||||
"admin_known"
|
||||
};
|
||||
|
||||
@Override
|
||||
public boolean useAdminCommand(String command, L2PcInstance activeChar)
|
||||
{
|
||||
if (command.equals("admin_stats"))
|
||||
{
|
||||
for (String line : ThreadPoolManager.getInstance().getStats())
|
||||
{
|
||||
activeChar.sendMessage(line);
|
||||
}
|
||||
}
|
||||
else if (command.startsWith("admin_skill_test"))
|
||||
{
|
||||
try
|
||||
{
|
||||
final StringTokenizer st = new StringTokenizer(command);
|
||||
st.nextToken();
|
||||
final int id = Integer.parseInt(st.nextToken());
|
||||
if (command.startsWith("admin_skill_test"))
|
||||
{
|
||||
adminTestSkill(activeChar, id, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
adminTestSkill(activeChar, id, false);
|
||||
}
|
||||
}
|
||||
catch (NumberFormatException e)
|
||||
{
|
||||
activeChar.sendMessage("Command format is //skill_test <ID>");
|
||||
}
|
||||
catch (NoSuchElementException nsee)
|
||||
{
|
||||
activeChar.sendMessage("Command format is //skill_test <ID>");
|
||||
}
|
||||
}
|
||||
else if (command.equals("admin_known on"))
|
||||
{
|
||||
Config.CHECK_KNOWN = true;
|
||||
}
|
||||
else if (command.equals("admin_known off"))
|
||||
{
|
||||
Config.CHECK_KNOWN = false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param activeChar
|
||||
* @param id
|
||||
* @param msu
|
||||
*/
|
||||
private void adminTestSkill(L2PcInstance activeChar, int id, boolean msu)
|
||||
{
|
||||
L2Character caster;
|
||||
final L2Object target = activeChar.getTarget();
|
||||
if (!(target instanceof L2Character))
|
||||
{
|
||||
caster = activeChar;
|
||||
}
|
||||
else
|
||||
{
|
||||
caster = (L2Character) target;
|
||||
}
|
||||
|
||||
final Skill _skill = SkillData.getInstance().getSkill(id, 1);
|
||||
if (_skill != null)
|
||||
{
|
||||
caster.setTarget(activeChar);
|
||||
if (msu)
|
||||
{
|
||||
caster.broadcastPacket(new MagicSkillUse(caster, activeChar, id, 1, _skill.getHitTime(), _skill.getReuseDelay()));
|
||||
}
|
||||
else
|
||||
{
|
||||
caster.doCast(_skill);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getAdminCommandList()
|
||||
{
|
||||
return ADMIN_COMMANDS;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user