From b9613c168f47ed4b6683236d530b022eb643bfb3 Mon Sep 17 00:00:00 2001
From: Rumen Nikiforov <unafraid89@gmail.com>
Date: Fri, 4 Nov 2011 13:43:50 +0000
Subject: [PATCH] BETA: Olympiad quests - Olympiad Starter - by Gnacik -
 Olympiad Veteran - by lion - Olympiad Undefeated - by lion A little bit
 changed by me

---
 L2J_DataPack_BETA/dist/game/data/scripts.cfg  |   3 +
 .../quests/Q551_OlympiadStarter/31688-00.htm  |   4 +
 .../quests/Q551_OlympiadStarter/31688-01.htm  |   5 +
 .../quests/Q551_OlympiadStarter/31688-02.htm  |   4 +
 .../quests/Q551_OlympiadStarter/31688-03.htm  |   3 +
 .../Q551_OlympiadStarter/31688-done.htm       |   4 +
 .../Q551_OlympiadStarter/31688-exchange.htm   |   3 +
 .../quests/Q551_OlympiadStarter/31688-f3.htm  |   4 +
 .../quests/Q551_OlympiadStarter/31688-f5.htm  |   4 +
 .../quests/Q551_OlympiadStarter/31688-no.htm  |   4 +
 .../quests/Q551_OlympiadStarter/31688-ok.htm  |   4 +
 .../Q551_OlympiadStarter.java                 | 189 +++++++++++++++
 .../quests/Q552_OlympiadVeteran/31688-00.htm  |   4 +
 .../quests/Q552_OlympiadVeteran/31688-01.htm  |   5 +
 .../quests/Q552_OlympiadVeteran/31688-02.htm  |   5 +
 .../quests/Q552_OlympiadVeteran/31688-03.htm  |   3 +
 .../Q552_OlympiadVeteran/31688-done.htm       |   4 +
 .../Q552_OlympiadVeteran/31688-exchange.htm   |   3 +
 .../quests/Q552_OlympiadVeteran/31688-no.htm  |   4 +
 .../quests/Q552_OlympiadVeteran/31688-ok.htm  |   4 +
 .../quests/Q552_OlympiadVeteran/31688-s1.htm  |   4 +
 .../quests/Q552_OlympiadVeteran/31688-s2.htm  |   4 +
 .../Q552_OlympiadVeteran.java                 | 217 ++++++++++++++++++
 .../Q553_OlympiadUndefeated/31688-00.htm      |   4 +
 .../Q553_OlympiadUndefeated/31688-01.htm      |   5 +
 .../Q553_OlympiadUndefeated/31688-02.htm      |   4 +
 .../Q553_OlympiadUndefeated/31688-03.htm      |   3 +
 .../Q553_OlympiadUndefeated/31688-done.htm    |   4 +
 .../31688-exchange.htm                        |   3 +
 .../Q553_OlympiadUndefeated/31688-no.htm      |   4 +
 .../Q553_OlympiadUndefeated/31688-ok.htm      |   4 +
 .../Q553_OlympiadUndefeated/31688-w2.htm      |   4 +
 .../Q553_OlympiadUndefeated/31688-w5.htm      |   4 +
 .../Q553_OlympiadUndefeated.java              | 182 +++++++++++++++
 34 files changed, 709 insertions(+)
 create mode 100644 L2J_DataPack_BETA/dist/game/data/scripts/quests/Q551_OlympiadStarter/31688-00.htm
 create mode 100644 L2J_DataPack_BETA/dist/game/data/scripts/quests/Q551_OlympiadStarter/31688-01.htm
 create mode 100644 L2J_DataPack_BETA/dist/game/data/scripts/quests/Q551_OlympiadStarter/31688-02.htm
 create mode 100644 L2J_DataPack_BETA/dist/game/data/scripts/quests/Q551_OlympiadStarter/31688-03.htm
 create mode 100644 L2J_DataPack_BETA/dist/game/data/scripts/quests/Q551_OlympiadStarter/31688-done.htm
 create mode 100644 L2J_DataPack_BETA/dist/game/data/scripts/quests/Q551_OlympiadStarter/31688-exchange.htm
 create mode 100644 L2J_DataPack_BETA/dist/game/data/scripts/quests/Q551_OlympiadStarter/31688-f3.htm
 create mode 100644 L2J_DataPack_BETA/dist/game/data/scripts/quests/Q551_OlympiadStarter/31688-f5.htm
 create mode 100644 L2J_DataPack_BETA/dist/game/data/scripts/quests/Q551_OlympiadStarter/31688-no.htm
 create mode 100644 L2J_DataPack_BETA/dist/game/data/scripts/quests/Q551_OlympiadStarter/31688-ok.htm
 create mode 100644 L2J_DataPack_BETA/dist/game/data/scripts/quests/Q551_OlympiadStarter/Q551_OlympiadStarter.java
 create mode 100644 L2J_DataPack_BETA/dist/game/data/scripts/quests/Q552_OlympiadVeteran/31688-00.htm
 create mode 100644 L2J_DataPack_BETA/dist/game/data/scripts/quests/Q552_OlympiadVeteran/31688-01.htm
 create mode 100644 L2J_DataPack_BETA/dist/game/data/scripts/quests/Q552_OlympiadVeteran/31688-02.htm
 create mode 100644 L2J_DataPack_BETA/dist/game/data/scripts/quests/Q552_OlympiadVeteran/31688-03.htm
 create mode 100644 L2J_DataPack_BETA/dist/game/data/scripts/quests/Q552_OlympiadVeteran/31688-done.htm
 create mode 100644 L2J_DataPack_BETA/dist/game/data/scripts/quests/Q552_OlympiadVeteran/31688-exchange.htm
 create mode 100644 L2J_DataPack_BETA/dist/game/data/scripts/quests/Q552_OlympiadVeteran/31688-no.htm
 create mode 100644 L2J_DataPack_BETA/dist/game/data/scripts/quests/Q552_OlympiadVeteran/31688-ok.htm
 create mode 100644 L2J_DataPack_BETA/dist/game/data/scripts/quests/Q552_OlympiadVeteran/31688-s1.htm
 create mode 100644 L2J_DataPack_BETA/dist/game/data/scripts/quests/Q552_OlympiadVeteran/31688-s2.htm
 create mode 100644 L2J_DataPack_BETA/dist/game/data/scripts/quests/Q552_OlympiadVeteran/Q552_OlympiadVeteran.java
 create mode 100644 L2J_DataPack_BETA/dist/game/data/scripts/quests/Q553_OlympiadUndefeated/31688-00.htm
 create mode 100644 L2J_DataPack_BETA/dist/game/data/scripts/quests/Q553_OlympiadUndefeated/31688-01.htm
 create mode 100644 L2J_DataPack_BETA/dist/game/data/scripts/quests/Q553_OlympiadUndefeated/31688-02.htm
 create mode 100644 L2J_DataPack_BETA/dist/game/data/scripts/quests/Q553_OlympiadUndefeated/31688-03.htm
 create mode 100644 L2J_DataPack_BETA/dist/game/data/scripts/quests/Q553_OlympiadUndefeated/31688-done.htm
 create mode 100644 L2J_DataPack_BETA/dist/game/data/scripts/quests/Q553_OlympiadUndefeated/31688-exchange.htm
 create mode 100644 L2J_DataPack_BETA/dist/game/data/scripts/quests/Q553_OlympiadUndefeated/31688-no.htm
 create mode 100644 L2J_DataPack_BETA/dist/game/data/scripts/quests/Q553_OlympiadUndefeated/31688-ok.htm
 create mode 100644 L2J_DataPack_BETA/dist/game/data/scripts/quests/Q553_OlympiadUndefeated/31688-w2.htm
 create mode 100644 L2J_DataPack_BETA/dist/game/data/scripts/quests/Q553_OlympiadUndefeated/31688-w5.htm
 create mode 100644 L2J_DataPack_BETA/dist/game/data/scripts/quests/Q553_OlympiadUndefeated/Q553_OlympiadUndefeated.java

