Jump to content

Question

3 answers to this question

Recommended Posts

  • 0
Posted

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
Guest
This topic is now closed to further replies.


  • Posts

    • Are You working on a serious server project? Get Yourself a proper Updater / Launcher!   
    • The character stops walking when using a mana potion. any can help me?   IemData item_begin    etcitem    728    [mana_potion]    item_type=etcitem    slot_bit_type={none}    armor_type=none    etcitem_type=potion    recipe_id=0    blessed=0    weight=180    default_action=action_skill_reduce    consume_type=consume_type_stackable    initial_count=1    maximum_count=20    soulshot_count=0    spiritshot_count=0    reduced_soulshot={}    reduced_spiritshot={}    reduced_mp_consume={}    immediate_effect=1    price=0    default_price=2000    item_skill=[s_mana_potion]    critical_attack_skill=[none]    attack_skill=[none]    magic_skill=[none]    item_skill_enchanted_four=[none]    material_type=liquid    crystal_type=none    crystal_count=0    is_trade=1    is_drop=1    is_destruct=1    physical_damage=0    random_damage=0    weapon_type=none    can_penetrate=0    critical=0    hit_modify=0    avoid_modify=0    dual_fhit_rate=0    shield_defense=0    shield_defense_rate=0    attack_range=0    damage_range={}    attack_speed=0    reuse_delay=10000    mp_consume=0    magical_damage=0    durability=0    damaged=0    physical_defense=0    magical_defense=0    mp_bonus=0    category={}    enchanted=0    html=[item_default.htm]    equip_pet={@ALL_PET}    magic_weapon=0    enchant_enable=0    can_equip_sex=-1    can_equip_race={}    can_equip_change_class=-1    can_equip_class={}    can_equip_agit=-1    can_equip_castle=-1    can_equip_castle_num={}    can_equip_clan_leader=-1    can_equip_clan_level=-1    can_equip_hero=-1    can_equip_nobless=-1    can_equip_chaotic=-1    item_end   SkillData   skill_begin    skill_name=[s_mana_potion]    skill_id=50004    level=1    operate_type=A2    magic_level=1    effect={{t_mp;57;3}}    is_magic=0    mp_consume2=0    cast_range=-1    effective_range=-1    skill_hit_time=0    skill_cool_time=0    skill_hit_cancel_time=0    reuse_delay=0    activate_rate=-1    lv_bonus_rate=0    basic_property=none    abnormal_time=15    abnormal_lv=1    abnormal_type=mp_recovery    attribute=attr_none    effect_point=0    target_type=self    affect_scope=single    affect_limit={0;0}    next_action=none    debuff=0    ride_state={@ride_none}    skill_end  
  • 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