ZURSULUS L2

Gather Ingredients for Pie

ID
299
Название
Gather Ingredients for Pie
start_npcs_json
[30620]
npc_ids_json
[30063,30466,30620]
constants_json
{"LARA":30063,"BRIGHT":30466,"EMILY":30620,"FRUIT_BASKET":7136,"AVELLAN_SPICE":7137,"HONEY_POUCH":7138,"VARNISH":1865}
Статус разбора
metadata_only; dynamic Java conditions/rewards retained in source; unresolved starts: []
Источник
game/data/scripts/quests/Q00299_GatherIngredientsForPie/Q00299_GatherIngredientsForPie.java

NPC квеста

IDНазваниеСтарт квестаУровень
30063LaraНет70
30466BrightНет80
30620EmilyДа70

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

htmltext = (player.getLevel() < 34) ? "30620-0a.htm" : "30620-0.htm";

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

giveItems(player, AVELLAN_SPICE, 1);
giveItems(player, FRUIT_BASKET, 1);
giveAdena(player, 25000, true);
giveItems(player, VARNISH, 50);
giveItems(partyMember, HONEY_POUCH, 1);

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

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

[30063-0.htm] Trader Lara: Emily's imported spice just arrived. Here, take a sniff! Isn't it fragrant? As she requested, I ordered a wonderfully aromatic spice! She'll be able to bake a delicious pie! "I'll take it to her." [30063-1.htm] Trader Lara: The fruit aroma is pleasant, isn't it? The spice is specially imported! Please take it to Emily. [30063-1a.htm] Trader Lara: Why haven't you returned to Emily yet? Deliver it to her before the fragrance of the spice dissipates. She must be waiting, so please hurry! [30466-0.htm] Guard Bright: You again? I'm on duty! What do you need? "Your mother sent me." [30466-1.htm] Guard Bright: My mother? Oh yeah, she asked for some fruit. Her bad knee keeps her in the house. Can you take her this basket? I can't leave my post. Thank you! [30466-1a.htm] Guard Bright: Keep it down! I'm on duty here. Are you done? Find someone else to bother. [30620-0.htm] Emily: Do I sound suspicious? At one time, this village was renowned for its hospitality... But then, something terrible happened here... We've been very wary of strangers since that dark day! But recently, there have been promising signs... High Priest Sylvan is planning a small tea party after the Sunday worship service at the temple. Worshippers and visitors are all invited! Hopefully, this will bring our village back to life! I want to bake some pies for the party, but I'm out of honey. Could you help me? "I'll help you." [30620-0a.htm] Emily: I'd like to take you up on your offer, stranger, but catching bees isn't for the inexperienced. Come back later. (This quest may only be undertaken by a character of level 34 and above.) [30620-1.htm] Emily: The highest quality honey can be found in the Beehive, but the insects that guard it are actually wasps! These wasps store honey in a organ called a honey sac inside their body. This is by far the finest honey, but it's extremely scarce! To make a pie I'll need at least 100 honey sacs! Get them by killing Wasp Leaders and Wasp Workers. Get 100 honey sacs and bring them to me. [30620-1a.htm] Emily: Hello again! How's the collection of honey sacs going? I need at least 100 honey sacs. Get busy! [30620-2.htm] Emily: Oh.... Very impressive! That was quick work! But now what am I going to do? I don't have the spice I need for the pie! Could you get some for me? You can't bake a fruit pie without fruit spice! Will you help me again? "I'll help you." [30620-2a.htm] Emily: These aren't enough honey sacs! Don't you realize I need to make enough pies for the villagers and the visitors alike? I'll need at least 100 honey sacs! [30620-3.htm] Emily: Oh, thank you! Please go and see Miss Lara in the village. She knows the kind of fruit spice I want! [30620-3a.htm] Emily: Why are you still here? I need that fruit spice! Get going, you loafer! [30620-4.htm] Emily: Oh, wonderful! You brought the spice! You're my hero! But, you see, I've got a problem... There's just one more thing... "OK, I'll help you again." [30620-4a.htm] Emily: I thought you had the spice I needed, but I don't see it on you. Go to the grocery store and get it from Trader Lara! [30620-5.htm] Emily: My son Bright stands guard at the front gate. He's not allowed to leave his post for personal reasons while he's on duty. When the weather is bad like this, my knees hurt so badly I can't walk! Occasionally my son has to leave his post to chase a criminal. Would you go and find him? Get a Fruit Basket from him and bring it to me. I can't walk a step! [30620-5a.htm] Emily: You haven't seen my son Bright yet? It won't take long... Please help me! [30620-6.htm] Emily: Ah, you're back already? Since I've gotten old, when it's cold and damp like this, I can't move around because of my bad knees. Did you bring me the Fruit Basket? "Here's your Fruit Basket." [30620-7.htm] Emily: You brought the Fruit Basket! It's so refreshing to see a young person that is so helpful! Thank you kindly, dear! I'll be baking pies every weekend for the tea at the temple, so if you need something to do, come back and see me! Here's a little something for you. [30620-7a.htm] Emily: Didn't you say that you brought the Fruit Basket? Well, where is it? Look, my son's just right around the corner. Go get it for me, would you?
Исходник условий и наград (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.Q00299_GatherIngredientsForPie;

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 Q00299_GatherIngredientsForPie extends Quest
{
	// NPCs
	private static final int LARA = 30063;
	private static final int BRIGHT = 30466;
	private static final int EMILY = 30620;
	
	// Items
	private static final int FRUIT_BASKET = 7136;
	private static final int AVELLAN_SPICE = 7137;
	private static final int HONEY_POUCH = 7138;
	
	// Reward resources
	private static final int VARNISH = 1865;
	
	public Q00299_GatherIngredientsForPie()
	{
		super(299, "Gather Ingredients for Pie");
		registerQuestItems(FRUIT_BASKET, AVELLAN_SPICE, HONEY_POUCH);
		addStartNpc(EMILY);
		addTalkId(EMILY, LARA, BRIGHT);
		addKillId(20934, 20935); // Wasp Worker, Wasp Leader
	}
	
	@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 "30620-1.htm":
			{
				st.startQuest();
				break;
			}
			case "30620-3.htm":
			{
				st.setCond(3, true);
				takeItems(player, HONEY_POUCH, -1);
				break;
			}
			case "30063-1.htm":
			{
				st.setCond(4, true);
				giveItems(player, AVELLAN_SPICE, 1);
				break;
			}
			case "30620-5.htm":
			{
				st.setCond(5, true);
				takeItems(player, AVELLAN_SPICE, 1);
				break;
			}
			case "30466-1.htm":
			{
				st.setCond(6, true);
				giveItems(player, FRUIT_BASKET, 1);
				break;
			}
			case "30620-7a.htm":
			{
				if (hasQuestItems(player, FRUIT_BASKET))
				{
					htmltext = "30620-7.htm";
					takeItems(player, FRUIT_BASKET, 1);
					if (getRandom(100) < 70)
					{
						giveAdena(player, 25000, true);
					}
					else
					{
						giveItems(player, VARNISH, 50);
					}
					
					st.exitQuest(true, true);
				}
				else
				{
					st.setCond(5);
				}
				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() < 34) ? "30620-0a.htm" : "30620-0.htm";
				break;
			}
			case State.STARTED:
			{
				final int cond = st.getCond();
				switch (npc.getId())
				{
					case EMILY:
					{
						if (cond == 1)
						{
							htmltext = "30620-1a.htm";
						}
						else if (cond == 2)
						{
							if (getQuestItemsCount(player, HONEY_POUCH) >= 100)
							{
								htmltext = "30620-2.htm";
							}
							else
							{
								htmltext = "30620-2a.htm";
								st.exitQuest(true);
							}
						}
						else if (cond == 3)
						{
							htmltext = "30620-3a.htm";
						}
						else if (cond == 4)
						{
							if (hasQuestItems(player, AVELLAN_SPICE))
							{
								htmltext = "30620-4.htm";
							}
							else
							{
								htmltext = "30620-4a.htm";
								st.exitQuest(true);
							}
						}
						else if (cond == 5)
						{
							htmltext = "30620-5a.htm";
						}
						else if (cond == 6)
						{
							htmltext = "30620-6.htm";
						}
						break;
					}
					case LARA:
					{
						if (cond == 3)
						{
							htmltext = "30063-0.htm";
						}
						else if (cond > 3)
						{
							htmltext = "30063-1a.htm";
						}
						break;
					}
					case BRIGHT:
					{
						if (cond == 5)
						{
							htmltext = "30466-0.htm";
						}
						else if (cond > 5)
						{
							htmltext = "30466-1a.htm";
						}
						break;
					}
				}
				break;
			}
		}
		
		return htmltext;
	}
	
	@Override
	public void onKill(Npc npc, Player player, boolean isPet)
	{
		final QuestState st = getRandomPartyMemberState(player, 1, 3, npc);
		if (st == null)
		{
			return;
		}
		
		if (getRandom(1000) < (npc.getId() == 20934 ? 571 : 625))
		{
			final Player partyMember = st.getPlayer();
			giveItems(partyMember, HONEY_POUCH, 1);
			if (getQuestItemsCount(partyMember, HONEY_POUCH) < 100)
			{
				playSound(partyMember, QuestSound.ITEMSOUND_QUEST_ITEMGET);
			}
			else
			{
				st.setCond(2, true);
			}
		}
	}
}