ZURSULUS L2

Tragedy in von Hellmann Forest

ID
22
Название
Tragedy in von Hellmann Forest
start_npcs_json
[31334]
npc_ids_json
[27217,31328,31334,31527,31528,31529]
constants_json
{"INNOCENTIN":31328,"TIFAREN":31334,"WELL":31527,"GHOST_OF_PRIEST":31528,"GHOST_OF_ADVENTURER":31529,"SOUL_OF_WELL":27217,"CROSS_OF_EINHASAD":7141,"LOST_SKULL_OF_ELF":7142,"LETTER_OF_INNOCENTIN":7143,"JEWEL_OF_ADVENTURER_1":7144,"JEWEL_OF_ADVENTURER_2":7145,"SEALED_REPORT_BOX":7146,"REPORT_BOX":7147,"MIN_LEVEL":63}
Статус разбора
metadata_only; dynamic Java conditions/rewards retained in source; unresolved starts: []
Источник
game/data/scripts/quests/Q00022_TragedyInVonHellmannForest/Q00022_TragedyInVonHellmannForest.java

NPC квеста

IDНазваниеСтарт квестаУровень
27217Soul of WellНет63
31328InnocentinНет70
31334TifarenДа70
31527WellНет70
31528Ghost of PriestНет70
31529Ghost of AdventurerНет70

Условия уровней: выражения из Java

private static final int MIN_LEVEL = 63;
if ((player.getLevel() >= MIN_LEVEL) && (qs2 != null) && qs2.isCompleted())
if (player.getLevel() >= MIN_LEVEL)

Выдача предметов, адены и опыта: выражения из Java

giveItems(player, LETTER_OF_INNOCENTIN, 1);
giveItems(player, JEWEL_OF_ADVENTURER_1, 1);
giveItems(player, CROSS_OF_EINHASAD, 1);
addExpAndSp(player, 345966, 31578);
giveItems(player, SEALED_REPORT_BOX, 1);
giveItems(player, REPORT_BOX, 1);
giveItems(attacker, JEWEL_OF_ADVENTURER_2, 1);
giveItems(killer, LOST_SKULL_OF_ELF, 1);

Квесты содержат динамические условия Java. Выражения выдачи включают промежуточные предметы, варианты и случайные награды; это не гарантированная награда. Константы приведены выше. Полные условия — в исходнике.

Тексты квеста

