Browse Source

BETA: Minor fixes:
* Fixed NPE vulnerability in Anais.
* Reported by: d!g0
* Suggested by: jurchiks
* Reworking Servitor Share effect since [9663] fixed nothing.
* Fixing stack over flow.
* Reported by: UnAfraid, nBd
* Reviewed by: UnAfraid
* Changes related to [L5965].
* Summon target handler update.
* Pet target handler update.
* Implemented Servitor target handler.
* Pailaka - Song Of Ice And Fire AI enhancement.
* Adding missing NPC string on first see creature event.
Reported by: Gladicek

Zoey76 12 years ago
parent
commit
332dae80dd

+ 8 - 8
L2J_DataPack_BETA/.classpath

@@ -1,10 +1,10 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <classpath>
-	<classpathentry including="**/*.java" kind="src" path="dist/game/data/scripts" />
-	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER" />
-	<classpathentry combineaccessrules="false" kind="src" path="/L2J_Server_BETA" />
-	<classpathentry kind="lib" path="/L2J_Server_BETA/dist/libs/javolution-5.5.1.jar" />
-	<classpathentry kind="lib" path="/L2J_Server_BETA/dist/libs/mmocore.jar" />
-	<classpathentry kind="lib" path="/L2J_Server_BETA/dist/libs/netcon-1.7.jar" />
-	<classpathentry kind="output" path="bin" />
-</classpath>
+	<classpathentry including="**/*.java" kind="src" path="dist/game/data/scripts"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+	<classpathentry combineaccessrules="false" kind="src" path="/L2J_Server_BETA3"/>
+	<classpathentry kind="lib" path="/L2J_Server_BETA3/dist/libs/javolution-5.5.1.jar" sourcepath="/L2J_Server_BETA3/dist/libs/javolution-5.5.1-src.zip"/>
+	<classpathentry kind="lib" path="/L2J_Server_BETA3/dist/libs/mmocore.jar"/>
+	<classpathentry kind="lib" path="/L2J_Server_BETA3/dist/libs/netcon-1.7.jar"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>

+ 1 - 0
L2J_DataPack_BETA/dist/game/data/scripts/ai/individual/Anais.java

