Nik

Untitled

Nik
Apr 4th, 2011
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 3.50 KB | None | 0 0
  1. Index: java/com/l2jserver/gameserver/model/L2Skill.java
  2. ===================================================================
  3. --- java/com/l2jserver/gameserver/model/L2Skill.java    (revision 402)
  4. +++ java/com/l2jserver/gameserver/model/L2Skill.java    (working copy)
  5. @@ -17,10 +17,12 @@
  6.  import java.util.ArrayList;
  7.  import java.util.Collection;
  8.  import java.util.List;
  9. +import java.util.Map;
  10.  import java.util.StringTokenizer;
  11.  import java.util.logging.Logger;
  12.  
  13.  import javolution.util.FastList;
  14. +import javolution.util.FastMap;
  15.  
  16.  import com.l2jserver.Config;
  17.  import com.l2jserver.gameserver.GeoData;
  18. @@ -173,6 +175,7 @@
  19.     private final int _negateLvl;   // abnormalLvl is negated with negateLvl
  20.     private final int[] _negateId;          // cancels the effect of skill ID
  21.     private final L2SkillType[] _negateStats;   // lists the effect types that are canceled
  22. +   private final Map<String, Byte> _negateAbnormals; // lists the effect abnormal types with order below the presented that are canceled
  23.     private final int _maxNegatedEffects;   // maximum number of effects to negate
  24.    
  25.     private final boolean _stayAfterDeath; // skill should stay after death
  26. @@ -352,6 +355,34 @@
  27.             _negateStats = array;
  28.         }
  29.        
  30. +       String negateAbnormals = set.getString("negateAbnormals", null);
  31. +       if (negateAbnormals != null && negateAbnormals != "")
  32. +       {
  33. +           _negateAbnormals = new FastMap<String, Byte>();
  34. +           for (String ngtStack : negateAbnormals.split(";"))
  35. +           {
  36. +               String[] ngt = ngtStack.split(",");
  37. +               if (ngt.length == 1) // Only abnormalType is present, without abnormalLvl
  38. +               {
  39. +                   _negateAbnormals.put(ngt[0], Byte.MAX_VALUE);
  40. +               }
  41. +               else if (ngt.length == 2) // Both abnormalType and abnormalLvl are present
  42. +               {
  43. +                   try
  44. +                   {
  45. +                       _negateAbnormals.put(ngt[0], Byte.parseByte(ngt[1]));
  46. +                   }
  47. +                   catch (Exception e)
  48. +                   {
  49. +                       throw new IllegalArgumentException("SkillId: "+_id+" Byte value required, but found: "+ngt[1]);
  50. +                   }
  51. +               }
  52. +               else // If not both from above, then smth is messed up... throw an error.
  53. +                   throw new IllegalArgumentException("SkillId: "+_id+": Incorrect negate Abnormals for "+ngtStack+". Lvl: abnormalType1,abnormalLvl1;abnormalType2,abnormalLvl2;abnormalType3,abnormalLvl3... or abnormalType1;abnormalType2;abnormalType3...");
  54. +           }
  55. +       }
  56. +       else
  57. +           _negateAbnormals = null;
  58.        
  59.         String negateId = set.getString("negateId", null);
  60.         if (negateId != null)
  61. @@ -647,6 +678,11 @@
  62.         return _negateStats;
  63.     }
  64.    
  65. +   public final Map<String, Byte> getNegateAbnormals()
  66. +   {
  67. +       return _negateAbnormals;
  68. +   }
  69. +  
  70.     public final int getAbnormalLvl()
  71.     {
  72.         return _abnormalLvl;
  73. Index: java/com/l2jserver/gameserver/skills/effects/EffectNegate.java
  74. ===================================================================
  75. --- java/com/l2jserver/gameserver/skills/effects/EffectNegate.java  (revision 402)
  76. +++ java/com/l2jserver/gameserver/skills/effects/EffectNegate.java  (working copy)
  77. @@ -52,6 +52,20 @@
  78.         {
  79.             getEffected().stopSkillEffects(negateSkillType, skill.getNegateLvl());
  80.         }
  81. +       if (skill.getNegateAbnormals() != null)
  82. +       {
  83. +           for (L2Effect effect : getEffected().getAllEffects())
  84. +           {
  85. +               if (effect == null)
  86. +                   continue;
  87. +              
  88. +               for (String negateAbnormalType : skill.getNegateAbnormals().keySet())
  89. +               {
  90. +                   if (negateAbnormalType.equalsIgnoreCase(effect.getAbnormalType()) && skill.getNegateAbnormals().get(negateAbnormalType) >= effect.getAbnormalLvl())
  91. +                       effect.exit();
  92. +               }
  93. +           }
  94. +       }
  95.         return true;
  96.     }
Advertisement
Add Comment
Please, Sign In to add comment