Bladeren bron

BETA: Improved quests '''Land Dragon Conqueror''' and '''Fire Dragon Destroyer'''.

Patch by: 
	Adry_85
	jurchiks 
	!UnAfraid
Review by: 
	Adry_85
	nonom
	!UnAfraid
Tested by:
	Adry85
	!UnAfraid
Adry_85 12 jaren geleden
bovenliggende
commit
a93acc405f
26 gewijzigde bestanden met toevoegingen van 231 en 189 verwijderingen
  1. 5 0
      L2J_DataPack_BETA/dist/game/data/scripts/quests/Q10290_LandDragonConqueror/30755-00.htm
  2. 5 4
      L2J_DataPack_BETA/dist/game/data/scripts/quests/Q10290_LandDragonConqueror/30755-01.htm
  3. 5 4
      L2J_DataPack_BETA/dist/game/data/scripts/quests/Q10290_LandDragonConqueror/30755-02.htm
  4. 7 0
      L2J_DataPack_BETA/dist/game/data/scripts/quests/Q10290_LandDragonConqueror/30755-03.html
  5. 5 3
      L2J_DataPack_BETA/dist/game/data/scripts/quests/Q10290_LandDragonConqueror/30755-04.htm
  6. 6 6
      L2J_DataPack_BETA/dist/game/data/scripts/quests/Q10290_LandDragonConqueror/30755-05.htm
  7. 0 5
      L2J_DataPack_BETA/dist/game/data/scripts/quests/Q10290_LandDragonConqueror/30755-06.htm
  8. 3 2
      L2J_DataPack_BETA/dist/game/data/scripts/quests/Q10290_LandDragonConqueror/30755-06.html
  9. 0 5
      L2J_DataPack_BETA/dist/game/data/scripts/quests/Q10290_LandDragonConqueror/30755-07.htm
  10. 3 2
      L2J_DataPack_BETA/dist/game/data/scripts/quests/Q10290_LandDragonConqueror/30755-07.html
  11. 3 2
      L2J_DataPack_BETA/dist/game/data/scripts/quests/Q10290_LandDragonConqueror/30755-08.html
  12. 3 2
      L2J_DataPack_BETA/dist/game/data/scripts/quests/Q10290_LandDragonConqueror/30755-09.html
  13. 74 61
      L2J_DataPack_BETA/dist/game/data/scripts/quests/Q10290_LandDragonConqueror/Q10290_LandDragonConqueror.java
  14. 5 0
      L2J_DataPack_BETA/dist/game/data/scripts/quests/Q10291_FireDragonDestroyer/31540-00.htm
  15. 4 6
      L2J_DataPack_BETA/dist/game/data/scripts/quests/Q10291_FireDragonDestroyer/31540-01.htm
  16. 7 4
      L2J_DataPack_BETA/dist/game/data/scripts/quests/Q10291_FireDragonDestroyer/31540-02.htm
  17. 7 0
      L2J_DataPack_BETA/dist/game/data/scripts/quests/Q10291_FireDragonDestroyer/31540-03.html
  18. 6 3
      L2J_DataPack_BETA/dist/game/data/scripts/quests/Q10291_FireDragonDestroyer/31540-04.htm
  19. 5 6
      L2J_DataPack_BETA/dist/game/data/scripts/quests/Q10291_FireDragonDestroyer/31540-05.htm
  20. 0 5
      L2J_DataPack_BETA/dist/game/data/scripts/quests/Q10291_FireDragonDestroyer/31540-06.htm
  21. 3 2
      L2J_DataPack_BETA/dist/game/data/scripts/quests/Q10291_FireDragonDestroyer/31540-06.html
  22. 0 4
      L2J_DataPack_BETA/dist/game/data/scripts/quests/Q10291_FireDragonDestroyer/31540-07.htm
  23. 3 2
      L2J_DataPack_BETA/dist/game/data/scripts/quests/Q10291_FireDragonDestroyer/31540-07.html
  24. 3 2
      L2J_DataPack_BETA/dist/game/data/scripts/quests/Q10291_FireDragonDestroyer/31540-08.html
  25. 3 2
      L2J_DataPack_BETA/dist/game/data/scripts/quests/Q10291_FireDragonDestroyer/31540-09.html
  26. 66 57
      L2J_DataPack_BETA/dist/game/data/scripts/quests/Q10291_FireDragonDestroyer/Q10291_FireDragonDestroyer.java

+ 5 - 0
L2J_DataPack_BETA/dist/game/data/scripts/quests/Q10290_LandDragonConqueror/30755-00.htm

@@ -0,0 +1,5 @@
+<html><body>
+Antharas Watchman Theodric:<br>
+You underestimate the power of Antharas. You simply do not have the skill required in order to take on this task.<br>
+(Only characters at level 83 or above can undertake this quest.)
+</body></html>

+ 5 - 4
L2J_DataPack_BETA/dist/game/data/scripts/quests/Q10290_LandDragonConqueror/30755-01.htm

@@ -1,4 +1,5 @@
-<html><body>Antharas Watchman Theodric:<br>
-Ah, I see that you have a <font color="LEVEL">Portal Stone</font> in your possession. It appears as though you may be one of the few chosen to handle this task.<br>
-<a action="bypass -h Quest Q10290_LandDragonConqueror 30755-05.htm">Continue listening.</a>
-</body></html>
+<html><body>
+Antharas Watchman Theodric:<br>
+You do not have the <font color="LEVEL">Portal Stone</font> which means you haven't satisfied the minimum requirements for this mission.<br>
+So if you really want to face Antharas, you need to be recognized by <font color="LEVEL">Gabriel</font> in Giran village.
+</body></html>

+ 5 - 4
L2J_DataPack_BETA/dist/game/data/scripts/quests/Q10290_LandDragonConqueror/30755-02.htm

@@ -1,4 +1,5 @@
-<html><body>Antharas Watchman Theodric:<br>
-You underestimate the power of Antharas. You simply do not have the skill required in order to take on this task.<br>
-(Only characters at level 83 or above can undertake this quest.)
-</body></html>
+<html><body>
+Antharas Watchman Theodric:<br>
+Ah, I see that you have a <font color="LEVEL">Portal Stone</font> in your possession. It appears as though you may be one of the few chosen to handle this task.<br>
+<a action="bypass -h Quest Q10290_LandDragonConqueror 30755-03.html">Continue listening.</a>
+</body></html>

+ 7 - 0
L2J_DataPack_BETA/dist/game/data/scripts/quests/Q10290_LandDragonConqueror/30755-03.html

@@ -0,0 +1,7 @@
+<html><body>
+Antharas Watchman Theodric:<br>
+I am a Watcher which brings the curse of immortality. My purpose in life is to watch over the earth dragon, Antharas. I can only assume that you and your comrades are here to slay the dragon.<br>
+I wish to give you some words of wisdom before you venture into this cave...<br>
+You will die.<br>
+<a action="bypass -h Quest Q10290_LandDragonConqueror 30755-04.htm">Words of wisdom, huh?</a>
+</body></html>

+ 5 - 3
L2J_DataPack_BETA/dist/game/data/scripts/quests/Q10290_LandDragonConqueror/30755-04.htm

@@ -1,4 +1,6 @@
-<html><body>Antharas Watchman Theodric:<br>
-You do not have the <font color="LEVEL">Portal Stone</font> which means you haven't satisfied the minimum requirements for this mission.<br>
-So if you really want to face Antharas, you need to be recognized by <font color="LEVEL">Gabriel</font> in Giran village.
+<html><body>
+Antharas Watchman Theodric:<br>
+Yes, Antharas can never really be killed... not yet anyway. You may have heard stories from other adventurers how they have killed him again and again. Each time he is killed, he resurrects even more powerful. I fear that the greed of adventurers has caused Antharas to become overwhelmingly powerful.<br>
+You will need an army to follow you if you have any hope of defeating Antharas now.<br>
+<a action="bypass -h Quest Q10290_LandDragonConqueror 30755-05.htm">Accept the mission.</a>
 </body></html>

+ 6 - 6
L2J_DataPack_BETA/dist/game/data/scripts/quests/Q10290_LandDragonConqueror/30755-05.htm

@@ -1,6 +1,6 @@
-<html><body>Antharas Watchman Theodric:<br>
-I am a Watcher which brings the curse of immortality. My purpose in life is to watch over the earth dragon, Antharas. I can only assume that you and your comrades are here to slay the dragon.<br>
-I wish to give you some words of wisdom before you venture into this cave... <br>
-You will die.<br>
-<a action="bypass -h Quest Q10290_LandDragonConqueror 30755-06.htm">Words of wisdom, huh?</a>
-</body></html>
+<html><body>
+Antharas Watchman Theodric:<br>
+Take this <font color="LEVEL">Shabby Necklace</font>. If you manage to strike Antharas down part of its energy will be contained in this necklace preventing it from growing any more powerful. If successful, the necklace will transform. Bring me the transformed necklace as proof of successfully stopping Antharas.<br>
+Remember, <font color="LEVEL">Antharas is even more powerful than before. It will take more effort to kill it now.</font><br>
+As always I will be watching...
+</body></html>

+ 0 - 5
L2J_DataPack_BETA/dist/game/data/scripts/quests/Q10290_LandDragonConqueror/30755-06.htm

@@ -1,5 +0,0 @@
-<html><body>Antharas Watchman Theodric:<br>
-Yes, Antharas can never really be killed... not yet anyway. You may have heard stories from other adventurers how they have killed him again and again. Each time he is killed, he resurrects even more powerful. I fear that the greed of adventurers has caused Antharas to become overwhelmingly powerful.<br>
-You will need an army to follow you if you have any hope of defeating Antharas now.<br>
-<a action="bypass -h Quest Q10290_LandDragonConqueror 30755-07.htm">Accept the mission.</a>
-</body></html>

+ 3 - 2
L2J_DataPack_BETA/dist/game/data/scripts/quests/Q10290_LandDragonConqueror/30755-08.htm → L2J_DataPack_BETA/dist/game/data/scripts/quests/Q10290_LandDragonConqueror/30755-06.html

@@ -1,4 +1,5 @@
-<html><body>Antharas Watchman Theodric:<br>
+<html><body>
+Antharas Watchman Theodric:<br>
 The necklace you possess is still just a <font color="LEVEL">Shabby Necklace</font> and contains no energy from Antharas. Speak to me again when this necklace has been transformed.<br>
 As always I will be watching...
-</body></html>
+</body></html>

+ 0 - 5
L2J_DataPack_BETA/dist/game/data/scripts/quests/Q10290_LandDragonConqueror/30755-07.htm

@@ -1,5 +0,0 @@
-<html><body>Antharas Watchman Theodric:<br>
-Take this <font color="LEVEL">Shabby Necklace</font>. If you manage to strike Antharas down part of its energy will be contained in this necklace preventing it from growing any more powerful. If successful, the necklace will transform. Bring me the transformed necklace as proof of successfully stopping Antharas.<br>
-Remember, <font color="LEVEL">Antharas is even more powerful than before. It will take more effort to kill it now.</font><br>
-As always I will be watching...
-</body></html>

+ 3 - 2
L2J_DataPack_BETA/dist/game/data/scripts/quests/Q10290_LandDragonConqueror/30755-09.htm → L2J_DataPack_BETA/dist/game/data/scripts/quests/Q10290_LandDragonConqueror/30755-07.html

@@ -1,3 +1,4 @@
-<html><body>Antharas Watchman Theodric:<br>
+<html><body>
+Antharas Watchman Theodric:<br>
 Why have you discarded the Shabby Necklace? Do you think everyone would believe that you defeated Antharas if you told the world? Here is another necklace. Try not to loose it. Only it can prove that you have defeated Antharas.
-</body></html>
+</body></html>

+ 3 - 2
L2J_DataPack_BETA/dist/game/data/scripts/quests/Q10290_LandDragonConqueror/30755-10.htm → L2J_DataPack_BETA/dist/game/data/scripts/quests/Q10290_LandDragonConqueror/30755-08.html

@@ -1,5 +1,6 @@
-<html><body>Antharas Watchman Theodric:<br>
+<html><body>
+Antharas Watchman Theodric:<br>
 And so it is done. Antharas has been stopped and his return prevented.<br>
 I have something for you... something that I rarely am allowed to give. The <font color="LEVEL">Antharas Slayer Circlet</font> is yours.<br>
 What now? I stay, I wait, and I watch. Antharas can never truly be killed. I can only hope that brave warriors such as you come to help and stop Antharas whenever it attempts to return.
-</body></html>
+</body></html>

+ 3 - 2
L2J_DataPack_BETA/dist/game/data/scripts/quests/Q10290_LandDragonConqueror/30755-03.htm → L2J_DataPack_BETA/dist/game/data/scripts/quests/Q10290_LandDragonConqueror/30755-09.html

@@ -1,4 +1,5 @@
-<html><body>Antharas Watchman Theodric:<br>
+<html><body>
+Antharas Watchman Theodric:<br>
 If I could only give more to those who wish to take on this task... Unfortunately I have nothing more to give. Be pleased with the fact that you are one of the few who went on to take on Antharas and lived to tell the tale.<br>
 (You have already completed this quest.)
-</body></html>
+</body></html>

+ 74 - 61
L2J_DataPack_BETA/dist/game/data/scripts/quests/Q10290_LandDragonConqueror/Q10290_LandDragonConqueror.java

@@ -14,11 +14,13 @@
  */
 package quests.Q10290_LandDragonConqueror;
 
+import com.l2jserver.gameserver.model.IL2Procedure;
 import com.l2jserver.gameserver.model.actor.L2Npc;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 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.util.Util;
 
 /**
  * Land Dragon Conqueror (10290)
@@ -27,39 +29,38 @@ import com.l2jserver.gameserver.model.quest.State;
 public class Q10290_LandDragonConqueror extends Quest
 {
 	// NPC
-	private static final int Theodoric = 30755;
-	// Old, Weak, Normal, Strong
-	private static final int[] Antharas =
-	{
-		29019,
-		29066,
-		29067,
-		29068
-	};
-	// Item
-	private static final int PortalStone = 3865;
-	private static final int ShabbyNecklace = 15522;
-	private static final int MiracleNecklace = 15523;
-	private static final int AntharaSlayerCirclet = 8568;
+	private static final int THEODRIC = 30755;
+	
+	// @formatter:off
+            private static final int[] ANTHARAS =
+            {
+                    // Old, Weak, Normal, Strong
+                    29019, 29066, 29067, 29068
+            };
+            //@formatter:on
+	
+	// Items
+	private static final int PORTAL_STONE = 3865;
+	private static final int SHABBY_NECKLACE = 15522;
+	private static final int MIRACLE_NECKLACE = 15523;
+	private static final int ANTHARAS_SLAYER_CIRCLET = 8568;
 	
 	@Override
 	public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
 	{
-		String htmltext = event;
 		final QuestState st = player.getQuestState(getName());
 		if (st == null)
 		{
-			return htmltext;
+			return getNoQuestMsg(player);
 		}
 		
-		if (event.equalsIgnoreCase("30755-07.htm"))
+		if (event.equals("30755-05.htm"))
 		{
-			st.setState(State.STARTED);
-			st.set("cond", "1");
-			st.giveItems(ShabbyNecklace, 1);
-			st.playSound("ItemSound.quest_accept");
+			st.startQuest();
+			st.giveItems(SHABBY_NECKLACE, 1);
 		}
-		return htmltext;
+		
+		return event;
 	}
 	
 	@Override
@@ -67,6 +68,7 @@ public class Q10290_LandDragonConqueror extends Quest
 	{
 		String htmltext = getNoQuestMsg(player);
 		final QuestState st = player.getQuestState(getName());
+		
 		if (st == null)
 		{
 			return htmltext;
@@ -78,48 +80,42 @@ public class Q10290_LandDragonConqueror extends Quest
 			{
 				if (player.getLevel() < 83)
 				{
-					htmltext = "30755-02.htm";
-				}
-				else if (st.hasQuestItems(PortalStone))
-				{
-					htmltext = "30755-01.htm";
+					htmltext = "30755-00.htm";
 				}
 				else
 				{
-					htmltext = "30755-04.htm";
+					htmltext = st.hasQuestItems(PORTAL_STONE) ? "30755-02.htm" : "30755-01.htm";
 				}
 				break;
 			}
 			case State.STARTED:
 			{
-				final int cond = st.getInt("cond");
+				final int cond = st.getCond();
 				if (cond == 1)
 				{
-					if (st.hasQuestItems(ShabbyNecklace))
+					if (st.hasQuestItems(SHABBY_NECKLACE))
 					{
-						htmltext = "30755-08.htm";
+						htmltext = "30755-06.html";
 					}
 					else
 					{
-						st.giveItems(ShabbyNecklace, 1);
-						htmltext = "30755-09.htm";
+						st.giveItems(SHABBY_NECKLACE, 1);
+						htmltext = "30755-07.html";
 					}
 				}
-				else if (cond == 2)
+				else if ((cond == 2) && st.hasQuestItems(MIRACLE_NECKLACE))
 				{
-					st.takeItems(MiracleNecklace, 1);
+					htmltext = "30755-08.html";
 					st.giveAdena(131236, true);
 					st.addExpAndSp(702557, 76334);
-					st.giveItems(AntharaSlayerCirclet, 1);
-					st.playSound("ItemSound.quest_finish");
-					st.exitQuest(false);
-					htmltext = "30755-10.htm";
+					st.giveItems(ANTHARAS_SLAYER_CIRCLET, 1);
+					st.exitQuest(false, true);
 				}
 				break;
 			}
 			case State.COMPLETED:
 			{
-				htmltext = "30755-03.htm";
+				htmltext = "30755-09.html";
 				break;
 			}
 		}
@@ -130,44 +126,61 @@ public class Q10290_LandDragonConqueror extends Quest
 	@Override
 	public String onKill(L2Npc npc, L2PcInstance player, boolean isPet)
 	{
-		if (player.getParty() != null)
+		if (!player.isInParty())
 		{
-			for (L2PcInstance partyMember : player.getParty().getMembers())
-			{
-				rewardPlayer(partyMember);
-			}
+			return super.onKill(npc, player, isPet);
+		}
+		
+		// rewards go only to command channel, not to a single party or player (retail Freya AI)
+		if (player.getParty().isInCommandChannel())
+		{
+			player.getParty().getCommandChannel().forEachMember(new RewardCheck(npc));
 		}
 		else
 		{
-			rewardPlayer(player);
+			player.getParty().forEachMember(new RewardCheck(npc));
 		}
-		return null;
+		
+		return super.onKill(npc, player, isPet);
 	}
 	
-	private void rewardPlayer(L2PcInstance player)
+	public class RewardCheck implements IL2Procedure<L2PcInstance>
 	{
-		final QuestState st = player.getQuestState(getName());
-		if ((st != null) && (st.getInt("cond") == 1))
+		private final L2Npc _npc;
+		
+		public RewardCheck(L2Npc npc)
 		{
-			st.takeItems(ShabbyNecklace, 1);
-			st.giveItems(MiracleNecklace, 1);
-			st.playSound("ItemSound.quest_middle");
-			st.set("cond", "2");
+			_npc = npc;
+		}
+		
+		@Override
+		public boolean execute(L2PcInstance member)
+		{
+			if (Util.checkIfInRange(8000, _npc, member, false))
+			{
+				QuestState st = member.getQuestState(getName());
+				
+				if ((st != null) && st.isCond(1) && st.hasQuestItems(SHABBY_NECKLACE))
+				{
+					st.takeItems(SHABBY_NECKLACE, -1);
+					st.giveItems(MIRACLE_NECKLACE, 1);
+					st.setCond(2, true);
+				}
+			}
+			return true;
 		}
 	}
 	
 	public Q10290_LandDragonConqueror(int questId, String name, String descr)
 	{
 		super(questId, name, descr);
-		
-		addStartNpc(Theodoric);
-		addTalkId(Theodoric);
-		addKillId(Antharas);
-		
+		addStartNpc(THEODRIC);
+		addTalkId(THEODRIC);
+		addKillId(ANTHARAS);
 		questItemIds = new int[]
 		{
-			MiracleNecklace,
-			ShabbyNecklace
+			MIRACLE_NECKLACE,
+			SHABBY_NECKLACE
 		};
 	}
 	

+ 5 - 0
L2J_DataPack_BETA/dist/game/data/scripts/quests/Q10291_FireDragonDestroyer/31540-00.htm

@@ -0,0 +1,5 @@
+<html><body>
+Watcher of Valakas Klein:<br>
+Hold on a moment. You must be at least "this" experienced before you can take on the thrill ride that is Valakas.<br>
+(Only characters level 83 or above can take this quest.)
+</body></html>

+ 4 - 6
L2J_DataPack_BETA/dist/game/data/scripts/quests/Q10291_FireDragonDestroyer/31540-01.htm

@@ -1,6 +1,4 @@
-<html><body>Watcher of Valakas Klein:<br>
-Is it hot in here or is it just me? Guess that is what you get when your blood is replaced with pure liquid magma for all eternity.<br>
-By the expression on your face I can tell you are wondering about Valakas, no? Heard the rumor as of late? No? Ah... you are in for a real treat then. It used to be Valakas was somewhat of a push over, no challenge to any adventurer looking for sport.<br>
-Valakas has found a way to channel the energy of the Forge of the Gods and increase his power. Now many adventurers go into his lair only never to return. Now you tell me friend... are you ready to play with fire?<br>
-<a action="bypass -h Quest Q10291_FireDragonDestroyer 31540-05.htm">Accept challenge to defeat Valakas.</a>
-</body></html>
+<html><body>
+Watcher of Valakas Klein:<br>
+Well, I'll give you this kid. You've got the skills to take on the Fire Dragon but you don't have the right tools for the task. If you're serious about fighting against Valakas, first go get a "Vacualite Floating Stone".
+</body></html>

+ 7 - 4
L2J_DataPack_BETA/dist/game/data/scripts/quests/Q10291_FireDragonDestroyer/31540-02.htm

@@ -1,4 +1,7 @@
-<html><body>Watcher of Valakas Klein:<br>
-Hold on a moment. You must be at least "this" experienced before you can take on the thrill ride that is Valakas.<br>
-(Only characters level 83 or above can take this quest.)
-</body></html>
+<html><body>
+Watcher of Valakas Klein:<br>
+Is it hot in here or is it just me? Guess that is what you get when your blood is replaced with pure liquid magma for all eternity.<br>
+By the expression on your face I can tell you are wondering about Valakas, no? Heard the rumor as of late? No? Ah... you are in for a real treat then. It used to be Valakas was somewhat of a push over, no challenge to any adventurer looking for sport.<br>
+Valakas has found a way to channel the energy of the Forge of the Gods and increase his power. Now many adventurers go into his lair only never to return. Now you tell me friend... are you ready to play with fire?<br>
+<a action="bypass -h Quest Q10291_FireDragonDestroyer 31540-03.html">Accept challenge to defeat Valakas.</a>
+</body></html>

+ 7 - 0
L2J_DataPack_BETA/dist/game/data/scripts/quests/Q10291_FireDragonDestroyer/31540-03.html

@@ -0,0 +1,7 @@
+<html><body>
+Watcher of Valakas Klein:<br>
+Ah... so determined I see. Are you sure you are ready to face Valakas? You may wish to reconsider.<br>
+A thought in my mind, years of being stopped by adventurers like you can do horrible things to a dragon's spirit. Imagine all that pure rage combined with his newly found power... one could only hope that Valakas doesn't like to play with his food.<br>
+You aren't the first adventurer I've given this speech to. Last chance. Are you sure you are ready?<br>
+<a action="bypass -h Quest Q10291_FireDragonDestroyer 31540-04.htm">Let's do this!</a>
+</body></html>

+ 6 - 3
L2J_DataPack_BETA/dist/game/data/scripts/quests/Q10291_FireDragonDestroyer/31540-04.htm

@@ -1,3 +1,6 @@
-<html><body>Watcher of Valakas Klein:<br>
-Well, I'll give you this kid. You've got the skills to take on the Fire Dragon but you don't have the right tools for the task. If you're serious about fighting against Valakas, first go get a "Vacualite Floating Stone".
-</body></html>
+<html><body>
+Watcher of Valakas Klein:<br>
+I can see that you are determined despite my warnings. I will not try to stop you any further from your haste to find a quick death.<br>
+However, should you be one of the lucky few to actually survive the encounter with Valakas you will need proof that you have defeated the Fire Dragon.<br>
+<a action="bypass -h Quest Q10291_FireDragonDestroyer 31540-05.htm">Ask about proof.</a>
+</body></html>

+ 5 - 6
L2J_DataPack_BETA/dist/game/data/scripts/quests/Q10291_FireDragonDestroyer/31540-05.htm

@@ -1,6 +1,5 @@
-<html><body>Watcher of Valakas Klein:<br>
-Ah... so determined I see. Are you sure you are ready to face Valakas? You may wish to reconsider.<br>
-A thought in my mind, years of being stopped by adventurers like you can do horrible things to a dragon's spirit. Imagine all that pure rage combined with his newly found power... one could only hope that Valakas doesn't like to play with his food.<br>
-You aren't the first adventurer I've given this speech to. Last chance. Are you sure you are ready?<br>
-<a action="bypass -h Quest Q10291_FireDragonDestroyer 31540-06.htm">Let's do this!</a>
-</body></html>
+<html><body>
+Watcher of Valakas Klein:<br>
+Take this Poor Necklace. By itself it is worthless. However, if combined with the blood of Valakas it will absorb some of his energy into the necklace. The reaction should be instant upon the defeat of Valakas. The necklace will transform into a necklace of value. Bring me this as proof that Valakas has been defeated and you shall be rewarded.<br>
+You may wish to bring a small-er-very large army with you into Valakas Lair.
+</body></html>

+ 0 - 5
L2J_DataPack_BETA/dist/game/data/scripts/quests/Q10291_FireDragonDestroyer/31540-06.htm

@@ -1,5 +0,0 @@
-<html><body>Watcher of Valakas Klein:<br>
-I can see that you are determined despite my warnings. I will not try to stop you any further from your haste to find a quick death.<br>
-However, should you be one of the lucky few to actually survive the encounter with Valakas you will need proof that you have defeated the Fire Dragon.<br>
-<a action="bypass -h Quest Q10291_FireDragonDestroyer 31540-07.htm">Ask about proof.</a>
-</body></html>

+ 3 - 2
L2J_DataPack_BETA/dist/game/data/scripts/quests/Q10291_FireDragonDestroyer/31540-08.htm → L2J_DataPack_BETA/dist/game/data/scripts/quests/Q10291_FireDragonDestroyer/31540-06.html

@@ -1,5 +1,6 @@
-<html><body>Watcher of Valakas Klein:<br>
+<html><body>
+Watcher of Valakas Klein:<br>
 I apologize I think you misunderstood me...<br>
 Let me restate it to you a bit more clearly. Don't come back until you have DEFEATED Valakas.<br>
 Return to me once the necklace you carry has the energy of Valakas contained in it.
-</body></html>
+</body></html>

+ 0 - 4
L2J_DataPack_BETA/dist/game/data/scripts/quests/Q10291_FireDragonDestroyer/31540-07.htm

@@ -1,4 +0,0 @@
-<html><body>Watcher of Valakas Klein:<br>
-Take this Poor Necklace. By itself it is worthless. However, if combined with the blood of Valakas it will absorb some of his energy into the necklace. The reaction should be instant upon the defeat of Valakas. The necklace will transform into a necklace of value. Bring me this as proof that Valakas has been defeated and you shall be rewarded.<br>
-You may wish to bring a small-er-very large army with you into Valakas Lair.
-</body></html>

+ 3 - 2
L2J_DataPack_BETA/dist/game/data/scripts/quests/Q10291_FireDragonDestroyer/31540-09.htm → L2J_DataPack_BETA/dist/game/data/scripts/quests/Q10291_FireDragonDestroyer/31540-07.html

@@ -1,4 +1,5 @@
-<html><body>Watcher of Valakas Klein:<br>
+<html><body>
+Watcher of Valakas Klein:<br>
 What? You lost the necklace? How did you lose that necklace? That takes a special type of talent to lose something that cannot be lost.<br>
 Here... take this spare necklace I have. Do not "lose" this one. It is the only thing that can be used to prove that you have defeated Valakas.
-</body></html>
+</body></html>

+ 3 - 2
L2J_DataPack_BETA/dist/game/data/scripts/quests/Q10291_FireDragonDestroyer/31540-10.htm → L2J_DataPack_BETA/dist/game/data/scripts/quests/Q10291_FireDragonDestroyer/31540-08.html

@@ -1,5 +1,6 @@
-<html><body>Watcher of Valakas Klein:<br>
+<html><body>
+Watcher of Valakas Klein:<br>
 Impossible! I cannot believe it. No really, I cannot believe it. Usually I'm pretty good about sending adventurers to their death by facing Valakas, but you... just, wow. This is impressive. Soon all across the land will tell stories about the brave... what ever your name is, and how they defeated Valakas.<br>
 You should feel pretty good about yourself right about now. Too bad it won't last more than 2 weeks. I don't want to rain on your parade, but Valakas is Immortal. Sure you won't see him around for a few days... but he'll be back... mad as ever.<br>
 In any case, take this. A gift for the time you slew the dragon.
-</body></html>
+</body></html>

+ 3 - 2
L2J_DataPack_BETA/dist/game/data/scripts/quests/Q10291_FireDragonDestroyer/31540-03.htm → L2J_DataPack_BETA/dist/game/data/scripts/quests/Q10291_FireDragonDestroyer/31540-09.html

@@ -1,4 +1,5 @@
-<html><body>Watcher of Valakas Klein:<br>
+<html><body>
+Watcher of Valakas Klein:<br>
 Well if it isn't Mr. Fancy-I-Killed-Valakas-Pants. If I could I would send you into the depths of Valakas lair to stop the Fire Dragon's return and reward you with riches of your success. I really wish I could... not really.<br>
 (You have already completed this quest.)
-</body></html>
+</body></html>

+ 66 - 57
L2J_DataPack_BETA/dist/game/data/scripts/quests/Q10291_FireDragonDestroyer/Q10291_FireDragonDestroyer.java

@@ -14,11 +14,13 @@
  */
 package quests.Q10291_FireDragonDestroyer;
 
+import com.l2jserver.gameserver.model.IL2Procedure;
 import com.l2jserver.gameserver.model.actor.L2Npc;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 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.util.Util;
 
 /**
  * Fire Dragon Destroyer (10291)
@@ -27,32 +29,31 @@ import com.l2jserver.gameserver.model.quest.State;
 public class Q10291_FireDragonDestroyer extends Quest
 {
 	// NPC
-	private static final int Klein = 31540;
-	private static final int Valakas = 29028;
-	// Item
-	private static final int FloatingStone = 7267;
-	private static final int PoorNecklace = 15524;
-	private static final int ValorNecklace = 15525;
-	private static final int ValakaSlayerCirclet = 8567;
+	private static final int KLEIN = 31540;
+	// Monster
+	private static final int VALAKAS = 29028;
+	// Items
+	private static final int FLOATING_STONE = 7267;
+	private static final int POOR_NECKLACE = 15524;
+	private static final int VALOR_NECKLACE = 15525;
+	private static final int VALAKAS_SLAYER_CIRCLET = 8567;
 	
 	@Override
 	public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
 	{
-		String htmltext = event;
 		final QuestState st = player.getQuestState(getName());
 		if (st == null)
 		{
-			return htmltext;
+			return getNoQuestMsg(player);
 		}
 		
-		if (event.equalsIgnoreCase("31540-07.htm"))
+		if (event.equals("31540-05.htm"))
 		{
-			st.setState(State.STARTED);
-			st.set("cond", "1");
-			st.giveItems(PoorNecklace, 1);
-			st.playSound("ItemSound.quest_accept");
+			st.startQuest();
+			st.giveItems(POOR_NECKLACE, 1);
 		}
-		return htmltext;
+		
+		return event;
 	}
 	
 	@Override
@@ -72,48 +73,42 @@ public class Q10291_FireDragonDestroyer extends Quest
 			{
 				if (player.getLevel() < 83)
 				{
-					htmltext = "31540-02.htm";
-				}
-				else if (st.hasQuestItems(FloatingStone))
-				{
-					htmltext = "31540-01.htm";
+					htmltext = "31540-00.htm";
 				}
 				else
 				{
-					htmltext = "31540-04.htm";
+					htmltext = st.hasQuestItems(FLOATING_STONE) ? "31540-02.htm" : "31540-01.htm";
 				}
 				break;
 			}
 			case State.STARTED:
 			{
-				final int cond = st.getInt("cond");
+				final int cond = st.getCond();
 				if (cond == 1)
 				{
-					if (st.hasQuestItems(PoorNecklace))
+					if (st.hasQuestItems(POOR_NECKLACE))
 					{
-						htmltext = "31540-08.htm";
+						htmltext = "31540-06.html";
 					}
 					else
 					{
-						st.giveItems(PoorNecklace, 1);
-						htmltext = "31540-09.htm";
+						st.giveItems(POOR_NECKLACE, 1);
+						htmltext = "31540-07.html";
 					}
 				}
-				else if (cond == 2)
+				else if ((cond == 2) && st.hasQuestItems(VALOR_NECKLACE))
 				{
-					st.takeItems(ValorNecklace, 1);
+					htmltext = "31540-08.html";
 					st.giveAdena(126549, true);
 					st.addExpAndSp(717291, 77397);
-					st.giveItems(ValakaSlayerCirclet, 1);
-					st.playSound("ItemSound.quest_finish");
-					st.exitQuest(false);
-					htmltext = "31540-10.htm";
+					st.giveItems(VALAKAS_SLAYER_CIRCLET, 1);
+					st.exitQuest(false, true);
 				}
 				break;
 			}
 			case State.COMPLETED:
 			{
-				htmltext = "31540-03.htm";
+				htmltext = "31540-09.html";
 				break;
 			}
 		}
@@ -124,47 +119,61 @@ public class Q10291_FireDragonDestroyer extends Quest
 	@Override
 	public String onKill(L2Npc npc, L2PcInstance player, boolean isPet)
 	{
-		if (player.getParty() != null)
+		if (!player.isInParty())
 		{
-			for (L2PcInstance partyMember : player.getParty().getMembers())
-			{
-				rewardPlayer(partyMember);
-			}
+			return super.onKill(npc, player, isPet);
+		}
+		
+		// rewards go only to command channel, not to a single party or player (retail Freya AI)
+		if (player.getParty().isInCommandChannel())
+		{
+			player.getParty().getCommandChannel().forEachMember(new RewardCheck(npc));
 		}
 		else
 		{
-			rewardPlayer(player);
+			player.getParty().forEachMember(new RewardCheck(npc));
 		}
-		return null;
+		
+		return super.onKill(npc, player, isPet);
 	}
 	
-	/**
-	 * @param player the player to reward.
-	 */
-	private void rewardPlayer(L2PcInstance player)
+	public class RewardCheck implements IL2Procedure<L2PcInstance>
 	{
-		final QuestState st = player.getQuestState(getName());
-		if ((st != null) && (st.getInt("cond") == 1))
+		private final L2Npc _npc;
+		
+		public RewardCheck(L2Npc npc)
 		{
-			st.takeItems(PoorNecklace, 1);
-			st.giveItems(ValorNecklace, 1);
-			st.playSound("ItemSound.quest_middle");
-			st.set("cond", "2");
+			_npc = npc;
+		}
+		
+		@Override
+		public boolean execute(L2PcInstance member)
+		{
+			if (Util.checkIfInRange(8000, _npc, member, false))
+			{
+				QuestState st = member.getQuestState(getName());
+				
+				if ((st != null) && st.isCond(1) && st.hasQuestItems(POOR_NECKLACE))
+				{
+					st.takeItems(POOR_NECKLACE, -1);
+					st.giveItems(VALOR_NECKLACE, 1);
+					st.setCond(2, true);
+				}
+			}
+			return true;
 		}
 	}
 	
 	public Q10291_FireDragonDestroyer(int questId, String name, String descr)
 	{
 		super(questId, name, descr);
-		
-		addStartNpc(Klein);
-		addTalkId(Klein);
-		addKillId(Valakas);
-		
+		addStartNpc(KLEIN);
+		addTalkId(KLEIN);
+		addKillId(VALAKAS);
 		questItemIds = new int[]
 		{
-			PoorNecklace,
-			ValorNecklace
+			POOR_NECKLACE,
+			VALOR_NECKLACE
 		};
 	}