Jump to content
  • 0

Cancellation System For L2Reunion


`Sapphire

Question

Can someone adapt this code for l2reunion?

 

And where to put it because i am new and i don't know how to put it so please can someone help me and adapt?

-import java.util.Vector;
+import javolution.util.FastMap;
 
 import net.sf.l2j.Config;
 import net.sf.l2j.gameserver.ThreadPoolManager;
@@ -52,7 +52,7 @@
         // Get skill power (which is used as baseRate).
         final double skillPower = skill.getPower();
         
-        Vector<L2Skill> cancelledBuffs = new Vector<>();
+        FastMap<L2Skill, int[]> cancelledBuffs = new FastMap<>();
         
         for (L2Object obj : targets)
         {
@@ -108,9 +108,9 @@
                     // Stores the last canceled skill for further use.
                     lastCanceledSkillId = effect.getSkill().getId();
                     
-                    if (!cancelledBuffs.contains(effect.getSkill()))
+                    if (!cancelledBuffs.containsKey(effect.getSkill()))
                     {
-                        cancelledBuffs.add(effect.getSkill());
+                        cancelledBuffs.put(effect.getSkill(), new int[] { effect.getCount(), effect.getTime() });
                     }
                     
                     // Exit the effect.

and

 package net.sf.l2j.gameserver.model.entity.custom;
 
-import java.util.Vector;
+import javolution.util.FastMap;
 
+import net.sf.l2j.gameserver.model.L2Effect;
 import net.sf.l2j.gameserver.model.L2Skill;
 import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
+import net.sf.l2j.gameserver.skills.Env;
+import net.sf.l2j.gameserver.skills.effects.EffectTemplate;
 
 /**
  * @author Anarchy
@@ -26,9 +29,9 @@
 public class CustomCancelTask implements Runnable
 {
     private L2PcInstance _player = null;
-    private Vector<L2Skill> _buffs = null;
+    private FastMap<L2Skill, int[]> _buffs = null;
         
-    public CustomCancelTask(L2PcInstance _player, Vector<L2Skill> _buffs)
+    public CustomCancelTask(L2PcInstance _player, FastMap<L2Skill, int[]> _buffs)
     {
         this._player = _player;
         this._buffs = _buffs;
@@ -42,7 +45,7 @@
             return;
         }
             
-        for (L2Skill s : _buffs)
+        for (L2Skill s : _buffs.keySet())
         {
             if (s == null)
             {
@@ -49,7 +52,21 @@
                 continue;
             }
                 
-            s.getEffects(_player, _player);
+             Env env = new Env();
+             env.player = _player;
+             env.target = _player;
+             env.skill = s;
+             L2Effect ef;
+             for (EffectTemplate et : s.getEffectTemplates())
+             {
+                ef = et.getEffect(env);
+                 if (ef != null)
+                 {
+                     ef.setCount(_buffs.get(s)[0]);
+                     ef.setFirstTime(_buffs.get(s)[1]);
+                     ef.scheduleEffect();
+                 }
+             }
         }
     }
 }
\ No newline at end of file

or check the topic 

 

here the link

 

http://www.maxcheate...r-cancellation/

 

and i am sorry for my bad english

 

and i can't speak english im using google translate

 

please help

 

thanks.

 

 

 

Link to comment
Share on other sites

10 answers to this question

Recommended Posts

  • 0

Can someone adapt this code for l2reunion?

 

And where to put it because i am new and i don't know how to put it so please can someone help me and adapt?

-import java.util.Vector;
+import javolution.util.FastMap;
 
 import net.sf.l2j.Config;
 import net.sf.l2j.gameserver.ThreadPoolManager;
@@ -52,7 +52,7 @@
         // Get skill power (which is used as baseRate).
         final double skillPower = skill.getPower();
         
-        Vector<L2Skill> cancelledBuffs = new Vector<>();
+        FastMap<L2Skill, int[]> cancelledBuffs = new FastMap<>();
         
         for (L2Object obj : targets)
         {
@@ -108,9 +108,9 @@
                     // Stores the last canceled skill for further use.
                     lastCanceledSkillId = effect.getSkill().getId();
                     
-                    if (!cancelledBuffs.contains(effect.getSkill()))
+                    if (!cancelledBuffs.containsKey(effect.getSkill()))
                     {
-                        cancelledBuffs.add(effect.getSkill());
+                        cancelledBuffs.put(effect.getSkill(), new int[] { effect.getCount(), effect.getTime() });
                     }
                     
                     // Exit the effect.

and

 package net.sf.l2j.gameserver.model.entity.custom;
 
-import java.util.Vector;
+import javolution.util.FastMap;
 
+import net.sf.l2j.gameserver.model.L2Effect;
 import net.sf.l2j.gameserver.model.L2Skill;
 import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
+import net.sf.l2j.gameserver.skills.Env;
+import net.sf.l2j.gameserver.skills.effects.EffectTemplate;
 
 /**
  * @author Anarchy
@@ -26,9 +29,9 @@
 public class CustomCancelTask implements Runnable
 {
     private L2PcInstance _player = null;
-    private Vector<L2Skill> _buffs = null;
+    private FastMap<L2Skill, int[]> _buffs = null;
         
-    public CustomCancelTask(L2PcInstance _player, Vector<L2Skill> _buffs)
+    public CustomCancelTask(L2PcInstance _player, FastMap<L2Skill, int[]> _buffs)
     {
         this._player = _player;
         this._buffs = _buffs;
@@ -42,7 +45,7 @@
             return;
         }
             
-        for (L2Skill s : _buffs)
+        for (L2Skill s : _buffs.keySet())
         {
             if (s == null)
             {
@@ -49,7 +52,21 @@
                 continue;
             }
                 
-            s.getEffects(_player, _player);
+             Env env = new Env();
+             env.player = _player;
+             env.target = _player;
+             env.skill = s;
+             L2Effect ef;
+             for (EffectTemplate et : s.getEffectTemplates())
+             {
+                ef = et.getEffect(env);
+                 if (ef != null)
+                 {
+                     ef.setCount(_buffs.get(s)[0]);
+                     ef.setFirstTime(_buffs.get(s)[1]);
+                     ef.scheduleEffect();
+                 }
+             }
         }
     }
 }
\ No newline at end of file

or check the topic 

 

here the link

 

http://www.maxcheate...r-cancellation/

 

and i am sorry for my bad english

 

and i can't speak english im using google translate

 

please help

 

thanks.

with this code buffs give back and in olympiad not only in pvp i have tested

Link to comment
Share on other sites

  • 0

bump

for adapt correct 1 code must have the pack of you want to adapt. and havent all the l2jreunion pack for help you. so add the code, change the imports and if you have errors post here.

Link to comment
Share on other sites

  • 0

for adapt correct 1 code must have the pack of you want to adapt. and havent all the l2jreunion pack for help you. so add the code, change the imports and if you have errors post here.

i don't know how to change the imports and adapt :( i'm so new and n00b

 

if you want to download the l2r pack you can download it here

 

 

DOWNLOAD LINK

Rar Password : www.l2reunion.eu

 

or go there and download it IF YOU WANT :(

 

and thank you for your reply

Link to comment
Share on other sites

  • 0

i don't know how to change the imports and adapt :( i'm so new and n00b

 

if you want to download the l2r pack you can download it here

 

 

or go there and download it IF YOU WANT :(

 

and thank you for your reply

ok listen me. 1st of all you must learn how add java codes.read any guide for uderstund how it works. 2nd  the import is this:  

 

import net.sf.l2j.gameserver.model.L2Effect . (interlude)

 

 

import com.l2jserver.gameserver. blabla  (l2jfreya)

 

so if you want to adapt the imports from interlude to freya you must change to this:

 

import com.l2jserver.gameserver.model.L2Effect

 

so read guides how add java codes, if you read guides you understund me what i say before. so if you uderstund me you can adapt the code. i cant give you the code adapted cuz i must download the pack and bla bla...and i havent the time. after you must learn how add java codes. good luck from me :)

Link to comment
Share on other sites

  • 0

Will i tried to adapt the imports and i failed, i told you i don't know how to adapt

 

JzjtFnK.png

man listen me. with these errors in console you have alot of errors in eclipse. you have forgot alot of ; and } go to fix this and read guides about coding. i havent the time for download pack import in eclipse and alot of work and i havent the time. read guides how add java codes and check your errors in eclipse i think you have alot of errors

Link to comment
Share on other sites

  • 0

Can someone adapt it or give me tutorials how to adapt i searched everywhere and i didn't find any thing!

 

my request is it hard or what? just give the tutorial how to adapt  or the easy way: adapt it for me xD

 

please :((

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...