Noticias:

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

Menú Principal

Anti drain moobs flag

Iniciado por Swarlog, Ago 19, 2022, 01:33 AM

Tema anterior - Siguiente tema

Swarlog

Codigo con el cual evitas recuperar Hp drenando del moob en estado de Debes de estar registrado para poder ver el contenido indicado. Registrate o Conectate puede editar para magos y warriors (skill/hit).Saludos espero que les sea útil.


### Eclipse Workspace Patch 1.0
#P Chr.6GMS
Index: java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java
===================================================================
--- java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java    (revision 5263)
+++ java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java    (working copy)
@@ -238,6 +238,8 @@
    public static final int STORE_PRIVATE_BUY = 3;
    public static final int STORE_PRIVATE_MANUFACTURE = 5;
    public static final int STORE_PRIVATE_PACKAGE_SELL = 8;
+
+    private int[] drainIds = {0,25,2};
 
    /** The table containing all minimum level needed for each Expertise (None, D, C, B, A, S)*/
    private static final int[] EXPERTISE_LEVELS =
@@ -284,6 +286,21 @@
        public void doCast(L2Skill skill)
        {
            super.doCast(skill);
+       
+            //--Cannot use drain skills in mobs--
+            L2Object target = getTarget();
+            L2MonsterInstance m = null;
+            if(target instanceof L2MonsterInstance)
+                m = (L2MonsterInstance) target;
+            if(m != null && getPvpFlag() > 0){
+            for(int i=0; i < drainIds.length; i ++)
+            {
+                if(skill.getId() == drainIds[i]){
+                    sendMessage("You can't drain hp from mobs");
+                    return;
+                }
+            }
+            }
 
            // cancel the recent fake-death protection instantly if the player attacks or casts spells
            getPlayer().setRecentFakeDeath(false);

By Zeus