ZURSULUS L2

Crystals of Fire and Ice

ID
306
Название
Crystals of Fire and Ice
start_npcs_json
[30004]
npc_ids_json
[]
constants_json
{"FLAME_SHARD":1020,"ICE_SHARD":1021}
Статус разбора
metadata_only; dynamic Java conditions/rewards retained in source; unresolved starts: []
Источник
game/data/scripts/quests/Q00306_CrystalOfFireAndIce/Q00306_CrystalOfFireAndIce.java

NPC квеста

Записей нет.

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

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

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

giveAdena(player, reward, true);
giveItems(player, drop[1], 1);

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

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

[30004-01.htm] Trader Katerina: I am working as a trader now, but actually my expertise is collecting and trading jewels. I find rare jewels by asking favors of travelers like you and sell them at Giran or Aden. Not long ago, I heard that one can find precious jewels at the Elven Ruins of Talking Island. It is an elemental stone used by the Elven Mystics or something like that ... Now that I think about it, the Elven Ruins may be too dangerous for you to go to. I was going to ask you to find me that jewel, but ... If you come across an opportunity later on to explore the Elven Ruins, please come to me. Then I will tell you in detail how to find the jewel there. (This quest may only be undertaken by a character of level 17 and above.) [30004-02.htm] Trader Katerina: I am working as a trader now, but actually my expertise is collecting and trading jewels. I find rare jewels by asking favors of travelers like you and sell them at Giran or Aden. Recently, I found some very interesting information while leafing through old records at the school of magic. It said that the Elemental Stone of Fire and Ice used by the Elven Mystics a long time ago is on this very island. The place is the Elven Ruins, which were abandoned a long time ago. Isn't that interesting? The Elven Ruins are too dangerous for someone like me, but someone like you will probably have no problem. If you find the jewels I am looking for in the ruins, I will give you a generous reward. What do you think? Say you will do it [30004-03.htm] Trader Katerina: Thank you so much for granting my request. Now please listen carefully to my account. The Elven Ruins here on Talking Island used to be a place where the Elves taught the Humans magic a long time ago. They say that underground, there used to be a temple where the Elves performed sacrificial rites to the spirit kings of fire and water. When the Elves left the island, they broke the Elemental Stone of Fire and Elemental Stone of Ice, which were in the underground temple before they left. But as the stones were shattered, the magic that was emitted from the shards summoned water spirit undines and flame spirit salamanders. Therefore, underneath the Elven Ruins there are still many salamanders and undines that have Flame Shards, fragments of the elemental stone of fire, and Ice Shards, fragments of the elemental stone of water, in their bodies. What you must do is go to the Elven Ruins and bring the fragments of elemental stones that are inside the bodies of the salamanders and undines. I will compensate you according to the number of jewels that you bring back. [30004-04.htm] Trader Katerina: You have not brought any fragments of elemental stone. As I already told you, you must go to the underground Elven Ruins to find the fragments of elemental stone. Inside the fire spirit salamanders and water spirit undines, you will be able to find the flame shard and ice shard, respectively, fragments of the elemental stones of fire and water. Say you will bring the jewel Say you will end the Contract [30004-05.htm] Trader Katerina: Thank you very much. I think I can feel a warmth at the tip of my fingers because the jewel contains the power of the spirits. How fascinating. As I promised, I will compensate you according to the number of jewels you brought me. Will you go back to the ruins to bring more jewels? Or do you want to end our Contract? Say you will continue Say you will end the Contract [30004-06.htm] Trader Katerina: If I come across any information on rare jewels in the future, I may ask you for your services again. I hope you will help me then, too. [30004-07.htm] Trader Katerina: Thank you. I thank you in advance. And don't worry about compensation. I will truly compensate you for as much as you bring back. I may not look it, but I always keep my word.
Исходник условий и наград (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.Q00306_CrystalOfFireAndIce;

import org.l2jmobius.gameserver.config.GeneralConfig;
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 Q00306_CrystalOfFireAndIce extends Quest
{
	// Items
	private static final int FLAME_SHARD = 1020;
	private static final int ICE_SHARD = 1021;
	
	// Droplist (npcId, itemId, chance)
	private static final int[][] DROPLIST =
	{
		// @formatter:off
		{20109, FLAME_SHARD, 300000},
		{20110, ICE_SHARD, 300000},
		{20112, FLAME_SHARD, 400000},
		{20113, ICE_SHARD, 400000},
		{20114, FLAME_SHARD, 500000},
		{20115, ICE_SHARD, 500000}
		// @formatter:on
	};
	
	public Q00306_CrystalOfFireAndIce()
	{
		super(306, "Crystals of Fire and Ice");
		registerQuestItems(FLAME_SHARD, ICE_SHARD);
		addStartNpc(30004); // Katerina
		addTalkId(30004);
		addKillId(20109, 20110, 20112, 20113, 20114, 20115);
	}
	
	@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("30004-03.htm"))
		{
			st.startQuest();
		}
		else if (event.equals("30004-06.htm"))
		{
			st.exitQuest(true, true);
		}
		
		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() < 17) ? "30004-01.htm" : "30004-02.htm";
				break;
			}
			case State.STARTED:
			{
				final int totalItems = getQuestItemsCount(player, FLAME_SHARD) + getQuestItemsCount(player, ICE_SHARD);
				if (totalItems == 0)
				{
					htmltext = "30004-04.htm";
				}
				else
				{
					htmltext = "30004-05.htm";
					takeItems(player, FLAME_SHARD, -1);
					takeItems(player, ICE_SHARD, -1);
					
					int reward = totalItems * 60;
					if (!GeneralConfig.ALT_VILLAGES_REPEATABLE_QUEST_REWARD && (totalItems >= 10))
					{
						reward += 5000;
					}
					
					giveAdena(player, reward, true);
				}
				break;
			}
		}
		
		return htmltext;
	}
	
	@Override
	public void onKill(Npc npc, Player player, boolean isPet)
	{
		final QuestState st = getQuestState(player, false);
		if ((st == null) || !st.isStarted())
		{
			return;
		}
		
		for (int[] drop : DROPLIST)
		{
			if (npc.getId() == drop[0])
			{
				if (getRandom(1000000) < drop[2])
				{
					giveItems(player, drop[1], 1);
				}
				break;
			}
		}
	}
}