diff --git a/L2J_DataPack_BETA/dist/game/data/scripts.cfg b/L2J_DataPack_BETA/dist/game/data/scripts.cfg
index 675d72367d..33b7c38756 100644
--- a/L2J_DataPack_BETA/dist/game/data/scripts.cfg
+++ b/L2J_DataPack_BETA/dist/game/data/scripts.cfg
@@ -582,6 +582,9 @@ quests/508_TheClansReputation/__init__.py
 quests/509_TheClansPrestige/__init__.py
 quests/510_AClansReputation/__init__.py
 quests/Q511_AwlUnderFoot/Q511_AwlUnderFoot.java
+quests/Q551_OlympiadStarter/Q551_OlympiadStarter.java
+quests/Q552_OlympiadVeteran/Q552_OlympiadVeteran.java
+quests/Q553_OlympiadUndefeated/Q553_OlympiadUndefeated.java
 quests/601_WatchingEyes/__init__.py
 quests/602_ShadowOfLight/__init__.py
 quests/603_DaimontheWhiteEyedPart1/__init__.py
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q551_OlympiadStarter/31688-00.htm b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q551_OlympiadStarter/31688-00.htm
new file mode 100644
index 0000000000..24993817af
--- /dev/null
+++ b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q551_OlympiadStarter/31688-00.htm
@@ -0,0 +1,4 @@
+<html><head><body>Grand Olympiad Manager:<br>
+You do not meet the requirements for taking on this mission.<br>
+(Only noblesse characters above level 75 who have completed a third class transfer can undertake this quest.)<br>
+</body></html>
\ No newline at end of file
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q551_OlympiadStarter/31688-01.htm b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q551_OlympiadStarter/31688-01.htm
new file mode 100644
index 0000000000..190042b49a
--- /dev/null
+++ b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q551_OlympiadStarter/31688-01.htm
@@ -0,0 +1,5 @@
+<html><head><body>Grand Olympiad Manager:<br>
+If you receive a mission involving challenging the Olympiad before you enter the Grand Olympiad, you can receive additional rewards. If you're qualified, why don't you try making the challenge?<br>
+<a action="bypass -h Quest 551_OlympiadStarter 31688-ok.htm">Accept</a><br>
+<a action="bypass -h Quest 551_OlympiadStarter 31688-02.htm">"Can you tell me more?"</a><br>
+</body></html>
\ No newline at end of file
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q551_OlympiadStarter/31688-02.htm b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q551_OlympiadStarter/31688-02.htm
new file mode 100644
index 0000000000..21c2449ee5
--- /dev/null
+++ b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q551_OlympiadStarter/31688-02.htm
@@ -0,0 +1,4 @@
+<html><head><body>Grand Olympiad Manager:<br>
+There is a reward for entering 10 games. But you will receive a reward by participating in 3 games, then in 5 games. You will also get rewared with the <font color="LEVEL">Medal of Honor</font> if you participate in <font color="LEVEL">5 and 10</font> games.<br>
+<a action="bypass -h Quest 551_OlympiadStarter 31688-ok.htm">Accept</a><br>
+</body></html>
\ No newline at end of file
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q551_OlympiadStarter/31688-03.htm b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q551_OlympiadStarter/31688-03.htm
new file mode 100644
index 0000000000..e707e953f3
--- /dev/null
+++ b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q551_OlympiadStarter/31688-03.htm
@@ -0,0 +1,3 @@
+<html><head><body>Grand Olympiad Manager:<br>
+Well done. Please come back tomorrow.
+</body></html>
\ No newline at end of file
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q551_OlympiadStarter/31688-done.htm b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q551_OlympiadStarter/31688-done.htm
new file mode 100644
index 0000000000..3694cf9966
--- /dev/null
+++ b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q551_OlympiadStarter/31688-done.htm
@@ -0,0 +1,4 @@
+<html><head><body>Grand Olympiad Manager:<br>
+You have already received the reward for this mission. You should rest before you try again!<br>
+(This quest can only be undertaken once a day. This quest resets everyday at 6:30 AM.)<br>
+</body></html>
\ No newline at end of file
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q551_OlympiadStarter/31688-exchange.htm b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q551_OlympiadStarter/31688-exchange.htm
new file mode 100644
index 0000000000..28b0c677c9
--- /dev/null
+++ b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q551_OlympiadStarter/31688-exchange.htm
@@ -0,0 +1,3 @@
+<html><head><body>Grand Olympiad Manager:<br>
+Well done. Please come back tomorrow.<br>
+</body></html>
\ No newline at end of file
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q551_OlympiadStarter/31688-f3.htm b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q551_OlympiadStarter/31688-f3.htm
new file mode 100644
index 0000000000..c38cf4bbfd
--- /dev/null
+++ b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q551_OlympiadStarter/31688-f3.htm
@@ -0,0 +1,4 @@
+<html><head><body>Grand Olympiad Manager:<br>
+I will give you an incomplete reward. Please remember that once you receive the reward, you cannot take on the mission anymore today. Do you still want to go ahead?<br>
+<a action="bypass -h Quest 551_OlympiadStarter exchange_3">"Yes please."</a><br>
+</body></html>
\ No newline at end of file
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q551_OlympiadStarter/31688-f5.htm b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q551_OlympiadStarter/31688-f5.htm
new file mode 100644
index 0000000000..a8ffb44491
--- /dev/null
+++ b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q551_OlympiadStarter/31688-f5.htm
@@ -0,0 +1,4 @@
+<html><head><body>Grand Olympiad Manager:<br>
+I will give you an incomplete reward. Please remember that once you receive the reward, you cannot take on the mission anymore today. Do you still want to go ahead?<br>
+<a action="bypass -h Quest 551_OlympiadStarter exchange_5">"Yes please."</a><br>
+</body></html>
\ No newline at end of file
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q551_OlympiadStarter/31688-no.htm b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q551_OlympiadStarter/31688-no.htm
new file mode 100644
index 0000000000..764e824d8f
--- /dev/null
+++ b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q551_OlympiadStarter/31688-no.htm
@@ -0,0 +1,4 @@
+<html><head><body>Grand Olympiad Manager:<br>
+You did not fulfil the requirements for receiving a reward.<br>
+You must participate in more than 3 Olympiad matches in order to receive a reward. If you participate 5 times, the reward will increase, and if you participate more than 10 times, you will receive the promised ultimate reward.<br>
+</body></html>
\ No newline at end of file
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q551_OlympiadStarter/31688-ok.htm b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q551_OlympiadStarter/31688-ok.htm
new file mode 100644
index 0000000000..2f976c9032
--- /dev/null
+++ b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q551_OlympiadStarter/31688-ok.htm
@@ -0,0 +1,4 @@
+<html><head><body>Grand Olympiad Manager:<br>
+The mission has been accepted. Please check to see if there are any other missions. Once preparations are complete, challenge the Olympiad.<br>
+<a action="bypass -h npc_%objectId%_Quest">See other missions.</a><br>
+</body></html>
\ No newline at end of file
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q551_OlympiadStarter/Q551_OlympiadStarter.java b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q551_OlympiadStarter/Q551_OlympiadStarter.java
new file mode 100644
index 0000000000..3e21fbb8f8
--- /dev/null
+++ b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q551_OlympiadStarter/Q551_OlympiadStarter.java
@@ -0,0 +1,189 @@
+/*
+ * This program 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.
+ *
+ * This program 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 quests.Q551_OlympiadStarter;
+
+import com.l2jserver.gameserver.model.actor.L2Npc;
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.gameserver.model.olympiad.CompetitionType;
+import com.l2jserver.gameserver.model.quest.Quest;
+import com.l2jserver.gameserver.model.quest.QuestState;
+import com.l2jserver.gameserver.model.quest.State;
+
+/**
+ ** @author Gnacik 2011-02-04 Based on official H5 PTS server
+ */
+public class Q551_OlympiadStarter extends Quest
+{
+	// Name
+	private static final String QUEST_NAME = "551_OlympiadStarter";
+	// NPC
+	private static final int MANAGER = 31688;
+	// Items
+	private static final int CERT_3 = 17238;
+	private static final int CERT_5 = 17239;
+	private static final int CERT_10 = 17240;
+	
+	private static final int OLY_CHEST = 17169;
+	private static final int MEDAL_OF_GLORY = 21874;
+	
+	public Q551_OlympiadStarter(int questId, String name, String descr)
+	{
+		super(questId, name, descr);
+		
+		addStartNpc(MANAGER);
+		addTalkId(MANAGER);
+		setOlympiadUse(true);
+	}
+	
+	@Override
+	public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
+	{
+		String htmltext = event;
+		QuestState st = player.getQuestState(getName());
+		if (st == null)
+			return htmltext;
+		
+		if (npc.getNpcId() == MANAGER)
+		{
+			if (event.equalsIgnoreCase("31688-ok.htm"))
+			{
+				st.setState(State.STARTED);
+				st.set("cond", "1");
+				st.playSound("ItemSound.quest_accept");
+			}
+			else if (event.equalsIgnoreCase("exchange_3"))
+			{
+				st.takeItems(CERT_3, 1);
+				st.giveItems(OLY_CHEST, 1);
+				st.playSound("ItemSound.quest_finish");
+				st.exitQuest(false);
+				
+				htmltext = "31688-exchange.htm";
+			}
+			else if (event.equalsIgnoreCase("exchange_5"))
+			{
+				st.takeItems(CERT_3, 1);
+				st.giveItems(OLY_CHEST, 2);
+				
+				st.takeItems(CERT_5, 1);
+				st.giveItems(MEDAL_OF_GLORY, 3);
+				st.playSound("ItemSound.quest_finish");
+				st.exitQuest(false);
+				
+				htmltext = "31688-exchange.htm";
+			}
+		}
+		return htmltext;
+	}
+	
+	@Override
+	public String onTalk(L2Npc npc, L2PcInstance player)
+	{
+		String htmltext = getNoQuestMsg(player);
+		QuestState st = player.getQuestState(getName());
+		if (st == null)
+			return htmltext;
+		
+		if (npc.getNpcId() == MANAGER)
+		{
+			if (player.getLevel() < 75 || !player.isNoble())
+				htmltext = "31688-00.htm";
+			else if (st.getState() == State.CREATED)
+				htmltext = "31688-01.htm";
+			else if (st.getState() == State.COMPLETED)
+				htmltext = "31688-done.htm";
+			else if (st.getState() == State.STARTED && st.hasQuestItems(CERT_10))
+			{
+				st.takeItems(CERT_3, 1);
+				st.takeItems(CERT_5, 1);
+				st.takeItems(CERT_10, 1);
+				st.giveItems(OLY_CHEST, 4);
+				st.giveItems(MEDAL_OF_GLORY, 5);
+				st.playSound("ItemSound.quest_finish");
+				st.exitQuest(false);
+				
+				htmltext = "31688-03.htm";
+			}
+			else if (st.getState() == State.STARTED && st.hasQuestItems(CERT_5))
+				htmltext = "31688-f3.htm";
+			else if (st.getState() == State.STARTED && st.hasQuestItems(CERT_3))
+				htmltext = "31688-f5.htm";
+			else
+				htmltext = "31688-no.htm";
+		}
+		return htmltext;
+	}
+	
+	@Override
+	public void onOlympiadWin(L2PcInstance winner, CompetitionType type)
+	{
+		QuestState st = null;
+		if (winner != null)
+		{
+			st = winner.getQuestState(getName());
+			if (st != null && st.getState() == State.STARTED)
+			{
+				int matches = st.getInt("matches") + 1;
+				switch (matches)
+				{
+					case 3:
+						st.giveItems(CERT_3, 1);
+						break;
+					case 5:
+						st.giveItems(CERT_5, 1);
+						break;
+					case 10:
+						st.giveItems(CERT_10, 1);
+						break;
+				}
+				
+				st.set("matches", String.valueOf(matches));
+			}
+		}
+	}
+	
+	@Override
+	public void onOlympiadLoose(L2PcInstance looser, CompetitionType type)
+	{
+		QuestState st = null;
+		if (looser != null)
+		{
+			st = looser.getQuestState(getName());
+			if (st != null && st.getState() == State.STARTED)
+			{
+				int matches = st.getInt("matches") + 1;
+				switch (matches)
+				{
+					case 3:
+						st.giveItems(CERT_3, 1);
+						break;
+					case 5:
+						st.giveItems(CERT_5, 1);
+						break;
+					case 10:
+						st.giveItems(CERT_10, 1);
+						break;
+				}
+				
+				st.set("matches", String.valueOf(matches));
+			}
+		}
+	}
+	
+	public static void main(String[] args)
+	{
+		new Q551_OlympiadStarter(551, QUEST_NAME, "Olympiad Starter");
+	}
+}
\ No newline at end of file
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q552_OlympiadVeteran/31688-00.htm b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q552_OlympiadVeteran/31688-00.htm
new file mode 100644
index 0000000000..24993817af
--- /dev/null
+++ b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q552_OlympiadVeteran/31688-00.htm
@@ -0,0 +1,4 @@
+<html><head><body>Grand Olympiad Manager:<br>
+You do not meet the requirements for taking on this mission.<br>
+(Only noblesse characters above level 75 who have completed a third class transfer can undertake this quest.)<br>
+</body></html>
\ No newline at end of file
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q552_OlympiadVeteran/31688-01.htm b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q552_OlympiadVeteran/31688-01.htm
new file mode 100644
index 0000000000..1dfa0aff5b
--- /dev/null
+++ b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q552_OlympiadVeteran/31688-01.htm
@@ -0,0 +1,5 @@
+<html><body>Grand Olympiad Manager:<br>
+While challenging the Olympiad, it is important to widen your level of experience as well. Just by making the challenge, you will receive a small reward. Will you make the challenge?<br>
+<a action="bypass -h Quest 552_OlympiadVeteran 31688-ok.htm">Accept</a><br>
+<a action="bypass -h Quest 552_OlympiadVeteran 31688-02.htm">"Tell me more."</a><br>
+</body></html>
\ No newline at end of file
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q552_OlympiadVeteran/31688-02.htm b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q552_OlympiadVeteran/31688-02.htm
new file mode 100644
index 0000000000..d20d3f3540
--- /dev/null
+++ b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q552_OlympiadVeteran/31688-02.htm
@@ -0,0 +1,5 @@
+<html><body>Grand Olympiad Manager:<br>
+Please participate in all the various categories of matches in the Olympiad. If you participate in each of the <font color="LEVEL">non-class battles, class battles, and group battles</font> <font color="LEVEL">5 times</font>, your mission will be complete.<br>
+If it is difficult to participate in the three match categories, you can participate in just one category, and you will still receive some reward. If you're still satisfied, you can come to me. But please remember that once you receive the reward, you can't take on the mission again that same day.<br>
+<a action="bypass -h Quest 552_OlympiadVeteran 31688-ok.htm">Accept</a><br>
+</body></html>
\ No newline at end of file
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q552_OlympiadVeteran/31688-03.htm b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q552_OlympiadVeteran/31688-03.htm
new file mode 100644
index 0000000000..e707e953f3
--- /dev/null
+++ b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q552_OlympiadVeteran/31688-03.htm
@@ -0,0 +1,3 @@
+<html><head><body>Grand Olympiad Manager:<br>
+Well done. Please come back tomorrow.
+</body></html>
\ No newline at end of file
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q552_OlympiadVeteran/31688-done.htm b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q552_OlympiadVeteran/31688-done.htm
new file mode 100644
index 0000000000..3694cf9966
--- /dev/null
+++ b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q552_OlympiadVeteran/31688-done.htm
@@ -0,0 +1,4 @@
+<html><head><body>Grand Olympiad Manager:<br>
+You have already received the reward for this mission. You should rest before you try again!<br>
+(This quest can only be undertaken once a day. This quest resets everyday at 6:30 AM.)<br>
+</body></html>
\ No newline at end of file
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q552_OlympiadVeteran/31688-exchange.htm b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q552_OlympiadVeteran/31688-exchange.htm
new file mode 100644
index 0000000000..28b0c677c9
--- /dev/null
+++ b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q552_OlympiadVeteran/31688-exchange.htm
@@ -0,0 +1,3 @@
+<html><head><body>Grand Olympiad Manager:<br>
+Well done. Please come back tomorrow.<br>
+</body></html>
\ No newline at end of file
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q552_OlympiadVeteran/31688-no.htm b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q552_OlympiadVeteran/31688-no.htm
new file mode 100644
index 0000000000..5ea1d4fac7
--- /dev/null
+++ b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q552_OlympiadVeteran/31688-no.htm
@@ -0,0 +1,4 @@
+<html><body>Grand Olympiad Manager:<br>
+You did not fulfill the requirements for receiving a reward.<br>
+you must participate at least 5 times in a non-class battle, class battle, or group battle in order to receive the reward. Of course, if you participate in all three categories, you can expect an even greater reward.
+</body></html>
\ No newline at end of file
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q552_OlympiadVeteran/31688-ok.htm b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q552_OlympiadVeteran/31688-ok.htm
new file mode 100644
index 0000000000..2f976c9032
--- /dev/null
+++ b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q552_OlympiadVeteran/31688-ok.htm
@@ -0,0 +1,4 @@
+<html><head><body>Grand Olympiad Manager:<br>
+The mission has been accepted. Please check to see if there are any other missions. Once preparations are complete, challenge the Olympiad.<br>
+<a action="bypass -h npc_%objectId%_Quest">See other missions.</a><br>
+</body></html>
\ No newline at end of file
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q552_OlympiadVeteran/31688-s1.htm b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q552_OlympiadVeteran/31688-s1.htm
new file mode 100644
index 0000000000..4d859e78a7
--- /dev/null
+++ b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q552_OlympiadVeteran/31688-s1.htm
@@ -0,0 +1,4 @@
+<html><body>Grand Olympiad Manager:<br>
+I will give you an incomplete reward. Please remember that once you receive the reward, you can;t take on the mission again today. Still want the reward?<br>
+<a action="bypass -h Quest 552_OlympiadVeteran exchange_1">"Yes."</a>
+</body></html>
\ No newline at end of file
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q552_OlympiadVeteran/31688-s2.htm b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q552_OlympiadVeteran/31688-s2.htm
new file mode 100644
index 0000000000..d23739524f
--- /dev/null
+++ b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q552_OlympiadVeteran/31688-s2.htm
@@ -0,0 +1,4 @@
+<html><head><body>Grand Olympiad Manager:<br>
+I will give you an incomplete reward. Please remember that once you receive the reward, you cannot take on the mission anymore today. Do you still want to go ahead?<br>
+<a action="bypass -h Quest 552_OlympiadVeteran exchange_2">"Yes please."</a><br>
+</body></html>
\ No newline at end of file
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q552_OlympiadVeteran/Q552_OlympiadVeteran.java b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q552_OlympiadVeteran/Q552_OlympiadVeteran.java
new file mode 100644
index 0000000000..31b53a68ad
--- /dev/null
+++ b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q552_OlympiadVeteran/Q552_OlympiadVeteran.java
@@ -0,0 +1,217 @@
+/*
+ * This program 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.
+ *
+ * This program 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 quests.Q552_OlympiadVeteran;
+
+import com.l2jserver.gameserver.model.actor.L2Npc;
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.gameserver.model.olympiad.CompetitionType;
+import com.l2jserver.gameserver.model.quest.Quest;
+import com.l2jserver.gameserver.model.quest.QuestState;
+import com.l2jserver.gameserver.model.quest.State;
+
+/**
+ ** @author lion 
+ *	2011-02-05 Based on official H5 PTS server and 551 quest ;)
+ */
+public class Q552_OlympiadVeteran extends Quest
+{
+	// Name
+	private static final String QUEST_NAME = "552_OlympiadVeteran";
+	// NPC
+	private static final int MANAGER = 31688;
+	// Items
+	private static final int Team_Event_Certificate = 17241;
+	private static final int Class_Free_Battle_Certificate = 17242;
+	private static final int Class_Battle_Certificate = 17243;
+	
+	private static final int OLY_CHEST = 17169;
+	
+	public Q552_OlympiadVeteran(int questId, String name, String descr)
+	{
+		super(questId, name, descr);
+		
+		addStartNpc(MANAGER);
+		addTalkId(MANAGER);
+		setOlympiadUse(true);
+	}
+	
+	@Override
+	public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
+	{
+		String htmltext = event;
+		QuestState st = player.getQuestState(getName());
+		if (st == null)
+			return htmltext;
+		
+		if (npc.getNpcId() == MANAGER)
+		{
+			if (event.equalsIgnoreCase("31688-ok.htm"))
+			{
+				st.setState(State.STARTED);
+				st.set("cond", "1");
+				st.playSound("ItemSound.quest_accept");
+			}
+			else if (event.equalsIgnoreCase("exchange_1"))
+			{
+				st.takeItems(Team_Event_Certificate, 1);
+				st.takeItems(Class_Free_Battle_Certificate, 1);
+				st.takeItems(Class_Battle_Certificate, 1);
+				st.giveItems(OLY_CHEST, 1);
+				
+				st.playSound("ItemSound.quest_finish");
+				st.exitQuest(false);
+				
+				htmltext = "31688-exchange.htm";
+			}
+			else if (event.equalsIgnoreCase("exchange_2"))
+			{
+				st.takeItems(Team_Event_Certificate, 1);
+				st.takeItems(Class_Free_Battle_Certificate, 1);
+				st.takeItems(Class_Battle_Certificate, 1);
+				st.giveItems(OLY_CHEST, 2);
+				
+				st.playSound("ItemSound.quest_finish");
+				st.exitQuest(false);
+				
+				htmltext = "31688-exchange.htm";
+			}
+		}
+		return htmltext;
+	}
+	
+	@Override
+	public String onTalk(L2Npc npc, L2PcInstance player)
+	{
+		String htmltext = getNoQuestMsg(player);
+		QuestState st = player.getQuestState(getName());
+		if (st == null)
+			return htmltext;
+		
+		if (npc.getNpcId() == MANAGER)
+		{
+			if (player.getLevel() < 75 || !player.isNoble())
+				htmltext = "31688-00.htm";
+			else if (st.getState() == State.CREATED)
+				htmltext = "31688-01.htm";
+			else if (st.getState() == State.COMPLETED)
+				htmltext = "31688-done.htm";
+			else if (st.getState() == State.STARTED && st.hasQuestItems(Team_Event_Certificate) && st.hasQuestItems(Class_Free_Battle_Certificate) && st.hasQuestItems(Class_Battle_Certificate))
+			{
+				st.takeItems(Team_Event_Certificate, 1);
+				st.takeItems(Class_Free_Battle_Certificate, 1);
+				st.takeItems(Class_Battle_Certificate, 1);
+				st.giveItems(OLY_CHEST, 4);
+				st.playSound("ItemSound.quest_finish");
+				st.exitQuest(false);
+				
+				htmltext = "31688-03.htm";
+			}
+			else if (st.getState() == State.STARTED && (st.hasQuestItems(Team_Event_Certificate) && st.hasQuestItems(Class_Free_Battle_Certificate) || st.hasQuestItems(Team_Event_Certificate) && st.hasQuestItems(Class_Battle_Certificate) || st.hasQuestItems(Class_Free_Battle_Certificate) && st.hasQuestItems(Class_Battle_Certificate)))
+				htmltext = "31688-s2.htm";
+			else if (st.getState() == State.STARTED && (st.hasQuestItems(Team_Event_Certificate) || st.hasQuestItems(Class_Free_Battle_Certificate) || st.hasQuestItems(Class_Battle_Certificate)))
+				htmltext = "31688-s1.htm";
+			else
+				htmltext = "31688-no.htm";
+		}
+		return htmltext;
+	}
+	
+	@Override
+	public void onOlympiadWin(L2PcInstance winner, CompetitionType type)
+	{
+		QuestState st = null;
+		if (winner != null)
+		{
+			st = winner.getQuestState(getName());
+			if (st != null && st.getState() == State.STARTED)
+			{
+				int matches;
+				switch (type)
+				{
+					case CLASSED:
+					{
+						matches = st.getInt("classed") + 1;
+						st.set("classed", String.valueOf(matches));
+						if (matches == 5)
+							st.giveItems(Class_Battle_Certificate, 1);
+						break;
+					}
+					case NON_CLASSED:
+					{
+						matches = st.getInt("nonclassed") + 1;
+						st.set("nonclassed", String.valueOf(matches));
+						if (matches == 5)
+							st.giveItems(Class_Free_Battle_Certificate, 1);
+						break;
+					}
+					case TEAMS:
+					{
+						matches = st.getInt("teams") + 1;
+						st.set("teams", String.valueOf(matches));
+						if (matches == 5)
+							st.giveItems(Team_Event_Certificate, 1);
+						break;
+					}
+				}
+			}
+		}
+	}
+	
+	@Override
+	public void onOlympiadLoose(L2PcInstance looser, CompetitionType type)
+	{
+		QuestState st = null;
+		if (looser != null)
+		{
+			st = looser.getQuestState(getName());
+			if (st != null && st.getState() == State.STARTED)
+			{
+				int matches;
+				switch (type)
+				{
+					case CLASSED:
+					{
+						matches = st.getInt("classed") + 1;
+						st.set("classed", String.valueOf(matches));
+						if (matches == 5)
+							st.giveItems(Class_Battle_Certificate, 1);
+						break;
+					}
+					case NON_CLASSED:
+					{
+						matches = st.getInt("nonclassed") + 1;
+						st.set("nonclassed", String.valueOf(matches));
+						if (matches == 5)
+							st.giveItems(Class_Free_Battle_Certificate, 1);
+						break;
+					}
+					case TEAMS:
+					{
+						matches = st.getInt("teams") + 1;
+						st.set("teams", String.valueOf(matches));
+						if (matches == 5)
+							st.giveItems(Team_Event_Certificate, 1);
+						break;
+					}
+				}
+			}
+		}
+	}
+	
+	public static void main(String[] args)
+	{
+		new Q552_OlympiadVeteran(552, QUEST_NAME, "Olympiad Veteran");
+	}
+}
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q553_OlympiadUndefeated/31688-00.htm b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q553_OlympiadUndefeated/31688-00.htm
new file mode 100644
index 0000000000..1ab5274ce0
--- /dev/null
+++ b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q553_OlympiadUndefeated/31688-00.htm
@@ -0,0 +1,4 @@
+<html><body>Grand Olympiad Manager:<br>
+You do not meet the requirements for taking on this mission.<br>
+(Only noblesse characters above level 75 who have completed a third class transfer can undertake this quest.)<br>
+</body></html>
\ No newline at end of file
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q553_OlympiadUndefeated/31688-01.htm b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q553_OlympiadUndefeated/31688-01.htm
new file mode 100644
index 0000000000..808202bb62
--- /dev/null
+++ b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q553_OlympiadUndefeated/31688-01.htm
@@ -0,0 +1,5 @@
+<html><body>Grand Olympiad Manager:<br>
+If you are not satisfied with just participating in the Grand Olympiad, and you wish to fight for victory, I have a suitable mission for you. Will you accept the challenge? If you prove your abilities, I promise to give you a fitting reward.<br>
+<a action="bypass -h Quest 553_OlympiadUndefeated 31688-ok.htm">Accept</a><br>
+<a action="bypass -h Quest 553_OlympiadUndefeated 31688-02.htm">"Tell me more first."</a>
+</body></html>
\ No newline at end of file
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q553_OlympiadUndefeated/31688-02.htm b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q553_OlympiadUndefeated/31688-02.htm
new file mode 100644
index 0000000000..5716d4a741
--- /dev/null
+++ b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q553_OlympiadUndefeated/31688-02.htm
@@ -0,0 +1,4 @@
+<html><body>Grand Olympiad Manager:<br>
+Enter the Olympiad and take on the challenge of <font color="LEVEL">10 consecutive wins</font>! As you know, consecutive wins means not losing along the way. Whether you have <font color="LEVEL">2 consecutive wins</font> or <font color="LEVEL">5 consecutive wins</font>, you will receive a reward. But it will be nothing compared to the reward for 10 consecutive wins. Also, <font color="LEVEL">5 and 10 consecutive wins</font> will get you the <font color="LEVEL">Medal of Honor</font>. If you're ready, you can come to me. But please remember that once you receive the reward, you cannot take on this mission again today.<br>
+<a action="bypass -h Quest 553_OlympiadUndefeated 31688-ok.htm">Accept</a>
+</body></html>
\ No newline at end of file
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q553_OlympiadUndefeated/31688-03.htm b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q553_OlympiadUndefeated/31688-03.htm
new file mode 100644
index 0000000000..e707e953f3
--- /dev/null
+++ b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q553_OlympiadUndefeated/31688-03.htm
@@ -0,0 +1,3 @@
+<html><head><body>Grand Olympiad Manager:<br>
+Well done. Please come back tomorrow.
+</body></html>
\ No newline at end of file
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q553_OlympiadUndefeated/31688-done.htm b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q553_OlympiadUndefeated/31688-done.htm
new file mode 100644
index 0000000000..3694cf9966
--- /dev/null
+++ b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q553_OlympiadUndefeated/31688-done.htm
@@ -0,0 +1,4 @@
+<html><head><body>Grand Olympiad Manager:<br>
+You have already received the reward for this mission. You should rest before you try again!<br>
+(This quest can only be undertaken once a day. This quest resets everyday at 6:30 AM.)<br>
+</body></html>
\ No newline at end of file
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q553_OlympiadUndefeated/31688-exchange.htm b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q553_OlympiadUndefeated/31688-exchange.htm
new file mode 100644
index 0000000000..28b0c677c9
--- /dev/null
+++ b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q553_OlympiadUndefeated/31688-exchange.htm
@@ -0,0 +1,3 @@
+<html><head><body>Grand Olympiad Manager:<br>
+Well done. Please come back tomorrow.<br>
+</body></html>
\ No newline at end of file
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q553_OlympiadUndefeated/31688-no.htm b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q553_OlympiadUndefeated/31688-no.htm
new file mode 100644
index 0000000000..35dec48a39
--- /dev/null
+++ b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q553_OlympiadUndefeated/31688-no.htm
@@ -0,0 +1,4 @@
+<html><body>Grand Olympiad Manager:<br>
+You did not fulfill the requirements for receiving a reward.<br>
+Please remember about the consecutive wins - you must not be defeated in the middle! There is a reward for 2 consecutive wins or for 5 consecutive wins, but they are nothing compared to the reward for 10 consecutive wins! If you're still satisfied, you can come to me.
+</body></html>
\ No newline at end of file
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q553_OlympiadUndefeated/31688-ok.htm b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q553_OlympiadUndefeated/31688-ok.htm
new file mode 100644
index 0000000000..453c774f3b
--- /dev/null
+++ b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q553_OlympiadUndefeated/31688-ok.htm
@@ -0,0 +1,4 @@
+<html><body>Grand Olympiad Manager:<br>
+The mission has been accepted. Please check to see if there are any other missions. Once preparations are complete, challenge the Olympiad.<br>
+<a action="bypass -h npc_%objectId%_Quest">See other missions.</a><br>
+</body></html>
\ No newline at end of file
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q553_OlympiadUndefeated/31688-w2.htm b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q553_OlympiadUndefeated/31688-w2.htm
new file mode 100644
index 0000000000..0900618b23
--- /dev/null
+++ b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q553_OlympiadUndefeated/31688-w2.htm
@@ -0,0 +1,4 @@
+<html><body>Grand Olympiad Manager:<br>
+I will give you an incomplete reward. Please remember that once you receive the reward, you can;t take on the mission again today. Still want the reward?<br>
+<a action="bypass -h Quest 553_OlympiadUndefeated exchange_2">"Yes."</a>
+</body></html>
\ No newline at end of file
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q553_OlympiadUndefeated/31688-w5.htm b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q553_OlympiadUndefeated/31688-w5.htm
new file mode 100644
index 0000000000..ccb9c61972
--- /dev/null
+++ b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q553_OlympiadUndefeated/31688-w5.htm
@@ -0,0 +1,4 @@
+<html><body>Grand Olympiad Manager:<br>
+I will give you an incomplete reward. Please remember that once you receive the reward, you can;t take on the mission again today. Still want the reward?<br>
+<a action="bypass -h Quest 553_OlympiadUndefeated exchange_5">"Yes."</a>
+</body></html>
\ No newline at end of file
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q553_OlympiadUndefeated/Q553_OlympiadUndefeated.java b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q553_OlympiadUndefeated/Q553_OlympiadUndefeated.java
new file mode 100644
index 0000000000..924310deb1
--- /dev/null
+++ b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q553_OlympiadUndefeated/Q553_OlympiadUndefeated.java
@@ -0,0 +1,182 @@
+/*
+ * This program 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.
+ *
+ * This program 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 quests.Q553_OlympiadUndefeated;
+
+import com.l2jserver.gameserver.model.actor.L2Npc;
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.gameserver.model.olympiad.CompetitionType;
+import com.l2jserver.gameserver.model.quest.Quest;
+import com.l2jserver.gameserver.model.quest.QuestState;
+import com.l2jserver.gameserver.model.quest.State;
+
+/**
+ ** @author lion 
+ * 2011-02-05 Based on official H5 PTS server and 551 quest ;)
+ */
+public class Q553_OlympiadUndefeated extends Quest
+{
+	// Name
+	private static final String QUEST_NAME = "553_OlympiadUndefeated";
+	// NPC
+	private static final int MANAGER = 31688;
+	// Items
+	private static final int WIN_CONF_2 = 17244;
+	private static final int WIN_CONF_5 = 17245;
+	private static final int WIN_CONF_10 = 17246;
+	
+	private static final int OLY_CHEST = 17169;
+	private static final int MEDAL_OF_GLORY = 21874;
+	
+	public Q553_OlympiadUndefeated(int questId, String name, String descr)
+	{
+		super(questId, name, descr);
+		
+		addStartNpc(MANAGER);
+		addTalkId(MANAGER);
+		setOlympiadUse(true);
+	}
+	
+	@Override
+	public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
+	{
+		String htmltext = event;
+		QuestState st = player.getQuestState(getName());
+		if (st == null)
+			return htmltext;
+		
+		if (npc.getNpcId() == MANAGER)
+		{
+			if (event.equalsIgnoreCase("31688-ok.htm"))
+			{
+				st.setState(State.STARTED);
+				st.set("cond", "1");
+				st.playSound("ItemSound.quest_accept");
+			}
+			else if (event.equalsIgnoreCase("exchange_2"))
+			{
+				st.takeItems(WIN_CONF_2, 1);
+				st.giveItems(OLY_CHEST, 1);
+				st.playSound("ItemSound.quest_finish");
+				st.exitQuest(false);
+				
+				htmltext = "31688-exchange.htm";
+			}
+			else if (event.equalsIgnoreCase("exchange_5"))
+			{
+				st.takeItems(WIN_CONF_2, 1);
+				st.giveItems(OLY_CHEST, 2);
+				
+				st.takeItems(WIN_CONF_5, 1);
+				st.giveItems(MEDAL_OF_GLORY, 3);
+				st.playSound("ItemSound.quest_finish");
+				st.exitQuest(false);
+				
+				htmltext = "31688-exchange.htm";
+			}
+		}
+		return htmltext;
+	}
+	
+	@Override
+	public String onTalk(L2Npc npc, L2PcInstance player)
+	{
+		String htmltext = getNoQuestMsg(player);
+		QuestState st = player.getQuestState(getName());
+		if (st == null)
+			return htmltext;
+		
+		if (npc.getNpcId() == MANAGER)
+		{
+			if (player.getLevel() < 75 || !player.isNoble())
+				htmltext = "31688-00.htm";
+			else if (st.getState() == State.CREATED)
+				htmltext = "31688-01.htm";
+			else if (st.getState() == State.COMPLETED)
+				htmltext = "31688-done.htm";
+			else if (st.getState() == State.STARTED && st.getInt("cond") == 1 && st.hasQuestItems(WIN_CONF_2))
+				htmltext = "31688-w2.htm";
+			else if (st.getState() == State.STARTED && st.getInt("cond") == 1 && st.hasQuestItems(WIN_CONF_5))
+				htmltext = "31688-w5.htm";
+			else if (st.getState() == State.STARTED && st.getInt("cond") == 2 && st.hasQuestItems(WIN_CONF_10))
+			{
+				st.takeItems(WIN_CONF_2, 1);
+				st.takeItems(WIN_CONF_5, 1);
+				st.takeItems(WIN_CONF_10, 1);
+				st.giveItems(OLY_CHEST, 4);
+				st.giveItems(MEDAL_OF_GLORY, 5);
+				st.playSound("ItemSound.quest_finish");
+				st.exitQuest(false);
+				
+				htmltext = "31688-03.htm";
+			}
+			else
+				htmltext = "31688-no.htm";
+		}
+		return htmltext;
+	}
+	
+	@Override
+	public void onOlympiadWin(L2PcInstance winner, CompetitionType type)
+	{
+		QuestState st = null;
+		if (winner != null)
+		{
+			st = winner.getQuestState(getName());
+			if (st != null && st.getState() == State.STARTED)
+			{
+				int matches = st.getInt("undefeatable") + 1;
+				st.set("undefeatable", String.valueOf(matches));
+				switch (matches)
+				{
+					case 2:
+						st.giveItems(WIN_CONF_2, 1);
+						break;
+					case 5:
+						st.giveItems(WIN_CONF_5, 1);
+						break;
+					case 10:
+						st.giveItems(WIN_CONF_10, 1);
+						st.set("cond", "2");
+						break;
+				}
+			}
+		}
+	}
+	
+	@Override
+	public void onOlympiadLoose(L2PcInstance looser, CompetitionType type)
+	{
+		QuestState st = null;
+		if (looser != null)
+		{
+			st = looser.getQuestState(getName());
+			if (st != null && st.getState() == State.STARTED && st.getInt("cond") < 2)
+			{
+				st.set("undefeatable", "0");
+				if (st.hasQuestItems(WIN_CONF_2))
+					st.takeItems(WIN_CONF_2, 1);
+				if (st.hasQuestItems(WIN_CONF_5))
+					st.takeItems(WIN_CONF_5, 1);
+				if (st.hasQuestItems(WIN_CONF_10))
+					st.takeItems(WIN_CONF_10, 1);
+			}
+		}
+	}
+	
+	public static void main(String[] args)
+	{
+		new Q553_OlympiadUndefeated(553, QUEST_NAME, "Olympiad Undefeated");
+	}
+}
-- 
GitLab