ZURSULUS L2

Little Wing's Big Adventure

ID
421
Название
Little Wing's Big Adventure
start_npcs_json
[30610]
npc_ids_json
[30610,30747]
constants_json
{"CRONOS":30610,"MIMYU":30747,"FAIRY_LEAF":4325}
Статус разбора
metadata_only; dynamic Java conditions/rewards retained in source; unresolved starts: []
Источник
game/data/scripts/quests/Q00421_LittleWingsBigAdventure/Q00421_LittleWingsBigAdventure.java

NPC квеста

IDНазваниеСтарт квестаУровень
30610CronosДа70
30747MimyuНет70

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

if (player.getLevel() < 45)

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

giveItems(player, FAIRY_LEAF, 4);
giveItems(player, i + 922, 1, item.getEnchantLevel()); // TODO: rebuild entirely pet system in order enchant is given a fuck. Supposed to give an item level XX for a flute level XX.

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

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

[30610-01.htm] Elder Cronos: We've had this conversation about hatchlings before, haven't we, my young friend? As I said before, raising a hatchling requires resolve, which you haven't proven to me yet. But you wouldn't listen, oh no... So here we are... Have you learned anything? Since you are determined to keep it, you should prepare yourself to be the master of a strider. Hone your skills and come back to see me. (This quest may only be undertaken by a character of level 45 and above.) [30610-02.htm] Elder Cronos: We've had this conversation about hatchlings before, haven't we, my young friend? As I said before, raising a hatchling requires resolve, which you haven't proven to me yet. But would you listen, oh no... So here we are... Have you learned anything? Wait, what is this? Why are you carrying all those dragon flutes? A bit greedy, don't you think? You should get rid of all but one of those if you want to own a strider. (This quest may only be undertaken by a character with one dragon flute.) [30610-03.htm] Elder Cronos: We've had this conversation about hatchlings before, haven't we, my young friend? As I said before, raising a hatchling requires resolve, which you haven't proven to me yet. But you wouldn't listen, oh no... So here we are... Have you learned anything? Since you are determined to keep it, you should prepare it to be a strider. That cute little fellow isn't ready yet, though! (Only a hatchling of level 55 or above can transform into a strider.) [30610-04.htm] Elder Cronos: We've had this conversation before, haven't we? As I said, raising a hatchling requires resolve, which you haven't yet proven. Have you learned your lesson yet? Are you ready to have your hatchling transformed into a strider? "Do you know how to do this?" [30610-05.htm] Elder Cronos: Whether I know how to do it or not is not your concern... You should talk to Fairy Mimyu in the Enchanted Valley. Actually, she was the one I got your hatchling from! I have kept in touch with her since our last encounter. We have become friendly. I will send her a letter asking her to take good care of you and your hatchling... Do you understand what I'm saying to you? [30610-06.htm] Elder Cronos: Whether I know how to do it or not is not your concern... The thing about hatchlings is... Wait! What is this? When did you switch the dragon flute? Oh, come on! How long can you go on acting like this? [30610-07.htm] Elder Cronos: Questions, questions, questions! You should mind your own business and go and find Fairy Mimyu in the Enchanted Valley. She will tell you what you need to do in order to transform your hatchling into a strider. [30747-01.htm] Fairy Mimyu: This is so annoying! Please, leave me alone! Oh, its you! You're the one who brought me the Fairy Stone... What have you brought me this time? Nothing?! What a selfish brute! Why would you visit me emptyhanded? Oh, I remember! Cronos said that you would be visiting me... "I wish to change a hatchling to a strider." [30747-02.htm] Fairy Mimyu: Oh, has the baby grown? Summon him, I wish to see him! Hurry! [30747-03.htm] Fairy Mimyu: This is not right! This is definitely not the hatchling Cronos mentioned! How dare you attempt to deceive me! I will take it from you now! [30747-04.htm] Fairy Mimyu: Oh my, hasn't the baby grown! You've done an admirable job raising him. His mother will be so proud! Yes, he'll make a fine strider! "Will you change my hatchling into a strider?" [30747-05.htm] Fairy Mimyu: Nothing would make me happier, unfortunately, the hatchling is responsible for his own transformation. He must find the four fairy trees and gorge himself on their juice. This task is risky, for the trees are protected by the ghosts of tree guardians. You must see that this Fairy Leaf is affixed to the tree when his thirst is sated. "Please be more specific about what must be done for him to become a strider!" [30747-06.htm] Fairy Mimyu: What is the meaning of this? If you persist with your lying I will change the hatchling back into an egg! First let me see the child, then we'll talk! [30747-07.htm] Fairy Mimyu: What more can I tell you? "Tell me about the four fairy trees." "Tell me about the ghosts of tree guardians." "Tell me about the Fairy Leaf." [30747-08.htm] Fairy Mimyu: The four fairy trees are connected. Their roots traverse unimaginable depths to touch the Mother Tree Glade in the Elven Forest. The Essence of Wind, star, twilight and the abyss respectively flow within the trunks of these trees... These elements are essential for a hatchling to mature properly...Legend says that these trees were planted long ago by King Raul after he met the Lady of the Lake. He did this at the behest of the Lady of the Lake to stop the poisonous smog that was coming over from Dragon Valley. Now, in the northern section of the valley, those damn hunters have settled down.... And there is one thing that you have to be absolutely careful about! While this sap is indispensible for a hatchling's growth, it is a deadly poison to your race. If you handle a fairy tree, you will likely get sick and die. Back [30747-09.htm] Fairy Mimyu: These are the spirits of elves who protected the Mother Tree Glade in ancient times. In death they have lost their former discretion and attack indiscriminately anyone who ventures near. You will find many souls in each tree. Your hatchling is certain to be attacked by these spirits when it is drinking the sap of the trees. You must use care when defending your hatchling, for if a fairy tree is cut down, the spirits from within that tree will be set loose upon you and your party. This would be disastrous. Return [30747-10.htm] Fairy Mimyu: When your hatchling has slaked his thirst, affix the Fairy Leaf I gave you to the tree from which he drank. This will heal the tree and quieten the spirits within it. You only have enough leaves to use one per tree. Is that clear? Return [30747-11.htm] Fairy Mimyu: Why have you come back so soon? Your hatchling has not had enough sap! Surely you don't think that someone else will do your job for you? Go now and deal with your responsibilities! Remember, your hatchling must drink the sap of the four fairy trees in the forest south of Aden Castle Town. You mustn't touch the sap of the tree as it is a deadly poison to your race. Your hatchling must feed himself! Beware the ghosts that guard the fairy trees! [30747-12.htm] Fairy Mimyu: Go ahead and summon your hatchling! I trust that you completed your task successfully? If not, the forest must be in quite an uproar with those spirits careening about! [30747-13.htm] Fairy Mimyu: Let's have a look... Ah, yes! Good job! Your task was quite challenging. You've made your godmother proud! You've filled yourself with the sap of the fairy trees. Well, my friend, it is time to play your dragon flute and send this child to the other world. Soon he will grow too large to safely stay here. Ah! When this child comes back from the other world, all his belongings will disappear. Therefore, move all his belongings to another place and then give me the flute. [30747-14.htm] Fairy Mimyu: Let's have a look. Oh my... Well, it is not your fault... Your master thinks himself too clever, and has been switching hatchlings on me. You are despicable! Although it is just a pet, you are obliged to treat it as a treasured gift! Yet you switch it around like it is no more than a piece of Coal! I find your type of person appalling! I never want to see you again! Leave me now! [30747-15.htm] Fairy Mimyu: What is the holdup? You must send this youngster to the other world and give me the flute! Is that clear? [30747-16.htm] Fairy Mimyu: Give me the dragon flute. Your strider will no longer respond to it. You must now use this to call him. Although your pet looks very different now, if you just continue to give it the love and attention you did before, you will get along fine. Someday he will likely trust you enough to take you flying on his back. There's something to look forward to! [30747-17.htm] Fairy Mimyu: Why would anyone carry more than one dragon flute? You aren't collecting hatchlings, are you? I hope you got this hatchling through the proper channels! I do not deal with those who traffic in pets! Pets are not chattel! [30747-18.htm] Fairy Mimyu: You are getting on my last nerve! Did you think I wouldn't notice that you switched the dragon flutes? You are reprehensible! I am going to put a curse on 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.Q00421_LittleWingsBigAdventure;

