ZURSULUS L2

Chest caught with a bait of icy air

ID
28
Название
Chest caught with a bait of icy air
start_npcs_json
[31572]
npc_ids_json
[31442,31572]
constants_json
{"OFULLE":31572,"KIKI":31442,"BIG_YELLOW_TREASURE_CHEST":6503,"KIKI_LETTER":7626,"ELVEN_RING":881}
Статус разбора
metadata_only; dynamic Java conditions/rewards retained in source; unresolved starts: []
Источник
game/data/scripts/quests/Q00028_ChestCaughtWithABaitOfIcyAir/Q00028_ChestCaughtWithABaitOfIcyAir.java

NPC квеста

IDНазваниеСтарт квестаУровень
31442KikiНет70
31572O'FulleДа70

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

if (player.getLevel() < 36)

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

giveItems(player, KIKI_LETTER, 1);
giveItems(player, ELVEN_RING, 1);

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

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

[31442-01.htm] Mineral Trader Kiki: If you're not here to buy minerals, why have you come? You must be either a soldier or a traveler. "I have a letter for you." [31442-02.htm] Mineral Trader Kiki: The letter! I had given up on it. The guild sent it a while back, but the ship ran aground and all was feared lost. Thank you. Don't let anyone else know about this! If word got out that Dwarves had lost it, it could damage our reputation as the most reliable race! Here is a gift for your trouble. As a Dwarf, I must show my gratitude for your kindness. [31442-03.htm] Mineral Trader Kiki: A letter for me? You must be mistaken. Dwarves never lose anything! You must have misunderstood. Now, if you're not going to buy anything, get lost! [31572-01.htm] Fishermen's Guild Member O'Fulle: Welcome back! You got the bait of chill before. You really did a number on those bandits! They're not all gone, however. Was the bait useful? It's not designed to catch fish, but has another, more valuable power! Did you catch anything? That bait was designed to catch something besides fish, by the way! If your fishing skill is level 12, you definitely should catch something with it! Have you found anything? "Why is that your business?" [31572-02.htm] Fishermen's Guild Member O'Fulle: Well, it's obvious you're not here to buy fishing gear! Have you ever been fishing? Try it once, you'll be hooked! Heh heh! I'm the man to see when you need bait! (This quest may only be undertaken by a character of level 36 and above.) [31572-03.htm] Fishermen's Guild Member O'Fulle: Well, it's obvious you're not here to buy fishing gear! Have you ever been fishing? Try it once, you'll be hooked! Heh heh! I'm the man to see when you need bait! (This quest may only be undertaken by a character who has completed O'Fulle's Special Bait quest.) [31572-04.htm] Fishermen's Guild Member O'Fulle: Well, I hate to bring this up, but a while back, someone asked me to find a large yellow treasure box. The bait I gave you earlier was specifically designed to find it! Don't look at me like that! It wouldn't have worked if you had known! I hope it won't be too much trouble for you to find the large yellow treasure box. Use the bait of chill to find it. You'll find this bait works best when your fishing skill level is exactly 12. Someone may have already found it, so you should also ask around in the market. [31572-05.htm] Fishermen's Guild Member O'Fulle: Did you find the large yellow treasure box? If so, let me authenticate it! I'll open it to verify its contents. "Here it is." [31572-06.htm] Fishermen's Guild Member O'Fulle: Are you finished already? No? Please, find the large yellow treasure box! If you can't find it by fishing, maybe you can get it from someone in the market. [31572-07.htm] Fishermen's Guild Member O'Fulle: This seems to be the large yellow treasure box that my client lost! When I opened it, it contained a letter addressed to Miss Kiki. The Dwarves must've really hated to lose this one! They're always bragging that they've never lost an item! Take this chest to Mineral Trader Kiki. [31572-08.htm] Fishermen's Guild Member O'Fulle: Didn't you say you had found the large yellow treasure box? I must authenticate its contents! If you opened it, it's useless! You'll need to bring another, unopened one. [31572-09.htm] Fishermen's Guild Member O'Fulle: Why haven't you taken the chest to Miss Kiki yet? Take it to the Blacksmith Shop. The Dwarves lost it in a shipwreck at the mouth of the river while delivering it to her. This loss would totally disgrace the Dwarves! Best to keep it to yourself!
Исходник условий и наград (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.Q00028_ChestCaughtWithABaitOfIcyAir;

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 quests.Q00051_OFullesSpecialBait.Q00051_OFullesSpecialBait;

public class Q00028_ChestCaughtWithABaitOfIcyAir extends Quest
{
	// NPCs
	private static final int OFULLE = 31572;
	private static final int KIKI = 31442;
	
	// Items
	private static final int BIG_YELLOW_TREASURE_CHEST = 6503;
	private static final int KIKI_LETTER = 7626;
	private static final int ELVEN_RING = 881;
	
	public Q00028_ChestCaughtWithABaitOfIcyAir()
	{
		super(28, "Chest caught with a bait of icy air");
		registerQuestItems(KIKI_LETTER);
		addStartNpc(OFULLE);
		addTalkId(OFULLE, KIKI);
	}
	
	@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 "31572-04.htm":
			{
				st.startQuest();
				break;
			}
			case "31572-07.htm":
			{
				if (hasQuestItems(player, BIG_YELLOW_TREASURE_CHEST))
				{
					st.setCond(2);
					takeItems(player, BIG_YELLOW_TREASURE_CHEST, 1);
					giveItems(player, KIKI_LETTER, 1);
				}
				else
				{
					htmltext = "31572-08.htm";
				}
				break;
			}
			case "31442-02.htm":
			{
				if (hasQuestItems(player, KIKI_LETTER))
				{
					htmltext = "31442-02.htm";
					takeItems(player, KIKI_LETTER, 1);
					giveItems(player, ELVEN_RING, 1);
					st.exitQuest(false, true);
				}
				else
				{
					htmltext = "31442-03.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:
			{
				if (player.getLevel() < 36)
				{
					htmltext = "31572-02.htm";
				}
				else
				{
					final QuestState st2 = player.getQuestState(Q00051_OFullesSpecialBait.class.getSimpleName());
					if ((st2 != null) && st2.isCompleted())
					{
						htmltext = "31572-01.htm";
					}
					else
					{
						htmltext = "31572-03.htm";
					}
				}
				break;
			}
			case State.STARTED:
			{
				final int cond = st.getCond();
				switch (npc.getId())
				{
					case OFULLE:
					{
						if (cond == 1)
						{
							htmltext = (!hasQuestItems(player, BIG_YELLOW_TREASURE_CHEST)) ? "31572-06.htm" : "31572-05.htm";
						}
						else if (cond == 2)
						{
							htmltext = "31572-09.htm";
						}
						break;
					}
					case KIKI:
					{
						if (cond == 2)
						{
							htmltext = "31442-01.htm";
						}
						break;
					}
				}
				break;
			}
			case State.COMPLETED:
			{
				htmltext = getAlreadyCompletedMsg(player);
				break;
			}
		}
		
		return htmltext;
	}
}