ZURSULUS L2

Wedding March

ID
431
Название
Wedding March
start_npcs_json
[31042]
npc_ids_json
[31042]
constants_json
{"KANTABILON":31042,"SILVER_CRYSTAL":7540,"WEDDING_ECHO_CRYSTAL":7062}
Статус разбора
metadata_only; dynamic Java conditions/rewards retained in source; unresolved starts: []
Источник
game/data/scripts/quests/Q00431_WeddingMarch/Q00431_WeddingMarch.java

NPC квеста

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

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

htmltext = (player.getLevel() < 38) ? "31042-00.htm" : "31042-01.htm";

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

giveItems(player, WEDDING_ECHO_CRYSTAL, 25);
giveItems(partyMember, SILVER_CRYSTAL, 1);

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

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

[31042-00.htm] Melody Maestro Kantabilon: Your pitch is way off! (This quest may only be undertaken by a character of level 38 and above.) [31042-01.htm] Melody Maestro Kantabilon: Great news! I found the musical score for a wedding march I've been searching for! Now I can play for all the lucky couples in the world! I need a special Echo Crystal to store this music. Bring me 50 Silver Crystals, and I'll fill half of them with music for you! "I'll get them." [31042-02.htm] Melody Maestro Kantabilon: You can get Silver Crystals from lienriks in the Field of Silence. [31042-03.htm] Melody Maestro Kantabilon: How can you call yourself an Adventurer if you can't even get these crystals? [31042-04.htm] Melody Maestro Kantabilon: Oh, I'm so thrilled! Now I can share this blessed music at wedding ceremonies! "Here are the crystals." [31042-05.htm] Melody Maestro Kantabilon: Here are the Echo Crystals with the wedding march. May this music bless you someday! [31042-06.htm] Melody Maestro Kantabilon: What can you gain by deceiving me? Go get the crystals!
Исходник условий и наград (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.Q00431_WeddingMarch;

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 Q00431_WeddingMarch extends Quest
{
	// NPC
	private static final int KANTABILON = 31042;
	
	// Item
	private static final int SILVER_CRYSTAL = 7540;
	
	// Reward
	private static final int WEDDING_ECHO_CRYSTAL = 7062;
	
	public Q00431_WeddingMarch()
	{
		super(431, "Wedding March");
		registerQuestItems(SILVER_CRYSTAL);
		addStartNpc(KANTABILON);
		addTalkId(KANTABILON);
		addKillId(20786, 20787);
	}
	
	@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("31042-02.htm"))
		{
			st.startQuest();
		}
		else if (event.equals("31042-05.htm"))
		{
			if (getQuestItemsCount(player, SILVER_CRYSTAL) < 50)
			{
				htmltext = "31042-03.htm";
			}
			else
			{
				takeItems(player, SILVER_CRYSTAL, -1);
				giveItems(player, WEDDING_ECHO_CRYSTAL, 25);
				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() < 38) ? "31042-00.htm" : "31042-01.htm";
				break;
			}
			case State.STARTED:
			{
				final int cond = st.getCond();
				if (cond == 1)
				{
					htmltext = "31042-02.htm";
				}
				else if (cond == 2)
				{
					htmltext = (getQuestItemsCount(player, SILVER_CRYSTAL) < 50) ? "31042-03.htm" : "31042-04.htm";
				}
				break;
			}
		}
		
		return htmltext;
	}
	
	@Override
	public void onKill(Npc npc, Player player, boolean isPet)
	{
		final QuestState qs = getRandomPartyMemberState(player, 1, 3, npc);
		if (qs == null)
		{
			return;
		}
		
		final Player partyMember = qs.getPlayer();
		final QuestState st = getQuestState(partyMember, false);
		if (st == null)
		{
			return;
		}
		
		if (getRandomBoolean())
		{
			giveItems(partyMember, SILVER_CRYSTAL, 1);
			if (getQuestItemsCount(partyMember, SILVER_CRYSTAL) < 50)
			{
				playSound(partyMember, QuestSound.ITEMSOUND_QUEST_ITEMGET);
			}
			else
			{
				st.setCond(2, true);
			}
		}
	}
}