ZURSULUS L2

Collector of Jewels

ID
369
Название
Collector of Jewels
start_npcs_json
[30376]
npc_ids_json
[30376]
constants_json
{"NELL":30376,"FLARE_SHARD":5882,"FREEZING_SHARD":5883,"ADENA":57}
Статус разбора
metadata_only; dynamic Java conditions/rewards retained in source; unresolved starts: []
Источник
game/data/scripts/quests/Q00369_CollectorOfJewels/Q00369_CollectorOfJewels.java

NPC квеста

IDНазваниеСтарт квестаУровень
30376NellДа70

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

htmltext = (player.getLevel() < 25) ? "30376-01.htm" : "30376-02.htm";

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

rewardItems(player, ADENA, 12500);
rewardItems(player, ADENA, 63500);

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

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

[30376-01.htm] Magister Nell: Do you wish to hear my story? Once I met a Wiseman. He convinced me that the Forgotten Temple is related to the Ruins on Talking Island. This glittering Flare Shard and Freezing Shard are proof! They are fragments from the Ruins of Talking Island and the Forgotten Temple! Before they were broken, these two elemental stones had mutual resonance. I'm sure of it! I'm desperate to get my hands on more of these fragments... If you know anyone strong enough to enter the Forgotten Temple and bring me some of these stones, please ask them to come and see me at once! (This quest may only be undertaken by a character of level 25 and above.) [30376-02.htm] Magister Nell: Do you wish to hear my story? Sometime ago, I met a Wiseman. He told me that the Forgotten Temple is related to the Ruins on Talking Island. More than anything else, this glittering Flare Shard and Freezing Shard are the proof! They are fragments of elemental stone found in the Ruins of Talking Island and the Forgotten Temple! Before they were broken, these two elemental stones must have had mutual resonance. Would you help me? Please go to the temple and bring me more of these gemstones. "I'll do it!" [30376-03.htm] Magister Nell: This won't be easy. The spirits that live in the Forgotten Temple are very strong. You will need help. You can get Flare Shards from Lakin salamanders, Salamander Rowins and Death Fires. Freezing Shards can be obtained from the Lakin Undine, the Rowin Undine and the Roxide. Please bring me 50 of each type. [30376-04.htm] Magister Nell: Ah, the shiny black hair... eyes that sparkle like gemstones... If I could only hear the voice once more... Why are you still here? Please hurry and collect 50 Flare Shards and 50 Freezing Shards for my research. You can find them by slaying Salamanders, Undines, Death Fires and Roxides in the Forgotten Temple. [30376-05.htm] Magister Nell: Ah, you have done as I asked. I feel the strong pull of their magic power. Here is your reward. Would you be interested in working with me some more? I still need many more of them... I'll pay you generously for your work... "Why do you need so many of them?" "I'll do it." "I quit." [30376-06.htm] Magister Nell: Well, if I only needed them for my research, these would be enough. But a wiseman taught me all about these gemstones. He said that he needed them, and asked me to collect the fragments for him. At that time the trader Katerina of Talking Island was there. She is also collecting gemstones. When she gives the gemstones to the wiseman, I also want to give at least the same quantity to him. You see, I am a magister... I can't be outdone by a trader like Katerina. Do you understand? Please do this for me. Collect more gemstones so that I can give them to the wiseman. "I will continue to do the work." "I quit." [30376-07.htm] Magister Nell: Thank you! Go to the Forgotten Temple with your colleagues. Slay the Roxide, the Lakin Undine, and the Rowin Undine to obtain Freezing Shards. Slay the Death Fire, the Lakin Salamander, and the Salamander Rowin to obtain Flare Shards. I'd like to give you at least 5 restored Spirit Ores, so please bring me 200 fragments of each kind. You will be well rewarded. [30376-08.htm] Magister Nell: Oh, too bad. Very well. I'll get someone else to help me. I appreciate your help up to now. I will take care of the remaining shards. Leave them here. If you change your mind, please come back and see me. Okay? [30376-09.htm] Magister Nell: Ah, what a profile! Like a classic statue... And that voice! Like an arrow piercing my heart...Where is he now? I wonder what he's doing? I must give him some Spirit Ore! Please, bring me 200 Flare Shards and 200 Freezing Shards! You can get them from Salamanders, Undines, Death Fires and Roxides, deep within the Forgotten Temple! Please, hurry! Time is short! [30376-10.htm] Magister Nell: Amazing! You've brought them! They must have been very heavy! Please put them down here. Be very, very careful! Thank you for your hard work. Here is your reward. These fragments are kind of small. Now, I can meet Les with confidence. He contacted me some time ago... Anyway, thank you for your help. If possible, please come and help me again sometime, and bring some friends to help you! Take care!
Исходник условий и наград (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.Q00369_CollectorOfJewels;

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

import org.l2jmobius.gameserver.entity.actor.Npc;
import org.l2jmobius.gameserver.entity.actor.Player;
import org.l2jmobius.gameserver.entity.item.holders.ItemChanceHolder;
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 Q00369_CollectorOfJewels extends Quest
{
	// NPC
	private static final int NELL = 30376;
	
	// Items
	private static final int FLARE_SHARD = 5882;
	private static final int FREEZING_SHARD = 5883;
	
	// Reward
	private static final int ADENA = 57;
	
	// Droplist
	private static final Map<Integer, ItemChanceHolder> MOBS_DROP_CHANCES = new HashMap<>();
	static
	{
		MOBS_DROP_CHANCES.put(20609, new ItemChanceHolder(FLARE_SHARD, 75, 1)); // salamander_lakin
		MOBS_DROP_CHANCES.put(20612, new ItemChanceHolder(FLARE_SHARD, 91, 1)); // salamander_rowin
		MOBS_DROP_CHANCES.put(20749, new ItemChanceHolder(FLARE_SHARD, 100, 2)); // death_fire
		MOBS_DROP_CHANCES.put(20616, new ItemChanceHolder(FREEZING_SHARD, 81, 1)); // undine_lakin
		MOBS_DROP_CHANCES.put(20619, new ItemChanceHolder(FREEZING_SHARD, 87, 1)); // undine_rowin
		MOBS_DROP_CHANCES.put(20747, new ItemChanceHolder(FREEZING_SHARD, 100, 2)); // roxide
	}
	
	public Q00369_CollectorOfJewels()
	{
		super(369, "Collector of Jewels");
		registerQuestItems(FLARE_SHARD, FREEZING_SHARD);
		addStartNpc(NELL);
		addTalkId(NELL);
		addKillId(MOBS_DROP_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;
		}
		
		switch (event)
		{
			case "30376-03.htm":
			{
				st.startQuest();
				break;
			}
			case "30376-07.htm":
			{
				playSound(player, QuestSound.ITEMSOUND_QUEST_ITEMGET);
				break;
			}
			case "30376-08.htm":
			{
				st.exitQuest(true, true);
				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() < 25) ? "30376-01.htm" : "30376-02.htm";
				break;
			}
			case State.STARTED:
			{
				final int cond = st.getCond();
				final int flare = getQuestItemsCount(player, FLARE_SHARD);
				final int freezing = getQuestItemsCount(player, FREEZING_SHARD);
				if (cond == 1)
				{
					htmltext = "30376-04.htm";
				}
				else if ((cond == 2) && (flare >= 50) && (freezing >= 50))
				{
					htmltext = "30376-05.htm";
					st.setCond(3, true);
					takeItems(player, FLARE_SHARD, -1);
					takeItems(player, FREEZING_SHARD, -1);
					rewardItems(player, ADENA, 12500);
				}
				else if (cond == 3)
				{
					htmltext = "30376-09.htm";
				}
				else if ((cond == 4) && (flare >= 200) && (freezing >= 200))
				{
					htmltext = "30376-10.htm";
					takeItems(player, FLARE_SHARD, -1);
					takeItems(player, FREEZING_SHARD, -1);
					rewardItems(player, ADENA, 63500);
					st.exitQuest(true, true);
				}
				break;
			}
		}
		
		return htmltext;
	}
	
	@Override
	public void onKill(Npc npc, Player player, boolean isSummon)
	{
		final ItemChanceHolder item = MOBS_DROP_CHANCES.get(npc.getId());
		if (getRandom(100) < item.getChance())
		{
			final Player luckyPlayer = getRandomPartyMember(player, npc);
			if (luckyPlayer != null)
			{
				final QuestState qs = getQuestState(luckyPlayer, false);
				if (qs != null)
				{
					final int itemCount = (qs.isMemoState(1) ? 50 : 200);
					final int cond = (qs.isMemoState(1) ? 2 : 4);
					if (giveItemRandomly(luckyPlayer, npc, item.getId(), item.getCount(), itemCount, 1, true) //
						&& (getQuestItemsCount(luckyPlayer, FLARE_SHARD, FREEZING_SHARD) >= (itemCount * 2)))
					{
						qs.setCond(cond);
					}
				}
			}
		}
	}
}