[31328-01.htm] Innocentin: Ah, hello again! Sometime ago, a priest here doing volunteer work found a crucifix and brought it to me. It was the very same crucifix I gave you! Did you drop it? Take this crucifix to Magister Tifaren immediately! [31328-01b.htm] Innocentin: Take this crucifix to Magister Tifaren and ask her to perform necromancy. She tends to be quite wary of strangers, so you may need to prove your sincerity to her. Keep trying, she'll come around. [31328-02.htm] Innocentin: Come on in! Did he tell you anything? "Well, he said..." [31328-03.htm] Innocentin I see.. Lidia von Hellmann was lord of the Forest of the Dead! She was Alfred's daughter, a survivor of the tragedy of Hellmann Forest... Thank you. Thanks to you, we know that his death wasn't in vain... I will treasure this crucifix always! Hmm..? Was there something else? "Who's behind all of this?" [31328-04.htm] Innocentin: Do you want to ask me something? "Who is behind the tragedy?" [31328-05.htm] Innocentin: Who's behind the tragedy? Well, there are several theories, I'm sure you've heard them all! Why don't I tell you one you probably haven't heard... Alfred von Hellmann and I were very close friends and he shared with me the terrible dissatisfaction he had in his heart... "I heard that he didn't intentionally become a traitor." [31328-06.htm] Innocentin: Exactly! He only meant to encourage the lame duck king! He never even considered treason until his meeting with a mystic in the forest! Around that time I hired a treasure hunter to find out exactly what was going on with Alfred... That didn't go well at all! "What happened?" [31328-07.htm] Innocentin: He was accused of worshipping the devil! His secretive nature, along with the sensitivity of the mission, led to his downfall. I was occupied elsewhere and couldn't protect him... He was charged, convicted and executed on the square of Rune Castle! The evidence he had gathered for me was thrown into a deserted well. "Tell me more!" [31328-08.htm] Innocentin: It's said that his ghost visits that well every night. I'd always believed that all ghosts were evil, but after my experiences with necromancy, the realm of the gods is denied to me. I must find out what actually happened! Would you meet with him and ask him what he found out? "I'll do it." [31328-09.htm] Innocentin: You'll find the well in the northwest part of the village. Show the ghost the letter and he'll grant your request. [31328-09a.htm] Innocentin: The ghost of the treasure hunter is said to appear around the well in the northwest part of the village. Take the letter to him and come back to me with his reply. [31328-10.htm] Innocentin: Oh, you're back? Did you bring any news? "Check out this box." [31328-11.htm] Innocentin: Indeed! Is this the box he told you about? He told me once, in case something happened to him, he would store all his most important documents in a box! Hmm... I can't help but think... Perhaps it's fortunate that I left the temple and came here! Ah... but that's not important... Now give me the box! I must open it carefully and see what it holds. Why don't you come back a little later? [31328-12.htm] Innocentin: It's the report of the Mystic Neidrahu, the instigator of the insurrection! Do you care to read it? "Yes!" [31328-13.htm] Regarding Neidrahu "... No one knows for sure how deeply Alfred von Hellmann was influenced by his magic, for his eloquence was certainly equal to his magic ability. Alfred wasn't the only one swayed by his words. Neidrahu called himself a messenger, and personally gathered many supporters for the insurrection." Turn the page [31328-14.htm] "Nidrah's preaching persuaded his followers of the awesome power of the dark arts. He often spoke of a powerful magus known as a devil, who practiced magic in Gludio. He convinced them that his own power was equal to the devil's! Information regarding Beleth, Black Magus and the pastoral history of the wasteland of Gludio was all available at the main library. Although many were suspicious of his claims, eventually they believed him." Turn the page [31328-15.htm] "This was to be his greatest accomplishment! The army of undead that he conjured played a pivotal role in the tragedy that occurred in the Hellmann Forest, but the outcome wasn't as he expected... Before his army was ready, the King learned of the Hellmann family's treason. In a fit of rage, and without any consultations, the King mobilized an occupation force and marched on the Hellmann Forest." Next Page [31328-16.htm] "The supporters of the von Hellmann family fought bravely, but their lack of organization was their undoing. As the King's army approached, the family finally realized that they had failed. By then, most of their sympathizers had been beheaded or taken prisoner by the King's army. The von Hellmanns were very powerful, but their treasonous behavior caused them to fall into disgrace and to be renounced by the royal family. The fall was especially painful to Alfred, who, as patriarch, had to watch as his vassals and then his family were tortured and beheaded, before he ascended the scaffold himself. Turn the page [31328-17.htm] "It was then that Nidrah's magic sprang into action! At dusk, as the King's army took inventory of the treasures of the Hellmann family, a huge army of undead fighters rushed the castle! They were the souls of the executed vassals, led by Alfred's children Lidia and Eilhalder von Hellmann! All were under the control of Nidrah." Turn the page [31328-18.htm] "What happened next was a repeat of the events of the war with Beleth. Those killed by an undead were resurrected and enlisted in Lidia's force. The higher-level vassals of the Hellmann family became vampires, or high level undead. They possessed indescribable power! It seemed the battle was over, until..." Next Page [31328-19.htm] "I had my doubts about Lidia. If she was resurrected, how did she become Lord of the Forest of the Dead? Why not Alfred? I think she conspired with Nidrah! I'll investigate this further." Hmm... [31328-20.htm] Innocentin: Did you finish it? It's the true account of the terrible tragedy that occurred in Hellmann Forest... But it doesn't answer all of my questions... Would you do something for me? I'm afraid it won't be easy, and you look very tired! Why don't you take a break and come back when you're refreshed. [31328-21.htm] Innocentin: Did you finish it? It's the true account of the terrible tragedy that occurred in Hellmann Forest... But it doesn't answer all of my questions... Would you do something for me? I'm afraid it won't be easy, and you look very tired! Why don't you take a break and come back later when you're refreshed and have had a little more training. (The Heart of Lidia quest may only be undertaken by a character of level 64 or above.) [31328-22.htm] Innocentin: Did you finish it? It's the true account of the terrible tragedy that occurred in Hellmann Forest... But it doesn't answer all of my questions... Would you do something for me? I'm afraid it won't be easy, and you look very tired! Why don't you take a break and come back when you're refreshed. [31328-23.htm] Innocentin: Did you finish it? It's the true account of the terrible tragedy that occurred in Hellmann Forest... But it doesn't answer all of my questions... Would you do something for me? I'm afraid it won't be easy, and you look very tired! Why don't you take a break and come back later when you're refreshed and have had a little more training. (The Heart of Lidia quest may only be undertaken by a character of level 64 and above.) [31334-01.htm] Grand Magister Tifaren: What's your business here? "I need the necromantic rite of communion performed." [31334-02.htm] Grand Magister Tifaren: The necromantic rite of communion is a secret rite performed only by the children of Shilen. It is our secret heritage. Not everyone may receive it. Who sent you? "High Priest Innocentin sent me." [31334-03.htm] Grand Magister Tifaren: You want me to hold a seance? The necromantic rite of communion is the secret magic of Dark Elves. It's not for novices! (This quest may only be undertaken by a character of level 63 and above who has completed Hidden Truth quest.) [31334-04.htm] Grand Magister Tifaren: High priest of Einhasad? Ha! You amuse me, now go! [31334-05.htm] Grand Magister Tifaren: Unbelievable! Whose soul could the high priest want me to summon with dark magic? Doesn't he serve the god of light? Show her Einhasad's Crucifix. [31334-06.htm] Grand Magister Tifaren: Einhasad's Crucifix! You would have me summon the soul of a priest? I believe you that High Priest Innocentin sent you. Since he requests it, I'll do my best. I need you to bring me something. "What?" [31334-07.htm] Grand Magister Tifaren: You say High Priest Innocentin asks me to hold a seance? You're kidding, right? Show me proof or be on your way! [31334-08.htm] Grand Magister Tifaren: Hunt zombies or ghosts in the Forest of the Dead for a clean skull, preferably an Elven one. It will increase my chances of summoning a priest of Einhasad to use a child of Shilen. [31334-09.htm] Grand Magister Tifaren: I believe High Priest Innocentin sent you. Hunt zombies or ghosts in the Forest of the Dead to find me a clean skull, preferably an Elven one. It will increase my chances of summoning a priest of Einhasad to use a child of Shilen. [31334-10.htm] Grand Magister Tifaren: An Elven skull! Now I can proceed. Wait for incantation [31334-11.htm] Grand Magister Tifaren: Is that an Elven skull? Good. However, I'm busy helping someone else, you'll have to come back later. [31334-12.htm] Grand Magister Tifaren: In the name of the Mother, come to me! I, who have mastered the laws of nature, demand that you obey my order! Your spirit shall reside within this vessel. Come! Wait [31334-13.htm] Grand Magister Tifaren: Success! My work is done. The soul is not stable in this vessel. It won't last long! Find out the rest directly from him before he leaves this realm! [31334-14.htm] Grand Magister Tifaren: My concentration has been broken! Come back later when it's quieter. I can't focus with so many people around. [31334-15.htm] Grand Magister Tifaren: I don't want to get involved with a priest of Einhasad. He's right here, finish your business quickly! [31334-16.htm] Grand Magister Tifaren: This ghost isn't the one you requested. Someone else must be conducting the seance as well! Come back when it's quieter and I'll try again. [31334-17.htm] Grand Magister Tifaren: Two minutes wasn't enough? I'll try bringing him out once more. This time, finish your talk! Try again [31334-18.htm] Grand Magister Tifaren: Finished? Don't tell me. Probably something related to Innocentin. Take it to him, I don't want to get involved! [31527-01.htm] Well: Ominous energy emanates from the well. Explore the well [31527-02.htm] Well: A spirit attacks you from the well. [31527-03.htm] Well: Be prepared to fight the spirit from the well! [31527-04.htm] Well: The box inside the well is within your reach. [31527-05.htm] Well: I'll have nothing more to do with this ominous well. [31528-01.htm] Ghost of Priest: It's all so confusing... "Can you remember anything?" [31528-02.htm] Ghost of Priest: I'm not sure... It's all so foggy. Why am I here? "I used necromancy." [31528-03.htm] Ghost of Priest: .................... (Points to Tifaren.) [31528-04.htm] Ghost of Priest: It's all so foggy. Can you be more specific? "What about the Lord of Forest of the Dead?" [31528-05.htm] Ghost of Priest: You must mean Lidia von Hellmann, she was the only survivor of the tragedy here. "What tragedy?" [31528-06.htm] Ghost of Priest: The tragedy of the Hellmann forest was the massacre of the royal family. The King's army slaughtered them and all of their supporters. That's how this forest got it's name. "Why were they killed?" [31528-07.htm] Ghost of Priest: The Hellmann family had revolted against the kingdom, hoping that the King would fight. However, the King had lost his will to fight since losing his wife and son at the battle against Amadeo, King of Aden. The result was a disaster and not what Alfred Von Hellmann had wanted. I need to ask him if there was somebody behind the scenes. [31528-08.htm] Ghost of Priest: I don't know. The High Priest was investigating, ask him! [31529-01.htm] Ghost of Adventurer: Do you have something to tell a ghost who is neither alive nor dead? "I came to listen to you." [31529-02.htm] Ghost of Adventurer: What do you want to know? "Here's a letter from the High Priest of the Earth." [31529-03.htm] Ghost of Adventurer: This is from High Priest Innocentin? He wants me to work even when I'm dead? Einhasad Temple must be worse off than I thought. Well, I don't have anything else to do, so what do you want to know? "I want to know about the Mage of the dark arts." [31529-03a.htm] Ghost of Adventurer: This is from the Priest of the Earth? He wants me to work even when I'm dead? Einhasad Temple must be worse off than I thought. Well, I don't have anything else to do, so what do you want to know? "I want to know about the Mage of the dark arts." [31529-04.htm] Ghost of Adventurer: His name is Neid, short for Nidrah. I can't rest in peace until I find him. "Tell me about him." [31529-05.htm] Ghost of Adventurer: The shock of decapitation has dulled my memory, so I don't remember him well, and his disciples burned all the records. I think I remember why I'm here. "Why?" [31529-06.htm] Ghost of Adventurer: I remember now! I hid the book about him in this well. The heads of those accused of following demons were thrown into it. If you enter the well, they'll attack you! "Is there no other way?" [31529-07.htm] Ghost of Adventurer: Of course! We just came up with another way. "What is it?" [31529-08.htm] Ghost of Adventurer: They aren't very smart! They'll attack if you touch the well. All you have to do is fight them. While you're fighting, I'll lift up the gate of the well. You can back out if you want to... "I'll do it!" "I quit." [31529-09.htm] Ghost of Adventurer: It's your loss, not mine. [31529-10.htm] Ghost of Adventurer: They aren't very smart! They'll attack if you touch the well. All you have to do is fight them. While you're fighting, I'll lift up the gate of the well. You can back out if you want to... "I'll do it!" "I don't want to do it." [31529-11.htm] Ghost of Adventurer: Ok. Then, let's talk about the method. First, take this jewelry. If you hit the well, the spirits will come out. While you are fighting with the spirits, I will break the seal of the hidden report in the well Just, don't kill the spirit while I'm working. Because they will come back to the well if they die. If I break the seal, the color of the jewelry will change. After that, you can kill the spirit or do whatever you want. You got it? "I am not sure" "I see" [31529-12.htm] Ghost of Adventurer: If you hit the well, the spirits will come out. While you are fighting with the spirits, I will break the seal of the hidden report in the well Just, don't kill the spirit while I'm working. Because they will come back to the well if they die. If I break the seal, the color of the jewelry will change. After that, you can kill the spirit or do whatever you want. You got it? "I am not sure" "I see" [31529-13.htm] Ghost of Adventurer: What don't you get? Fight with them, don't kill them. When the jewelry changes color, find me. Don't kill the spirits before the jewelry changes color! [31529-13a.htm] Ghost of Adventurer: OK! Go ahead! [31529-14.htm] Ghost of Adventurer: Hey, why don't you do a good job? You can't just hit once and then run away like a child! Real work isn't easy! You must call the soul by beating the well, fight until the jewil changes color, and then investigate the will! Is that clear? [31529-15.htm] Ghost of Adventurer: The report is at the gate of the well. Since I'm a ghost, you'll have to get it. [31529-16.htm] Ghost of Adventurer: This is it! I'll break the first seal. Give it to Innocentin, only he can finish opening the lock. Until we meet again! [31529-17.htm] Ghost of Adventurer: This is my life's work! Quickly, find Innocentin! [31529-18.htm] Ghost of Adventurer: This is it! I'll break the first seal. Give it to Innocentin, only he can finish opening the lock. Until we meet again! [31529-19.htm] Ghost of Adventurer: This is my life's work! Quickly, find Innocentin!
Исходник условий и наград (Java)
/*
 * Copyright (c) 2013 L2jMobius
 * 
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 * 
 * The above copyright notice and this permission notice shall be
 * included in all copies or substantial portions of the Software.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
 * IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */
