Autor Tema: Comando Expon - ExpOff  (Leído 278 veces)

Mordor

  • Jr. Member
  • **
  • Mensajes: 83
  • Karma: +0/-0
    • Ver Perfil
Comando Expon - ExpOff
« en: Enero 24, 2018, 12:28:17 pm »
Quizas para algunos les sea útil he adaptado estos comandos, funcionan correctamente aunque quizás alguno pueda mejorarlo:

Ruta: java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java

Código
@@ -5802,9 +5816,28 @@
  @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);
+ }
+
+ // ----------------------EXP on/off----------------------
+ private boolean _expGainOn = true;
+
+ public void setExpOn(boolean expOn)
+ {
+ _expGainOn = expOn;
  }
 
+ public boolean getExpOn()
+ {
+ return _expGainOn;
+ }
+ // ----------------------EXP on/off----end------------------
+

Ruta:handlers.command.voiced

Código
/*
 * Copyright (C) 2014-2018 L2jAdmins
 *
 * This file is part of L2jAdmins.
 *
 * L2jAdmins 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.
 *
 * L2jAdmins 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.command.voiced;

import net.sf.l2j.gameserver.handler.command.voiced.IVoicedCommandHandler;
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;

/**
 * @Adaptacion Mordor
 */

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("[SYSTEM]: Bloqueo de Exp Deshabilitado!");
}
else if (command.equalsIgnoreCase("expoff") || command.equalsIgnoreCase("xpoff"))
{
activeChar.setExpOn(false);
activeChar.sendMessage("[SYSTEM]: Bloqueo de Exp Habilitado!");
}
return true;
}

public String[] getVoicedCommandList()
{
return _voicedCommands;
}
}

Luego de eso tienen que registrar el handler.




« Última modificación: Enero 24, 2018, 09:02:10 pm por fissban »