ZURSULUS L2

Gatekeeper's Favor

ID
297
Название
Gatekeeper's Favor
start_npcs_json
[30540]
npc_ids_json
[]
constants_json
{"STARSTONE":1573,"GATEKEEPER_TOKEN":1659}
Статус разбора
metadata_only; dynamic Java conditions/rewards retained in source; unresolved starts: []
Источник
game/data/scripts/quests/Q00297_GatekeepersFavor/Q00297_GatekeepersFavor.java

NPC квеста

Записей нет.

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

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

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

rewardItems(player, GATEKEEPER_TOKEN, 2);
giveItems(player, STARSTONE, 1);

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

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

[30540-01.htm] Gatekeeper Wirphy: Twenty starstones from the whinstone golems would be enough for now. But do you know that the whinstone golems are extremely strong? I am sorry. I've met many adventurers in my long life and the way I see it, you're just beginning your journey as an adventurer and do not have enough experience for the job. It may be too dangerous for you. (This quest may only be undertaken by a character of level 15 and above.) [30540-02.htm] Gatekeeper Wirphy: Most of my body parts were created by combining materials from the previous creations of the ancient giants. But because the remains are not complete, I can always feel energy draining out of my body. My body could not be perfected with Dwarven technology, so they opted for a second choice -- rechargeable energy. But I used too much energy while recently teleporting a large group of traders. Will you help me? Say you will help [30540-03.htm] Gatekeeper Wirphy: Thank you! You are truly kind. While travelling through the Spine Mine Field, you will see many whinstone golems, one of the legacies of the ancient giants, wandering around. Please collect twenty Starstones from their bodies. That should be enough energy for now. I don't have much, but I can give you a gatekeeper's token that lets you use the teleport service. Good luck then! [30540-04.htm] Gatekeeper Wirphy: I need at least twenty Starstones. The Dwarves created us so that we can only recharge in units of twenty starstones. There are many whinstone golems in the Mine Field, so it shouldn't be difficult to gather them. [30540-05.htm] Gatekeeper Wirphy: Phew! Thank goodness. I was almost out of energy. Right ... I have to give you this. This is a Gatekeeper's token. If you need to teleport to Gludin later, just give it back to me. With the token, I will teleport you without charging any adena. Thank you again. Have a nice day!
Исходник условий и наград (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.Q00297_GatekeepersFavor;

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 Q00297_GatekeepersFavor extends Quest
{
	// Item
	private static final int STARSTONE = 1573;
	
	// Reward
	private static final int GATEKEEPER_TOKEN = 1659;
	
	public Q00297_GatekeepersFavor()
	{
		super(297, "Gatekeeper's Favor");
		registerQuestItems(STARSTONE);
		addStartNpc(30540); // Wirphy
		addTalkId(30540);
		addKillId(20521); // Whinstone Golem
	}
	
	@Override
	public String onEvent(String event, Npc npc, Player player)
	{
		final String htmltext = event;
		final QuestState st = getQuestState(player, false);
		if (st == null)
		{
			return htmltext;
		}
		
		if (event.equals("30540-03.htm"))
		{
			st.startQuest();
		}
		
		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() < 15) ? "30540-01.htm" : "30540-02.htm";
				break;
			}
			case State.STARTED:
			{
				if (st.isCond(1))
				{
					htmltext = "30540-04.htm";
				}
				else
				{
					htmltext = "30540-05.htm";
					takeItems(player, STARSTONE, -1);
					rewardItems(player, GATEKEEPER_TOKEN, 2);
					st.exitQuest(true, true);
				}
				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 (getRandomBoolean())
		{
			giveItems(player, STARSTONE, 1);
			if (getQuestItemsCount(player, STARSTONE) < 20)
			{
				playSound(player, QuestSound.ITEMSOUND_QUEST_ITEMGET);
			}
			else
			{
				st.setCond(2, true);
			}
		}
	}
}