|
@@ -18,10 +18,8 @@
|
|
|
*/
|
|
|
package handlers.effecthandlers;
|
|
|
|
|
|
-import java.util.List;
|
|
|
-
|
|
|
-import com.l2jserver.gameserver.model.actor.L2Summon;
|
|
|
-import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
|
|
+import com.l2jserver.gameserver.ThreadPoolManager;
|
|
|
+import com.l2jserver.gameserver.model.actor.L2Character;
|
|
|
import com.l2jserver.gameserver.model.effects.EffectFlag;
|
|
|
import com.l2jserver.gameserver.model.effects.EffectTemplate;
|
|
|
import com.l2jserver.gameserver.model.effects.L2Effect;
|
|
@@ -30,8 +28,9 @@ import com.l2jserver.gameserver.model.stats.Env;
|
|
|
|
|
|
/**
|
|
|
* Servitor Share effect.<br>
|
|
|
- * Synchronizing effects on player and servitor if one of them gets removed for some reason the same will happen to another.
|
|
|
- * @author UnAfraid
|
|
|
+ * Synchronizing effects on player and servitor if one of them gets removed for some reason the same will happen to another. Partner's effect exit is executed in own thread, since there is no more queue to schedule the effects,<br>
|
|
|
+ * partner's effect is called while this effect is still exiting issuing an exit call for the effect, causing a stack over flow.
|
|
|
+ * @author UnAfraid, Zoey76
|
|
|
*/
|
|
|
public class ServitorShare extends L2Effect
|
|
|
{
|
|
@@ -67,35 +66,29 @@ public class ServitorShare extends L2Effect
|
|
|
@Override
|
|
|
public void onExit()
|
|
|
{
|
|
|
- List<L2Effect> effects = null;
|
|
|
- if (getEffected().isPlayer())
|
|
|
+ final L2Character effected = getEffected().isPlayer() ? getEffected().getSummon() : getEffected().getActingPlayer();
|
|
|
+ if (effected != null)
|
|
|
{
|
|
|
- final L2Summon summon = getEffected().getSummon();
|
|
|
- if ((summon != null) && summon.isServitor())
|
|
|
- {
|
|
|
- effects = summon.getAllEffects();
|
|
|
- }
|
|
|
+ ThreadPoolManager.getInstance().scheduleEffect(new ScheduledEffectExitTask(effected, getSkill().getId()), 100);
|
|
|
}
|
|
|
- else if (getEffected().isServitor())
|
|
|
+ super.onExit();
|
|
|
+ }
|
|
|
+
|
|
|
+ private static final class ScheduledEffectExitTask implements Runnable
|
|
|
+ {
|
|
|
+ private final L2Character _effected;
|
|
|
+ private final int _skillId;
|
|
|
+
|
|
|
+ public ScheduledEffectExitTask(L2Character effected, int skillId)
|
|
|
{
|
|
|
- final L2PcInstance owner = getEffected().getActingPlayer();
|
|
|
- if (owner != null)
|
|
|
- {
|
|
|
- effects = owner.getAllEffects();
|
|
|
- }
|
|
|
+ _effected = effected;
|
|
|
+ _skillId = skillId;
|
|
|
}
|
|
|
|
|
|
- if (effects != null)
|
|
|
+ @Override
|
|
|
+ public void run()
|
|
|
{
|
|
|
- for (L2Effect eff : effects)
|
|
|
- {
|
|
|
- if (eff.getSkill().getId() == getSkill().getId())
|
|
|
- {
|
|
|
- eff.exit();
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
+ _effected.stopSkillEffects(_skillId);
|
|
|
}
|
|
|
- super.onExit();
|
|
|
}
|
|
|
}
|