@@ -174,6 +174,7 @@ public final class Anais extends AbstractNpcAI
 	{
 		npc.doCast(DIVINE_NOVA.getSkill());
 		cancelQuestTimer("GUARD_ATTACK", npc, _nextTarget);
+		cancelQuestTimer("CHECK", npc, null);
 		if (_current != null)
 		{
 			_current.setDisplayEffect(2);

+ 1 - 1
L2J_DataPack_BETA/dist/game/data/scripts/events/GiftOfVitality/GiftOfVitality.java

@@ -117,7 +117,7 @@ public class GiftOfVitality extends LongTimeEvent
 			{
 				htmltext = "4306-nolevel.htm";
 			}
-			else if (!player.hasSummon() || !player.getSummon().isServitor())
+			else if (!player.hasServitor())
 			{
 				htmltext = "4306-nosummon.htm";
 			}

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

@@ -265,6 +265,7 @@ import handlers.targethandlers.PartyNotMe;
 import handlers.targethandlers.PartyOther;
 import handlers.targethandlers.Pet;
 import handlers.targethandlers.Self;
+import handlers.targethandlers.Servitor;
 import handlers.targethandlers.Summon;
 import handlers.targethandlers.Unlockable;
 import handlers.telnethandlers.ChatsHandler;
@@ -609,6 +610,7 @@ public class MasterHandler
 			PartyOther.class,
 			Pet.class,
 			Self.class,
+			Servitor.class,
 			Summon.class,
 			Unlockable.class,
 		},

+ 1 - 1
L2J_DataPack_BETA/dist/game/data/scripts/handlers/bypasshandlers/SupportMagic.java

@@ -99,7 +99,7 @@ public class SupportMagic implements IBypassHandler
 	private static void makeSupportMagic(L2PcInstance player, L2Npc npc, boolean isSummon)
 	{
 		final int level = player.getLevel();
-		if (isSummon && (!player.hasSummon() || !player.getSummon().isServitor()))
+		if (isSummon && !player.hasServitor())
 		{
 			npc.showChatWindow(player, "data/html/default/SupportMagicNoSummon.htm");
 			return;

+ 22 - 29
L2J_DataPack_BETA/dist/game/data/scripts/handlers/effecthandlers/ServitorShare.java

@@ -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();
 	}
 }

+ 3 - 3
L2J_DataPack_BETA/dist/game/data/scripts/handlers/targethandlers/Pet.java

@@ -25,6 +25,7 @@ import com.l2jserver.gameserver.model.skills.L2Skill;
 import com.l2jserver.gameserver.model.skills.targets.L2TargetType;
 
 /**
+ * Target Pet handler.
  * @author UnAfraid
  */
 public class Pet implements ITargetTypeHandler
@@ -32,12 +33,11 @@ public class Pet implements ITargetTypeHandler
 	@Override
 	public L2Object[] getTargetList(L2Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target)
 	{
-		target = activeChar.getSummon();
-		if ((target != null) && !target.isDead())
+		if (activeChar.hasPet())
 		{
 			return new L2Character[]
 			{
-				target
+				activeChar.getSummon()
 			};
 		}
 		return EMPTY_TARGET_LIST;

+ 51 - 0
L2J_DataPack_BETA/dist/game/data/scripts/handlers/targethandlers/Servitor.java

@@ -0,0 +1,51 @@
+/*
+ * 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.targethandlers;
+
+import com.l2jserver.gameserver.handler.ITargetTypeHandler;
+import com.l2jserver.gameserver.model.L2Object;
+import com.l2jserver.gameserver.model.actor.L2Character;
+import com.l2jserver.gameserver.model.skills.L2Skill;
+import com.l2jserver.gameserver.model.skills.targets.L2TargetType;
+
+/**
+ * Target Servitor handler.
+ * @author Zoey76
+ */
+public class Servitor implements ITargetTypeHandler
+{
+	@Override
+	public L2Object[] getTargetList(L2Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target)
+	{
+		if (activeChar.hasServitor())
+		{
+			return new L2Character[]
+			{
+				activeChar.getSummon()
+			};
+		}
+		return EMPTY_TARGET_LIST;
+	}
+	
+	@Override
+	public Enum<L2TargetType> getTargetType()
+	{
+		return L2TargetType.SERVITOR;
+	}
+}

+ 3 - 3
L2J_DataPack_BETA/dist/game/data/scripts/handlers/targethandlers/Summon.java

@@ -25,6 +25,7 @@ import com.l2jserver.gameserver.model.skills.L2Skill;
 import com.l2jserver.gameserver.model.skills.targets.L2TargetType;
 
 /**
+ * Target Summon handler.
  * @author UnAfraid
  */
 public class Summon implements ITargetTypeHandler
@@ -32,12 +33,11 @@ public class Summon implements ITargetTypeHandler
 	@Override
 	public L2Object[] getTargetList(L2Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target)
 	{
-		target = activeChar.getSummon();
-		if ((target != null) && !target.isDead() && target.isServitor())
+		if (activeChar.hasSummon())
 		{
 			return new L2Character[]
 			{
-				target
+				activeChar.getSummon()
 			};
 		}
 		return EMPTY_TARGET_LIST;

+ 23 - 0
L2J_DataPack_BETA/dist/game/data/scripts/instances/Pailaka/PailakaSongOfIceAndFire.java

@@ -31,7 +31,11 @@ import com.l2jserver.gameserver.model.quest.Quest;
 import com.l2jserver.gameserver.model.quest.QuestState;
 import com.l2jserver.gameserver.model.quest.State;
 import com.l2jserver.gameserver.model.zone.L2ZoneType;
+import com.l2jserver.gameserver.network.NpcStringId;
 import com.l2jserver.gameserver.network.SystemMessageId;
+import com.l2jserver.gameserver.network.clientpackets.Say2;
+import com.l2jserver.gameserver.network.serverpackets.NpcSay;
+import com.l2jserver.gameserver.util.Broadcast;
 
 /**
  * Pailaka (Forgotten Temple) instance zone.
@@ -186,6 +190,8 @@ public class PailakaSongOfIceAndFire extends Quest
 		13293,
 		13129
 	};
+	/** Flag for "see creature". */
+	private boolean _seenCreature = false;
 	
 	private static final void dropHerb(L2Npc mob, L2PcInstance player, int[][] drop)
 	{
@@ -326,6 +332,11 @@ public class PailakaSongOfIceAndFire extends Quest
 					}
 				}
 				break;
+			case "GARGOS_LAUGH":
+			{
+				Broadcast.toKnownPlayers(npc, new NpcSay(npc.getObjectId(), Say2.NPC_SHOUT, npc.getTemplate().getIdTemplate(), NpcStringId.OHHOHOH));
+				break;
+			}
 		}
 		return event;
 	}
