ZURSULUS L2

Let's Become a Royal Member!

ID
381
Название
Let's Become a Royal Member!
start_npcs_json
[30232]
npc_ids_json
[30090,30232]
constants_json
{"SORINT":30232,"SANDRA":30090,"KAIL_COIN":5899,"COIN_ALBUM":5900,"GOLDEN_CLOVER_COIN":7569,"COIN_COLLECTOR_MEMBERSHIP":3813,"ROYAL_MEMBERSHIP":5898}
Статус разбора
metadata_only; dynamic Java conditions/rewards retained in source; unresolved starts: []
Источник
game/data/scripts/quests/Q00381_LetsBecomeARoyalMember/Q00381_LetsBecomeARoyalMember.java

NPC квеста

IDНазваниеСтарт квестаУровень
30090SandraНет70
30232SorintДа70

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

htmltext = ((player.getLevel() < 55) || !hasQuestItems(player, COIN_COLLECTOR_MEMBERSHIP)) ? "30232-02.htm" : "30232-01.htm";

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

giveItems(player, ROYAL_MEMBERSHIP, 1);
giveItems(player, COIN_ALBUM, 1);
giveItems(player, KAIL_COIN, 1);
giveItems(player, GOLDEN_CLOVER_COIN, 1);

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

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

[30090-01.htm] Sandra: Do you have the high-quality coin collection book? It's no longer for sale. Too many collectors dilute the market. You must do me a favor if you really want a book. It shouldn't be too hard for you, but there's no way I could do it. Will you help me? "I'll help you." [30090-02.htm] Sandra: I'm a coin collector, too. A while back, another coin collector told me that the rare coins of Elmore were also quite valuable, although the war has left most trade routes to Elmore impassable. But this didn't slow me down! A delivery of very valuable coins has been stolen by Fallen Chieftain Vegus in the Forsaken Plains! It included the rare golden clover coin I was looking for! These coins are still contraband, so I can't go after them myself. Bring me at least one of the rare golden clover coins and I'll make a high-quality coin collection book for you. Vegus usually appears in the Forsaken Plains two to three times a day. Find him there. [30090-03.htm] Sandra: You still haven't found the rare golden clover coin. I won't give you the high-quality coin collection book for free. At the last meeting of the Coin Collection Club, they concluded that there were too many high-level coin collection books. They've forbidden me to sell them. The rare golden clover coin was stolen by the Fallen Chieftain Vegus in the Forsaken Plains. [30090-04.htm] Sandra: You've brought the rare golden clover coin! Look how shiny it is! Note the exquisite pattern! It's a work of art! Now you're qualified to be a top-quality coin collector. Take this high-quality coin collection book. [30090-05.htm] Sandra: You still have the high-quality coin collection book that I gave you, don't you? Don't you need it for something? Think carefully. [30232-01.htm] Warehouse Keeper Sorint: Welcome! Come on in! I was about to ask you over anyway! I believe we've had this discussion before, am I right? About the special membership? Anyway, a special committee has been formed of members from all locations of the coin collectors club to decide upon whom to bestow the honor of a Royal Membership! Are you up to the challenge? "I'll do it." [30232-02.htm] Warehouse Keeper Sorint: All you need is a Level 1 Coin Collector Club Membership Card and enough experience... Oh, I see... That doesn't describe you, does it? (Only a character who possesses a Level 1 Coin Collector Club Membership Card and whose level is 55 or above can undertake this quest.) [30232-03.htm] Warehouse Keeper Sorint: Very well! You must prepare to impress the committee... There is an excellent opportunity available, I've heard a strange rumor... It's said that Kail's Coins were discovered in the Forsaken Plains. At one time Kail was Beleth's right-hand man. Bring me some of these coins. Also, if you buy a "Coin Collecting Album" from Trader Sandra of Giran that she sells only when she is in a good mood. Then, you will surely be chosen by the committee! [30232-04.htm] Warehouse Keeper Sorint: The monsters that inhabit the Forsaken Plains are quite dangerous. You must be fully prepared before you go there. You should leave any valuables you have with me... For safe keeping... Ha! [30232-05.htm] Warehouse Keeper Sorint: Unless you bring me a rare, high-quality Coin Collecting Album from Trader Sandra of Giran and Kail's Coins, I don't see how I could give you a Recommendation... Of course, I understand that these items are not easy to come by. That's why the reward is so great... you can become royalty! [30232-06.htm] Warehouse Keeper Sorint: Ah, Kail's Coin! And such a splendid album! This will truly enhance your collection. Once the committee sees this, they are bound to make you a royal! In fact, I'm so sure they will agree with me, I'm going to give you the Royal Membership Card of the Coin Collectors Club. You should go and visit Head Blacksmith Vergara. He's been wanting to see an actual royal member...
Исходник условий и наград (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.Q00381_LetsBecomeARoyalMember;

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 Q00381_LetsBecomeARoyalMember extends Quest
{
	// NPCs
	private static final int SORINT = 30232;
	private static final int SANDRA = 30090;
	
	// Items
	private static final int KAIL_COIN = 5899;
	private static final int COIN_ALBUM = 5900;
	private static final int GOLDEN_CLOVER_COIN = 7569;
	private static final int COIN_COLLECTOR_MEMBERSHIP = 3813;
	
	// Reward
	private static final int ROYAL_MEMBERSHIP = 5898;
	
	public Q00381_LetsBecomeARoyalMember()
	{
		super(381, "Let's Become a Royal Member!");
		registerQuestItems(KAIL_COIN, GOLDEN_CLOVER_COIN);
		addStartNpc(SORINT);
		addTalkId(SORINT, SANDRA);
		addKillId(21018, 27316);
	}
	
	@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("30090-02.htm"))
		{
			st.set("aCond", "1"); // Alternative cond used for Sandra.
		}
		else if (event.equals("30232-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() < 55) || !hasQuestItems(player, COIN_COLLECTOR_MEMBERSHIP)) ? "30232-02.htm" : "30232-01.htm";
				break;
			}
			case State.STARTED:
			{
				switch (npc.getId())
				{
					case SORINT:
					{
						if (!hasQuestItems(player, KAIL_COIN))
						{
							htmltext = "30232-04.htm";
						}
						else if (!hasQuestItems(player, COIN_ALBUM))
						{
							htmltext = "30232-05.htm";
						}
						else
						{
							htmltext = "30232-06.htm";
							takeItems(player, KAIL_COIN, -1);
							takeItems(player, COIN_ALBUM, -1);
							giveItems(player, ROYAL_MEMBERSHIP, 1);
							st.exitQuest(true, true);
						}
						break;
					}
					case SANDRA:
					{
						if (!hasQuestItems(player, COIN_ALBUM))
						{
							if (st.getInt("aCond") == 0)
							{
								htmltext = "30090-01.htm";
							}
							else
							{
								if (!hasQuestItems(player, GOLDEN_CLOVER_COIN))
								{
									htmltext = "30090-03.htm";
								}
								else
								{
									htmltext = "30090-04.htm";
									takeItems(player, GOLDEN_CLOVER_COIN, -1);
									giveItems(player, COIN_ALBUM, 1);
								}
							}
						}
						else
						{
							htmltext = "30090-05.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.isStarted())
		{
			return;
		}
		
		if (npc.getId() == 21018)
		{
			if (!hasQuestItems(player, KAIL_COIN) && (getRandom(100) < 5))
			{
				giveItems(player, KAIL_COIN, 1);
				playSound(player, QuestSound.ITEMSOUND_QUEST_ITEMGET);
			}
		}
		else if (st.getInt("aCond") == 1)
		{
			if (!hasQuestItems(player, GOLDEN_CLOVER_COIN))
			{
				giveItems(player, GOLDEN_CLOVER_COIN, 1);
				playSound(player, QuestSound.ITEMSOUND_QUEST_ITEMGET);
			}
		}
	}
}