import org.l2jmobius.gameserver.data.xml.SkillData;
import org.l2jmobius.gameserver.entity.actor.Attackable;
import org.l2jmobius.gameserver.entity.actor.Creature;
import org.l2jmobius.gameserver.entity.actor.Npc;
import org.l2jmobius.gameserver.entity.actor.Player;
import org.l2jmobius.gameserver.entity.actor.Summon;
import org.l2jmobius.gameserver.entity.actor.instance.Monster;
import org.l2jmobius.gameserver.entity.item.instance.Item;
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;
import org.l2jmobius.gameserver.mechanics.skill.Skill;
import org.l2jmobius.gameserver.network.enums.ChatType;
import org.l2jmobius.gameserver.util.MathUtil;

/**
 * iCond is an internal variable, used because cond isn't developped on that quest (only 3 states) :
 * <ul>
 * <li>1-3 leads initial mimyu behavior ;</li>
 * <li>used for leaves support as mask : 4, 8, 16 or 32 = 60 overall ;</li>
 * <li>63 becomes the "marker" to get back to mimyu (60 + 3), meaning you hitted the 4 trees ;</li>
 * <li>setted to 100 if mimyu check is ok.</li>
 * </ul>
 */
public class Q00421_LittleWingsBigAdventure extends Quest
{
	// NPCs
	private static final int CRONOS = 30610;
	private static final int MIMYU = 30747;
	