@@ -506,6 +517,17 @@ public class PailakaSongOfIceAndFire extends Quest
 		return super.onExitZone(character, zone);
 	}
 	
+	@Override
+	public String onSeeCreature(L2Npc npc, L2Character creature, boolean isSummon)
+	{
+		if (!_seenCreature && creature.isPlayer())
+		{
+			_seenCreature = true;
+			startQuestTimer("GARGOS_LAUGH", 1000, npc, creature.getActingPlayer());
+		}
+		return super.onSeeCreature(npc, creature, isSummon);
+	}
+	
 	static final class Teleport implements Runnable
 	{
 		private final L2Character _char;
@@ -540,6 +562,7 @@ public class PailakaSongOfIceAndFire extends Quest
 		addAttackId(BOTTLE, BRAZIER);
 		addKillId(MONSTERS);
 		addExitZoneId(ZONE);
+		addSeeCreatureId(GARGOS);
 		registerQuestItems(ITEMS);
 	}
 	

+ 3 - 3
L2J_DataPack_BETA/dist/game/data/stats/skills/00800-00899.xml

@@ -371,7 +371,7 @@
 		<set name="mpConsume" val="#mpConsume" />
 		<set name="operateType" val="A1" />
 		<set name="reuseDelay" val="2000" />
-		<set name="targetType" val="SUMMON" />
+		<set name="targetType" val="SERVITOR" />
 		<!-- FIXME: It shouldn't affect all summons, missing condition for target race "construct" -->
 		<for>
 			<effect name="HealPercent" noicon="1" val="#amount" />
@@ -397,7 +397,7 @@
 		<set name="operateType" val="A2" />
 		<set name="reuseDelay" val="2000" />
 		<set name="skillType" val="BUFF" />
-		<set name="targetType" val="SUMMON" />
+		<set name="targetType" val="SERVITOR" />
 		<!-- FIXME: It shouldn't affect all summons, missing condition for target race "construct" -->
 		<for>
 			<effect name="Buff" val="0">
@@ -426,7 +426,7 @@
 		<set name="operateType" val="A2" />
 		<set name="reuseDelay" val="2000" />
 		<set name="skillType" val="BUFF" />
-		<set name="targetType" val="SUMMON" />
+		<set name="targetType" val="SERVITOR" />
 		<!-- FIXME: It shouldn't affect all summons, missing condition for target race "construct" -->
 		<for>
 			<effect name="Buff" val="0">

+ 1 - 1
L2J_DataPack_BETA/dist/game/data/stats/skills/01500-01599.xml

@@ -1581,7 +1581,7 @@
 		<set name="operateType" val="A2" />
 		<set name="reuseDelay" val="60000" />
 		<set name="skillType" val="BUFF" />
-		<set name="targetType" val="PET" />
+		<set name="targetType" val="SERVITOR" />
 		<for>
 			<!-- Note: 0.5 means 50% of owner's patk! -->
 			<effect self="1" name="ServitorShare" val="0" /> <!-- This effect is used to cancel pet's effect when player's have been canceled. -->

+ 1 - 1
L2J_DataPack_BETA/dist/game/data/stats/skills/05500-05599.xml

@@ -1131,7 +1131,7 @@
 		<set name="isTriggeredSkill" val="true" />
 		<set name="magicLvl" val="81" />
 		<set name="operateType" val="A1" />
-		<set name="targetType" val="SUMMON" />
+		<set name="targetType" val="SERVITOR" />
 		<for>
 			<effect name="Heal" noicon="1" val="418" />
 			<effect name="ManaHealByLevel" noicon="1" val="73" />