package quests.Q00022_TragedyInVonHellmannForest;

import org.l2jmobius.gameserver.config.PlayerConfig;
import org.l2jmobius.gameserver.entity.Location;
import org.l2jmobius.gameserver.entity.actor.Npc;
import org.l2jmobius.gameserver.entity.actor.Player;
import org.l2jmobius.gameserver.mechanics.script.Quest;
import org.l2jmobius.gameserver.mechanics.script.QuestSound;
import org.l2jmobius.gameserver.mechanics.script.QuestState;
import org.l2jmobius.gameserver.mechanics.script.QuestTimer;
import org.l2jmobius.gameserver.network.enums.ChatType;
import org.l2jmobius.gameserver.util.LocationUtil;

import quests.Q00021_HiddenTruth.Q00021_HiddenTruth;

public class Q00022_TragedyInVonHellmannForest extends Quest
{
	// NPCs
	private static final int INNOCENTIN = 31328;
	private static final int TIFAREN = 31334;
	private static final int WELL = 31527;
	private static final int GHOST_OF_PRIEST = 31528;
	private static final int GHOST_OF_ADVENTURER = 31529;
	
	// Monsters
	private static final int[] MOBS =
	{
		21553, // Trampled Man
		21554, // Trampled Man
		21555, // Slaughter Executioner
		21556, // Slaughter Executioner
		21561, // Sacrificed Man
	};
	private static final int SOUL_OF_WELL = 27217;
	
