ZURSULUS L2

Electrifying Recharge!

ID
367
Название
Electrifying Recharge!
start_npcs_json
[30673]
npc_ids_json
[21035,30673]
constants_json
{"LORAIN":30673,"CATHEROK":21035,"LORAIN_LAMP":5875,"TITAN_LAMP_1":5876,"TITAN_LAMP_2":5877,"TITAN_LAMP_3":5878,"TITAN_LAMP_4":5879,"TITAN_LAMP_5":5880}
Статус разбора
metadata_only; dynamic Java conditions/rewards retained in source; unresolved starts: []
Источник
game/data/scripts/quests/Q00367_ElectrifyingRecharge/Q00367_ElectrifyingRecharge.java

NPC квеста

IDНазваниеСтарт квестаУровень
21035CatherokНет42
30673LorainДа70

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

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

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

giveItems(player, LORAIN_LAMP, 1);
giveItems(player, LORAIN_LAMP, 1);
giveItems(player, LORAIN_LAMP, 1);
giveItems(player, LORAIN_LAMP, 1);
rewardItems(player, getRandomEntry(REWARD), 1);
giveItems(player, randomItem, 1);

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

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

[30673-01.htm] Researcher Lorain: By any chance are you headed to the Cruma Tower? I need some help with something. I believe I've discovered the secret source of energy used by the ancient Titans, but I must conduct several more experiments to confirm my findings. "I'll help." [30673-02.htm] Researcher Lorain: I can't bring myself to sacrifice your life for the sake of my research. Come back when you're older. (This quest may only be undertaken by a character of level 37 and above.) [30673-03.htm] Researcher Lorain: The last time I ventured into the deepest part of the dungeon I encountered a monster they call the catherok. His attack caused my body to start tingling all over, followed by complete paralysis! Luckily, my colleagues saved me from certain death! When I gathered my wits, I noticed that an ancient relic had been activated. It gave off an amazing light... At that moment, it came to me! The sting of the catherok contained a power source that actually activated ancient relics! Take this relic and entice a catherok to attack. It will become activated. When it reaches its brightest, bring it back to me. Heed my words, you must never confront the catherok alone. [30673-04.htm] Researcher Lorain: This relic could use a little more exposure to the catherok. It is not yet useful for my research. Please do it again. "Okay, I'll continue." "I want to quit." [30673-05.htm] Researcher Lorain: Dammit! You've destroyed the relic! If you can't handle a simple task like this, how do you expect to ever be a great adventurer? You have one more chance. Don't screw it up! [30673-06.htm] Researcher Lorain: You've done it! Did you feel that amazing sensation? Don't look at me like that... You know you love it! "I'll do it again!" "I've had enough." [30673-07.htm] Researcher Lorain: I knew you couldn't refuse! I'll never forget the first time I felt that sensation... It's addictive, isn't it? [30673-08.htm] Researcher Lorain: What a bummer! I thought you were an adventurer! [30673-09.htm] Researcher Lorain: Keep up the good work.
Исходник условий и наград (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.Q00367_ElectrifyingRecharge;

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;
import org.l2jmobius.gameserver.mechanics.skill.Skill;

public class Q00367_ElectrifyingRecharge extends Quest
{
	// NPCs
	private static final int LORAIN = 30673;
	
	// Monsters
	private static final int CATHEROK = 21035;
	
	// Item
	private static final int LORAIN_LAMP = 5875;
	private static final int TITAN_LAMP_1 = 5876;
	private static final int TITAN_LAMP_2 = 5877;
	private static final int TITAN_LAMP_3 = 5878;
	private static final int TITAN_LAMP_4 = 5879;
	private static final int TITAN_LAMP_5 = 5880;
	
	// Reward
	private static final int[] REWARD =
	{
		4553,
		4554,
		4555,
		4556,
		4557,
		4558,
		4559,
		4560,
		4561,
		4562,
		4563,
		4564
	};
	
	public Q00367_ElectrifyingRecharge()
	{
		super(367, "Electrifying Recharge!");
		registerQuestItems(LORAIN_LAMP, TITAN_LAMP_1, TITAN_LAMP_2, TITAN_LAMP_3, TITAN_LAMP_4, TITAN_LAMP_5);
		addStartNpc(LORAIN);
		addTalkId(LORAIN);
		addSpellFinishedId(CATHEROK);
	}
	
	@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 "30673-03.htm":
			{
				st.startQuest();
				giveItems(player, LORAIN_LAMP, 1);
				break;
			}
			case "30673-09.htm":
			{
				playSound(player, QuestSound.ITEMSOUND_QUEST_ACCEPT);
				giveItems(player, LORAIN_LAMP, 1);
				break;
			}
			case "30673-08.htm":
			{
				st.exitQuest(true, true);
				break;
			}
			case "30673-07.htm":
			{
				st.setCond(1);
				playSound(player, QuestSound.ITEMSOUND_QUEST_ACCEPT);
				giveItems(player, LORAIN_LAMP, 1);
				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() < 37) ? "30673-02.htm" : "30673-01.htm";
				break;
			}
			case State.STARTED:
			{
				final int cond = st.getCond();
				if (cond == 1)
				{
					if (hasQuestItems(player, 5880))
					{
						htmltext = "30673-05.htm";
						playSound(player, QuestSound.ITEMSOUND_QUEST_ACCEPT);
						takeItems(player, 5880, 1);
						giveItems(player, LORAIN_LAMP, 1);
					}
					else if (hasQuestItems(player, 5876))
					{
						htmltext = "30673-04.htm";
						takeItems(player, 5876, 1);
					}
					else if (hasQuestItems(player, 5877))
					{
						htmltext = "30673-04.htm";
						takeItems(player, 5877, 1);
					}
					else if (hasQuestItems(player, 5878))
					{
						htmltext = "30673-04.htm";
						takeItems(player, 5878, 1);
					}
					else
					{
						htmltext = "30673-03.htm";
					}
				}
				else if ((cond == 2) && hasQuestItems(player, 5879))
				{
					htmltext = "30673-06.htm";
					takeItems(player, 5879, 1);
					rewardItems(player, getRandomEntry(REWARD), 1);
					playSound(player, QuestSound.ITEMSOUND_QUEST_FINISH);
				}
				break;
			}
		}
		
		return htmltext;
	}
	
	@Override
	public void onSpellFinished(Npc npc, Player player, Skill skill)
	{
		final QuestState st = getQuestState(player, false);
		if ((st == null) || !st.isCond(1))
		{
			return;
		}
		
		if ((skill.getId() == 4072) && hasQuestItems(player, LORAIN_LAMP))
		{
			final int randomItem = getRandom(5876, 5880);
			takeItems(player, LORAIN_LAMP, 1);
			giveItems(player, randomItem, 1);
			if (randomItem == 5879)
			{
				st.setCond(2, true);
			}
			else
			{
				playSound(player, QuestSound.ITEMSOUND_QUEST_ITEMGET);
			}
		}
	}
}