craftyf0x 0 Опубликовано 12 сентября, 2015 (изменено) Кто может помочь переписать этот код под сборку acis ?? Я вроде почти всё сделал, но зашёл в тупик в итоге, при компиляции выдаёт ошибки которые я уже не знаю как править. Есть добрые люди? Очень нужна реализация блока exp. Ошибки компиляции и код который у меня сейчас, могу тоже кинуть. Могу дать TeamViewer если уверены, что справитесь. Index: trunk/gameserver/head-src/com/l2jfrozen/Config.java =================================================================== --- trunk/gameserver/head-src/com/l2jfrozen/Config.java (revision 803) +++ trunk/gameserver/head-src/com/l2jfrozen/Config.java (working copy) @@ -2241,6 +2241,7 @@ public static String FARM2_CUSTOM_MESSAGE; public static String PVP1_CUSTOM_MESSAGE; public static String PVP2_CUSTOM_MESSAGE; + public static boolean ALLOW_EXP_GAIN_COMMAND; //============================================================ public static void loadL2SCORIAConfig() @@ -2359,6 +2360,7 @@ FARM2_CUSTOM_MESSAGE = L2ScoriaSettings.getProperty("Farm2CustomMeesage", "You have been teleported to Farm Zone 2!"); PVP1_CUSTOM_MESSAGE = L2ScoriaSettings.getProperty("PvP1CustomMeesage", "You have been teleported to PvP Zone 1!"); PVP2_CUSTOM_MESSAGE = L2ScoriaSettings.getProperty("PvP2CustomMeesage", "You have been teleported to PvP Zone 2!"); + ALLOW_EXP_GAIN_COMMAND = Boolean.parseBoolean(L2ScoriaSettings.getProperty("AllowExpGainCommand", "false")); } catch(Exception e) { Index: trunk/gameserver/head-src/com/l2jfrozen/gameserver/handler/VoicedCommandHandler.java =================================================================== --- trunk/gameserver/head-src/com/l2jfrozen/gameserver/handler/VoicedCommandHandler.java (revision 803) +++ trunk/gameserver/head-src/com/l2jfrozen/gameserver/handler/VoicedCommandHandler.java (working copy) @@ -36,6 +36,7 @@ import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.VersionCmd; import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.Voting; import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.Wedding; +import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.ExpGain; /** * This class ... @@ -90,7 +91,8 @@ { registerVoicedCommandHandler(new Wedding()); } - + + registerVoicedCommandHandler(new ExpGain()); registerVoicedCommandHandler(new StatsCmd()); if(Config.ALLOW_VERSION_COMMAND) Index: trunk/gameserver/head-src/com/l2jfrozen/gameserver/model/actor/instance/L2PcInstance.java =================================================================== --- trunk/gameserver/head-src/com/l2jfrozen/gameserver/model/actor/instance/L2PcInstance.java (revision 803) +++ trunk/gameserver/head-src/com/l2jfrozen/gameserver/model/actor/instance/L2PcInstance.java (working copy) @@ -13049,8 +13049,13 @@ @Override public void addExpAndSp(long addToExp, int addToSp) { - getStat().addExpAndSp(addToExp, addToSp); - } + // getStat().addExpAndSp(addToExp, addToSp, false); + //} + if (_expGainOn) + getStat().addExpAndSp(addToExp, addToSp); + else + getStat().addExpAndSp(0, addToSp); + } public void removeExpAndSp(long removeExp, int removeSp) { @@ -15984,4 +15989,16 @@ { return getClient().getFloodProtectors(); } + + // ----------------------EXP on/off---------------------- + private boolean _expGainOn = true; + public void setExpOn(boolean expOn) + { + _expGainOn = expOn; + } + public boolean getExpOn() + { + return _expGainOn; + } + // ----------------------EXP on/off----end------------------ } Index: trunk/gameserver/head-src/com/l2jfrozen/gameserver/handler/voicedcommandhandlers/ExpGain.java =================================================================== --- trunk/gameserver/head-src/com/l2jfrozen/gameserver/handler/voicedcommandhandlers/ExpGain.java (revision 0) +++ trunk/gameserver/head-src/com/l2jfrozen/gameserver/handler/voicedcommandhandlers/ExpGain.java (revision 0) @@ -0,0 +1,48 @@ +/ + */ +package com.l2jfrozen.gameserver.handler.voicedcommandhandlers; + +import com.l2jfrozen.gameserver.handler.IVoicedCommandHandler; +import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance; + +public class ExpGain implements IVoicedCommandHandler +{ + private String[] _voicedCommands = { + "expon", + "xpon", + "expoff", + "xpoff" + }; + + public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target) + { + if (command.equalsIgnoreCase("expon") || command.equalsIgnoreCase("xpon")) + { + activeChar.setExpOn(true); + activeChar.sendMessage("You gain XP."); + } + else if (command.equalsIgnoreCase("expoff") || command.equalsIgnoreCase("xpoff")) + { + activeChar.setExpOn(false); + activeChar.sendMessage("You not gain XP."); + } + return true; + } + + public String[] getVoicedCommandList() + { + return _voicedCommands; + } +} \ No newline at end of file Index: trunk/gameserver/config/functions/l2jfrozen.properties =================================================================== --- trunk/gameserver/config/functions/l2jfrozen.properties (revision 803) +++ trunk/gameserver/config/functions/l2jfrozen.properties (working copy) @@ -275,4 +275,10 @@ ProtectorSkillLevel = 13 ProtectorSkillTime = 600 # Npc Protector Message -ProtectorMessage = Hey You!, Never Kill On This Area, Go Read The Rules! \ No newline at end of file +ProtectorMessage = Hey You!, Never Kill On This Area, Go Read The Rules! + +# --------------------------------------------------------------------------------- +# Enable / Disable Xp +# --------------------------------------------------------------------------------- +#Enable / Disable command receiving experience. (. Expon. Expoff. Xpon. Xpoff) +AllowExpGainCommand = False \ No newline at end of file Ниже переделанный код expgain.java Бьёт ошибки в него, но как исправить я не знаю. if (command.equalsIgnoreCase("expon") || command.equalsIgnoreCase("xpon")) [javac] ^ [javac] symbol: variable command [javac] location: class ExpGain xpoff [javac] ^ [javac] symbol: variable xpoff [javac] location: class ExpGain /* * */ package net.sf.l2j.gameserver.handler.usercommandhandlers; import net.sf.l2j.gameserver.handler.IUserCommandHandler; import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance; public class ExpGain implements IUserCommandHandler { private static final int[] COMMAND_IDS = { expon, xpon, expoff, xpoff }; public boolean useUserCommand(int id, L2PcInstance activeChar) { if (command.equalsIgnoreCase("expon") || command.equalsIgnoreCase("xpon")) { activeChar.setExpOn(true); activeChar.sendMessage("You gain XP."); } else if (command.equalsIgnoreCase("expoff") || command.equalsIgnoreCase("xpoff")) { activeChar.setExpOn(false); activeChar.sendMessage("You not gain XP."); } return true; } public int[] getUserCommandList() { return COMMAND_IDS; } } Изменено 12 сентября, 2015 пользователем craftyf0x Поделиться сообщением Ссылка на сообщение Поделиться на другие сайты