- 0
This community uses essential cookies to function properly. Non-essential cookies and third-party services are used only with your consent. Read our Privacy Policy and We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue..
Question
`Sapphire
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 fileor 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.
10 answers to this question
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now