ZURSULUS L2

Shriek of Ghosts

ID
371
Название
Shriek of Ghosts
start_npcs_json
[30867]
npc_ids_json
[30867,30929]
constants_json
{"REVA":30867,"PATRIN":30929,"URN":5903,"PORCELAIN":6002}
Статус разбора
metadata_only; dynamic Java conditions/rewards retained in source; unresolved starts: []
Источник
game/data/scripts/quests/Q00371_ShrieksOfGhosts/Q00371_ShrieksOfGhosts.java

NPC квеста

IDНазваниеСтарт квестаУровень
30867RevaДа70
30929PatrinНет70

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

htmltext = (player.getLevel() < 59) ? "30867-01.htm" : "30867-02.htm";

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

giveAdena(player, urns * 1000, true);
giveItems(player, 6003, 1);
giveItems(player, 6004, 1);
giveItems(player, 6005, 1);
giveItems(player, 6006, 1);

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

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

[30867-01.htm] Seer Reva: Behold... countless ghosts encircle the Tower of Insolence! Just listen to their horrible screams! Do you feel their incredible rage? The sword of a devil shall pierce the heart of an angel, and the bright red blood of the last emperor will run through the streets! Dawn and dusk will become as one, and the heavens and earth will tremble! This is how Pa'agrio describes the beginning of endless winter... The arrogant humans are hastening their grisly fate! Unless the wrathful souls of the dead can be appeased, a terrible apocalypse will surely destroy this land forever! Take heed, young warrior! When you've developed your skills to the point that you can brave the tower, come and see me. (This quest may only be undertaken by a character of level 59 and above.) [30867-02.htm] Seer Reva: Behold... countless ghosts encircle the Tower of Insolence! Just listen to their horrible screams! Do you feel their incredible rage? The sword of a devil shall pierce the heart of an angel, and the bright red blood of the last emperor will run through the streets! Dawn and dusk will become as one, and the heavens and earth will tremble! This is how Pa'agrio describes the beginning of endless winter... The arrogant humans are hastening their grisly fate! Unless the wrathful souls of the dead can be appeased, a terrible apocalypse will surely destroy this land forever! I beg of you! Will you take the risk of the tower and help us? "I will brave the tower." [30867-03.htm] Seer Reva: Humans so easily ignore the fact that the Tower of Insolence is like a gigantic tomb, erected at the expense of countless lives! To conceal the secret of the tower, the despot Baium executed thousands of slaves and buried them there. Their vengeful spirits haunt the tower to this day. Hurry to the Tower of Insolence. There you will find the undead warriors who serve the Devil's Overlord. You must kill Hallate's warriors, Hallate's knights and Hallate's commanders. Don't give an inch! Recover the Ancient Ash Urns! Bring back the ashes and I will perform the ritual of fire that will put the undead warriors to rest. If your work is deemed worthy in my eyes, I will bestow upon you a prize. Bring me 100 or more ash urns at once and you will receive an even greater prize! [30867-04.htm] Seer Reva: Congratulations on your safe return, young soldier! Word has come that the tower has become a chaotic entanglement of angels and demons. Have you vanquished Hallate's warriors, Hallate's knights and Hallate's commanders and recovered the Ancient Ash Urns? Hand over the Ancient Ash Urns. Settle the account later. "I quit." [30867-05.htm] Seer Reva: Congratulations on your safe return, young soldier! Word has come that the tower has become a chaotic entanglement of angels and demons. I trust that you have recovered many of the Ancient Ash Urns from Hallate's warriors, knights and commanders! The Ancient Porcelain you brought doesn't contain any remains. It was only used for decoration! It's no good to me, you can keep it for yourself! Either sell it at a store or take it to antique dealer Patrin! He is at the general store in Oren Castle Town. Hand over the Ancient Ash Urns. Settle the account later. "I want to quit." [30867-06.htm] Seer Reva: How rude! You come here empty-handed and have the gall to demand a prize? Hurry to the Tower of Insolence and find the Ancient Ash Urns! The souls of the undead warriors cry out for rest! Don't waste any more time! [30867-07.htm] Seer Reva: These are remains of the dead, trampled by a despot... I can feel their bitterness, even after one thousand years! Listen to me, young soldier! I, Reva, will grant you a prize for your hard work! Take it! Continue the mission. Quit the mission. [30867-08.htm] Seer Reva: These are remains of the dead, trampled by a despot... I can feel their bitterness, even after one thousand years! You have brought over 100 ash urns at once! What a magnificent accomplishment! As I promised, I will grant you a special prize! Take it! Continue the mission. Quit the mission. [30867-09.htm] Seer Reva: Failure in this mission would prove catastrophic to us! Don't underestimate its importance! This is your duty! Do it! [30867-10.htm] Seer Reva: Would you ignore the desperate cries of the dead? If you are so callous, I won't stop you! You must be aware that the failure of this mission will bring a terrible and irreversible disaster upon us. But if you've made up your mind, so be it! Your help is appreciated. Tejakar Oroka! [30929-01.htm] Antique Dealer Patrin: It has come to my attention that the Orc seer Reva of Aden Castle Town is collecting Ancient Ash Urns. I asked him to give them to me so that I could sell them for a handsome price to antique collectors. He refused my offer, insisting that he needed them for a ritual! He promised me that if he finds an urn that does not contain any remains he would send it to me. Have you brought me such an item? "Tell me about the appraisal." "Please appraise the urn." [30929-01a.htm] Antique Dealer Patrin: An appraisal determines the true value of an item! To the untrained eye, an antique piece like this one may seem rather ordinary. But to the experienced eye of an expert like myself, each subtle mark and worn surface tells a story. The materials and techniques used to create it become clear to me. If the porcelain you bring me turns out to be a famous or a high grade porcelain, it will fetch a very high price at the store. If the appraisal shows that the porcelain is low grade or lowest grade, it becomes practically worthless! Such items are better left unappraised. Back [30929-02.htm] Antique Dealder Patrin: What's the big idea, coming to me empty-handed for an appraisal? Are you crazy or is this some kind of a joke? [30929-03.htm] Antique Dealer Patrin: Just a moment... Let me get my glasses... Now, what have we here, hmm? Oh, my! Indeed! This is a famous porcelain, made by the court sculptors! It is of the highest quality. It will fetch a great price at any store! [30929-04.htm] Antique Dealer Patrin: Just a moment... Let me get my glasses... What have we here, hmm? Hmm... Oh my! Indeed! You've found a high grade porcelain. It has been glazed to make it shiny. Most likely it decorated the home of an Elmoreden aristocrat... It will fetch a good price at any store. [30929-05.htm] Antique Dealer Patrin: Just a moment... Let me get my glasses... Now, what have we here, hmm? Oh Oh...! Well, there's no go way to say this... This is a low grade porcelain. Take a look here... Do you see this scratch? And look at this chipped edge... I'm sorry. It won't fetch much at a store. [30929-06.htm] Antique Dealer Patrin: Just a moment... Let me get my glasses... Now, what have we here, hmm... Oh my! This is the lowest grade porcelain I've ever seen! Look at the large crack on the side. Do you see it? The texture is very crude, made from coarse clay... Sorry to disappoint you, but it is practically worthless... [30929-07.htm] Antique Dealer Patrin: Just a moment... Let me get my glasses... Now, what have we here, hmm...? Wha...?!! I just touched it once... and it shattered into a thousand pieces! Oh, my! How embarrassing! I should've been more careful! Ahem! I'm so sorry. Objects this old tends to be fragile and are easily broken...
Исходник условий и наград (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.Q00371_ShrieksOfGhosts;

import java.util.HashMap;
import java.util.Map;

import org.l2jmobius.gameserver.config.PlayerConfig;
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.QuestState;
import org.l2jmobius.gameserver.mechanics.script.State;
import org.l2jmobius.gameserver.util.LocationUtil;

public class Q00371_ShrieksOfGhosts extends Quest
{
	private static class DropInfo
	{
		public int _firstChance;
		public int _secondChance;
		
		public DropInfo(int firstChance, int secondChance)
		{
			_firstChance = firstChance;
			_secondChance = secondChance;
		}
		
		public int getFirstChance()
		{
			return _firstChance;
		}
		
		public int getSecondChance()
		{
			return _secondChance;
		}
	}
	
	// NPCs
	private static final int REVA = 30867;
	private static final int PATRIN = 30929;
	
	// Item
	private static final int URN = 5903;
	private static final int PORCELAIN = 6002;
	
	// Drop chances
	private static final Map<Integer, DropInfo> MOBS = new HashMap<>();
	static
	{
		MOBS.put(20818, new DropInfo(350, 400)); // hallates_warrior
		MOBS.put(20820, new DropInfo(583, 673)); // hallates_knight
		MOBS.put(20824, new DropInfo(458, 538)); // hallates_commander
	}
	
	public Q00371_ShrieksOfGhosts()
	{
		super(371, "Shriek of Ghosts");
		registerQuestItems(URN, PORCELAIN);
		addStartNpc(REVA);
		addTalkId(REVA, PATRIN);
		addKillId(20818, 20820, 20824);
	}
	
	@Override
	public String onEvent(String event, Npc npc, Player player)
	{
		String htmltext = event;
		final QuestState st = getQuestState(player, false);
		if (st == null)
		{
			return htmltext;
		}
		
		switch (event)
		{
			case "30867-03.htm":
			{
				st.startQuest();
				break;
			}
			case "30867-07.htm":
			{
				int urns = getQuestItemsCount(player, URN);
				if (urns > 0)
				{
					takeItems(player, URN, urns);
					if (urns >= 100)
					{
						urns += 13;
						htmltext = "30867-08.htm";
					}
					else
					{
						urns += 7;
					}
					
					giveAdena(player, urns * 1000, true);
				}
				break;
			}
			case "30867-10.htm":
			{
				st.exitQuest(true, true);
				break;
			}
			case "APPR":
			{
				if (hasQuestItems(player, PORCELAIN))
				{
					final int chance = getRandom(100);
					takeItems(player, PORCELAIN, 1);
					if (chance < 2)
					{
						giveItems(player, 6003, 1);
						htmltext = "30929-03.htm";
					}
					else if (chance < 32)
					{
						giveItems(player, 6004, 1);
						htmltext = "30929-04.htm";
					}
					else if (chance < 62)
					{
						giveItems(player, 6005, 1);
						htmltext = "30929-05.htm";
					}
					else if (chance < 77)
					{
						giveItems(player, 6006, 1);
						htmltext = "30929-06.htm";
					}
					else
					{
						htmltext = "30929-07.htm";
					}
				}
				else
				{
					htmltext = "30929-02.htm";
				}
				break;
			}
		}
		
		return htmltext;
	}
	
	@Override
	public String onTalk(Npc npc, Player player)
	{
		String htmltext = getNoQuestMsg(player);
		final QuestState st = getQuestState(player, true);
		
		switch (st.getState())
		{
			case State.CREATED:
			{
				htmltext = (player.getLevel() < 59) ? "30867-01.htm" : "30867-02.htm";
				break;
			}
			case State.STARTED:
			{
				switch (npc.getId())
				{
					case REVA:
					{
						if (hasQuestItems(player, URN))
						{
							htmltext = (hasQuestItems(player, PORCELAIN)) ? "30867-05.htm" : "30867-04.htm";
						}
						else
						{
							htmltext = "30867-06.htm";
						}
						break;
					}
					case PATRIN:
					{
						htmltext = "30929-01.htm";
						break;
					}
				}
				break;
			}
		}
		
		return htmltext;
	}
	
	@Override
	public void onKill(Npc npc, Player killer, boolean isSummon)
	{
		final QuestState qs = getQuestState(killer, false);
		if ((qs == null) || !LocationUtil.checkIfInRange(PlayerConfig.ALT_PARTY_RANGE, npc, killer, true))
		{
			return;
		}
		
		final DropInfo info = MOBS.get(npc.getId());
		final int random = getRandom(1000);
		if (random < info.getFirstChance())
		{
			giveItemRandomly(qs.getPlayer(), npc, URN, 1, 0, 1, true);
		}
		else if (random < info.getSecondChance())
		{
			giveItemRandomly(qs.getPlayer(), npc, PORCELAIN, 1, 0, 1, true);
		}
	}
}