	// Item
	private static final int FAIRY_LEAF = 4325;
	
	public Q00421_LittleWingsBigAdventure()
	{
		super(421, "Little Wing's Big Adventure");
		registerQuestItems(FAIRY_LEAF);
		addStartNpc(CRONOS);
		addTalkId(CRONOS, MIMYU);
		addAttackId(27185, 27186, 27187, 27188);
		addKillId(27185, 27186, 27187, 27188);
	}
	
	@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 "30610-06.htm":
			{
				if ((getQuestItemsCount(player, 3500) + getQuestItemsCount(player, 3501) + getQuestItemsCount(player, 3502)) == 1)
				{
					// Find the level of the flute.
					for (int i = 3500; i < 3503; i++)
					{
						final Item item = player.getInventory().getItemByItemId(i);
						if ((item != null) && (item.getEnchantLevel() >= 55))
						{
							st.startQuest();
							st.set("iCond", "1");
							st.set("summonOid", String.valueOf(item.getObjectId()));
							return "30610-05.htm";
						}
					}
				}
				
				// Exit quest if you got more than one flute, or the flute level doesn't meat requirements.
				st.exitQuest(true);
				break;
			}
			case "30747-02.htm":
			{
				final Summon summon = player.getSummon();
				if (summon != null)
				{
					htmltext = (summon.getControlObjectId() == st.getInt("summonOid")) ? "30747-04.htm" : "30747-03.htm";
				}
				break;
			}
			case "30747-05.htm":
			{
				final Summon summon = player.getSummon();
				if ((summon == null) || (summon.getControlObjectId() != st.getInt("summonOid")))
				{
					htmltext = "30747-06.htm";
				}
				else
				{
					st.setCond(2, true);
					st.set("iCond", "3");
					giveItems(player, FAIRY_LEAF, 4);
				}
				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:
			{
				// Wrong level.
				if (player.getLevel() < 45)
				{
					htmltext = "30610-01.htm";
				}
				else if ((getQuestItemsCount(player, 3500) + getQuestItemsCount(player, 3501) + getQuestItemsCount(player, 3502)) != 1)
				{
					htmltext = "30610-02.htm";
				}
				else
				{
					// Find the level of the hatchling.
					for (int i = 3500; i < 3503; i++)
					{
						final Item item = player.getInventory().getItemByItemId(i);
						if ((item != null) && (item.getEnchantLevel() >= 55))
						{
							return "30610-04.htm";
						}
					}
					
					// Invalid level.
					htmltext = "30610-03.htm";
				}
				break;
			}
			case State.STARTED:
			{
				switch (npc.getId())
				{
					case CRONOS:
					{
						htmltext = "30610-07.htm";
						break;
					}
					case MIMYU:
					{
						final int id = st.getInt("iCond");
						if (id == 1)
						{
							htmltext = "30747-01.htm";
							st.set("iCond", "2");
						}
						else if (id == 2)
						{
							final Summon summon = player.getSummon();
							htmltext = (summon != null) ? ((summon.getControlObjectId() == st.getInt("summonOid")) ? "30747-04.htm" : "30747-03.htm") : "30747-02.htm";
						}
						else if (id == 3)
						{
							htmltext = "30747-07.htm";
						}
						else if ((id > 3) && (id < 63))
						{
							htmltext = "30747-11.htm";
						}
						else if (id == 63) // Did all trees, no more leaves.
						{
							final Summon summon = player.getSummon();
							if (summon == null)
							{
								return "30747-12.htm";
							}
							
							if (summon.getControlObjectId() != st.getInt("summonOid"))
							{
								return "30747-14.htm";
							}
							
							htmltext = "30747-13.htm";
							st.set("iCond", "100");
						}
						else if (id == 100) // Spoke with the Fairy.
						{
							final Summon summon = player.getSummon();
							if ((summon != null) && (summon.getControlObjectId() == st.getInt("summonOid")))
							{
								return "30747-15.htm";
							}
							
							if ((getQuestItemsCount(player, 3500) + getQuestItemsCount(player, 3501) + getQuestItemsCount(player, 3502)) > 1)
							{
								return "30747-17.htm";
							}
							
							for (int i = 3500; i < 3503; i++)
							{
								final Item item = player.getInventory().getItemByItemId(i);
								if ((item != null) && (item.getObjectId() == st.getInt("summonOid")))
								{
									takeItems(player, i, 1);
									giveItems(player, i + 922, 1, item.getEnchantLevel()); // TODO: rebuild entirely pet system in order enchant is given a fuck. Supposed to give an item level XX for a flute level XX.
									st.exitQuest(true, true);
									return "30747-16.htm";
								}
							}
							
							// Curse if the registered objectId is the wrong one (switch flutes).
							htmltext = "30747-18.htm";
							
							final Skill skill = SkillData.getInstance().getSkill(4167, 1);
							if ((skill != null) && player.isAffectedBySkill(skill.getId()))
							{
								skill.applyEffects(npc, player);
							}
						}
						break;
					}
				}
				break;
			}
		}
		
