### Eclipse Workspace Patch 1.0
#P L2J_DataPack_BETA
Index: dist/game/data/scripts/handlers/effecthandlers/DispelBySlot.java
===================================================================
--- dist/game/data/scripts/handlers/effecthandlers/DispelBySlot.java (revision 10078)
+++ dist/game/data/scripts/handlers/effecthandlers/DispelBySlot.java (working copy)
@@ -18,11 +18,14 @@
*/
package handlers.effecthandlers;
+import java.util.ArrayList;
import java.util.Collections;
import java.util.EnumMap;
+import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
+import com.l2jserver.gameserver.ThreadPoolManager;
import com.l2jserver.gameserver.model.CharEffectList;
import com.l2jserver.gameserver.model.StatsSet;
import com.l2jserver.gameserver.model.actor.L2Character;
@@ -32,6 +35,8 @@
import com.l2jserver.gameserver.model.skills.AbnormalType;
import com.l2jserver.gameserver.model.skills.BuffInfo;
+import custom.CancelReturn.CancelReturn;
+
/**
* Dispel By Slot effect implementation.
* @author Gnacik, Zoey76, Adry_85
@@ -82,6 +87,7 @@
final L2Character effected = info.getEffected();
final CharEffectList effectList = effected.getEffectList();
+ final List<BuffInfo> buffList = new ArrayList<>();
// There is no need to iterate over all buffs,
// Just iterate once over all slots to dispel and get the buff with that abnormal if exists,
// Operation of O(n) for the amount of slots to dispel (which is usually small) and O(1) to get the buff.
@@ -102,11 +108,18 @@
{
continue;
}
-
- if ((entry.getKey() == toDispel.getSkill().getAbnormalType()) && (entry.getValue() >= toDispel.getSkill().getAbnormalLvl()))
+ if (effected.isPlayer() && !effected.getActingPlayer().isInOlympiadMode())
{
+ buffList.add(toDispel);
+ }
+ else if ((entry.getKey() == toDispel.getSkill().getAbnormalType()) && (entry.getValue() >= toDispel.getSkill().getAbnormalLvl()))
+ {
effectList.stopSkillEffects(true, entry.getKey());
}
}
+ if (!buffList.isEmpty())
+ {
+ ThreadPoolManager.getInstance().scheduleGeneral(new CancelReturn(effected, buffList), 15 * 1000);
+ }
}
}
Index: dist/game/data/scripts/custom/CancelReturn/CancelReturn.java
===================================================================
--- dist/game/data/scripts/custom/CancelReturn/CancelReturn.java (revision 0)
+++ dist/game/data/scripts/custom/CancelReturn/CancelReturn.java (working copy)
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2004-2013 L2J DataPack
+ *
+ * This file is part of L2J DataPack.
+ *
+ * L2J DataPack is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * L2J DataPack is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package custom.CancelReturn;
+
+import java.util.List;
+
+import com.l2jserver.gameserver.model.CharEffectList;
+import com.l2jserver.gameserver.model.actor.L2Character;
+import com.l2jserver.gameserver.model.skills.BuffInfo;
+
+/**
+ * Cancel Return.<br>
+ * It will return dispelled effects back to it's owner.
+ * @author xban1x
+ */
+public final class CancelReturn implements Runnable
+{
+ private final L2Character _character;
+ private final List<BuffInfo> _buffList;
+
+ public CancelReturn(L2Character character, List<BuffInfo> buffList)
+ {
+ _character = character;
+ _buffList = buffList;
+ }
+
+ @Override
+ public void run()
+ {
+ if ((_character != null) && (_buffList != null))
+ {
+ final CharEffectList cel = _character.getEffectList();
+ for (BuffInfo bi : _buffList)
+ {
+ cel.add(bi);
+ }
+ }
+ }
+
+}
Index: dist/game/data/scripts/custom/CancelReturn/CancelReturn.java
===================================================================
--- dist/game/data/scripts/custom/CancelReturn/CancelReturn.java (revision 0)
+++ dist/game/data/scripts/custom/CancelReturn/CancelReturn.java (working copy)
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2004-2013 L2J DataPack
+ *
+ * This file is part of L2J DataPack.
+ *
+ * L2J DataPack is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * L2J DataPack is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package custom.CancelReturn;
+
+import java.util.List;
+
+import com.l2jserver.gameserver.model.CharEffectList;
+import com.l2jserver.gameserver.model.actor.L2Character;
+import com.l2jserver.gameserver.model.skills.BuffInfo;
+
+/**
+ * Cancel Return.<br>
+ * It will return dispelled effects back to it's owner.
+ * @author xban1x
+ */
+public final class CancelReturn implements Runnable
+{
+ private final L2Character _character;
+ private final List<BuffInfo> _buffList;
+
+ public CancelReturn(L2Character character, List<BuffInfo> buffList)
+ {
+ _character = character;
+ _buffList = buffList;
+ }
+
+ @Override
+ public void run()
+ {
+ if ((_character != null) && (_buffList != null))
+ {
+ final CharEffectList cel = _character.getEffectList();
+ for (BuffInfo bi : _buffList)
+ {
+ cel.add(bi);
+ }
+ }
+ }
+
+}
Index: dist/game/data/scripts/handlers/effecthandlers/DispelBySlotProbability.java
===================================================================
--- dist/game/data/scripts/handlers/effecthandlers/DispelBySlotProbability.java (revision 10078)
+++ dist/game/data/scripts/handlers/effecthandlers/DispelBySlotProbability.java (working copy)
@@ -18,11 +18,14 @@
*/
package handlers.effecthandlers;
+import java.util.ArrayList;
import java.util.Collections;
import java.util.EnumMap;
+import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
+import com.l2jserver.gameserver.ThreadPoolManager;
import com.l2jserver.gameserver.model.CharEffectList;
import com.l2jserver.gameserver.model.StatsSet;
import com.l2jserver.gameserver.model.actor.L2Character;
@@ -33,6 +36,8 @@
import com.l2jserver.gameserver.model.skills.BuffInfo;
import com.l2jserver.util.Rnd;
+import custom.CancelReturn.CancelReturn;
+
/**
* Dispel By Slot Probability effect implementation.
* @author Adry_85, Zoey76
@@ -85,6 +90,7 @@
final L2Character effected = info.getEffected();
final CharEffectList effectList = effected.getEffectList();
+ final List<BuffInfo> buffList = new ArrayList<>();
// There is no need to iterate over all buffs,
// Just iterate once over all slots to dispel and get the buff with that abnormal if exists,
// Operation of O(n) for the amount of slots to dispel (which is usually small) and O(1) to get the buff.
@@ -106,12 +112,19 @@
{
continue;
}
-
- if ((toDispel.getSkill().getAbnormalType() == entry.getKey()) && (entry.getValue() >= toDispel.getSkill().getAbnormalLvl()))
+ if (effected.isPlayer() && !effected.getActingPlayer().isInOlympiadMode())
{
+ buffList.add(toDispel);
+ }
+ else if ((toDispel.getSkill().getAbnormalType() == entry.getKey()) && (entry.getValue() >= toDispel.getSkill().getAbnormalLvl()))
+ {
effectList.stopSkillEffects(true, entry.getKey());
}
}
}
+ if (!buffList.isEmpty())
+ {
+ ThreadPoolManager.getInstance().scheduleGeneral(new CancelReturn(effected, buffList), 15 * 1000);
+ }
}
}
Index: dist/game/data/scripts/handlers/effecthandlers/DispelByCategory.java
===================================================================
--- dist/game/data/scripts/handlers/effecthandlers/DispelByCategory.java (revision 10078)
+++ dist/game/data/scripts/handlers/effecthandlers/DispelByCategory.java (working copy)
@@ -20,6 +20,7 @@
import java.util.List;
+import com.l2jserver.gameserver.ThreadPoolManager;
import com.l2jserver.gameserver.model.StatsSet;
import com.l2jserver.gameserver.model.conditions.Condition;
import com.l2jserver.gameserver.model.effects.AbstractEffect;
@@ -27,6 +28,8 @@
import com.l2jserver.gameserver.model.skills.BuffInfo;
import com.l2jserver.gameserver.model.stats.Formulas;
+import custom.CancelReturn.CancelReturn;
+
/**
* Dispel By Category effect implementation.
* @author DS, Adry_85
@@ -66,6 +69,13 @@
}
final List<BuffInfo> canceled = Formulas.calcCancelStealEffects(info.getEffector(), info.getEffected(), info.getSkill(), _slot, _rate, _max);
+ if (info.getEffected().isPlayer() && !info.getEffected().getActingPlayer().isInOlympiadMode())
+ {
+ if (!canceled.isEmpty())
+ {
+ ThreadPoolManager.getInstance().scheduleGeneral(new CancelReturn(info.getEffected(), canceled), 15 * 1000);
+ }
+ }
for (BuffInfo can : canceled)
{
info.getEffected().getEffectList().stopSkillEffects(true, can.getSkill());