Jump to content
  • 0

.xpon / .xpoff


EloBoost

Question

3 answers to this question

Recommended Posts

  • 0

adapt this it's not hard just some small changes on the imports

### Eclipse Workspace Patch 1.0
#P L2jxCine_GameServer
Index: head-src/net/xcine/Config.java
===================================================================
--- head-src/net/xcine/Config.java      (revision 59)
+++ head-src/net/xcine/Config.java      (working copy)
@@ -305,6 +305,7 @@
        public static String CHAT_FILTER_PUNISHMENT;
        public static ArrayList<String> FILTER_LIST = new ArrayList<>();

+       public static boolean NOXPGAIN_ENABLED;
        public static int FS_TIME_ATTACK;
        public static int FS_TIME_COOLDOWN;
        public static int FS_TIME_ENTRY;

        //Rates
@@ -2115,6 +2123,7 @@
                        CHAT_FILTER_PUNISHMENT = otherSettings.getProperty("ChatFilterPunishment", "off");
                        CHAT_FILTER_PUNISHMENT_PARAM1 = Integer.parseInt(otherSettings.getProperty("ChatFilterPunishmentParam1", "1"));
                        CHAT_FILTER_PUNISHMENT_PARAM2 = Integer.parseInt(otherSettings.getProperty("ChatFilterPunishmentParam2", "1000"));
+                       NOXPGAIN_ENABLED = Boolean.parseBoolean(otherSettings.getProperty("NoXPGainEnable", "false"));
                        FS_TIME_ATTACK = Integer.parseInt(otherSettings.getProperty("TimeOfAttack", "50"));
                        FS_TIME_COOLDOWN = Integer.parseInt(otherSettings.getProperty("TimeOfCoolDown", "5"));
                        FS_TIME_ENTRY = Integer.parseInt(otherSettings.getProperty("TimeOfEntry", "3"));
Index: head-src/net/xcine/gameserver/model/actor/instance/L2PcInstance.java
===================================================================
--- head-src/net/xcine/gameserver/model/actor/instance/L2PcInstance.java        (revision 59)
+++ head-src/net/xcine/gameserver/model/actor/instance/L2PcInstance.java        (working copy)
@@ -1362,6 +1362,17 @@

        private long timerToAttack;

+       private boolean _cantGainXP;
+      
+       public void cantGainXP(boolean b)
+       {
+               _cantGainXP = b;
+       }      
+          
+       public boolean cantGainXP()
+       {
+               return _cantGainXP;
+       }      
        //private boolean isInDangerArea;
        ////////////////////////////////////////////////////////////////////
        //START CHAT BAN SYSTEM
Index: head-src/net/xcine/gameserver/handler/VoicedCommandHandler.java
===================================================================
--- head-src/net/xcine/gameserver/handler/VoicedCommandHandler.java     (revision 54)
+++ head-src/net/xcine/gameserver/handler/VoicedCommandHandler.java     (working copy)
@@ -27,6 +27,7 @@
 import net.xcine.gameserver.handler.voicedcommandhandlers.BankingCmd;
 import net.xcine.gameserver.handler.voicedcommandhandlers.CTFCmd;
 import net.xcine.gameserver.handler.voicedcommandhandlers.DMCmd;
+import net.xcine.gameserver.handler.voicedcommandhandlers.NoExp;
 import net.xcine.gameserver.handler.voicedcommandhandlers.OfflineShop;
 import net.xcine.gameserver.handler.voicedcommandhandlers.Online;
 import net.xcine.gameserver.handler.voicedcommandhandlers.StatsCmd;
@@ -98,7 +99,8 @@
                {
                        registerVoicedCommandHandler(new OfflineShop());
                }
-              
+        if (Config.NOXPGAIN_ENABLED)
+            VoicedCommandHandler.getInstance().registerVoicedCommandHandler(new NoExp());
                _log.config("VoicedCommandHandler: Loaded " + _datatable.size() + " handlers.");

        }