	// Items
	private static final int CROSS_OF_EINHASAD = 7141;
	private static final int LOST_SKULL_OF_ELF = 7142;
	private static final int LETTER_OF_INNOCENTIN = 7143;
	private static final int JEWEL_OF_ADVENTURER_1 = 7144;
	private static final int JEWEL_OF_ADVENTURER_2 = 7145;
	private static final int SEALED_REPORT_BOX = 7146;
	private static final int REPORT_BOX = 7147;
	
	// Misc
	private static final int MIN_LEVEL = 63;
	private static final Location PRIEST_LOC = new Location(38354, -49777, -1128);
	private static final Location SOUL_WELL_LOC = new Location(34706, -54590, -2054);
	private static int _tifarenOwner = 0;
	private static Npc _soulWellNpc = null;
	
	public Q00022_TragedyInVonHellmannForest()
	{
		super(22, "Tragedy in von Hellmann Forest");
		addKillId(MOBS);
		addKillId(SOUL_OF_WELL);
		addAttackId(SOUL_OF_WELL);
		addStartNpc(TIFAREN);
		addTalkId(INNOCENTIN, TIFAREN, WELL, GHOST_OF_PRIEST, GHOST_OF_ADVENTURER);
		registerQuestItems(LOST_SKULL_OF_ELF, CROSS_OF_EINHASAD, REPORT_BOX, JEWEL_OF_ADVENTURER_1, JEWEL_OF_ADVENTURER_2, SEALED_REPORT_BOX);
	}
	
