Noticias:

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

Menú Principal

Anti-Drain Mob

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

Tema anterior - Siguiente tema

Swarlog

### 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);

Debes de estar registrado para poder ver el contenido indicado. Registrate o Conectateno funciona.. es mas elimina el stado PK
Mira este haber.. si no funciona avisame que lo reparo ;)

CitarL2PcInstance

### 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 drainId : drainIds)
+ {
+ if((skill.getSkillType() == L2SkillType.DRAIN) || (skill.getSkillType() == L2SkillType.BUFF) ){
+ 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);

Citarl2character

                       // reduce targets HP
                target.reduceCurrentHp(damage, this, null);
               
                if (reflectedDamage > 0)
                {
                    reduceCurrentHp(reflectedDamage, target, true, false, null);
                }
+
+ if ((this instanceof L2PcInstance) && (((L2PcInstance)this).getPvpFlag() != 0) && (target instanceof L2MonsterInstance))
+ {
+ sendMessage("You can't drain hp from mobs");
+ }
-                                if  (!isBow) // Do not absorb if weapon is of type bow
+ else if  (!isBow) // Do not absorb if weapon is of type bow
                {
                    // Absorb HP from the damage inflicted
                    double absorbPercent = getStat().calcStat(Stats.ABSORB_DAMAGE_PERCENT, 0, null, null);
                   
                    if (absorbPercent > 0)