[Share] My VoiceCommand for disable and enable Exp and Sp

    Share

    micr0

    Posts : 72
    Join date : 2013-01-23
    Age : 23
    Location : Bulgaria

    [Share] My VoiceCommand for disable and enable Exp and Sp

    Post  micr0 on 30th March 2013, 16:26

    hi this is my voice command for disable and enable exp and sp

    im dont test please test and feadback
    Code:

    ### Eclipse Workspace Patch 1.0
    #P Lisvus_GameServer
    Index: java/net/sf/l2j/gameserver/GameServer.java
    ===================================================================
    --- java/net/sf/l2j/gameserver/GameServer.java   (revision 366)
    +++ java/net/sf/l2j/gameserver/GameServer.java   (working copy)
    @@ -32,16 +32,150 @@
     import net.sf.l2j.gameserver.cache.CrestCache;
     import net.sf.l2j.gameserver.cache.HtmCache;
     import net.sf.l2j.gameserver.communitybbs.Manager.ForumsBBSManager;
    -import net.sf.l2j.gameserver.datatables.*;
    +import net.sf.l2j.gameserver.datatables.ArmorSetsTable;
    +import net.sf.l2j.gameserver.datatables.CharNameTable;
    +import net.sf.l2j.gameserver.datatables.CharTemplateTable;
    +import net.sf.l2j.gameserver.datatables.ClanTable;
    +import net.sf.l2j.gameserver.datatables.DoorTable;
    +import net.sf.l2j.gameserver.datatables.FishTable;
    +import net.sf.l2j.gameserver.datatables.GmListTable;
    +import net.sf.l2j.gameserver.datatables.HelperBuffTable;
    +import net.sf.l2j.gameserver.datatables.HennaTable;
    +import net.sf.l2j.gameserver.datatables.HennaTreeTable;
    +import net.sf.l2j.gameserver.datatables.HitConditionBonus;
    +import net.sf.l2j.gameserver.datatables.ItemTable;
    +import net.sf.l2j.gameserver.datatables.MapRegionTable;
    +import net.sf.l2j.gameserver.datatables.NobleSkillTable;
    +import net.sf.l2j.gameserver.datatables.NpcBufferTable;
    +import net.sf.l2j.gameserver.datatables.NpcTable;
    +import net.sf.l2j.gameserver.datatables.OfflineTradersTable;
    +import net.sf.l2j.gameserver.datatables.SkillSpellbookTable;
    +import net.sf.l2j.gameserver.datatables.SkillTable;
    +import net.sf.l2j.gameserver.datatables.SkillTreeTable;
    +import net.sf.l2j.gameserver.datatables.SpawnTable;
    +import net.sf.l2j.gameserver.datatables.TeleportLocationTable;
    +import net.sf.l2j.gameserver.datatables.ZoneData;
     import net.sf.l2j.gameserver.handler.AdminCommandHandler;
     import net.sf.l2j.gameserver.handler.ItemHandler;
     import net.sf.l2j.gameserver.handler.SkillHandler;
     import net.sf.l2j.gameserver.handler.UserCommandHandler;
     import net.sf.l2j.gameserver.handler.VoicedCommandHandler;
    -import net.sf.l2j.gameserver.handler.admincommandhandlers.*;
    -import net.sf.l2j.gameserver.handler.itemhandlers.*;
    -import net.sf.l2j.gameserver.handler.skillhandlers.*;
    -import net.sf.l2j.gameserver.handler.usercommandhandlers.*;
    +import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminAdmin;
    +import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminAnnouncements;
    +import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminBBS;
    +import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminBan;
    +import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminBanChat;
    +import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminCache;
    +import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminChangeAccessLevel;
    +import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminCreateItem;
    +import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminDelete;
    +import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminDoorControl;
    +import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminEditChar;
    +import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminEditNpc;
    +import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminEffects;
    +import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminEnchant;
    +import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminEventEngine;
    +import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminExpSp;
    +import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminFightCalculator;
    +import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminGeoEditor;
    +import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminGeodata;
    +import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminGm;
    +import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminGmChat;
    +import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminHeal;
    +import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminHelpPage;
    +import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminInvul;
    +import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminKick;
    +import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminKill;
    +import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminLevel;
    +import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminLogin;
    +import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminMammon;
    +import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminManor;
    +import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminMenu;
    +import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminMobGroup;
    +import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminMonsterRace;
    +import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminPForge;
    +import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminPathNode;
    +import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminPetition;
    +import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminPledge;
    +import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminPolymorph;
    +import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminQuest;
    +import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminRepairChar;
    +import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminRes;
    +import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminRideWyvern;
    +import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminShop;
    +import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminShutdown;
    +import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminSiege;
    +import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminSkill;
    +import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminSpawn;
    +import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminTarget;
    +import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminTeleport;
    +import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminTest;
    +import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminUnblockIp;
    +import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminZone;
    +import net.sf.l2j.gameserver.handler.itemhandlers.BeastSoulShot;
    +import net.sf.l2j.gameserver.handler.itemhandlers.BeastSpiritShot;
    +import net.sf.l2j.gameserver.handler.itemhandlers.BlessedSpiritShot;
    +import net.sf.l2j.gameserver.handler.itemhandlers.Book;
    +import net.sf.l2j.gameserver.handler.itemhandlers.CharChangePotions;
    +import net.sf.l2j.gameserver.handler.itemhandlers.ChestKey;
    +import net.sf.l2j.gameserver.handler.itemhandlers.CrystalCarol;
    +import net.sf.l2j.gameserver.handler.itemhandlers.EnchantScrolls;
    +import net.sf.l2j.gameserver.handler.itemhandlers.EnergyStone;
    +import net.sf.l2j.gameserver.handler.itemhandlers.ExtractableItems;
    +import net.sf.l2j.gameserver.handler.itemhandlers.Firework;
    +import net.sf.l2j.gameserver.handler.itemhandlers.FishShots;
    +import net.sf.l2j.gameserver.handler.itemhandlers.Harvester;
    +import net.sf.l2j.gameserver.handler.itemhandlers.MercTicket;
    +import net.sf.l2j.gameserver.handler.itemhandlers.MysteryPotion;
    +import net.sf.l2j.gameserver.handler.itemhandlers.PetFood;
    +import net.sf.l2j.gameserver.handler.itemhandlers.Potions;
    +import net.sf.l2j.gameserver.handler.itemhandlers.Recipes;
    +import net.sf.l2j.gameserver.handler.itemhandlers.Remedy;
    +import net.sf.l2j.gameserver.handler.itemhandlers.RollingDice;
    +import net.sf.l2j.gameserver.handler.itemhandlers.ScrollOfEscape;
    +import net.sf.l2j.gameserver.handler.itemhandlers.ScrollOfResurrection;
    +import net.sf.l2j.gameserver.handler.itemhandlers.Scrolls;
    +import net.sf.l2j.gameserver.handler.itemhandlers.Seed;
    +import net.sf.l2j.gameserver.handler.itemhandlers.SevenSignsRecord;
    +import net.sf.l2j.gameserver.handler.itemhandlers.SoulCrystals;
    +import net.sf.l2j.gameserver.handler.itemhandlers.SoulShots;
    +import net.sf.l2j.gameserver.handler.itemhandlers.SpecialXMas;
    +import net.sf.l2j.gameserver.handler.itemhandlers.SpiritShot;
    +import net.sf.l2j.gameserver.handler.itemhandlers.SummonItems;
    +import net.sf.l2j.gameserver.handler.itemhandlers.WorldMap;
    +import net.sf.l2j.gameserver.handler.skillhandlers.BalanceLife;
    +import net.sf.l2j.gameserver.handler.skillhandlers.Blow;
    +import net.sf.l2j.gameserver.handler.skillhandlers.Charge;
    +import net.sf.l2j.gameserver.handler.skillhandlers.CombatPointHeal;
    +import net.sf.l2j.gameserver.handler.skillhandlers.Continuous;
    +import net.sf.l2j.gameserver.handler.skillhandlers.CpDamPercent;
    +import net.sf.l2j.gameserver.handler.skillhandlers.Craft;
    +import net.sf.l2j.gameserver.handler.skillhandlers.Disablers;
    +import net.sf.l2j.gameserver.handler.skillhandlers.DrainSoul;
    +import net.sf.l2j.gameserver.handler.skillhandlers.Fishing;
    +import net.sf.l2j.gameserver.handler.skillhandlers.FishingSkill;
    +import net.sf.l2j.gameserver.handler.skillhandlers.Harvest;
    +import net.sf.l2j.gameserver.handler.skillhandlers.Heal;
    +import net.sf.l2j.gameserver.handler.skillhandlers.ManaHeal;
    +import net.sf.l2j.gameserver.handler.skillhandlers.Mdam;
    +import net.sf.l2j.gameserver.handler.skillhandlers.Pdam;
    +import net.sf.l2j.gameserver.handler.skillhandlers.Recall;
    +import net.sf.l2j.gameserver.handler.skillhandlers.Resurrect;
    +import net.sf.l2j.gameserver.handler.skillhandlers.Sow;
    +import net.sf.l2j.gameserver.handler.skillhandlers.Spoil;
    +import net.sf.l2j.gameserver.handler.skillhandlers.StrSiegeAssault;
    +import net.sf.l2j.gameserver.handler.skillhandlers.Sweep;
    +import net.sf.l2j.gameserver.handler.skillhandlers.Unlock;
    +import net.sf.l2j.gameserver.handler.usercommandhandlers.ClanPenalty;
    +import net.sf.l2j.gameserver.handler.usercommandhandlers.ClanWarsList;
    +import net.sf.l2j.gameserver.handler.usercommandhandlers.DisMount;
    +import net.sf.l2j.gameserver.handler.usercommandhandlers.Escape;
    +import net.sf.l2j.gameserver.handler.usercommandhandlers.Loc;
    +import net.sf.l2j.gameserver.handler.usercommandhandlers.Mount;
    +import net.sf.l2j.gameserver.handler.usercommandhandlers.OlympiadStat;
    +import net.sf.l2j.gameserver.handler.usercommandhandlers.PartyInfo;
    +import net.sf.l2j.gameserver.handler.usercommandhandlers.Time;
    +import net.sf.l2j.gameserver.handler.voicedcommandhandlers.VoiceExperience;
     import net.sf.l2j.gameserver.handler.voicedcommandhandlers.stats;
     import net.sf.l2j.gameserver.idfactory.IdFactory;
     import net.sf.l2j.gameserver.instancemanager.AuctionManager;
    @@ -413,6 +547,7 @@
     
           _voicedCommandHandler = VoicedCommandHandler.getInstance();
           _voicedCommandHandler.registerVoicedCommandHandler(new stats());
    +      _voicedCommandHandler.registerVoicedCommandHandler(new VoiceExperience());
           
            _log.config("VoicedCommandHandler: Loaded " + _voicedCommandHandler.size() + " handlers.");
     
    Index: java/net/sf/l2j/Config.java
    ===================================================================
    --- java/net/sf/l2j/Config.java   (revision 366)
    +++ java/net/sf/l2j/Config.java   (working copy)
    @@ -126,6 +126,7 @@
        /** Alternative game crafting SP rate multiplier - default 1*/
        public static double ALT_GAME_CREATION_SP_RATE;
       
    +   public static boolean Boost_EXP_COMMAND;
       
        /** Alternative game skill learning */
        public static boolean ALT_GAME_SKILL_LEARN;
    @@ -1590,7 +1591,8 @@
                    ALT_GAME_CANCEL_CAST        = altSettings.getProperty("AltGameCancelByHit", "Cast").equalsIgnoreCase("cast") || altSettings.getProperty("AltGameCancelByHit", "Cast").equalsIgnoreCase("all");
                        ALT_PERFECT_SHLD_BLOCK      = Integer.parseInt(altSettings.getProperty("AltPerfectShieldBlockRate", "5"));
                    ALT_GAME_DELEVEL            = Boolean.parseBoolean(altSettings.getProperty("Delevel", "true"));
    -                   ALT_GAME_MAGICFAILURES      = Boolean.parseBoolean(altSettings.getProperty("MagicFailures", "false"));
    +            Boost_EXP_COMMAND = Boolean.parseBoolean(altSettings.getProperty("SpExpCommand", "False"));
    +            ALT_GAME_MAGICFAILURES = Boolean.parseBoolean(altSettings.getProperty("MagicFailures", "false"));
                    ALT_GAME_MOB_ATTACK_AI      = Boolean.parseBoolean(altSettings.getProperty("AltGameMobAttackAI", "false"));
                    ALT_GAME_EXPONENT_XP        = Float.parseFloat(altSettings.getProperty("AltGameExponentXp", "0."));
                    ALT_GAME_EXPONENT_SP        = Float.parseFloat(altSettings.getProperty("AltGameExponentSp", "0."));
    Index: java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/VoiceExperience.java
    ===================================================================
    --- java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/VoiceExperience.java   (revision 0)
    +++ java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/VoiceExperience.java   (revision 0)
    @@ -0,0 +1,58 @@
    +/*
    + * 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.sf.l2j.gameserver.handler.voicedcommandhandlers;
    +
    +import net.sf.l2j.Config;
    +import net.sf.l2j.gameserver.handler.IVoicedCommandHandler;
    +import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
    +
    +public class VoiceExperience implements IVoicedCommandHandler
    +{
    +   private static final String[] VOICED_COMMANDS =
    +   {
    +      "expon",
    +      "expoff"
    +   };
    +   
    +   @Override
    +   public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
    +   {
    +      if (!Config.Boost_EXP_COMMAND)
    +      {
    +         activeChar.sendMessage("Command Disabled");
    +         return false;
    +      }
    +      
    +      if (command.equalsIgnoreCase("expon"))
    +      {
    +         activeChar.setGainXpSp(true);
    +         activeChar.sendMessage("Experience Gain: Enabled");
    +         activeChar.sendMessage("Skill Point Gain: Enabled");
    +      }
    +      else if (command.equalsIgnoreCase("expoff"))
    +      {
    +         activeChar.setGainXpSp(false);
    +         activeChar.sendMessage("Experience Gain: Disabled");
    +         activeChar.sendMessage("Skill Point Gain: Disabled");
    +      }
    +      return true;
    +   }
    +   
    +   @Override
    +   public String[] getVoicedCommandList()
    +   {
    +      return VOICED_COMMANDS;
    +   }
    +}
    \ No newline at end of file
    Index: java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java
    ===================================================================
    --- java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java   (revision 366)
    +++ java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java   (working copy)
    @@ -654,6 +654,8 @@
        private double _mpUpdateDecCheck = .0;
        private double _mpUpdateInterval = .0;
     
    +   private boolean _setGainXpSp = false;
    +
        /** Skill casting information (used to queue when several skills are cast in a short time) **/
        public class SkillDat
        {
    @@ -11386,4 +11388,14 @@
            _fallingTimestamp = System.currentTimeMillis() + FALLING_VALIDATION_DELAY;
        }
     
    +   
    +   public void setGainXpSp(boolean XpSp)
    +   {
    +      _setGainXpSp = XpSp;
    +   }
    +   
    +   public boolean getGainXpSp()
    +   {
    +      return _setGainXpSp;
    +   }
     }
    \ No newline at end of file
    Index: java/config/altsettings.properties
    ===================================================================
    --- java/config/altsettings.properties   (revision 366)
    +++ java/config/altsettings.properties   (working copy)
    @@ -295,4 +295,8 @@
     # Don't load quests
     AltDevNoQuests = False
     # Don't load spawntable
    -AltDevNoSpawns = False
    \ No newline at end of file
    +AltDevNoSpawns = False
    +
    +# Enable / Disable / gaining experience. (.expon .expoff )
    +# Default: False
    +SpExpCommand = False
    \ No newline at end of file
    Index: java/net/sf/l2j/gameserver/model/actor/stat/PcStat.java
    ===================================================================
    --- java/net/sf/l2j/gameserver/model/actor/stat/PcStat.java   (revision 366)
    +++ java/net/sf/l2j/gameserver/model/actor/stat/PcStat.java   (working copy)
    @@ -54,8 +54,12 @@
        // Method - Public
        public boolean addExp(int value)
        {
    -        if (!super.addExp(value))
    -            return false;
    +      if (!getActiveChar().getGainXpSp())
    +      {
    +         return false;
    +      }
    +      if (!super.addExp(value))
    +         return false;
     
            // Set new karma
            if (getActiveChar().getKarma() > 0 && (getActiveChar().isGM() || !getActiveChar().isInsideZone(L2PcInstance.ZONE_PVP)))
    @@ -177,6 +181,11 @@
     
        public boolean addSp(int value)
        {
    +      if (!getActiveChar().getGainXpSp())
    +      {
    +         return false;
    +      }
    +
            if (!super.addSp(value)) return false;
     
            StatusUpdate su = new StatusUpdate(getActiveChar().getObjectId());

      Current date/time is 23rd July 2017, 11:44