Noticias:

Debes de estar registrado para poder ver el contenido indicado. Registrate o Conectate

Menú Principal

Buff Protection enchant

Iniciado por Swarlog, Ago 16, 2022, 02:35 AM

Tema anterior - Siguiente tema

Swarlog

Para que cuando tengas un buff a +30 y luego te den el mismo a +5 no se te quite el de +30.

Lo activas/desactivas con el uso del comando:  .blockon // .blockoff

Core :

Index: C:/Documents and Settings/B1ggBoss/workspace/trunk/L2_GameServer/java/net/sf/l2j/gameserver/model/actor/L2Character.java
===================================================================
--- C:/Documents and Settings/B1ggBoss/workspace/trunk/L2_GameServer/java/net/sf/l2j/gameserver/model/actor/L2Character.java    (revision 3347)
+++ C:/Documents and Settings/B1ggBoss/workspace/trunk/L2_GameServer/java/net/sf/l2j/gameserver/model/actor/L2Character.java    (working copy)
@@ -155,6 +155,7 @@
    // Data Field
    private List<L2Character> _attackByList;
    private volatile boolean _isCastingNow                    = false;
+    private boolean _protected                                = false;
    private volatile boolean _isCastingSimultaneouslyNow        = false;
    private L2Skill _lastSkillCast;
    private L2Skill _lastSimultaneousSkillCast;
@@ -314,6 +315,23 @@
        return false;
    }
+    public void setProtectedPlayer(boolean prot)
+    {
+        if (prot == true)
+        {
+            _protected = true;
+        }
+        else
+        {
+            _protected = false;
+        }
+    }

+    public boolean isProtected()
+    {
+        return _protected;
+    }
+
    // =========================================================
    // Constructor
    /**

Datapack:

Index: C:/Documents and Settings/B1ggBoss/workspace/datapack_development/data/scripts/handlers/skillhandlers/Continuous.java
===================================================================
--- C:/Documents and Settings/B1ggBoss/workspace/datapack_development/data/scripts/handlers/skillhandlers/Continuous.java    (revision 6455)
+++ C:/Documents and Settings/B1ggBoss/workspace/datapack_development/data/scripts/handlers/skillhandlers/Continuous.java    (working copy)
@@ -120,6 +120,15 @@
                    ((L2PcInstance) activeChar).setCharmOfLuck(true);
            }
         
+            if (skill.getSkillType() == L2SkillType.BUFF && !(activeChar instanceof L2ClanHallManagerInstance))
+            {
+                if (target instanceof L2PcInstance && ((L2PcInstance) target).isProtected())
+                    continue;
+                else if (player != null && player.isProtected())
+                    continue;
+            }
+
+         
            if (skill.isOffensive() || skill.isDebuff())
            {
                if (player != null)

/*
* 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 handlers.voicedcommandhandlers;
import com.l2jserver.gameserver.handler.IVoicedCommandHandler;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
/**
*
* @author B1ggBoss
*
*/
public class BadBuffShield implements IVoicedCommandHandler
{
    private static final String[] _voicedCommands =
    {
        "blockon",
        "blockoff"
    };
 
    /**
    *
    * @see net.sf.l2j.gameserver.handler.IVoicedCommandHandler#useVoicedCommand(java.lang.String, net.sf.l2j.gameserver.model.actor.instance.L2PcInstance, java.lang.String)
    */
    public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
    {
        if (command.equalsIgnoreCase("blockon"))
        {
            activeChar.sendMessage("You are now under the grief-buff protection");
            activeChar.setProtectedPlayer(true);
        }
        else if (command.equalsIgnoreCase("blockoff"))
        {
            activeChar.sendMessage("The grief-buff protection is now desactivated");
            activeChar.setProtectedPlayer(false);
        }
        return true;
    }
 
    /**
    *
    * @see net.sf.l2j.gameserver.handler.IVoicedCommandHandler#getVoicedCommandList()
    */
    public String[] getVoicedCommandList()
    {
        return _voicedCommands;
    }
}

Index: C:/Documents and Settings/B1ggBoss/workspace/datapack_development/data/scripts/handlers/MasterHandler.java
===================================================================
--- C:/Documents and Settings/B1ggBoss/workspace/datapack_development/data/scripts/handlers/MasterHandler.java    (revision 6455)
+++ C:/Documents and Settings/B1ggBoss/workspace/datapack_development/data/scripts/handlers/MasterHandler.java    (working copy)
@@ -224,6 +224,7 @@
            VoicedCommandHandler.getInstance().registerVoicedCommandHandler(new Wedding());
        if (Config.BANKING_SYSTEM_ENABLED)
            VoicedCommandHandler.getInstance().registerVoicedCommandHandler(new Banking());
+        VoicedCommandHandler.getInstance().registerVoicedCommandHandler(new BadBuffShield());
        _log.config("Loaded " + VoicedCommandHandler.getInstance().size() + " VoicedHandlers");
    }
 

Creditos : B1ggBoss
Actualizacion : Chrisz