	@Override
	public String onEvent(String event, Npc npc, Player player)
	{
		final QuestState qs = player.getQuestState(getName());
		String htmltext = null;
		if (qs == null)
		{
			return htmltext;
		}
		
		switch (event)
		{
			case "31529-02.htm":
			case "31529-04.htm":
			case "31529-05.htm":
			case "31529-06.htm":
			case "31529-07.htm":
			case "31529-09.htm":
			case "31529-13.htm":
			case "31529-13a.htm":
			case "31528-02.htm":
			case "31528-05.htm":
			case "31528-06.htm":
			case "31528-07.htm":
			case "31328-13.htm":
			case "31328-06.htm":
			case "31328-05.htm":
			case "31328-02.htm":
			case "31328-07.htm":
			case "31328-08.htm":
			case "31328-14.htm":
			case "31328-15.htm":
			case "31328-16.htm":
			case "31328-17.htm":
			case "31328-18.htm":
			case "31334-12.htm":
			{
				htmltext = event;
				break;
			}
			case "31334-02.htm":
			{
				if (qs.isCreated())
				{
					final QuestState qs2 = player.getQuestState(Q00021_HiddenTruth.class.getSimpleName());
					if ((player.getLevel() >= MIN_LEVEL) && (qs2 != null) && qs2.isCompleted())
					{
						htmltext = event;
					}
					else
					{
						htmltext = "31334-03.htm";
					}
				}
				break;
			}
			case "31334-04.htm":
			{
				if (qs.isCreated())
				{
					qs.startQuest();
					htmltext = event;
				}
				break;
			}
			case "31334-07.htm":
			{
				if (!hasQuestItems(player, CROSS_OF_EINHASAD))
				{
					qs.setCond(2);
					htmltext = event;
				}
				else
				{
					htmltext = "31334-06.htm";
					qs.setCond(3);
				}
				break;
			}
			case "31334-08.htm":
			{
				if (qs.isCond(3))
				{
					qs.setCond(4, true);
					htmltext = event;
				}
				break;
			}
			case "31334-13.htm":
			{
				final int cond = qs.getCond();
				if (((5 <= cond) && (cond <= 7)) && hasQuestItems(player, CROSS_OF_EINHASAD))
				{
					if (_tifarenOwner == 0)
					{
						_tifarenOwner = player.getObjectId();
						final Npc ghost2 = addSpawn(GHOST_OF_PRIEST, PRIEST_LOC, true, 0);
						ghost2.setScriptValue(player.getObjectId());
						startQuestTimer("DESPAWN_GHOST2", 1000 * 120, ghost2, player);
						ghost2.broadcastSay(ChatType.GENERAL, "Did you call me, " + player.getName() + "?");
						if (((cond == 5) || (cond == 6)) && hasQuestItems(player, LOST_SKULL_OF_ELF))
						{
							takeItems(player, LOST_SKULL_OF_ELF, -1);
							qs.setCond(7, true);
						}
						
						htmltext = event;
					}
					else
					{
						qs.setCond(6);
						htmltext = "31334-14.htm";
					}
				}
				break;
			}
			case "31528-04.htm":
			{
				if (npc.getScriptValue() == player.getObjectId())
				{
					playSound(player, QuestSound.ITEMSOUND_QUEST_ACCEPT);
					htmltext = event;
				}
				break;
			}
			case "31528-08.htm":
			{
				final QuestTimer qt = getQuestTimer("DESPAWN_GHOST2", npc, player);
				if ((qt != null) && (npc.getScriptValue() == player.getObjectId()))
				{
					qt.cancel();
					npc.setScriptValue(0);
					startQuestTimer("DESPAWN_GHOST2", 1000 * 3, npc, player);
					qs.setCond(8, true);
					htmltext = event;
				}
				break;
			}
			case "DESPAWN_GHOST2":
			{
				_tifarenOwner = 0;
				if (npc.getScriptValue() != 0)
				{
					npc.broadcastSay(ChatType.GENERAL, "I_M_CONFUSED_MAYBE_IT_S_TIME_TO_GO_BACK");
				}
				
				npc.deleteMe();
				break;
			}
			case "31328-03.htm":
			{
				if (qs.isCond(8))
				{
					takeItems(player, CROSS_OF_EINHASAD, -1);
					htmltext = event;
				}
				break;
			}
			case "31328-09.htm":
			{
				if (qs.isCond(8))
				{
					giveItems(player, LETTER_OF_INNOCENTIN, 1);
					qs.setCond(9, true);
					htmltext = event;
				}
				break;
			}
			case "31328-11.htm":
			{
				if (qs.isCond(14) && hasQuestItems(player, REPORT_BOX))
				{
					takeItems(player, REPORT_BOX, -1);
					qs.setCond(15, true);
					htmltext = event;
				}
				break;
			}
			case "31328-19.htm":
			{
				if (qs.isCond(15))
				{
					qs.setCond(16, true);
					htmltext = event;
				}
				break;
			}
			case "31527-02.htm":
			{
				if (qs.isCond(10) && (_soulWellNpc == null))
				{
					_soulWellNpc = addSpawn(SOUL_OF_WELL, SOUL_WELL_LOC, true, 0);
					startQuestTimer("activateSoulOfWell", 90000, _soulWellNpc, player);
					startQuestTimer("despawnSoulOfWell", 120000, _soulWellNpc, player);
					_soulWellNpc.getAI().setIntentionAttack(player);
					
					htmltext = event;
				}
				else
				{
					htmltext = "31527-03.htm";
				}
				break;
			}
			case "activateSoulOfWell":
			{
				// this enables onAttack ELSE IF block which allows the player to proceed the quest
				npc.setScriptValue(1);
				break;
			}
			case "despawnSoulOfWell":
			{
				// if the player fails to proceed the quest in 2 minutes, the soul is unspawned
				if (!npc.isDead())
				{
					_soulWellNpc = null;
				}
				
				npc.deleteMe();
				break;
			}
			case "31529-03.htm":
			{
				if (qs.isCond(9) && hasQuestItems(player, LETTER_OF_INNOCENTIN))
				{
					qs.set("memoState", "8");
					htmltext = event;
				}
				break;
			}
			case "31529-08.htm":
			{
				if (qs.getInt("memoState") == 8)
				{
					qs.set("memoState", "9");
					htmltext = event;
				}
				break;
			}
			case "31529-11.htm":
			{
				if (qs.getInt("memoState") == 9)
				{
					giveItems(player, JEWEL_OF_ADVENTURER_1, 1);
					qs.setCond(10, true);
					qs.set("memoState", "10");
					htmltext = event;
				}
				break;
			}
		}
		
		return htmltext;
	}
	
