U3Games

Games | Desarrollo & Soporte => L2 | Implementaciones => L2 | Sección de Servidores => Lineage => L2 | Comandos => Mensaje iniciado por: Swarlog en Jun 25, 2025, 09:53 PM

Título: Comandos .expoff / .expon
Publicado por: Swarlog en Jun 25, 2025, 09:53 PM
CitarCORE:

Index: java/com/l2jserver/gameserver/model/actor/stat/PcStat.java
===================================================================
--- java/com/l2jserver/gameserver/model/actor/stat/PcStat.java (revision 5757)
+++ java/com/l2jserver/gameserver/model/actor/stat/PcStat.java (working copy)
@@ -82,6 +82,12 @@
  {
  return false;
  }
+
+ // Check, if exp gain isn't disabled by voiced command
+ if (activeChar.canOverrideCond(PcCondOverride.DISABLE_EXP_GAIN))
+ {
+ return false;
+ }
 
  if (!super.addExp(value))
  {
@@ -133,7 +139,13 @@
  {
  return false;
  }
-
+
+ // Check, if exp gain isn't disabled by voiced command
+ if (activeChar.canOverrideCond(PcCondOverride.DISABLE_EXP_GAIN))
+ {
+ addToExp = 0;
+ }
+
  long baseExp = addToExp;
  int baseSp = addToSp;
 
Index: java/com/l2jserver/gameserver/model/PcCondOverride.java
===================================================================
--- java/com/l2jserver/gameserver/model/PcCondOverride.java (revision 5757)
+++ java/com/l2jserver/gameserver/model/PcCondOverride.java (working copy)
@@ -38,7 +38,8 @@
  DESTROY_ALL_ITEMS(12, "Overrides item destroy conditions"),
  SEE_ALL_PLAYERS(13, "Overrides the conditions to see hidden players"),
  TARGET_ALL(14, "Overrides target conditions"),
- DROP_ALL_ITEMS(15, "Overrides item drop conditions");
+ DROP_ALL_ITEMS(15, "Overrides item drop conditions"),
+ DISABLE_EXP_GAIN(16, "Disables experience gain");
 
  private final int _mask;
  private final String _descr;

CitarDATA:

Index: dist/game/data/scripts/handlers/MasterHandler.java
===================================================================
--- dist/game/data/scripts/handlers/MasterHandler.java (revision 9395)
+++ dist/game/data/scripts/handlers/MasterHandler.java (working copy)
@@ -315,6 +315,7 @@
 import handlers.voicedcommandhandlers.Lang;
 import handlers.voicedcommandhandlers.StatsVCmd;
 import handlers.voicedcommandhandlers.TvTVoicedInfo;
+import handlers.voicedcommandhandlers.UserOptions;
 import handlers.voicedcommandhandlers.Wedding;
 
 /**
@@ -601,6 +602,7 @@
  {
  // Voiced Command Handlers
  StatsVCmd.class,
+ UserOptions.class,
  // TODO: Add configuration options for this voiced commands:
  // CastleVCmd.class,
  // SetVCmd.class,
Index: dist/game/data/scripts/handlers/voicedcommandhandlers/UserOptions.java
===================================================================
--- dist/game/data/scripts/handlers/voicedcommandhandlers/UserOptions.java (revision 0)
+++ dist/game/data/scripts/handlers/voicedcommandhandlers/UserOptions.java (working copy)
@@ -0,0 +1,44 @@
+package handlers.voicedcommandhandlers;
+
+import com.l2jserver.gameserver.handler.IVoicedCommandHandler;
+import com.l2jserver.gameserver.model.PcCondOverride;
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+
+/**
+ * @author GKR, Mr.Deff
+ */
+public class UserOptions implements IVoicedCommandHandler
+{
+ private static final String[] _voicedCommands =
+ {
+ "expon",
+ "expoff",
+ };
+
+ public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
+ {
+ if (activeChar == null)
+ {
+ return false;
+ }
+
+ switch(command)
+ {
+ case "expoff":
+ activeChar.addOverrideCond(PcCondOverride.DISABLE_EXP_GAIN);
+ activeChar.sendMessage("Exp gain disabled.");
+ break;
+ case "expon":
+ activeChar.removeOverridedCond(PcCondOverride.DISABLE_EXP_GAIN);
+ activeChar.sendMessage("Exp gain restored.");
+ break;
+ }
+
+ return true;
+ }
+
+ public String[] getVoicedCommandList()
+ {
+ return _voicedCommands;
+ }
+}