View difference between Paste ID: XRTKvgEm and H8UUmJ9t
SHOW: | | - or go back to the newest paste.
1
diff --git a/aCis_gameserver/config/players.properties b/aCis_gameserver/config/players.properties
2
index 3e58ec8..42b9fcd 100644
3
--- a/aCis_gameserver/config/players.properties
4
+++ b/aCis_gameserver/config/players.properties
5
@@ -250,3 +250,12 @@
6
 # Allow player subclass addition without checking for unique quest items. Default : False.
7
 SubClassWithoutQuests = False
8
 
9
+#=============================================================
10
+#                Custom Cansel Segunds
11
+#=============================================================
12
+# this setting back the buffs after the set time in CustomCancelSeconds
13
+# Default : False
14
+AllowCustomCancelTask = True
15
+# 5 = 5 seconds.
16
+CustomCancelSeconds = 7
17
+
18
diff --git a/aCis_gameserver/java/net/sf/l2j/Config.java b/aCis_gameserver/java/net/sf/l2j/Config.java
19
index 146971c..bf447a0 100644
20
--- a/aCis_gameserver/java/net/sf/l2j/Config.java
21
+++ b/aCis_gameserver/java/net/sf/l2j/Config.java
22
@@ -435,6 +435,9 @@
23
 	public static boolean DIVINE_SP_BOOK_NEEDED;
24
 	public static boolean SUBCLASS_WITHOUT_QUESTS;
25
 	
26
+	/** Custom Cansel Segunds */
27
+	public static boolean ALLOW_CUSTOM_CANCEL;
28
+	public static int CUSTOM_CANCEL_SECONDS;
29
 	
30
 	// --------------------------------------------------
31
 	// Sieges
32
@@ -1078,6 +1081,9 @@
33
 		DIVINE_SP_BOOK_NEEDED = players.getProperty("DivineInspirationSpBookNeeded", true);
34
 		SUBCLASS_WITHOUT_QUESTS = players.getProperty("SubClassWithoutQuests", false);
35
 		
36
+		ALLOW_CUSTOM_CANCEL = players.getProperty("AllowCustomCancelTask", false);
37
+		CUSTOM_CANCEL_SECONDS = players.getProperty("CustomCancelSeconds", 5);
38
+
39
 	}
40
 	
41
 	/**
42
diff --git a/aCis_gameserver/java/net/sf/l2j/gameserver/handler/skillhandlers/Cancel.java b/aCis_gameserver/java/net/sf/l2j/gameserver/handler/skillhandlers/Cancel.java
43
index 9722407..ebe3c59 100644
44
--- a/aCis_gameserver/java/net/sf/l2j/gameserver/handler/skillhandlers/Cancel.java
45
+++ b/aCis_gameserver/java/net/sf/l2j/gameserver/handler/skillhandlers/Cancel.java
46
@@ -3,6 +3,7 @@
47
 import java.util.Arrays;
48
 import java.util.Collections;
49
 import java.util.List;
50
+import java.util.Vector;
51
 
52
 import net.sf.l2j.commons.math.MathUtil;
53
+import net.sf.l2j.commons.pool.ThreadPool;
54
@@ -13,8 +14,10 @@
55
 import net.sf.l2j.gameserver.enums.skills.EffectType;
56
 import net.sf.l2j.gameserver.enums.skills.SkillType;
57
 import net.sf.l2j.gameserver.handler.ISkillHandler;
58
+import net.sf.l2j.gameserver.model.CustomCancelTask;
59
 import net.sf.l2j.gameserver.model.WorldObject;
60
 import net.sf.l2j.gameserver.model.actor.Creature;
61
+import net.sf.l2j.gameserver.model.actor.Player;
62
 import net.sf.l2j.gameserver.skills.AbstractEffect;
63
 import net.sf.l2j.gameserver.skills.Formulas;
64
 import net.sf.l2j.gameserver.skills.L2Skill;
65
@@ -31,6 +34,7 @@
66
 	@Override
67
 	public void useSkill(Creature activeChar, L2Skill skill, WorldObject[] targets)
68
 	{
69
+		Vector<L2Skill> cancelledBuffs = new Vector<>();
70
 		// Delimit min/max % success.
71
 		final int minRate = (skill.getSkillType() == SkillType.CANCEL) ? 25 : 40;
72
 		final int maxRate = (skill.getSkillType() == SkillType.CANCEL) ? 75 : 95;
73
@@ -58,6 +62,15 @@
74
 			
75
 			for (AbstractEffect effect : list)
76
 			{
77
+
78
+				if (Config.ALLOW_CUSTOM_CANCEL)
79
+				{
80
+					if (!cancelledBuffs.contains(effect.getSkill()))
81
+					{
82
+						cancelledBuffs.add(effect.getSkill());
83
+					}
84
+				}
85
+
86
 				// Don't cancel toggles or debuffs.
87
 				if (effect.getSkill().isToggle() || effect.getSkill().isDebuff())
88
 					continue;
89
@@ -88,6 +101,14 @@
90
 						continue;
91
 				}
92
 				
93
+				if (Config.ALLOW_CUSTOM_CANCEL)
94
+				{
95
+					if (cancelledBuffs.size() > 0)
96
+					{
97
+						ThreadPool.schedule(new CustomCancelTask((Player) target, cancelledBuffs), Config.CUSTOM_CANCEL_SECONDS * 1000);
98
+					}
99
+				}
100
+
101
 				// Calculate the success chance following previous variables.
102
 				if (calcCancelSuccess(effect.getPeriod(), diffLevel, skillPower, skillVuln, minRate, maxRate))
103
 					effect.exit();
104
diff --git a/aCis_gameserver/java/net/sf/l2j/gameserver/model/CustomCancelTask.java b/aCis_gameserver/java/net/sf/l2j/gameserver/model/CustomCancelTask.java
105
new file mode 100644
106
index 0000000..412d6d0
107
--- /dev/null
108
+++ b/aCis_gameserver/java/net/sf/l2j/gameserver/model/CustomCancelTask.java
109
@@ -0,0 +1,41 @@
110
+package net.sf.l2j.gameserver.model;
111
+
112
+import java.util.Vector;
113
+
114
+import net.sf.l2j.gameserver.model.actor.Player;
115
+import net.sf.l2j.gameserver.skills.L2Skill;
116
+
117
+
118
+/**
119
+ * @author Anarchy
120
+ *
121
+ */
122
+public class CustomCancelTask implements Runnable
123
+{
124
+	private Player _player = null;
125
+	private Vector<L2Skill> _buffs = null;
126
+	
127
+	public CustomCancelTask(Player _player, Vector<L2Skill> _buffs)
128
+	{
129
+		this._player = _player;
130
+		this._buffs = _buffs;
131
+	}
132
+	
133
+	@Override
134
+	public void run()
135
+	{
136
+		if (_player == null || !_player.isOnline())
137
+		{
138
+			return;
139
+		}
140
+		for (L2Skill s : _buffs)
141
+		{
142
+			if (s == null)
143
+			{
144
+				continue;
145
+			}
146
+			
147
+			s.getEffects(_player, _player);
148
+		}
149
+	}
150
+}
151