Browse Source

BETA: Continuing with [9650], more fixes to effects with recursive calls to effect effect on exit!
* Stack over flow fixed.
* Fixing misuse of onStart() and onExit() methods.
* Removed ConfuseMob effect, using Confusion instead.

Zoey76 12 years ago
parent
commit
26ece71411

+ 0 - 2
L2J_DataPack_BETA/dist/game/data/scripts/handlers/EffectMasterHandler.java

@@ -42,7 +42,6 @@ import handlers.effecthandlers.ChangeHairStyle;
 import handlers.effecthandlers.CharmOfCourage;
 import handlers.effecthandlers.CharmOfLuck;
 import handlers.effecthandlers.ClanGate;
-import handlers.effecthandlers.ConfuseMob;
 import handlers.effecthandlers.Confusion;
 import handlers.effecthandlers.ConsumeBody;
 import handlers.effecthandlers.ConvertItem;
@@ -147,7 +146,6 @@ public final class EffectMasterHandler
 		CharmOfCourage.class,
 		CharmOfLuck.class,
 		ClanGate.class,
-		ConfuseMob.class,
 		Confusion.class,
 		ConsumeBody.class,
 		ConvertItem.class,

+ 0 - 2
L2J_DataPack_BETA/dist/game/data/scripts/handlers/admincommandhandlers/AdminEffects.java

@@ -224,7 +224,6 @@ public class AdminEffects implements IAdminCommandHandler
 				{
 					player.stopAbnormalEffect(AbnormalEffect.HOLD_1);
 					player.setIsParalyzed(false);
-					player.stopParalyze(false);
 				}
 			}
 			catch (Exception e)
@@ -290,7 +289,6 @@ public class AdminEffects implements IAdminCommandHandler
 						player.stopAbnormalEffect(AbnormalEffect.HOLD_2);
 					}
 					player.setIsParalyzed(false);
-					player.stopParalyze(false);
 				}
 			}
 			catch (Exception e)

+ 1 - 1
L2J_DataPack_BETA/dist/game/data/scripts/handlers/effecthandlers/Bluff.java

@@ -29,7 +29,7 @@ import com.l2jserver.gameserver.network.serverpackets.StartRotation;
 import com.l2jserver.gameserver.network.serverpackets.StopRotation;
 
 /**
- * Implementation of the Bluff Effect
+ * Bluff effect.
  * @author decad
  */
 public class Bluff extends L2Effect

+ 1 - 3
L2J_DataPack_BETA/dist/game/data/scripts/handlers/effecthandlers/Cancel.java

@@ -19,7 +19,6 @@
 package handlers.effecthandlers;
 
 import java.util.List;
-import java.util.logging.Logger;
 
 import com.l2jserver.gameserver.model.actor.L2Character;
 import com.l2jserver.gameserver.model.effects.EffectTemplate;
