Secret Experience

Secret Experience (https://secretexperience.net/)
-   [Lineage] Java Mods (https://secretexperience.net/lineage-java-mods/)
-   -   [L2JServer] .delevel command (https://secretexperience.net/lineage-java-mods/21490-delevel-command.html)

Guma 17-05-2010 03:44 PM

.delevel command
 
Código:

/*
 * 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 com.l2emu.gameserver.handler.voicedcommandhandlers;

import com.l2emu.gameserver.handler.IVoicedCommandHandler;
import com.l2emu.gameserver.model.actor.instance.L2PcInstance;
import com.l2emu.gameserver.model.base.Experience;

/**
 * @author Intrepid
 */
public class delevel implements IVoicedCommandHandler
{
        private static final String[] VOICED_COMMANDS = {"delevel"};
       
        public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
        {
                if (command.equalsIgnoreCase("delevel"))
                {
                        activeChar.destroyItemByItemId("Consume", 57, 10000000, activeChar, true);
                        activeChar.getStat().removeExpAndSp((activeChar.getExp() - Experience.LEVEL[activeChar.getStat().getLevel() - 1]), 0);
                }
                return true;
               
        }
        public String[] getVoicedCommandList()
        {
                return VOICED_COMMANDS;
        }
}

creditos : Intrepid

UchihaItachI 19-05-2010 12:00 AM

Como lhe falei em mp guma,
procurei procurei e não achei
sei que tem feito porem nao acho nem a pau
o comand voice
.xpon que abilita oa experiencia normalmente e o comand voice
.xpoff que restring o char de obter exp.
desde ja agrade
ate ++

Lanterna-Verde 09-12-2010 07:21 PM

@UchihaItachi
Comando: .allow_xp_sp

Crie um documento em java/com/l2jserver/gameserver/handler/voicedcommandhandlers chamado AllowExpAndSp.java
e coloque isto nele:
Código:

package handlers.voicedcommandhandlers;

import com.l2jserver.gameserver.handler.IVoicedCommandHandler;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.network.serverpackets.CreatureSay;
import com.l2jserver.gameserver.network.clientpackets.Say2;

/**
 * Allow player to enable or disable Experience and SP Gain.
 */
public class AllowExpAndSp implements IVoicedCommandHandler
{
        private static final String[] VOICED_COMMANDS =
        {
                "allow_xp_sp"
        };

        public boolean useVoicedCommand(String command, L2PcInstance player, String params)
        {
                if (command.equalsIgnoreCase("allow_xp_sp"))
                {
                        if (player != null)
                        {
                                if (player.canGetExp() == true)
                                {
                                        player.setCanGetExp(false);
                                        player.sendPacket(new CreatureSay(0, Say2.PARTY, "Server", "Exp and Sp Disabled."));
                                }
                                else
                                {
                                        player.setCanGetExp(true);
                                        player.sendPacket(new CreatureSay(0, Say2.PARTY, "Server", "Exp and Sp Enabled."));
                                }
                        }
                }
                return true;
        }
       
        public String[] getVoicedCommandList()
        {
                return VOICED_COMMANDS;
        }
}

Finalização do Código:

Código:

Index: java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java
===================================================================
--- java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java        (revision 4422)
+++ java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java        (working copy)
@@ -828,6 +828,9 @@
       
        private long _pvpFlagLasts;
       
+        /** Allow Player to receive Exp and Sp */
+        private boolean _canGetExpAndSp = true;
+       
        public void setPvpFlagLasts(long time)
        {
                _pvpFlagLasts = time;
@@ -15162,4 +15165,14 @@
                        L2DatabaseFactory.close(con);
                }
        }
-}
+       
+    public final boolean canGetExpAndSp()
+        {
+                return _canGetExpAndSp;
+        }
+       
+        public final void setCanGetExpAndSp(boolean b)
+        {
+                _canGetExpAndSp = b;
+        }
+}
\ No newline at end of file
Index: java/com/l2jserver/gameserver/model/actor/L2Attackable.java
===================================================================
--- java/com/l2jserver/gameserver/model/actor/L2Attackable.java        (revision 4422)
+++ java/com/l2jserver/gameserver/model/actor/L2Attackable.java        (working copy)
@@ -681,6 +681,15 @@
                                                                sp *= Config.L2JMOD_CHAMPION_REWARDS;
                                                        }
                                                       
+                                                        if (attacker instanceof L2PcInstance)
+                                                        {
+                                                                if (((L2PcInstance) attacker).canGetExpAndSp() == false)
+                                                                {
+                                                                        exp = 0;
+                                                                        sp = 0;
+                                                                }
+                                                        }
+                                                       
                                                        // Check for an over-hit enabled strike
                                                        if (attacker instanceof L2PcInstance)
                                                        {
Index: java/com/l2jserver/gameserver/model/L2Party.java
===================================================================
--- java/com/l2jserver/gameserver/model/L2Party.java        (revision 4422)
+++ java/com/l2jserver/gameserver/model/L2Party.java        (working copy)
@@ -694,7 +694,8 @@
                {
                        for (L2Character member : rewardedMembers)
                        {
-                                if(member.isDead()) continue;
+                                if(member.isDead() || !((L2PcInstance) member).canGetExpAndSp())
+                                        continue;
                               
                                penalty = 0;



Horários baseados na GMT -3. Agora são 07:40 AM.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0