Index: head-src/net/xcine/gameserver/handler/voicedcommandhandlers/NoExp.java
===================================================================
--- head-src/net/xcine/gameserver/handler/voicedcommandhandlers/NoExp.java      (revision 0)
+++ head-src/net/xcine/gameserver/handler/voicedcommandhandlers/NoExp.java      (working copy)
@@ -0,0 +1,62 @@
+/*
+ * This program 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.
+ *
+ * This program 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 net.xcine.gameserver.handler.voicedcommandhandlers;
+
+import net.xcine.gameserver.handler.IVoicedCommandHandler;
+import net.xcine.gameserver.model.actor.instance.L2PcInstance;
+
+/**
+ * This class allows user to turn XP-gain off and on.
+ *
+ * @author Notorious
+ */
+public class NoExp implements IVoicedCommandHandler
+{
+   private static final String[] _voicedCommands =
+   {
+      "xpoff",
+      "xpon"
+   };
+
+   /**
+    *
+    * @see net.xcine.gameserver.handler.IVoicedCommandHandler#useVoicedCommand(java.lang.String, net.xcine.gameserver.model.actor.instance.L2PcInstance, java.lang.String)
+    */
+   @Override
+   public boolean useVoicedCommand(String command, L2PcInstance activeChar, String params)
+   {
+      if (command.equalsIgnoreCase("xpoff"))
+      {
+         activeChar.cantGainXP(true);
+         activeChar.sendMessage("You have turned XP-gain OFF!");
+      }
+      else if (command.equalsIgnoreCase("xpon"))
+      {
+         activeChar.cantGainXP(false);
+         activeChar.sendMessage("You have turned XP-gain ON!");
+      }
+      return true;
+   }
+
+   /**
+    *
+    * @see net.xcine.gameserver.handler.IVoicedCommandHandler#getVoicedCommandList()
+    */
+   @Override
+   public String[] getVoicedCommandList()
+   {
+      return _voicedCommands;
+   }
+}
\ No newline at end of file
Index: head-src/net/xcine/gameserver/model/actor/stat/PcStat.java
===================================================================
--- head-src/net/xcine/gameserver/model/actor/stat/PcStat.java  (revision 54)
+++ head-src/net/xcine/gameserver/model/actor/stat/PcStat.java  (working copy)
@@ -55,8 +55,8 @@
        {
                L2PcInstance activeChar = getActiveChar();

-               //Player is Gm and access level is below or equal to canGainExp and is in party, don't give Xp
-               if(!getActiveChar().getAccessLevel().canGainExp() && getActiveChar().isInParty())
+               // Allowed to gain exp?
+               if (!getActiveChar().getAccessLevel().canGainExp() && getActiveChar().isInParty() || (Config.NOXPGAIN_ENABLED && getActiveChar().cantGainXP()))
                        return false;

                if(!super.addExp(value))
@@ -109,7 +109,7 @@

                //Player is Gm and acces level is below or equal to GM_DONT_TAKE_EXPSP and is in party, don't give Xp/Sp
                L2PcInstance activeChar = getActiveChar();
-               if(!activeChar.getAccessLevel().canGainExp() && activeChar.isInParty())
+               if (!activeChar.getAccessLevel().canGainExp() && activeChar.isInParty() || (Config.NOXPGAIN_ENABLED && getActiveChar().cantGainXP()))
                        return false;

                // if this player has a pet that takes from the owner's Exp, give the pet Exp now
Index: config/main/other.properties
===================================================================
--- config/main/other.properties        (revision 54)
+++ config/main/other.properties        (working copy)
@@ -232,3 +232,10 @@
 # Enable Messages to GMs on 4-5 consecutive pvp of a player
 # Why? to see if a char are farming!
 EnableAntiPvpFarmMsg = true
+
+#==============================================================#
+#       Voice-command for turning off XP-gain                  #                                                        
+#==============================================================#
+# Player can use .xpoff to disable XP-gain, and .xpon to enable again.
+# Default: False
+NoXPGainEnable = False
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.


  • Posts

    • DRESSME MANAGER.! COBA-LTD IS BRING YOU NEW SKIN MANAGER new skin manager placed on our server with lot of Skin's     Anakim Suit     White Knight     Archer Suit B     Beleth Suit     Cat Suit     CowBoy Suit     Dark Assassin Suit     Dragon Born Suit     Dark Knight Suit     Light Assassin Suit     Ninja Suit     Red Zaken Suit     Blue Zaken Suit     King Setim Suit     King White Setim Suit     Black Samurai Suit     Brown Wizard Suit     Legendary Suit     Pink Wizard Suit based on Vote coin's for more fun and unique dress skin code. Have fun by you Admin COBA.
    • You mentioned that you've fixed the issues, but how it would be ready for a live server when only a few fixes have been shared. It would be helpful and appreciated if you could share more information about the fixes or the process. It's always great when everyone can collaborate and learn from each other. If you choose not to share this information, it is unreasonable to expect others to. I, along with @Tryskell(I believe), am completely fed up with the arrogance of these so-called "developers." They perform half-baked fixes on critical issues and have the audacity to call it a major accomplishment. You all deserve your fate!
    • Most L2 developers are not willing to work remotely through Team Viewer or AnyDesk due to the low income and their moody nature. Therefore, it is highly unlikely to find an L2 developer willing to work under these conditions.
    • Hello all,   Looking for a developer who would be able working on my new project. Only experienced can apply for this paid job. There will be no direct access to my sources. You will work though teamviewer or anydesk. Interested can contact me here or through skype: Waleess.    Kind regards, Wales
    • Is the latest version suitable for live servers? Have you heard stories that aren't what you tell me? Na 401 tem travamentos bug or auto consumption of memory and CPU usage is constant. I fixed those things in my aCis.
  • Topics

×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock