From 9a24d7bc4802b4d574a84cac21df306f2c9a08dc Mon Sep 17 00:00:00 2001
From: Adry_85 <Adrya85@hotmail.it>
Date: Sat, 8 Dec 2012 17:39:29 +0000
Subject: [PATCH] BETA: Retail like quest '''Threat Removal''' (290).

---
 .../quests/Q00290_ThreatRemoval/30201-00.htm  |   4 -
 .../quests/Q00290_ThreatRemoval/30201-01.htm  |  10 +-
 .../quests/Q00290_ThreatRemoval/30201-02.htm  |   4 -
 .../quests/Q00290_ThreatRemoval/30201-02.html |   3 +
 .../quests/Q00290_ThreatRemoval/30201-03.htm  |   2 -
 .../quests/Q00290_ThreatRemoval/30201-03.html |   3 +
 .../quests/Q00290_ThreatRemoval/30201-04.htm  |   4 -
 .../quests/Q00290_ThreatRemoval/30201-04.html |   3 +
 .../quests/Q00290_ThreatRemoval/30201-05.htm  |   4 -
 .../quests/Q00290_ThreatRemoval/30201-05.html |   4 +
 .../quests/Q00290_ThreatRemoval/30201-06.htm  |   4 -
 .../quests/Q00290_ThreatRemoval/30201-06.html |   5 +
 .../quests/Q00290_ThreatRemoval/30201-07.htm  |   4 -
 .../quests/Q00290_ThreatRemoval/30201-07.html |   3 +
 .../quests/Q00290_ThreatRemoval/30201-08.htm  |   2 -
 .../quests/Q00290_ThreatRemoval/30201-08.html |   5 +
 .../quests/Q00290_ThreatRemoval/30201-09.html |   3 +
 .../quests/Q00290_ThreatRemoval/30201-10.html |   3 +
 .../Q00290_ThreatRemoval.java                 | 295 ++++++++----------
 19 files changed, 171 insertions(+), 194 deletions(-)
 delete mode 100644 L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00290_ThreatRemoval/30201-00.htm
 delete mode 100644 L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00290_ThreatRemoval/30201-02.htm
 create mode 100644 L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00290_ThreatRemoval/30201-02.html
 delete mode 100644 L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00290_ThreatRemoval/30201-03.htm
 create mode 100644 L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00290_ThreatRemoval/30201-03.html
 delete mode 100644 L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00290_ThreatRemoval/30201-04.htm
 create mode 100644 L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00290_ThreatRemoval/30201-04.html
 delete mode 100644 L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00290_ThreatRemoval/30201-05.htm
 create mode 100644 L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00290_ThreatRemoval/30201-05.html
 delete mode 100644 L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00290_ThreatRemoval/30201-06.htm
 create mode 100644 L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00290_ThreatRemoval/30201-06.html
 delete mode 100644 L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00290_ThreatRemoval/30201-07.htm
 create mode 100644 L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00290_ThreatRemoval/30201-07.html
 delete mode 100644 L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00290_ThreatRemoval/30201-08.htm
 create mode 100644 L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00290_ThreatRemoval/30201-08.html
 create mode 100644 L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00290_ThreatRemoval/30201-09.html
 create mode 100644 L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00290_ThreatRemoval/30201-10.html

diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00290_ThreatRemoval/30201-00.htm b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00290_ThreatRemoval/30201-00.htm
deleted file mode 100644
index ca104bc9ed..0000000000
--- a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00290_ThreatRemoval/30201-00.htm
+++ /dev/null
@@ -1,4 +0,0 @@
-<html><head><body>Guard Pinaps:<br>Look recruit, I can't assign this mission to anyone who hasn't 
-survived enough storms, you get me? <br>
-(Only character with level 82 or above and who has performed the No Secret quest can take on this quest).
-</body></html>
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00290_ThreatRemoval/30201-01.htm b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00290_ThreatRemoval/30201-01.htm
index ffe7eb5da5..4117c5a946 100644
--- a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00290_ThreatRemoval/30201-01.htm
+++ b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00290_ThreatRemoval/30201-01.htm
@@ -1,6 +1,4 @@
-<html><head><body>Guard Pinaps:<br>I carefully inspected the Training Log and Schedule of the Sel Mahums, 
-which you brought it last time. It looks like they are getting trained more systematically than I expected.  
-I guess just finding out the information isn't enough...<br>If their power gets stronger through this training, 
-it will be a huge threat to this village. Wouldn't you want to help me to stop their training?<br>
-<a action="bypass -h Quest Q00290_ThreatRemoval 30201-02.htm">Say you would.</a>
-</body></html>
\ No newline at end of file
+<html><body>Guard Pinaps:<br>
+I carefully inspected the Training Log and Schedule of the Sel Mahums, which you brought it last time. It looks like they are getting trained more systematically than I expected.  I guess just finding out the information isn't enough...<br>If their power gets stronger through this training, it will be a huge threat to this village. Wouldn't you want to help me to stop their training?<br>
+<a action="bypass -h Quest Q00290_ThreatRemoval 30201-02.html">Say you would.</a>
+</body></html>
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00290_ThreatRemoval/30201-02.htm b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00290_ThreatRemoval/30201-02.htm
deleted file mode 100644
index 6a2f82d063..0000000000
--- a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00290_ThreatRemoval/30201-02.htm
+++ /dev/null
@@ -1,4 +0,0 @@
-<html><head><body>Guard Pinaps:<br>The mission is simple: Kill them. The recruits, the instructors, every Sel 
-Mahum you find in the Sel Mahum Training Grounds. They cannot be allowed to continue their training. Gather 
-<font color="LEVEL">over 400 Sel Mahum tags</font> and bring them to me. I will reward you.., I know you fight 
-for more than honor.</body></html>
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00290_ThreatRemoval/30201-02.html b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00290_ThreatRemoval/30201-02.html
new file mode 100644
index 0000000000..d00f154e0f
--- /dev/null
+++ b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00290_ThreatRemoval/30201-02.html
@@ -0,0 +1,3 @@
+<html><body>Guard Pinaps:<br>
+The mission is simple: Kill them. The recruits, the instructors, every Sel Mahum you find in the Sel Mahum Training Grounds. They cannot be allowed to continue their training. Gather <font color="LEVEL">over 400 Sel Mahum tags</font> and bring them to me. I will reward you.., I know you fight for more than honor.
+</body></html>
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00290_ThreatRemoval/30201-03.htm b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00290_ThreatRemoval/30201-03.htm
deleted file mode 100644
index 649759b864..0000000000
--- a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00290_ThreatRemoval/30201-03.htm
+++ /dev/null
@@ -1,2 +0,0 @@
-<html><head><body>Guard Pinaps:<br>I'm not paying you by the hour! Let's go! You're not getting anything until 
-I get my 400 Sel Mahum ID Tags.</body></html>
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00290_ThreatRemoval/30201-03.html b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00290_ThreatRemoval/30201-03.html
new file mode 100644
index 0000000000..5d6f27212d
--- /dev/null
+++ b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00290_ThreatRemoval/30201-03.html
@@ -0,0 +1,3 @@
+<html><body>Guard Pinaps:<br>
+Look recruit, I can't assign this mission to anyone who hasn't survived enough storms, you get me? <br>(Only character with level 82 or above and who has performed the No Secret quest can take on this quest).
+</body></html>
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00290_ThreatRemoval/30201-04.htm b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00290_ThreatRemoval/30201-04.htm
deleted file mode 100644
index d33ae866f7..0000000000
--- a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00290_ThreatRemoval/30201-04.htm
+++ /dev/null
@@ -1,4 +0,0 @@
-<html><head><body>Guard Pinaps:<br>You've done my job, the Town of Orean is safe. Thank you, defender... 
-Please accept this gift for your help.<br>
-<a action="bypass -h Quest Q00290_ThreatRemoval 30201-05.htm">Take the reward.</a>
-</body></html>
\ No newline at end of file
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00290_ThreatRemoval/30201-04.html b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00290_ThreatRemoval/30201-04.html
new file mode 100644
index 0000000000..fb7e1653f0
--- /dev/null
+++ b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00290_ThreatRemoval/30201-04.html
@@ -0,0 +1,3 @@
+<html><body>Guard Pinaps:<br>
+I'm not paying you by the hour! Let's go! You're not getting anything until I get my 400 Sel Mahum ID Tags.
+</body></html>
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00290_ThreatRemoval/30201-05.htm b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00290_ThreatRemoval/30201-05.htm
deleted file mode 100644
index 5660fb1b92..0000000000
--- a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00290_ThreatRemoval/30201-05.htm
+++ /dev/null
@@ -1,4 +0,0 @@
-<html><head><body>Guard Pinaps:<br>Like it or not, this is the best I can get right now. I may be able to 
-do better next time. What do you think? Still game?<br>
-<a action="bypass -h Quest Q00290_ThreatRemoval 30201-06.htm">Say you will continue to help.</a><br>
-<a action="bypass -h Quest Q00290_ThreatRemoval 30201-07.htm">Say you will stop helping.</a></body></html>
\ No newline at end of file
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00290_ThreatRemoval/30201-05.html b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00290_ThreatRemoval/30201-05.html
new file mode 100644
index 0000000000..2aeeebbc08
--- /dev/null
+++ b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00290_ThreatRemoval/30201-05.html
@@ -0,0 +1,4 @@
+<html><body>Guard Pinaps:<br>
+You've done my job, the Town of Orean is safe. Thank you, defender... Please accept this gift for your help.<br>
+<a action="bypass -h Quest Q00290_ThreatRemoval 30201-06.html">Take the reward.</a>
+</body></html>
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00290_ThreatRemoval/30201-06.htm b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00290_ThreatRemoval/30201-06.htm
deleted file mode 100644
index 7860abe9be..0000000000
--- a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00290_ThreatRemoval/30201-06.htm
+++ /dev/null
@@ -1,4 +0,0 @@
-<html><head><body>Guard Pinaps:<br>Thanks. I was really hoping you'd say that. 
-When this is over we may share a pint. For now, we carry out the mission. Get rid of those Sel Mahums 
-at the Sel Mahum Training Grounds, and bring <font color="LEVEL">more than 400 Sel Mahum tags</font> as evidence. 
-You will be rewarded.</body></html>
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00290_ThreatRemoval/30201-06.html b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00290_ThreatRemoval/30201-06.html
new file mode 100644
index 0000000000..75bb780810
--- /dev/null
+++ b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00290_ThreatRemoval/30201-06.html
@@ -0,0 +1,5 @@
+<html><body>Guard Pinaps:<br>
+Like it or not, this is the best I can get right now. I may be able to do better next time. What do you think? Still game?<br>
+<a action="bypass -h Quest Q00290_ThreatRemoval 30201-07.html">Say you will continue to help.</a><br>
+<a action="bypass -h Quest Q00290_ThreatRemoval exit">Say you will stop helping.</a>
+</body></html>
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00290_ThreatRemoval/30201-07.htm b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00290_ThreatRemoval/30201-07.htm
deleted file mode 100644
index c15d4fc781..0000000000
--- a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00290_ThreatRemoval/30201-07.htm
+++ /dev/null
@@ -1,4 +0,0 @@
-<html><head><body>Guard Pinaps:<br>I need your help. But unlike me, you are not duty bound, mercenary. 
-Stay or leave. I will not grovel.<br>
-<a action="bypass -h Quest Q00290_ThreatRemoval 30201-06.htm">Say you will continue.</a><br>
-<a action="bypass -h Quest Q00290_ThreatRemoval 30201-08.htm">Say you will quit.</a></body></html>
\ No newline at end of file
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00290_ThreatRemoval/30201-07.html b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00290_ThreatRemoval/30201-07.html
new file mode 100644
index 0000000000..6260bf8e72
--- /dev/null
+++ b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00290_ThreatRemoval/30201-07.html
@@ -0,0 +1,3 @@
+<html><body>Guard Pinaps:<br>
+Thanks. I was really hoping you'd say that. When this is over we may share a pint. For now, we carry out the mission. Get rid of those Sel Mahums at the Sel Mahum Training Grounds, and bring <font color="LEVEL">more than 400 Sel Mahum tags</font> as evidence. You will be rewarded.
+</body></html>
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00290_ThreatRemoval/30201-08.htm b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00290_ThreatRemoval/30201-08.htm
deleted file mode 100644
index 64acf6255a..0000000000
--- a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00290_ThreatRemoval/30201-08.htm
+++ /dev/null
@@ -1,2 +0,0 @@
-<html><head><body>Guard Pinaps:<br>Oh, it is. So be it. I respect your skills. May we serve together again 
-someday.</body></html>
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00290_ThreatRemoval/30201-08.html b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00290_ThreatRemoval/30201-08.html
new file mode 100644
index 0000000000..f10e3109a8
--- /dev/null
+++ b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00290_ThreatRemoval/30201-08.html
@@ -0,0 +1,5 @@
+<html><body>Guard Pinaps:<br>
+I need your help. But unlike me, you are not duty bound, mercenary. Stay or leave. I will not grovel.<br>
+<a action="bypass -h Quest Q00290_ThreatRemoval 30201-07.html">Say you will continue.</a><br>
+<a action="bypass -h Quest Q00290_ThreatRemoval 30201-10.html">Say you will quit.</a>
+</body></html>
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00290_ThreatRemoval/30201-09.html b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00290_ThreatRemoval/30201-09.html
new file mode 100644
index 0000000000..61d36695d8
--- /dev/null
+++ b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00290_ThreatRemoval/30201-09.html
@@ -0,0 +1,3 @@
+<html><body>Guard Pinaps:<br>
+Oh, it is. So be it. I respect your skills. May we serve together again someday.
+</body></html>
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00290_ThreatRemoval/30201-10.html b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00290_ThreatRemoval/30201-10.html
new file mode 100644
index 0000000000..625406f299
--- /dev/null
+++ b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00290_ThreatRemoval/30201-10.html
@@ -0,0 +1,3 @@
+<html><body>Guard Pinaps:<br>
+You're sharp and determined. I think we make a great team. I hope we can work together again.
+</body></html>
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00290_ThreatRemoval/Q00290_ThreatRemoval.java b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00290_ThreatRemoval/Q00290_ThreatRemoval.java
index db10cb9458..0449399396 100644
--- a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00290_ThreatRemoval/Q00290_ThreatRemoval.java
+++ b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00290_ThreatRemoval/Q00290_ThreatRemoval.java
@@ -14,6 +14,9 @@
  */
 package quests.Q00290_ThreatRemoval;
 
+import java.util.HashMap;
+import java.util.Map;
+
 import quests.Q00251_NoSecrets.Q00251_NoSecrets;
 
 import com.l2jserver.Config;
@@ -22,70 +25,38 @@ 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;
 
 /**
  * Threat Removal (290)
- * @author kostantinos
+ * @author Adry_85
  */
 public class Q00290_ThreatRemoval extends Quest
 {
-	public static final int PINAPS = 30201;
-	public static final int TAGS = 15714;
+	// NPC
+	private static final int PINAPS = 30201;
+	// Item
+	private static final int ENCHANT_WEAPON_S = 959;
+	private static final int ENCHANT_ARMOR_S = 960;
+	private static final int FIRE_CRYSTAL = 9552;
+	private static final int SEL_MAHUM_ID_TAG = 15714;
+	// Misc
+	private static final int MIN_LEVEL = 82;
 	
-	private static final int[] MOBS1 =
-	{
-		22780,
-		22782,
-		22784
-	};
-	private static final int[] MOBS2 =
-	{
-		22781,
-		22783,
-		22785
-	};
-	private static final int[] MOBS3 =
-	{
-		22776,
-		22775,
-		22777,
-		22778
-	};
+	private static final Map<Integer, Integer> MOBS_TAG = new HashMap<>();
 	
-	private static final int[][][] REWARD =
+	static
 	{
-		{
-			{
-				959,
-				1
-			}
-		},
-		{
-			{
-				960,
-				1
-			},
-			{
-				960,
-				2
-			},
-			{
-				960,
-				3
-			}
-		},
-		{
-			{
-				9552,
-				1
-			},
-			{
-				9552,
-				2
-			}
-		}
-	};
+		MOBS_TAG.put(22775, 932); // Sel Mahum Drill Sergeant
+		MOBS_TAG.put(22776, 397); // Sel Mahum Training Officer
+		MOBS_TAG.put(22777, 932); // Sel Mahum Drill Sergeant
+		MOBS_TAG.put(22778, 932); // Sel Mahum Drill Sergeant
+		MOBS_TAG.put(22780, 363); // Sel Mahum Recruit
+		MOBS_TAG.put(22781, 483); // Sel Mahum Soldier
+		MOBS_TAG.put(22782, 363); // Sel Mahum Recruit
+		MOBS_TAG.put(22783, 352); // Sel Mahum Soldier
+		MOBS_TAG.put(22784, 363); // Sel Mahum Recruit
+		MOBS_TAG.put(22785, 169); // Sel Mahum Soldier
+	}
 	
 	public Q00290_ThreatRemoval(int id, String name, String descr)
 	{
@@ -93,161 +64,165 @@ public class Q00290_ThreatRemoval extends Quest
 		
 		addStartNpc(PINAPS);
 		addTalkId(PINAPS);
-		
-		for (int i : MOBS1)
-		{
-			addKillId(i);
-		}
-		for (int i : MOBS2)
-		{
-			addKillId(i);
-		}
-		for (int i : MOBS3)
-		{
-			addKillId(i);
-		}
+		addKillId(MOBS_TAG.keySet());
+		registerQuestItems(SEL_MAHUM_ID_TAG);
 	}
 	
 	@Override
 	public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
 	{
-		String htmltext = event;
-		QuestState st = player.getQuestState(getName());
+		final QuestState st = player.getQuestState(getName());
 		if (st == null)
 		{
-			return htmltext;
+			return null;
 		}
-		int[][] i = REWARD[getRandom(REWARD.length)];
-		int b = getRandom(i.length);
 		
-		if (npc.getNpcId() == PINAPS)
+		String htmltext = null;
+		switch (event)
 		{
-			if (event.equalsIgnoreCase("30201-02.htm"))
+			case "30201-02.html":
 			{
-				st.set("cond", "1");
-				st.setState(State.STARTED);
-				st.playSound("ItemSound.quest_accept");
+				st.startQuest();
+				htmltext = event;
+				break;
 			}
-			else if (event.equalsIgnoreCase("30201-05.htm"))
+			case "30201-06.html":
 			{
-				if (st.getQuestItemsCount(TAGS) >= 400)
+				if (st.isCond(1))
 				{
-					st.giveItems(i[b][0], i[b][1]);
-					st.takeItems(TAGS, 400);
-					st.playSound("ItemSound.quest_finish");
-					htmltext = "30201-05.htm";
+					st.takeItems(SEL_MAHUM_ID_TAG, 400);
+					switch (getRandom(10))
+					{
+						case 0:
+						{
+							st.rewardItems(ENCHANT_WEAPON_S, 1);
+							break;
+						}
+						case 1:
+						case 2:
+						case 3:
+						{
+							st.rewardItems(ENCHANT_ARMOR_S, 1);
+							break;
+						}
+						case 4:
+						case 5:
+						{
+							st.rewardItems(ENCHANT_ARMOR_S, 2);
+							break;
+						}
+						case 6:
+						{
+							st.rewardItems(ENCHANT_ARMOR_S, 3);
+							break;
+						}
+						case 7:
+						case 8:
+						{
+							st.rewardItems(FIRE_CRYSTAL, 1);
+							break;
+						}
+						case 9:
+						case 10:
+						{
+							st.rewardItems(FIRE_CRYSTAL, 2);
+							break;
+						}
+					}
+					htmltext = event;
 				}
-				else
+				break;
+			}
+			case "30201-07.html":
+			{
+				if (st.isCond(1))
 				{
-					htmltext = "30201-03.htm";
+					htmltext = event;
 				}
+				break;
 			}
-			else if (event.equalsIgnoreCase("30201-08.htm"))
+			case "exit":
 			{
-				st.playSound("ItemSound.quest_finish");
-				st.exitQuest(true);
+				if (st.isCond(1))
+				{
+					if (st.hasQuestItems(SEL_MAHUM_ID_TAG))
+					{
+						htmltext = "30201-08.html";
+					}
+					else
+					{
+						st.exitQuest(true, true);
+						htmltext = "30201-09.html";
+					}
+				}
+				break;
+			}
+			case "30201-10.html":
+			{
+				if (st.isCond(1))
+				{
+					st.exitQuest(true, true);
+					htmltext = event;
+				}
+				break;
 			}
 		}
+		
 		return htmltext;
 	}
 	
 	@Override
 	public String onTalk(L2Npc npc, L2PcInstance player)
 	{
-		String htmltext = getNoQuestMsg(player);
 		QuestState st = player.getQuestState(getName());
-		QuestState _prev = player.getQuestState(Q00251_NoSecrets.class.getSimpleName());
+		String htmltext = getNoQuestMsg(player);
 		if (st == null)
 		{
 			return htmltext;
 		}
 		
-		if (npc.getNpcId() == PINAPS)
+		switch (st.getState())
 		{
-			switch (st.getState())
+			case State.CREATED:
 			{
-				case State.CREATED:
-					if ((player.getLevel() >= 82) && (_prev != null) && _prev.isCompleted())
-					{
-						htmltext = "30201-01.htm";
-					}
-					else
-					{
-						htmltext = "30201-00.htm";
-					}
-					break;
-				case State.STARTED:
-					if (st.getInt("cond") == 1)
+				st = player.getQuestState(Q00251_NoSecrets.class.getSimpleName());
+				htmltext = ((player.getLevel() >= MIN_LEVEL) && (st != null) && (st.isCompleted())) ? "30201-01.htm" : "30201-03.html";
+				break;
+			}
+			case State.STARTED:
+			{
+				if (npc.getNpcId() == PINAPS)
+				{
+					if (st.isCond(1))
 					{
-						if (st.getQuestItemsCount(TAGS) >= 400)
-						{
-							htmltext = "30201-04.htm";
-						}
-						else
-						{
-							htmltext = "30201-03.htm";
-						}
+						htmltext = (st.getQuestItemsCount(SEL_MAHUM_ID_TAG) < 400) ? "30201-04.html" : "30201-05.html";
 					}
-					break;
+				}
+				break;
 			}
 		}
+		
 		return htmltext;
 	}
 	
 	@Override
 	public String onKill(L2Npc npc, L2PcInstance player, boolean isPet)
 	{
-		QuestState st = player.getQuestState(getName());
-		int npcId = npc.getNpcId();
-		if ((st == null) || (st.getState() != State.STARTED))
+		final L2PcInstance partyMember = getRandomPartyMember(player, "1");
+		if (partyMember == null)
 		{
 			return null;
 		}
-		if (Util.contains(MOBS1, npcId))
-		{
-			int chance = (int) (25 * Config.RATE_QUEST_DROP);
-			int numItems = (chance / 100);
-			chance = chance % 100;
-			if (getRandom(100) < chance)
-			{
-				numItems++;
-			}
-			if (numItems > 0)
-			{
-				st.playSound("ItemSound.quest_itemget");
-				st.giveItems(TAGS, numItems);
-			}
-		}
-		else if (Util.contains(MOBS2, npcId))
-		{
-			int chance = (int) (30 * Config.RATE_QUEST_DROP);
-			int numItems = (chance / 100);
-			chance = chance % 100;
-			if (getRandom(100) < chance)
-			{
-				numItems++;
-			}
-			if (numItems > 0)
-			{
-				st.playSound("ItemSound.quest_itemget");
-				st.giveItems(TAGS, numItems);
-			}
-		}
-		else if (Util.contains(MOBS3, npcId))
+		
+		final QuestState st = partyMember.getQuestState(getName());
+		int npcId = npc.getNpcId();
+		int chance = (int) ((MOBS_TAG.get(npcId) * Config.RATE_QUEST_DROP) % 1000);
+		if (getRandom(1000) < chance)
 		{
-			int chance = (int) (50 * Config.RATE_QUEST_DROP);
-			int numItems = (chance / 100);
-			chance = chance % 100;
-			if (getRandom(100) < chance)
-			{
-				numItems++;
-			}
-			if (numItems > 0)
-			{
-				st.playSound("ItemSound.quest_itemget");
-				st.giveItems(TAGS, numItems);
-			}
+			st.rewardItems(SEL_MAHUM_ID_TAG, 1);
+			st.playSound("ItemSound.quest_itemget");
 		}
+		
 		return super.onKill(npc, player, isPet);
 	}
 	
-- 
GitLab