ZURSULUS L2

Sorrowful Sound of Flute

ID
363
Название
Sorrowful Sound of Flute
start_npcs_json
[30956]
npc_ids_json
[30057,30058,30458,30594,30595,30956,30959]
constants_json
{"NANARIN":30956,"OPIX":30595,"ALDO":30057,"RANSPO":30594,"HOLVAS":30058,"BARBADO":30959,"POITAN":30458,"NANARIN_FLUTE":4319,"BLACK_BEER":4320,"CLOTHES":4318,"THEME_OF_SOLITUDE":4420}
Статус разбора
metadata_only; dynamic Java conditions/rewards retained in source; unresolved starts: []
Источник
game/data/scripts/quests/Q00363_SorrowfulSoundOfFlute/Q00363_SorrowfulSoundOfFlute.java

NPC квеста

IDНазваниеСтарт квестаУровень
30057AldoНет70
30058HolvasНет70
30458PoitanНет70
30594RanspoНет70
30595OpixНет70
30956NanarinДа70
30959BarbadoНет70

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

htmltext = (player.getLevel() < 15) ? "30956-03.htm" : "30956-01.htm";

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

giveItems(player, CLOTHES, 1);
giveItems(player, NANARIN_FLUTE, 1);
giveItems(player, BLACK_BEER, 1);
giveItems(player, THEME_OF_SOLITUDE, 1);

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

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