	@Override
	public String onTalk(Npc npc, Player player)
	{
		final QuestState qs = getQuestState(player, true);
		String htmltext = getNoQuestMsg(player);
		switch (npc.getId())
		{
			case TIFAREN:
			{
				switch (qs.getCond())
				{
					case 0:
					{
						if (qs.isCreated())
						{
							htmltext = "31334-01.htm";
						}
						else if (qs.isCompleted())
						{
							htmltext = getAlreadyCompletedMsg(player);
						}
						break;
					}
					case 1:
					case 3:
					{
						htmltext = "31334-05.htm";
						break;
					}
					case 4:
					case 5:
					{
						if (hasQuestItems(player, CROSS_OF_EINHASAD))
						{
							if (!hasQuestItems(player, LOST_SKULL_OF_ELF))
							{
								htmltext = "31334-09.htm";
							}
							else if (_tifarenOwner == 0)
							{
								htmltext = "31334-10.htm";
							}
							else
							{
								htmltext = "31334-11.htm";
							}
						}
						break;
					}
					case 6:
					case 7:
					{
						if (hasQuestItems(player, CROSS_OF_EINHASAD))
						{
							if (_tifarenOwner == 0)
							{
								htmltext = "31334-17.htm";
							}
							else if (_tifarenOwner == player.getObjectId())
							{
								htmltext = "31334-15.htm";
							}
							else
							{
								htmltext = "31334-16.htm";
								qs.setCond(6);
							}
						}
						break;
					}
					case 8:
					{
						if (hasQuestItems(player, CROSS_OF_EINHASAD))
						{
							htmltext = "31334-18.htm";
						}
						break;
					}
				}
				break;
			}
			case GHOST_OF_PRIEST:
			{
				if (npc.getScriptValue() == player.getObjectId())
				{
					htmltext = "31528-01.htm";
				}
				else
				{
					htmltext = "31528-03.htm";
				}
				break;
			}
			case INNOCENTIN:
			{
				switch (qs.getCond())
				{
					case 2:
					{
						if (!hasQuestItems(player, CROSS_OF_EINHASAD))
						{
							giveItems(player, CROSS_OF_EINHASAD, 1);
							qs.setCond(3);
							htmltext = "31328-01.htm";
						}
						break;
					}
					case 3:
					{
						if (hasQuestItems(player, CROSS_OF_EINHASAD))
						{
							htmltext = "31328-01b.htm";
						}
						break;
					}
					case 8:
					{
						if (hasQuestItems(player, CROSS_OF_EINHASAD))
						{
							htmltext = "31328-02.htm";
						}
						else
						{
							htmltext = "31328-04.htm";
						}
						break;
					}
					case 9:
					{
						htmltext = "31328-09a.htm";
						break;
					}
					case 14:
					{
						if (hasQuestItems(player, REPORT_BOX))
						{
							htmltext = "31328-10.htm";
						}
						break;
					}
					case 15:
					{
						htmltext = "31328-12.htm";
						break;
					}
					case 16:
					{
						addExpAndSp(player, 345966, 31578);
						qs.exitQuest(false);
						if (player.getLevel() >= MIN_LEVEL)
						{
							htmltext = "31328-20.htm";
						}
						else
						{
							htmltext = "31328-21.htm";
						}
						break;
					}
				}
				break;
			}
			case WELL:
			{
				switch (qs.getCond())
				{
					case 10:
					{
						if (hasQuestItems(player, JEWEL_OF_ADVENTURER_1))
						{
							htmltext = "31527-01.htm";
							
						}
						break;
					}
					case 12:
					{
						if (hasQuestItems(player, JEWEL_OF_ADVENTURER_2) && !hasQuestItems(player, SEALED_REPORT_BOX))
						{
							giveItems(player, SEALED_REPORT_BOX, 1);
							qs.setCond(13);
							htmltext = "31527-04.htm";
						}
						break;
					}
					case 13:
					case 14:
					case 15:
					case 16:
					{
						htmltext = "31527-05.htm";
						break;
					}
				}
				break;
			}
			case GHOST_OF_ADVENTURER:
			{
				switch (qs.getCond())
				{
					case 9:
					{
						if (hasQuestItems(player, LETTER_OF_INNOCENTIN))
						{
							switch (qs.getInt("memoState"))
							{
								case 0:
								{
									htmltext = "31529-01.htm";
									break;
								}
								case 8:
								{
									htmltext = "31529-03a.htm";
									break;
								}
								case 9:
								{
									htmltext = "31529-10.htm";
									break;
								}
								default:
								{
									break;
								}
							}
						}
						break;
					}
					case 10:
					{
						if (hasQuestItems(player, JEWEL_OF_ADVENTURER_1))
						{
							final int id = qs.getInt("memoState");
							if (id == 10)
							{
								htmltext = "31529-12.htm";
							}
							else if (id == 11)
							{
								htmltext = "31529-14.htm";
							}
						}
						break;
					}
					case 11:
					{
						if (hasQuestItems(player, JEWEL_OF_ADVENTURER_2) && !hasQuestItems(player, SEALED_REPORT_BOX))
						{
							htmltext = "31529-15.htm";
							qs.setCond(12);
						}
						break;
					}
					case 13:
					{
						if (hasQuestItems(player, JEWEL_OF_ADVENTURER_2) && hasQuestItems(player, SEALED_REPORT_BOX))
						{
							giveItems(player, REPORT_BOX, 1);
							takeItems(player, SEALED_REPORT_BOX, -1);
							takeItems(player, JEWEL_OF_ADVENTURER_2, -1);
							qs.setCond(14);
							htmltext = "31529-16.htm";
						}
						break;
					}
					case 14:
					{
						if (hasQuestItems(player, REPORT_BOX))
						{
							htmltext = "31529-17.htm";
						}
						break;
					}
				}
				break;
			}
		}
		
		return htmltext;
	}
	
