Guest User

Unique Cancellation System, addapted by Crystalia

a guest
Aug 8th, 2012
525
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 4.84 KB | None | 0 0
  1. ### Eclipse Workspace Patch 1.0
  2. #P L2jFrozen_GS
  3. Index: head-src/com/l2jfrozen/gameserver/model/actor/instance/L2PcInstance.java
  4. ===================================================================
  5. --- head-src/com/l2jfrozen/gameserver/model/actor/instance/L2PcInstance.java    (revision 948)
  6. +++ head-src/com/l2jfrozen/gameserver/model/actor/instance/L2PcInstance.java    (working copy)
  7. @@ -967,6 +969,8 @@
  8.    
  9.     /** The _observer mode. */
  10.     private boolean _observerMode = false;
  11. +  
  12. +   private FastList<L2Effect> removedBuffs = new FastList<L2Effect>();
  13.  
  14.     /** Stored from last ValidatePosition *. */
  15.     private Location _lastClientPosition = new Location(0, 0, 0);
  16.    
  17. @@ -5689,6 +5695,15 @@
  18.  
  19.         return item;
  20.     }
  21. +  
  22. +      
  23. +   public FastList<L2Effect> getRemovedBuffs(){
  24. +   return removedBuffs;
  25. +   }
  26. +              
  27. +   public void addRemovedBuff(L2Effect j){
  28. +   removedBuffs.add(j);
  29. +   }
  30.  
  31.     /**
  32.      * Check item manipulation.
  33.      
  34. ### Eclipse Workspace Patch 1.0
  35. #P L2jFrozen_GS
  36. Index: head-src/com/l2jfrozen/gameserver/handler/skillhandlers/Disablers.java
  37. ===================================================================
  38. --- head-src/com/l2jfrozen/gameserver/handler/skillhandlers/Disablers.java  (revision 948)
  39. +++ head-src/com/l2jfrozen/gameserver/handler/skillhandlers/Disablers.java  (working copy)
  40. @@ -22,10 +22,13 @@
  41.  import java.util.logging.Level;
  42.  import java.util.logging.Logger;
  43.  
  44. +import javolution.util.FastList;
  45. +
  46.  import com.l2jfrozen.Config;
  47.  import com.l2jfrozen.gameserver.ai.CtrlEvent;
  48.  import com.l2jfrozen.gameserver.ai.CtrlIntention;
  49.  import com.l2jfrozen.gameserver.ai.L2AttackableAI;
  50. +import com.l2jfrozen.gameserver.datatables.SkillTable;
  51.  import com.l2jfrozen.gameserver.datatables.xml.ExperienceData;
  52.  import com.l2jfrozen.gameserver.handler.ISkillHandler;
  53.  import com.l2jfrozen.gameserver.handler.SkillHandler;
  54. @@ -44,6 +47,7 @@
  55.  import com.l2jfrozen.gameserver.network.serverpackets.SystemMessage;
  56.  import com.l2jfrozen.gameserver.skills.Formulas;
  57.  import com.l2jfrozen.gameserver.skills.Stats;
  58. +import com.l2jfrozen.gameserver.thread.ThreadPoolManager;
  59.  import com.l2jfrozen.util.random.Rnd;
  60.  
  61.  /**
  62. @@ -80,6 +84,29 @@
  63.     private String[] _negateEffectTypes = null;
  64.     private float _negatePower = 0.f;
  65.     private int _negateId = 0;
  66. +          
  67. +   public class Canc implements Runnable{
  68. +   L2PcInstance j;
  69. +   FastList<L2Effect> l;
  70. +                  
  71. +   public Canc(L2PcInstance p,FastList<L2Effect> f){
  72. +   j = p;
  73. +   l = f;
  74. +   }
  75. +                      
  76. +   @Override
  77. +   public void run(){
  78. +   if(l.isEmpty())
  79. +   return;
  80. +   for(L2Effect b : l)
  81. +   {
  82. +   L2Skill k = SkillTable.getInstance().getInfo(b.getSkill().getId(), b.getLevel());
  83. +   if(k != null)
  84. +   k.getEffects(j, j);
  85. +   }
  86. +   l.clear();
  87. +   }
  88. +   }  
  89.  
  90.     @Override
  91.     public void useSkill(L2Character activeChar, L2Skill skill, L2Object[] targets)
  92. @@ -434,45 +461,30 @@
  93.  
  94.                         if(Rnd.get(100) < landrate)
  95.                         {
  96. -                           L2Effect[] effects = target.getAllEffects();
  97. -                           int maxfive = 5;
  98. -                           for(L2Effect e : effects)
  99. -                           {
  100. -                               switch(e.getEffectType())
  101. -                               {
  102. -                                   case SIGNET_GROUND:
  103. -                                   case SIGNET_EFFECT:
  104. -                                       continue;
  105. -                               }
  106. +                           L2PcInstance p = null;
  107. +                           if(target instanceof L2PcInstance)
  108. +                           p = (L2PcInstance) target;
  109. +                                                                                      
  110. +                           if(p != null){
  111. +                           L2Effect[] l = p.getAllEffects();
  112. +                           int r = Rnd.get(6);
  113. +                           if(l.length < r){}
  114. +                           int i = 0;
  115. +                           for(L2Effect h : l){
  116. +                           int id = h.getSkill().getId();
  117. +                           if(id == 4082 || id == 4515 || id == 110 || id == 111 || id == 1323 || id == 1325)
  118. +                           continue;                                  
  119. +                           if(i == r)
  120. +                           break;
  121. +                                                                                          
  122. +                           i++;
  123. +                           p.addRemovedBuff(h);
  124. +                           h.exit();
  125. +                           }
  126. +                           ThreadPoolManager.getInstance().scheduleGeneral(new Canc(p,p.getRemovedBuffs()), 6000);
  127.  
  128. -                               if(e.getSkill().getId() != 4082 && e.getSkill().getId() != 4215 && e.getSkill().getId() != 5182 && e.getSkill().getId() != 4515 && e.getSkill().getId() != 110 && e.getSkill().getId() != 111 && e.getSkill().getId() != 1323 && e.getSkill().getId() != 1325)
  129. -                               // Cannot cancel skills 4082, 4215, 4515, 110, 111, 1323, 1325
  130. -                               {
  131. -                                   if(e.getSkill().getSkillType() != SkillType.BUFF) //sleep, slow, surrenders etc
  132. -                                       e.exit(true);
  133. -                                   else
  134. -                                   {
  135. -                                       int rate = 100;
  136. -                                       int level = e.getLevel();
  137. -                                       if(level > 0)
  138. -                                           rate = Integer.valueOf(150 / (1 + level));
  139. +                           }
  140.  
  141. -                                       if(rate > 95)
  142. -                                           rate = 95;
  143. -                                       else if(rate < 5)
  144. -                                           rate = 5;
  145. -
  146. -                                       if(Rnd.get(100) < rate)
  147. -                                       {
  148. -                                           e.exit(true);
  149. -                                           maxfive--;
  150. -                                           if(maxfive == 0)
  151. -                                               break;
  152. -                                       }
  153. -                                   }
  154. -                               }
  155. -                           }
  156. -                           effects = null;
  157.                         }
  158.                         else
  159.                         {
Advertisement
Add Comment
Please, Sign In to add comment