Свернуть ↑
public class Cfg implements IVoicedCommandHandler
{
private static final String[] _voicedCommands = {"lang","cfg"};
public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
{
if (command.equalsIgnoreCase("cfg"))
{
String filename = "data/html/addon/cfg.htm";
NpcHtmlMessage html = new NpcHtmlMessage(1);
html.setFile(filename);
//----------------------------------------
if (activeChar._useAutoLoot)
html.replace("%aul%", "On");
else
html.replace("%aul%", "Off");
if (activeChar._showchanceSkill)
html.replace("%ssc%", "On");
else
html.replace("%ssc%", "Off");
if (activeChar.getExpOn())
html.replace("%noe%", "On");
else
html.replace("%noe%", "Off");
//----------------------------------------
if (target != null)
{
String[] param = target.split(" ");
if (param.length == 2)
{
//АвтоЛут
if (param[0].equalsIgnoreCase("aul") && Config.AUTO_LOOT_INDIVIDUAL)
{
if (param[1].equalsIgnoreCase("on"))
activeChar._useAutoLoot=true;
else if (param[1].equalsIgnoreCase("of"))
activeChar._useAutoLoot=false;
}
//Шанс скилов
if (param[0].equalsIgnoreCase("ssc") && Config.SKILL_CHANCE_SHOW)
{
if (param[1].equalsIgnoreCase("on"))
activeChar._showchanceSkill=true;
else if (param[1].equalsIgnoreCase("of"))
activeChar._showchanceSkill=false;
}
//Блок Опыта
if (param[0].equalsIgnoreCase("noe") && Config.ALLOW_EXP_GAIN_COMMAND)
{
if (param[1].equalsIgnoreCase("on"))
activeChar.setExpOn(true);
else if (param[1].equalsIgnoreCase("of"))
activeChar.setExpOn(false);
}
}
}
//----------------------------------------
activeChar.sendPacket(html);
}
return true;
}
public String[] getVoicedCommandList()
{
return _voicedCommands;
}
}