	@Override
	public void onAttack(Npc npc, Player attacker, int damage, boolean isSummon)
	{
		final QuestState qs = attacker.getQuestState(getName());
		if ((qs != null) && qs.isCond(10) && hasQuestItems(attacker, JEWEL_OF_ADVENTURER_1))
		{
			if (qs.getInt("memoState") == 10)
			{
				qs.set("memoState", "11");
			}
			else if (npc.isScriptValue(1))
			{
				takeItems(attacker, JEWEL_OF_ADVENTURER_1, -1);
				giveItems(attacker, JEWEL_OF_ADVENTURER_2, 1);
				qs.setCond(11);
			}
		}
	}
	
	@Override
	public void onKill(Npc npc, Player killer, boolean isSummon)
	{
		if (LocationUtil.checkIfInRange(PlayerConfig.ALT_PARTY_RANGE, killer, npc, true))
		{
			if (npc.getId() == SOUL_OF_WELL)
			{
				_soulWellNpc = null;
			}
			else
			{
				final QuestState qs = killer.getQuestState(getName());
				if ((qs != null) && qs.isCond(4) && hasQuestItems(killer, CROSS_OF_EINHASAD) && !hasQuestItems(killer, LOST_SKULL_OF_ELF) && (getRandom(100) < 10))
				{
					giveItems(killer, LOST_SKULL_OF_ELF, 1);
					qs.setCond(5, true);
				}
			}
		}
	}
}