@@ -29,12 +28,11 @@ import com.l2jserver.gameserver.model.stats.Env;
 import com.l2jserver.gameserver.model.stats.Formulas;
 
 /**
+ * Cancel effect.
  * @author DS
  */
 public class Cancel extends L2Effect
 {
-	protected static final Logger _log = Logger.getLogger(Cancel.class.getName());
-	
 	public Cancel(Env env, EffectTemplate template)
 	{
 		super(env, template);

+ 0 - 93
L2J_DataPack_BETA/dist/game/data/scripts/handlers/effecthandlers/ConfuseMob.java

@@ -1,93 +0,0 @@
-/*
- * 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 handlers.effecthandlers;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import com.l2jserver.gameserver.ai.CtrlIntention;
-import com.l2jserver.gameserver.model.L2Object;
-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;
-import com.l2jserver.gameserver.model.effects.L2EffectType;
-import com.l2jserver.gameserver.model.stats.Env;
-import com.l2jserver.util.Rnd;
-
-/**
- * Confuse Mob effect implementation.
- * @author littlecrow
- */
-public class ConfuseMob extends L2Effect
-{
-	public ConfuseMob(Env env, EffectTemplate template)
-	{
-		super(env, template);
-	}
-	
-	@Override
-	public L2EffectType getEffectType()
-	{
-		return L2EffectType.CONFUSE_MOB_ONLY;
-	}
-	
-	@Override
-	public boolean onStart()
-	{
-		getEffected().startConfused();
-		return true;
-	}
-	
-	@Override
-	public void onExit()
-	{
-		getEffected().stopConfused(this);
-	}
-	
-	@Override
-	public boolean onActionTime()
-	{
-		final List<L2Character> targetList = new ArrayList<>();
-		// Getting the possible targets
-		for (L2Object obj : getEffected().getKnownList().getKnownObjects().values())
-		{
-			if (obj.isL2Attackable() && (obj != getEffected()))
-			{
-				targetList.add((L2Character) obj);
-			}
-		}
-		// if there is no target, exit function
-		if (!targetList.isEmpty())
-		{
-			// Choosing randomly a new target
-			final L2Character target = targetList.get(Rnd.nextInt(targetList.size()));
-			// Attacking the target
-			getEffected().setTarget(target);
-			getEffected().getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target);
-		}
-		return false;
-	}
-	
-	@Override
-	public int getEffectFlags()
-	{
-		return EffectFlag.CONFUSED.getMask();
-	}
-}

+ 7 - 3
L2J_DataPack_BETA/dist/game/data/scripts/handlers/effecthandlers/Confusion.java

@@ -21,6 +21,7 @@ package handlers.effecthandlers;
 import java.util.ArrayList;
 import java.util.List;
 
+import com.l2jserver.gameserver.ai.CtrlEvent;
 import com.l2jserver.gameserver.ai.CtrlIntention;
 import com.l2jserver.gameserver.model.L2Object;
 import com.l2jserver.gameserver.model.actor.L2Character;
@@ -45,7 +46,7 @@ public class Confusion extends L2Effect
 	@Override
 	public L2EffectType getEffectType()
 	{
-		return L2EffectType.CONFUSION;
+		return L2EffectType.NONE;
 	}
 	
 	@Override
@@ -58,7 +59,10 @@ public class Confusion extends L2Effect
 	@Override
 	public void onExit()
 	{
-		getEffected().stopConfused(this);
+		if (!getEffected().isPlayer())
+		{
+			getEffected().getAI().notifyEvent(CtrlEvent.EVT_THINK);
+		}
 	}
 	
 	@Override
@@ -68,7 +72,7 @@ public class Confusion extends L2Effect
 		// Getting the possible targets
 		for (L2Object obj : getEffected().getKnownList().getKnownObjects().values())
 		{
-			if ((obj instanceof L2Character) && (obj != getEffected()))
+			if (((getEffected().isMonster() && obj.isL2Attackable()) || (obj instanceof L2Character)) && (obj != getEffected()))
 			{
 				targetList.add((L2Character) obj);
 			}

+ 11 - 1
L2J_DataPack_BETA/dist/game/data/scripts/handlers/effecthandlers/FakeDeath.java

@@ -23,8 +23,11 @@ import com.l2jserver.gameserver.model.effects.L2Effect;
 import com.l2jserver.gameserver.model.effects.L2EffectType;
 import com.l2jserver.gameserver.model.stats.Env;
 import com.l2jserver.gameserver.network.SystemMessageId;
+import com.l2jserver.gameserver.network.serverpackets.ChangeWaitType;
+import com.l2jserver.gameserver.network.serverpackets.Revive;
 
 /**
+ * Fake Death effect.
  * @author mkizub
  */
 public class FakeDeath extends L2Effect
@@ -50,7 +53,14 @@ public class FakeDeath extends L2Effect
 	@Override
 	public void onExit()
 	{
-		getEffected().stopFakeDeath(false);
+		if (getEffected().isPlayer())
+		{
+			getEffected().getActingPlayer().setIsFakeDeath(false);
+			getEffected().getActingPlayer().setRecentFakeDeath(true);
+		}
+		
+		getEffected().broadcastPacket(new ChangeWaitType(getEffected(), ChangeWaitType.WT_STOP_FAKEDEATH));
+		getEffected().broadcastPacket(new Revive(getEffected()));
 	}
 	
 	@Override

+ 5 - 2
L2J_DataPack_BETA/dist/game/data/scripts/handlers/effecthandlers/Paralyze.java

@@ -18,6 +18,7 @@
  */
 package handlers.effecthandlers;
 
+import com.l2jserver.gameserver.ai.CtrlEvent;
 import com.l2jserver.gameserver.ai.CtrlIntention;
 import com.l2jserver.gameserver.model.effects.AbnormalEffect;
 import com.l2jserver.gameserver.model.effects.EffectFlag;
@@ -64,8 +65,10 @@ public class Paralyze extends L2Effect
 	public void onExit()
 	{
 		getEffected().stopAbnormalEffect(AbnormalEffect.HOLD_1);
-		getEffected().stopParalyze(false);
-		super.onExit();
+		if (!getEffected().isPlayer())
+		{
+			getEffected().getAI().notifyEvent(CtrlEvent.EVT_THINK);
+		}
 	}
 	
 	@Override

+ 5 - 2
L2J_DataPack_BETA/dist/game/data/scripts/handlers/effecthandlers/Petrification.java

@@ -18,6 +18,7 @@
  */
 package handlers.effecthandlers;
 
+import com.l2jserver.gameserver.ai.CtrlEvent;
 import com.l2jserver.gameserver.model.effects.AbnormalEffect;
 import com.l2jserver.gameserver.model.effects.EffectFlag;
 import com.l2jserver.gameserver.model.effects.EffectTemplate;
@@ -50,8 +51,10 @@ public class Petrification extends L2Effect
 	public void onExit()
 	{
 		getEffected().stopAbnormalEffect(AbnormalEffect.HOLD_2);
-		getEffected().stopParalyze(false);
-		super.onExit();
+		if (!getEffected().isPlayer())
+		{
+			getEffected().getAI().notifyEvent(CtrlEvent.EVT_THINK);
+		}
 	}
 	
 	@Override

+ 0 - 6
L2J_DataPack_BETA/dist/game/data/scripts/handlers/effecthandlers/Relax.java

@@ -53,12 +53,6 @@ public class Relax extends L2Effect
 		return super.onStart();
 	}
 	
-	@Override
-	public void onExit()
-	{
-		super.onExit();
-	}
-	
 	@Override
 	public boolean onActionTime()
 	{

+ 0 - 14
L2J_DataPack_BETA/dist/game/data/scripts/handlers/effecthandlers/SilentMove.java

@@ -45,19 +45,6 @@ public class SilentMove extends L2Effect
 		return true;
 	}
 	
-	@Override
-	public boolean onStart()
-	{
-		super.onStart();
-		return true;
-	}
-	
-	@Override
-	public void onExit()
-	{
-		super.onExit();
-	}
-	
 	@Override
 	public L2EffectType getEffectType()
 	{
@@ -79,7 +66,6 @@ public class SilentMove extends L2Effect
 		}
 		
 		double manaDam = calc();
-		
 		if (manaDam > getEffected().getCurrentMp())
 		{
 			getEffected().sendPacket(SystemMessageId.SKILL_REMOVED_DUE_LACK_MP);

+ 1 - 1
L2J_DataPack_BETA/dist/game/data/stats/skills/01100-01199.xml

@@ -942,7 +942,7 @@
 		<set name="skillType" val="CONFUSE_MOB_ONLY" />
 		<set name="targetType" val="ONE" />
 		<for>
-			<effect count="5" name="ConfuseMob" val="0" />
+			<effect count="5" name="Confusion" val="0" />
 		</for>
 	</skill>
 	<skill id="1164" levels="19" name="Curse: Weakness" enchantGroup1="1" enchantGroup2="1" enchantGroup3="1" enchantGroup4="1">

+ 1 - 1
L2J_DataPack_BETA/dist/game/data/stats/skills/03500-03599.xml

@@ -884,7 +884,7 @@
 		<set name="skillType" val="CONFUSE_MOB_ONLY" />
 		<set name="targetType" val="ONE" />
 		<for>
-			<effect count="5" name="ConfuseMob" val="0" />
+			<effect count="5" name="Confusion" val="0" />
 		</for>
 	</skill>
 	<skill id="3582" levels="1" name="Special Ability: Infinity Cleaver">