[30057-01.htm] Warehouse Freightman Aldo: Let's see, what would Barbado like? Well, a while back he mentioned he didn't have anything to wear to an event... Maybe he would like a new outfit! By the way, how do you know Barbado? [30058-01.htm] Warehouse Keeper Holvas: Hmmm, what would Barbado like to have? Well, he is a musician and has expressed an interest in learning to play a new instrument... Yes, I believe he mentioned that he wanted to learn to play the flute! [30458-01.htm] Blacksmith Poitan: Oh, Barbado. What would he want? Oh, I know! He likes nothing better than a cold glass of black beer after a performance! [30594-01.htm] Warehouse Chief Ranspo: What would Barbado like? Well, I don't know about him, but I could use a cold, black beer! [30595-01.htm] Head Blacksmith Opix: What would Barbado like? Well, he is a musician. I have often heard him say that he would like to learn a new instrument... What was it? Ah, yes! It was a flute! [30956-01.htm] Musician Nanarin: I must admit that his broad shoulders take my breath away, and that lovely beard of his has captured my soul... What can I do? I've never felt this way before... Could you please help me? "I will help you." [30956-02.htm] Musician Nanarin: Could you perhaps find out what would make him happy? I love Barbado... Please ask his friends what he wants the most. Start with the Dwarves in this village, and don't you dare mention my name! Will you please do this for me? [30956-03.htm] Musician Nanarin: You know, come to think of it, I don't think that you are the right person for this job. (This quest may only be undertaken by a character of level 15 and above.) [30956-04.htm] Musician Nanarin: So? What does Barbado want? "He wants a new outfit." "He would like to have a flute." "He would like a black beer." [30956-05.htm] Musician Nanarin: Splendid! Please take him these clothes. If he asks, tell him they are from his secret admirer. [30956-06.htm] Musician Nanarin: Oh, marvelous! Please take him this flute. If he asks you who sent it, just say that it is from his secret admirer. [30956-07.htm] Musician Nanarin: Oh, great! Please take him this black beer. If he asks who sent it, tell him it is from his secret admirer. [30956-08.htm] Musician Nanarin:: Oh, my sweet Barbado... How I pray that my gift will make him happy... [30956-09.htm] Musician Nanarin: Oh, yes, no need to tell me. I've already heard. Take this as a token of my appreciation. It's a score of some music that I enjoy playing on my flute. Take it to a Melody Maestro and she will make an Echo Crystal for you. [30956-10.htm] Musician Nanarin: What a loser! I was a fool to trust you with such an important errand! Why are you standing there with your mouth hanging open? Get out of my sight, right now!!! [30959-01.htm] Musician Barbado: Thanks anyway, but I don't have any use for that. If that is all, would you excuse me, please? I must practice my music. [30959-02.htm] Musician Barbado: Just what I've always wanted! I wish I knew who sent me this! Whoever it is must know me well. [30959-03.htm] Musician Barbado: I am practicing my music. Please don't disturb me.
Исходник условий и наград (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.Q00363_SorrowfulSoundOfFlute;

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.State;

public class Q00363_SorrowfulSoundOfFlute extends Quest
{
	// NPCs
	private static final int NANARIN = 30956;
	private static final int OPIX = 30595;
	private static final int ALDO = 30057;
	private static final int RANSPO = 30594;
	private static final int HOLVAS = 30058;
	private static final int BARBADO = 30959;
	private static final int POITAN = 30458;
	
	// Items
	private static final int NANARIN_FLUTE = 4319;
	private static final int BLACK_BEER = 4320;
	private static final int CLOTHES = 4318;
	
	// Reward
	private static final int THEME_OF_SOLITUDE = 4420;
	
	public Q00363_SorrowfulSoundOfFlute()
	{
		super(363, "Sorrowful Sound of Flute");
		registerQuestItems(NANARIN_FLUTE, BLACK_BEER, CLOTHES);
		addStartNpc(NANARIN);
		addTalkId(NANARIN, OPIX, ALDO, RANSPO, HOLVAS, BARBADO, POITAN);
	}
	
	@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 "30956-02.htm":
			{
				st.startQuest();
				break;
			}
			case "30956-05.htm":
			{
				st.setCond(3, true);
				giveItems(player, CLOTHES, 1);
				break;
			}
			case "30956-06.htm":
			{
				st.setCond(3, true);
				giveItems(player, NANARIN_FLUTE, 1);
				break;
			}
			case "30956-07.htm":
			{
				st.setCond(3, true);
				giveItems(player, BLACK_BEER, 1);
				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() < 15) ? "30956-03.htm" : "30956-01.htm";
				break;
			}
			case State.STARTED:
			{
				final int cond = st.getCond();
				switch (npc.getId())
				{
					case NANARIN:
					{
						if (cond == 1)
						{
							htmltext = "30956-02.htm";
						}
						else if (cond == 2)
						{
							htmltext = "30956-04.htm";
						}
						else if (cond == 3)
						{
							htmltext = "30956-08.htm";
						}
						else if (cond == 4)
						{
							if (st.getInt("success") == 1)
							{
								htmltext = "30956-09.htm";
								giveItems(player, THEME_OF_SOLITUDE, 1);
								playSound(player, QuestSound.ITEMSOUND_QUEST_FINISH);
							}
							else
							{
								htmltext = "30956-10.htm";
								playSound(player, QuestSound.ITEMSOUND_QUEST_GIVEUP);
							}
							
							st.exitQuest(true);
						}
						break;
					}
					case OPIX:
					case POITAN:
					case ALDO:
					case RANSPO:
					case HOLVAS:
					{
						htmltext = npc.getId() + "-01.htm";
						if (cond == 1)
						{
							st.setCond(2, true);
						}
						break;
					}
					case BARBADO:
					{
						if (cond == 3)
						{
							st.setCond(4, true);
							
							if (hasQuestItems(player, NANARIN_FLUTE))
							{
								htmltext = "30959-02.htm";
								st.set("success", "1");
							}
							else
							{
								htmltext = "30959-01.htm";
							}
							
							takeItems(player, BLACK_BEER, -1);
							takeItems(player, CLOTHES, -1);
							takeItems(player, NANARIN_FLUTE, -1);
						}
						else if (cond == 4)
						{
							htmltext = "30959-03.htm";
						}
						break;
					}
				}
				break;
			}
		}
		
		return htmltext;
	}
}