ZURSULUS L2

Jovial Accordion

ID
364
Название
Jovial Accordion
start_npcs_json
[30959]
npc_ids_json
[30060,30075,30957,30959,30960,30961]
constants_json
{"BARBADO":30959,"SWAN":30957,"SABRIN":30060,"XABER":30075,"CLOTH_CHEST":30961,"BEER_CHEST":30960,"KEY_1":4323,"KEY_2":4324,"STOLEN_BEER":4321,"STOLEN_CLOTHES":4322,"ECHO":4421}
Статус разбора
metadata_only; dynamic Java conditions/rewards retained in source; unresolved starts: []
Источник
game/data/scripts/quests/Q00364_JovialAccordion/Q00364_JovialAccordion.java

NPC квеста

IDНазваниеСтарт квестаУровень
30060SabrinНет70
30075XaberНет80
30957SwanНет70
30959BarbadoДа70
30960Beer ChestНет70
30961Cloth ChestНет70

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

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

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

giveItems(player, KEY_1, 1);
giveItems(player, KEY_2, 1);
giveItems(player, STOLEN_BEER, 1);
giveItems(player, STOLEN_CLOTHES, 1);
giveItems(player, ECHO, 1);
giveAdena(player, 100, true);

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

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

[30060-01.htm] Trader Sabrin: Did Swan send you? This is not enough! Go back and tell him that from now on it will be more, otherwise he should do business elsewhere. [30060-02.htm] Trader Sabrin: You know, it would be much less trouble if we just stole the recipe for making black beer from Jonas... [30075-01.htm] Guard Xaber: I received the item. Please tell Swan that I will send someone to him tomorrow. [30075-02.htm] Guard Xaber: Needless to say, the best kind of business is one that doesn't need any start-up capital! [30957-01.htm] Bard Swan: Barbado wants to play a duet with me? Hmmm, I don't know, my beloved seems to actually be attracted to that hairy ape! I am practically broke from buying gifts for Nanarin. Well, if you'll run an errand for me, I'll play a duet with Barbado. What do you say? "I will run an errand for you." [30957-02.htm] Bard Swan: Please get some black beer from Chef Jonas and take it to Trader Sabrin. Jonas keeps his beer in a beer chest and stores it in a warehouse... He becomes quite cross when asked for favors, so it would be best if you handled this without talking to him. Also, go to the grocery store in the village and find a clothes chest. You will find it near Trader Sonia. Take the contents of that chest to Guard Xaber. Here are the keys to the two chests. Good luck! [30957-03.htm] Bard Swan: Is this too complicated for you? Would you like for me to explain it again? Take the black beer from Jonas' beer chest located in the warehouse and take it to Trader Sabrin. Then go to the grocery store and take Sonia's Event Clothes from the clothes chest and take them to Guard Xaber. [30957-04.htm] Bard Swan: Good job! As I promised, I will play a duet. But let him know, I only intend to do this once! Here is your reward for running my errand. [30957-05.htm] Bard Swan: How could you have botched so easy an errand?! Two items should not have been that hard to deliver! Well, at least you delivered one item... I'll play the duet, but I won't give you any money. [30957-06.htm] Bard Swan: How could you have failed so easy a task? I shall never play a duet with Barbado! [30957-07.htm] Bard Swan: Quiet! I'm writing a letter to my beloved and I must concentrate! [30959-00.htm] Musician Barbado: Thank you for offering, but I am afraid that you lack the necessary skills to undertake this task. It will be too much for you. (This quest may only be undertaken by a character of level 15 and above.) [30959-01.htm] Musician Barbado: Some time ago, I heard Bard Swan playing his mandolin. His skills are quite impressive. I wish he would play a duet with me, but for some reason, whenever he sees me he avoids me... I hate to ask you to do this, but would you go see Swan and tell him that I want to play a duet with him? Of course you will be rewarded for your effort. "I will help you." [30959-02.htm] Musician Barbado: Thank you so much! You can find Bard Swan beneath the big tree in the center of the village. Please convince him to honor my request. I am sure you are capable of this. [30959-03.htm] Musician Barbado: You must persuade Bard Swan to play music with me. You will find him under the big tree in the center of the village. I am sure you are capable of this. [30959-04.htm] Musician Barbado: Thank you so much! At last I get to play a duet with Bard Swan! My dream is coming true! You have made this possible. Here! Take this priceless accordion music as a token of my appreciation! [30960-01.htm] Beer Chest: This chest contains beer made by Jonas... Open the chest. [30960-02.htm] Beer Chest: The chest contains black beer. [30960-03.htm] Beer Chest: The chest is locked. [30960-04.htm] Beer Chest: The key to the chest is broken. [30961-01.htm] Clothes Chest: This chest contains the clothing of Trader Sonia. Open the chest. [30961-02.htm] Clothes Chest: Contains magnificent clothing. [30961-03.htm] Clothes Chest: The chest is locked. [30961-04.htm] Clothes Chest: The key to the chest is 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.Q00364_JovialAccordion;

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 Q00364_JovialAccordion extends Quest
{
	// NPCs
	private static final int BARBADO = 30959;
	private static final int SWAN = 30957;
	private static final int SABRIN = 30060;
	private static final int XABER = 30075;
	private static final int CLOTH_CHEST = 30961;
	private static final int BEER_CHEST = 30960;
	
	// Items
	private static final int KEY_1 = 4323;
	private static final int KEY_2 = 4324;
	private static final int STOLEN_BEER = 4321;
	private static final int STOLEN_CLOTHES = 4322;
	private static final int ECHO = 4421;
	
	public Q00364_JovialAccordion()
	{
		super(364, "Jovial Accordion");
		registerQuestItems(KEY_1, KEY_2, STOLEN_BEER, STOLEN_CLOTHES);
		addStartNpc(BARBADO);
		addTalkId(BARBADO, SWAN, SABRIN, XABER, CLOTH_CHEST, BEER_CHEST);
	}
	
	@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 "30959-02.htm":
			{
				st.startQuest();
				st.set("items", "0");
				break;
			}
			case "30957-02.htm":
			{
				st.setCond(2, true);
				giveItems(player, KEY_1, 1);
				giveItems(player, KEY_2, 1);
				break;
			}
			case "30960-04.htm":
			{
				if (hasQuestItems(player, KEY_2))
				{
					takeItems(player, KEY_2, 1);
					if (getRandomBoolean())
					{
						htmltext = "30960-02.htm";
						giveItems(player, STOLEN_BEER, 1);
						playSound(player, QuestSound.ITEMSOUND_QUEST_ITEMGET);
					}
				}
				break;
			}
			case "30961-04.htm":
			{
				if (hasQuestItems(player, KEY_1))
				{
					takeItems(player, KEY_1, 1);
					if (getRandomBoolean())
					{
						htmltext = "30961-02.htm";
						giveItems(player, STOLEN_CLOTHES, 1);
						playSound(player, QuestSound.ITEMSOUND_QUEST_ITEMGET);
					}
				}
				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) ? "30959-00.htm" : "30959-01.htm";
				break;
			}
			case State.STARTED:
			{
				final int cond = st.getCond();
				final int stolenItems = st.getInt("items");
				switch (npc.getId())
				{
					case BARBADO:
					{
						if ((cond == 1) || (cond == 2))
						{
							htmltext = "30959-03.htm";
						}
						else if (cond == 3)
						{
							htmltext = "30959-04.htm";
							giveItems(player, ECHO, 1);
							st.exitQuest(true, true);
						}
						break;
					}
					case SWAN:
					{
						if (cond == 1)
						{
							htmltext = "30957-01.htm";
						}
						else if (cond == 2)
						{
							if (stolenItems > 0)
							{
								st.setCond(3, true);
								
								if (stolenItems == 2)
								{
									htmltext = "30957-04.htm";
									giveAdena(player, 100, true);
								}
								else
								{
									htmltext = "30957-05.htm";
								}
							}
							else
							{
								if (!hasQuestItems(player, KEY_1) && !hasQuestItems(player, KEY_2))
								{
									htmltext = "30957-06.htm";
									st.exitQuest(true, true);
								}
								else
								{
									htmltext = "30957-03.htm";
								}
							}
						}
						else if (cond == 3)
						{
							htmltext = "30957-07.htm";
						}
						break;
					}
					case BEER_CHEST:
					{
						htmltext = "30960-03.htm";
						if ((cond == 2) && hasQuestItems(player, KEY_2))
						{
							htmltext = "30960-01.htm";
						}
						break;
					}
					case CLOTH_CHEST:
					{
						htmltext = "30961-03.htm";
						if ((cond == 2) && hasQuestItems(player, KEY_1))
						{
							htmltext = "30961-01.htm";
						}
						break;
					}
					case SABRIN:
					{
						if (hasQuestItems(player, STOLEN_BEER))
						{
							htmltext = "30060-01.htm";
							st.set("items", String.valueOf(stolenItems + 1));
							playSound(player, QuestSound.ITEMSOUND_QUEST_ITEMGET);
							takeItems(player, STOLEN_BEER, 1);
						}
						else
						{
							htmltext = "30060-02.htm";
						}
						break;
					}
					case XABER:
					{
						if (hasQuestItems(player, STOLEN_CLOTHES))
						{
							htmltext = "30075-01.htm";
							st.set("items", String.valueOf(stolenItems + 1));
							playSound(player, QuestSound.ITEMSOUND_QUEST_ITEMGET);
							takeItems(player, STOLEN_CLOTHES, 1);
						}
						else
						{
							htmltext = "30075-02.htm";
						}
						break;
					}
				}
				break;
			}
		}
		
		return htmltext;
	}
}