- Хроники
- Chaotic Throne: High Five
- Исходники
- Присутствуют
- Сборка
- TheBattle.Club Open-team
Добрый вечер всем. Я столкнулся с проблемам. Не работает скрипт Auto-CP в конфиге всё включено. скилы писать надо ? вот такой
<skill id="90001" levels="1" name="Mana potion">
<set name="icon" value="" />
<set name="displayId" value="2005" />
<set name="itemConsumeId" value="728" />
<set name="itemConsumeCount" value="1" />
<set name="isHandler" value="true" />
<set name="target" value="TARGET_SELF" />
<set name="skillType" value="MANAHEAL" />
<set name="power" value="2000" />
<set name="operateType" value="OP_ACTIVE" />
<set name="altUse" value="true" />
</skill>
или не надо ? Помогите если не сложно. Я новичок не знаю работать с скриптами )
Вот скрипт
package commands.voiced;
import l2open.config.ConfigValue;
import l2open.extensions.scripts.Functions;
import l2open.extensions.scripts.ScriptFile;
import l2open.gameserver.handler.IVoicedCommandHandler;
import l2open.gameserver.handler.VoicedCommandHandler;
import l2open.gameserver.model.*;
import l2open.util.Files;
import static services.Talks.Kief.getPoints;
public class AutoCp extends Functions implements IVoicedCommandHandler, ScriptFile {
private String[] _commandList = new String[]{"autocp", "acp" };
public boolean useVoicedCommand(String command, L2Player activeChar, String args)
{
if((ConfigValue.AutoCpEnable || activeChar.isGM()) && (!ConfigValue.AutoCpOnlyPremim || activeChar.hasBonus()) && command.equals("autocp") || command.equals("acp") )
{
String dialog = Files.read("data/scripts/commands/voiced/autocp.htm", activeChar);
if(args != null && !args.isEmpty())
{
String[] param = args.split(" ");
if(param.length == 1)
{
if(param[0].equals("on"))
{
activeChar._enable_auto = true;
activeChar.setVar("enable_auto", "true");
activeChar.sendMessage("AutoCp Enable");
}
else if(param[0].equals("off"))
{
activeChar._enable_auto = false;
activeChar.setVar("enable_auto", "true");
activeChar.sendMessage("AutoCp Enable");
}
else if(param[0].equals("cp_select"));
else if(param[0].equals("hp_select"));
else if(param[0].equals("mp_select"));
return true;
}
else if(param.length == 2)
{
String type = param[0];
int value = Integer.parseInt(param[1]);
//activeChar.sendMessage("autocp["+command+"]: type="+type+" value="+value);
if(type.equals("cp_percent"))
{
activeChar._enable_auto_cp_cp = value;
activeChar.setVar("cp_percent", String.valueOf(value));
}
else if(type.equals("hp_percent"))
{
activeChar._enable_auto_cp_hp = value;
activeChar.setVar("hp_percent", String.valueOf(value));
}
else if(type.equals("mp_percent"))
{
activeChar._enable_auto_cp_mp = value;
activeChar.setVar("mp_percent", String.valueOf(value));
}
else if(type.equals("cp_time"))
{
activeChar._time_auto_cp_cp = Math.max(value, 333);
activeChar.setVar("cp_time", String.valueOf(Math.max(value, 333)));
}
else if(type.equals("hp_time"))
{
activeChar._time_auto_cp_hp = Math.max(value, 333);
activeChar.setVar("hp_time", String.valueOf(Math.max(value, 333)));
}
else if(type.equals("mp_time"))
{
activeChar._time_auto_cp_mp = Math.max(value, 333);
activeChar.setVar("mp_time", String.valueOf(Math.max(value, 333)));
}
}
}
dialog = dialog.replace("<?enable_auto_cp_cp?>", "<font color="+(activeChar._enable_auto_cp_cp == 0 ? "FF0000" : "00FF00")+">"+activeChar._enable_auto_cp_cp+"%</font>");
dialog = dialog.replace("<?enable_auto_cp_hp?>", "<font color="+(activeChar._enable_auto_cp_hp == 0 ? "FF0000" : "00FF00")+">"+activeChar._enable_auto_cp_hp+"%</font>");
dialog = dialog.replace("<?enable_auto_cp_mp?>", "<font color="+(activeChar._enable_auto_cp_mp == 0 ? "FF0000" : "00FF00")+">"+activeChar._enable_auto_cp_mp+"%</font>");
dialog = dialog.replace("<?time_auto_cp_cp?>", "<font color=00FF00>"+activeChar._time_auto_cp_cp+"</font>");
dialog = dialog.replace("<?time_auto_cp_hp?>", "<font color=00FF00>"+activeChar._time_auto_cp_hp+"</font>");
dialog = dialog.replace("<?time_auto_cp_mp?>", "<font color=00FF00>"+activeChar._time_auto_cp_mp+"</font>");
dialog = dialog.replace("<?enable_auto?>", "<font color="+(activeChar._enable_auto ? "00FF00" : "FF0000")+">"+(activeChar._enable_auto ? "Включено" : "Отключено")+"</font>");
show(dialog, activeChar);
return true;
}
return true;
}
public String[] getVoicedCommandList()
{
return _commandList;
}
public void onLoad()
{
VoicedCommandHandler.getInstance().registerVoicedCommandHandler(this);
}
public void onReload()
{}
public void onShutdown()
{}
}
<skill id="90001" levels="1" name="Mana potion">
<set name="icon" value="" />
<set name="displayId" value="2005" />
<set name="itemConsumeId" value="728" />
<set name="itemConsumeCount" value="1" />
<set name="isHandler" value="true" />
<set name="target" value="TARGET_SELF" />
<set name="skillType" value="MANAHEAL" />
<set name="power" value="2000" />
<set name="operateType" value="OP_ACTIVE" />
<set name="altUse" value="true" />
</skill>
или не надо ? Помогите если не сложно. Я новичок не знаю работать с скриптами )
Вот скрипт
package commands.voiced;
import l2open.config.ConfigValue;
import l2open.extensions.scripts.Functions;
import l2open.extensions.scripts.ScriptFile;
import l2open.gameserver.handler.IVoicedCommandHandler;
import l2open.gameserver.handler.VoicedCommandHandler;
import l2open.gameserver.model.*;
import l2open.util.Files;
import static services.Talks.Kief.getPoints;
public class AutoCp extends Functions implements IVoicedCommandHandler, ScriptFile {
private String[] _commandList = new String[]{"autocp", "acp" };
public boolean useVoicedCommand(String command, L2Player activeChar, String args)
{
if((ConfigValue.AutoCpEnable || activeChar.isGM()) && (!ConfigValue.AutoCpOnlyPremim || activeChar.hasBonus()) && command.equals("autocp") || command.equals("acp") )
{
String dialog = Files.read("data/scripts/commands/voiced/autocp.htm", activeChar);
if(args != null && !args.isEmpty())
{
String[] param = args.split(" ");
if(param.length == 1)
{
if(param[0].equals("on"))
{
activeChar._enable_auto = true;
activeChar.setVar("enable_auto", "true");
activeChar.sendMessage("AutoCp Enable");
}
else if(param[0].equals("off"))
{
activeChar._enable_auto = false;
activeChar.setVar("enable_auto", "true");
activeChar.sendMessage("AutoCp Enable");
}
else if(param[0].equals("cp_select"));
else if(param[0].equals("hp_select"));
else if(param[0].equals("mp_select"));
return true;
}
else if(param.length == 2)
{
String type = param[0];
int value = Integer.parseInt(param[1]);
//activeChar.sendMessage("autocp["+command+"]: type="+type+" value="+value);
if(type.equals("cp_percent"))
{
activeChar._enable_auto_cp_cp = value;
activeChar.setVar("cp_percent", String.valueOf(value));
}
else if(type.equals("hp_percent"))
{
activeChar._enable_auto_cp_hp = value;
activeChar.setVar("hp_percent", String.valueOf(value));
}
else if(type.equals("mp_percent"))
{
activeChar._enable_auto_cp_mp = value;
activeChar.setVar("mp_percent", String.valueOf(value));
}
else if(type.equals("cp_time"))
{
activeChar._time_auto_cp_cp = Math.max(value, 333);
activeChar.setVar("cp_time", String.valueOf(Math.max(value, 333)));
}
else if(type.equals("hp_time"))
{
activeChar._time_auto_cp_hp = Math.max(value, 333);
activeChar.setVar("hp_time", String.valueOf(Math.max(value, 333)));
}
else if(type.equals("mp_time"))
{
activeChar._time_auto_cp_mp = Math.max(value, 333);
activeChar.setVar("mp_time", String.valueOf(Math.max(value, 333)));
}
}
}
dialog = dialog.replace("<?enable_auto_cp_cp?>", "<font color="+(activeChar._enable_auto_cp_cp == 0 ? "FF0000" : "00FF00")+">"+activeChar._enable_auto_cp_cp+"%</font>");
dialog = dialog.replace("<?enable_auto_cp_hp?>", "<font color="+(activeChar._enable_auto_cp_hp == 0 ? "FF0000" : "00FF00")+">"+activeChar._enable_auto_cp_hp+"%</font>");
dialog = dialog.replace("<?enable_auto_cp_mp?>", "<font color="+(activeChar._enable_auto_cp_mp == 0 ? "FF0000" : "00FF00")+">"+activeChar._enable_auto_cp_mp+"%</font>");
dialog = dialog.replace("<?time_auto_cp_cp?>", "<font color=00FF00>"+activeChar._time_auto_cp_cp+"</font>");
dialog = dialog.replace("<?time_auto_cp_hp?>", "<font color=00FF00>"+activeChar._time_auto_cp_hp+"</font>");
dialog = dialog.replace("<?time_auto_cp_mp?>", "<font color=00FF00>"+activeChar._time_auto_cp_mp+"</font>");
dialog = dialog.replace("<?enable_auto?>", "<font color="+(activeChar._enable_auto ? "00FF00" : "FF0000")+">"+(activeChar._enable_auto ? "Включено" : "Отключено")+"</font>");
show(dialog, activeChar);
return true;
}
return true;
}
public String[] getVoicedCommandList()
{
return _commandList;
}
public void onLoad()
{
VoicedCommandHandler.getInstance().registerVoicedCommandHandler(this);
}
public void onReload()
{}
public void onShutdown()
{}
}