		return htmltext;
	}
	
	@Override
	public void onAttack(Npc npc, Player attacker, int damage, boolean isPet)
	{
		// Minions scream no matter current quest state.
		if (npc.asMonster().hasMinions())
		{
			for (Monster ghost : npc.asMonster().getMinionList().getSpawnedMinions())
			{
				if (!ghost.isDead() && (getRandom(100) < 1))
				{
					ghost.broadcastSay(ChatType.GENERAL, "We must protect the fairy tree!");
				}
			}
		}
		
		// Condition required : 2.
		final QuestState st = getQuestState(attacker, false);
		if ((st == null) || !st.isCond(2))
		{
			return;
		}
		
		// A pet was the attacker, and the objectId is the good one.
		if (isPet && (attacker.getSummon().getControlObjectId() == st.getInt("summonOid")))
		{
			// Random luck is reached and you still have some leaves ; go further.
			if ((getRandom(100) < 1) && hasQuestItems(st.getPlayer(), FAIRY_LEAF))
			{
				final int idMask = (int) MathUtil.pow(2, (npc.getId() - 27182) - 1);
				final int iCond = st.getInt("iCond");
				if ((iCond | idMask) != iCond)
				{
					st.set("iCond", String.valueOf(iCond | idMask));
					npc.broadcastSay(ChatType.GENERAL, "Give me a Fairy Leaf...!");
					takeItems(st.getPlayer(), FAIRY_LEAF, 1);
					npc.broadcastSay(ChatType.GENERAL, "Leave now, before you incur the wrath of the guardian ghost...");
					
					// Four leafs have been used ; update quest state.
					if (st.getInt("iCond") == 63)
					{
						st.setCond(3, true);
					}
					else
					{
						playSound(st.getPlayer(), QuestSound.ITEMSOUND_QUEST_ITEMGET);
					}
				}
			}
		}
	}
	
	@Override
	public void onKill(Npc npc, Player killer, boolean isPet)
	{
		final Creature originalKiller = isPet ? killer.getSummon() : killer;
		
		// Tree curses the killer.
		if ((getRandom(100) < 30) && (originalKiller != null))
		{
			final Skill skill = SkillData.getInstance().getSkill(4243, 1);
			if ((skill != null) && originalKiller.isAffectedBySkill(skill.getId()))
			{
				skill.applyEffects(npc, originalKiller);
			}
		}
		
		// Spawn 20 ghosts, attacking the killer.
		for (int i = 0; i < 20; i++)
		{
			final Attackable newNpc = addSpawn(27189, npc.getX(), npc.getY(), npc.getZ(), getRandom(65536), true, 300000).asAttackable();
			newNpc.setRunning();
			newNpc.addDamageHate(originalKiller, 0, 999);
			newNpc.getAI().setIntentionAttack(originalKiller);
		}
	}
}