ZURSULUS L2

Gather the Flames

ID
617
Название
Gather the Flames
start_npcs_json
[31271,31539]
npc_ids_json
[31271,31539,32049]
constants_json
{"HILDA":31271,"VULCAN":31539,"ROONEY":32049,"TORCH":7264}
Статус разбора
metadata_only; dynamic Java conditions/rewards retained in source; unresolved starts: []
Источник
game/data/scripts/quests/Q00617_GatherTheFlames/Q00617_GatherTheFlames.java

NPC квеста

IDНазваниеСтарт квестаУровень
31271HildaДа70
31539VulcanДа70
32049RooneyНет70

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

htmltext = npc.getId() + ((player.getLevel() >= 74) ? "-01.htm" : "-02.htm");

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

giveItems(player, getRandomEntry(REWARD), 1);
giveItems(player, Integer.parseInt(event), 1);

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

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

[31271-01.htm] Blacksmith Hilda: I have a story for you. Have you heard tell of Vulcan, the blacksmith? Now, all us blacksmiths have much to say about fire - we depend on it for our livelihood. Vulcan, though, he spoke of nothing else, and his talk was the marvel of all who heard it. He said that the fire was the actual life of the blacksmith, and could think of nothing but ways to make his fire hotter and fiercer. Eventually, he followed his notions right into the deeps of the Forge of the Gods, where he said he could collect and use all the fire he would want. It's a horribly dangerous place, and he's looking for those who can accompany him, adventurers who are not shy of danger and who can help him collect the flames. Do you reckon to be interested? Express interest in the venture. [31271-02.htm] Blacksmith Hilda: Ho, there! I'm Hilda the Blacksmith, and if you want good, solid work done, there's none better here. Don't pay any attention to the claims of that crackpot Vulcan. He's mad through and through. Fire is his obsession - he's forever searching for ways to make fire hotter and fiercer. I care for my fire, as does any competent blacksmith, but there are limits. Anyway, he won't live long enough to help you with anything; he's in the habit of venturing into the Forge of the Gods, and one day its dangers will claim him - and his eternal fire too! I've heard he is looking for adventurers to help him collect flames, but take my advice: leave that job to tougher adventurers, or wait until you are tougher. If you accompany him now, you'll die right alongside him. [31271-03.htm] Blacksmith Hilda: Very well, then. Defeat the monsters in the Forge of the Gods, collect the flames you find there, and bring them to Vulcan. He's mad, but he's a canny blacksmith; he'll give you an S-grade weapon recipe if you can bring him 1000 flames. You may have heard tell of Vulcan's younger brother Rooney. No? Well, he's as mad as his brother is, and perhaps even cannier as a blacksmith. He's a wandering lad, but he has a lot of different S-grade weapon recipes. Give Rooney 1200 flames, and he'll reward you with an S-grade weapon recipe. If you can find him in his wanderings, it might be a good idea for you to meet with him too. [31271-04.htm] Blacksmith Hilda: So you met with Vulcan, did you? Did he give you an earful of his madness? Well, he's mad about flame, but the rewards he offers are real. Defeat the monsters in the Forge of the Gods, collect the flames you find, and go to him; he will give you an S-grade weapon recipe if you bring him 1000 flames. If you gather even more flames, you might see about meeting Vulcan's younger brother Rooney. He's as mad as his brother, and he's engaged in the same quest. Bring him 1200 flames and he will give you an S-grade weapon recipe. Rooney wanders from here to there, so he's not easy to find...but it might be worth your while to deal with him. [31539-01.htm] Flame Blacksmith Vulcan: Fire is the lifeblood of a blacksmith. I need a hotter fire to make this high quality weapon. I'm gathering flames from Forge of the Gods, can you help me? Quest [31539-02.htm] Flame Blacksmith Vulcan: Fire is the lifeblood of a blacksmith. I need a hotter fire to make this high quality weapon. I'm gathering flames from Forge of the Gods. You don't want to get burned, do you? (This quest may only be undertaken by a character of level 74 and above.) [31539-03.htm] Flame Blacksmith Vulcan: Very well! Let me ask you a favor! Bring me 1000 Flames from the monsters inside the Forge of the Gods. I'll give you a S-grade weapon recipe that I have. Oh, I just remembered than my younger brother, Rooney, also collects Flames in the Forge of the Gods. He's a wanderer, that boy! I've heard that he gives a S-grade weapon recipe to anyone who brings him 1200 Flames, but he probably won't be easy to find! [31539-04.htm] Flame Blacksmith Vulcan: You brought me one thousand flames as I asked! So, do you want to exchange them for a Grade S weapon recipe? "I don't want to trade now." "Yes, I'll trade now." [31539-05.htm] Flame Blacksmith Vulcan: You don't have 1000 flames yet. Get them from monsters in Forge of the Gods. Bring me 1000 flames and I'll give you a grade S weapon recipe. "I'll keep at it." "I want to quit." [31539-06.htm] Flame Blacksmith Vulcan: Continue gathering flames from monsters in Forge of the Gods. [31539-07.htm] Flame Blacksmith Vulcan: Sorry if this isn't for the weapon you wanted, but a grade S weapon recipe is hard to get and very valuable! [31539-08.htm] Flame Blacksmith Vulcan: Come back anytime if you change your mind, I'll be here. [32049-01.htm] Blacksmith of Wind Rooney: You brought 1200 flames! Choose your recipe from the list: "Forgotten Blade" "Basalt Battlehammer" "Imperial Staff" "Angel Slayer" "Dragon Hunter Axe" "Saint Spear" "Demon Splinter" "Heavens Divider" "Arcana Mace" "Draconic Bow" [32049-02.htm] Blacksmith of Wind Rooney: You don't have 1200 flames yet. Get them from monsters in Forge of the Gods. Bring me 1200 flames and I'll give you an S-grade weapon recipe. [32049-03.htm] Blacksmith of Wind Rooney: Here it is, I hope you will enjoy it! That sort of recipe is really rare to find. Thanks again for the flames!
Исходник условий и наград (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.Q00617_GatherTheFlames;

import java.util.HashMap;
import java.util.Map;

import org.l2jmobius.commons.util.StringUtil;
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;

public class Q00617_GatherTheFlames extends Quest
{
	// NPCs
	private static final int HILDA = 31271;
	private static final int VULCAN = 31539;
	private static final int ROONEY = 32049;
	
	// Items
	private static final int TORCH = 7264;
	
	// Drop chances
	private static final Map<Integer, Integer> CHANCES = new HashMap<>();
	static
	{
		CHANCES.put(21381, 510000);
		CHANCES.put(21653, 510000);
		CHANCES.put(21387, 530000);
		CHANCES.put(21655, 530000);
		CHANCES.put(21390, 560000);
		CHANCES.put(21656, 690000);
		CHANCES.put(21389, 550000);
		CHANCES.put(21388, 530000);
		CHANCES.put(21383, 510000);
		CHANCES.put(21392, 560000);
		CHANCES.put(21382, 600000);
		CHANCES.put(21654, 520000);
		CHANCES.put(21384, 640000);
		CHANCES.put(21394, 510000);
		CHANCES.put(21395, 560000);
		CHANCES.put(21385, 520000);
		CHANCES.put(21391, 550000);
		CHANCES.put(21393, 580000);
		CHANCES.put(21657, 570000);
		CHANCES.put(21386, 520000);
		CHANCES.put(21652, 490000);
		CHANCES.put(21378, 490000);
		CHANCES.put(21376, 480000);
		CHANCES.put(21377, 480000);
		CHANCES.put(21379, 590000);
		CHANCES.put(21380, 490000);
	}
	
	// Rewards
	private static final int[] REWARD =
	{
		6881,
		6883,
		6885,
		6887,
		6891,
		6893,
		6895,
		6897,
		6899,
		7580
	};
	
	public Q00617_GatherTheFlames()
	{
		super(617, "Gather the Flames");
		registerQuestItems(TORCH);
		addStartNpc(VULCAN, HILDA);
		addTalkId(VULCAN, HILDA, ROONEY);
		addKillId(CHANCES.keySet());
	}
	
	@Override
	public String onEvent(String event, Npc npc, Player player)
	{
		String htmltext = event;
		final QuestState st = getQuestState(player, false);
		if (st == null)
		{
			return htmltext;
		}
		
		if (event.equals("31539-03.htm") || event.equals("31271-03.htm"))
		{
			st.startQuest();
		}
		else if (event.equals("31539-05.htm"))
		{
			if (getQuestItemsCount(player, TORCH) >= 1000)
			{
				htmltext = "31539-07.htm";
				takeItems(player, TORCH, 1000);
				giveItems(player, getRandomEntry(REWARD), 1);
			}
		}
		else if (event.equals("31539-08.htm"))
		{
			takeItems(player, TORCH, -1);
			st.exitQuest(true, true);
		}
		else if (StringUtil.isNumeric(event))
		{
			if (getQuestItemsCount(player, TORCH) >= 1200)
			{
				htmltext = "32049-03.htm";
				takeItems(player, TORCH, 1200);
				giveItems(player, Integer.parseInt(event), 1);
			}
			else
			{
				htmltext = "32049-02.htm";
			}
		}
		
		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 = npc.getId() + ((player.getLevel() >= 74) ? "-01.htm" : "-02.htm");
				break;
			}
			case State.STARTED:
			{
				switch (npc.getId())
				{
					case VULCAN:
					{
						htmltext = (getQuestItemsCount(player, TORCH) >= 1000) ? "31539-04.htm" : "31539-05.htm";
						break;
					}
					case HILDA:
					{
						htmltext = "31271-04.htm";
						break;
					}
					case ROONEY:
					{
						htmltext = (getQuestItemsCount(player, TORCH) >= 1200) ? "32049-01.htm" : "32049-02.htm";
						break;
					}
				}
				break;
			}
		}
		
		return htmltext;
	}
	
	@Override
	public void onKill(Npc npc, Player killer, boolean isSummon)
	{
		final Player partyMember = getRandomPartyMemberState(killer, State.STARTED);
		if (partyMember == null)
		{
			return;
		}
		
		if (getRandom(1000000) < CHANCES.get(npc.getId()))
		{
			giveItemRandomly(partyMember, npc, TORCH, 1, 0, 1, true);
		}
	}
}