ZURSULUS L2

Heart in Search of Power

ID
627
Название
Heart in Search of Power
start_npcs_json
[31518]
npc_ids_json
[31518,31519]
constants_json
{"NECROMANCER":31518,"ENFEUX":31519,"SEAL_OF_LIGHT":7170,"BEAD_OF_OBEDIENCE":7171,"GEM_OF_SAINTS":7172}
Статус разбора
metadata_only; dynamic Java conditions/rewards retained in source; unresolved starts: []
Источник
game/data/scripts/quests/Q00627_HeartInSearchOfPower/Q00627_HeartInSearchOfPower.java

NPC квеста

IDНазваниеСтарт квестаУровень
31518Mysterious NecromancerДа70
31519EnfeuxНет70

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

htmltext = (player.getLevel() < 60) ? "31518-00a.htm" : "31518-00.htm";

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

giveItems(player, SEAL_OF_LIGHT, 1);
giveItems(player, GEM_OF_SAINTS, 1);
giveItems(player, REWARDS.get(event)[0], REWARDS.get(event)[1]);
giveAdena(player, REWARDS.get(event)[2], true);
giveItems(player, BEAD_OF_OBEDIENCE, 1);

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

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

[31518-00.htm] Mysterious Necromancer: You aren't a pilgrim, are you? Anyway, you've traveled a long way, haven't you? Could you help me with something? I'm trying to create a new type of chimera! I've tried all sorts of ingredients, including blood of vampire and muscle of Ogre! I've come here to find a new source for ingredients... But gathering ingredients isn't as easy as it seems! Right now I'm trying to find remains of saint! Why are you looking at me like that? You think we should just let them rot? Do you want to help me or what? "What do you want me to do?" [31518-00a.htm] Mysterious Necromancer: I think it is too early for you to help me. Come back after you have gained some more experience. (This quest may only be undertaken by a character of level 60 and above.) [31518-01.htm] Mysterious Necromancer: All I know so far is that the remains of saints are in a place called Enfeux, which is sealed. I must make a seal from beads of obedience to unlock it. Beads of obedience control the thoughts of the creatures that guard the Valley of Saints. Bring me 300 of them. You can take them from the Eye of Splendor, Flash of Splendor, Blade of Splendor, Wisdom of Splendor, Soul of Splendor, Victory of Splendor, Punishment of Splendor, Shout of Splendor, Signet of Splendor, Crown of Splendor and Wailing of Splendor. I'm counting on you! [31518-01a.htm] Mysterious Necromancer: Where are the 300 beads of obedience I asked for? You can get them from Eye of Splendor, Flash of Splendor, Blade of Splendor, Wisdom of Splendor, Soul of Splendor, Victory of Splendor, Punishment of Splendor, Shout of Splendor, Signet of Splendor, Crown of Splendor and Wailing of Splendor. Please collect 300 beads and bring them to me. [31518-02.htm] Mysterious Necromancer: You've collected all 300 beads of obedience for me! Now I can use them to make a Seal of Light! Please give them to me. "Here you go." [31518-03.htm] Mysterious Necromancer: The beads of obedience allowed me to create a Seal of Light. Could you possibly help me some more? Enfeux is in the deepest part of the Valley of Saints. It's marked on this Map. You can take it with you. To extract the remains of saints, you must insert this Seal of Light into the space to the right side of Enfeux. After activating it with the seal, you can take out the remains of saints. I hope you can bring back as many as possible, but remember, the Seal of Light can be used only once. [31518-03a.htm] Mysterious Necromancer: Where are the 300 beads of obedience? [31518-04.htm] Mysterious Necromancer: What are you still doing here? Don't you know how important this is? Bring me some remains of saints right away! [31518-05.htm] Mysterious Necromancer: You brought me the remains of saints! Did you have any serious problems? I'm so glad to hear it! Now, please give me the remains of saints! "Not until I get my reward!" [31518-06.htm] Mysterious Necromancer: Since you brought me the remains you will be rewarded. Would you care for some adena or a basic ingredient? Which do you choose? "Adena." "Asofes." "Thons." "Enrias." "Mold Hardener." [31518-07.htm] Mysterious Necromancer: I wish it could be more, but this is all I can give you. I hope you'll find it useful. Feel free to come back and help anytime! [31519-00.htm] Enfeux: Upon close examination, on the lower right side, you see where to insert the seal. Insert the seal. [31519-01.htm] Enfeux: The Seal of Light has disappeared. In its place, you find an orb that looks like remains of saints. [31519-02.htm] Enfeux: You've already obtained the remains of saints. You can't get any more of them until you have a Seal of Light.
Исходник условий и наград (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.Q00627_HeartInSearchOfPower;

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.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 Q00627_HeartInSearchOfPower extends Quest
{
	// NPCs
	private static final int NECROMANCER = 31518;
	private static final int ENFEUX = 31519;
	
	// Items
	private static final int SEAL_OF_LIGHT = 7170;
	private static final int BEAD_OF_OBEDIENCE = 7171;
	private static final int GEM_OF_SAINTS = 7172;
	
	// Drop chances
	private static final Map<Integer, Integer> CHANCES = new HashMap<>();
	static
	{
		CHANCES.put(21520, 550000);
		CHANCES.put(21523, 584000);
		CHANCES.put(21524, 621000);
		CHANCES.put(21525, 621000);
		CHANCES.put(21526, 606000);
		CHANCES.put(21529, 625000);
		CHANCES.put(21530, 578000);
		CHANCES.put(21531, 690000);
		CHANCES.put(21532, 671000);
		CHANCES.put(21535, 693000);
		CHANCES.put(21536, 615000);
		CHANCES.put(21539, 762000);
		CHANCES.put(21540, 762000);
		CHANCES.put(21658, 690000);
	}
	
	// Rewards
	private static final Map<String, int[]> REWARDS = new HashMap<>();
	static
	{
		// @formatter:off
		REWARDS.put("adena", new int[]{0, 0, 100000});
		REWARDS.put("asofe", new int[]{4043, 13, 6400});
		REWARDS.put("thon", new int[]{4044, 13, 6400});
		REWARDS.put("enria", new int[]{4042, 6, 13600});
		REWARDS.put("mold", new int[]{4041, 6, 17200});
		// @formatter:on
	}
	
	public Q00627_HeartInSearchOfPower()
	{
		super(627, "Heart in Search of Power");
		registerQuestItems(BEAD_OF_OBEDIENCE);
		addStartNpc(NECROMANCER);
		addTalkId(NECROMANCER, ENFEUX);
		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("31518-01.htm"))
		{
			st.startQuest();
		}
		else if (event.equals("31518-03.htm"))
		{
			if (getQuestItemsCount(player, BEAD_OF_OBEDIENCE) == 300)
			{
				st.setCond(3, true);
				takeItems(player, BEAD_OF_OBEDIENCE, -1);
				giveItems(player, SEAL_OF_LIGHT, 1);
			}
			else
			{
				st.setCond(1);
				takeItems(player, BEAD_OF_OBEDIENCE, -1);
				htmltext = "31518-03a.htm";
			}
		}
		else if (event.equals("31519-01.htm"))
		{
			if (getQuestItemsCount(player, SEAL_OF_LIGHT) == 1)
			{
				st.setCond(4, true);
				takeItems(player, SEAL_OF_LIGHT, 1);
				giveItems(player, GEM_OF_SAINTS, 1);
			}
		}
		else if (REWARDS.containsKey(event))
		{
			if (getQuestItemsCount(player, GEM_OF_SAINTS) == 1)
			{
				htmltext = "31518-07.htm";
				takeItems(player, GEM_OF_SAINTS, 1);
				
				if (REWARDS.get(event)[0] > 0)
				{
					giveItems(player, REWARDS.get(event)[0], REWARDS.get(event)[1]);
				}
				
				giveAdena(player, REWARDS.get(event)[2], true);
				
				st.exitQuest(true, true);
			}
			else
			{
				htmltext = "31518-7.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 = (player.getLevel() < 60) ? "31518-00a.htm" : "31518-00.htm";
				break;
			}
			case State.STARTED:
			{
				final int cond = st.getCond();
				switch (npc.getId())
				{
					case NECROMANCER:
					{
						if (cond == 1)
						{
							htmltext = "31518-01a.htm";
						}
						else if (cond == 2)
						{
							htmltext = "31518-02.htm";
						}
						else if (cond == 3)
						{
							htmltext = "31518-04.htm";
						}
						else if (cond == 4)
						{
							htmltext = "31518-05.htm";
						}
						break;
					}
					case ENFEUX:
					{
						if (cond == 3)
						{
							htmltext = "31519-00.htm";
						}
						else if (cond == 4)
						{
							htmltext = "31519-02.htm";
						}
						break;
					}
				}
				break;
			}
			
		}
		
		return htmltext;
	}
	
	@Override
	public void onKill(Npc npc, Player player, boolean isPet)
	{
		final QuestState st = getQuestState(player, false);
		if ((st == null) || !st.isCond(1))
		{
			return;
		}
		
		if (getRandom(1000000) < CHANCES.get(npc.getId()))
		{
			giveItems(player, BEAD_OF_OBEDIENCE, 1);
			if (getQuestItemsCount(player, BEAD_OF_OBEDIENCE) < 300)
			{
				playSound(player, QuestSound.ITEMSOUND_QUEST_ITEMGET);
			}
			else
			{
				st.setCond(2, true);
			}
		}
	}
}