ZURSULUS L2

Birthday Party Song

ID
432
Название
Birthday Party Song
start_npcs_json
[31043]
npc_ids_json
[31043]
constants_json
{"OCTAVIA":31043,"RED_CRYSTAL":7541}
Статус разбора
metadata_only; dynamic Java conditions/rewards retained in source; unresolved starts: []
Источник
game/data/scripts/quests/Q00432_BirthdayPartySong/Q00432_BirthdayPartySong.java

NPC квеста

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

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

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

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

rewardItems(player, 7061, 25);
giveItems(partyMember, RED_CRYSTAL, 1);

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

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

[31043-00.htm] Melody Maestro Octavia: You need more classical training to be of help here! (This quest may only be undertaken by a character of level 31 and above.) [31043-01.htm] Melody Maestro Octavia: This beautiful weather has inspired me to finish a birthday musical piece, but I need some Red Crystals to store it! Will you help me find some? "I'll get the crystals." [31043-02.htm] Melody Maestro Octavia: Kill rough hewn rock golems in the Floran Agricultural Area to get the Red Crystals. Come back when you have 50! [31043-03.htm] Melody Maestro Octavia: This should be easy work for an adventurer like you! Go and get the crystals! [31043-04.htm] Melody Maestro Octavia: Isn't this wonderful? Now I can share my birthday song with everyone! Yahoo!! Aren't you also happy? "Here are the crystals." [31043-05.htm] Melody Maestro Octavia: Here's a small gift for the help. Now you can play birthday music for all your friends! [31043-06.htm] Melody Maestro Octavia: Without crystals, I can't save my music! You must help me!
Исходник условий и наград (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.Q00432_BirthdayPartySong;

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 Q00432_BirthdayPartySong extends Quest
{
	// NPC
	private static final int OCTAVIA = 31043;
	
	// Item
	private static final int RED_CRYSTAL = 7541;
	
	public Q00432_BirthdayPartySong()
	{
		super(432, "Birthday Party Song");
		registerQuestItems(RED_CRYSTAL);
		addStartNpc(OCTAVIA);
		addTalkId(OCTAVIA);
		addKillId(21103);
	}
	
	@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("31043-02.htm"))
		{
			st.startQuest();
		}
		else if (event.equals("31043-06.htm") && (getQuestItemsCount(player, RED_CRYSTAL) == 50))
		{
			htmltext = "31043-05.htm";
			takeItems(player, RED_CRYSTAL, -1);
			rewardItems(player, 7061, 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() < 31) ? "31043-00.htm" : "31043-01.htm";
				break;
			}
			case State.STARTED:
			{
				htmltext = (getQuestItemsCount(player, RED_CRYSTAL) < 50) ? "31043-03.htm" : "31043-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, RED_CRYSTAL, 1);
			if (getQuestItemsCount(partyMember, RED_CRYSTAL) < 50)
			{
				playSound(partyMember, QuestSound.ITEMSOUND_QUEST_ITEMGET);
			}
			else
			{
				st.setCond(2, true);
			}
		}
	}
}