ZURSULUS L2

Seductive Whispers

ID
663
Название
Seductive Whispers
start_npcs_json
[30846]
npc_ids_json
[30846]
constants_json
{"WILBERT":30846,"SPIRIT_BEAD":8766,"ADENA":57,"ENCHANT_WEAPON_A":729,"ENCHANT_ARMOR_A":730,"ENCHANT_WEAPON_B":947,"ENCHANT_ARMOR_B":948,"ENCHANT_WEAPON_C":951,"ENCHANT_WEAPON_D":955}
Статус разбора
metadata_only; dynamic Java conditions/rewards retained in source; unresolved starts: []
Источник
game/data/scripts/quests/Q00663_SeductiveWhispers/Q00663_SeductiveWhispers.java

NPC квеста

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

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

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

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

rewardItems(player, ADENA, 2384000);
rewardItems(player, ENCHANT_WEAPON_A, 1);
rewardItems(player, ENCHANT_ARMOR_A, 1);
rewardItems(player, ENCHANT_ARMOR_A, 1);
rewardItems(player, ADENA, 2384000);
rewardItems(player, ENCHANT_WEAPON_A, 1);
rewardItems(player, ENCHANT_ARMOR_A, 1);
rewardItems(player, ENCHANT_ARMOR_A, 1);
rewardItems(player, ADENA, 40000);
rewardItems(player, ADENA, 80000);
rewardItems(player, ADENA, 110000);
rewardItems(player, ENCHANT_WEAPON_D, 1);
rewardItems(player, ADENA, 199000);
rewardItems(player, ENCHANT_WEAPON_C, 1);
rewardItems(player, ADENA, 388000);
rewardItems(player, getRandomEntry(RECIPES), 1);
rewardItems(player, ADENA, 675000);
rewardItems(player, getRandomEntry(BLADES), 1);
rewardItems(player, ADENA, 1284000);
rewardItems(player, ENCHANT_WEAPON_B, 1);
rewardItems(player, ENCHANT_ARMOR_B, 1);
rewardItems(player, ENCHANT_WEAPON_B, 1);
rewardItems(player, ENCHANT_ARMOR_B, 1);
rewardItems(player, ADENA, 800);
rewardItems(player, ADENA, 800);
rewardItems(player, ADENA, 800);
rewardItems(player, ADENA, 2384000);
rewardItems(player, ENCHANT_WEAPON_A, 1);
rewardItems(player, ENCHANT_ARMOR_A, 1);
rewardItems(player, ENCHANT_ARMOR_A, 1);
giveItems(partyMember, SPIRIT_BEAD, 1);

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

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

[30846-01.htm] Blacksmith Wilbert: Hey, you, traveler! Come over here, my friend. You look a little bored. Not sure how what to do with yourself? How about we play a little game that's pretty popular in these parts? I think you'll enjoy it. "What's the game?" [30846-01a.htm] Blacksmith Wilbert: From time to time, we enjoy a duel game called The Battle of Sun and Moon. It's pretty popular in these parts, in case you haven't heard of it. I've found it a great way to pass the time when you're between jobs. Just say the word and I'll teach you everything you need to know. What do you say? "I'd like to play." [30846-02.htm] Blacksmith Wilbert: Hey there! Yeah, you, traveler! When you're a little less green, come see me for some excitement you won't soon forget. (Only characters level 50 and above are permitted to take on this quest.) [30846-03.htm] Blacksmith Wilbert: All right! If that's what you want, I'll let you you join in. You can't be ready for the game already, can you? You're not thinking of joining in without bringing anything to the table, are you? You have to go get one item if you want to enjoy a game with us. It's not so hard to find, but we need to have Spirit Beads to make weapons. I'll give you the details another time, but for now, go to Aden Cemetery, the Ancient Battlegrounds and the Fields of Massacre and get some Spirit Beads from the undead and the demons. Didn't I explain it well enough? "What is a Spirit Bead?" "How do you play the game called War Between the Sun and the Moon?" [30846-04.htm] Blacksmith Wilbert: You know that you need a Spirit Bead to play the game, right? Now, why don't you go get some so we can get started? Go to the National Cemetery, the Ancient Battlegrounds and the Fields of Massacre and get some Spirit Beads from the undead and the demons. "I don't want to play this game anymore." "What is a Spirit Bead?" "How do you play the game called War Between the Sun and the Moon?" "I quit." [30846-05.htm] Blacksmith Wilbert: Ha ha! Think you have what it takes to be a winner? Yes? How about the two of us play a round or two? Tell you what, we can even practice a little first if you prefer. Of course, even a practice run isn't free -- after all, why play at all if there isn't something at stake? But I'll make the stakes low, so learning won't cost you much. Let's say... 1 Spirit Bead. And if you win, I'll give you 800 adena! Can't beat that, my friend. Once you're ready to play for real, just hand over the Spirit Beads and let me know! So what'll it be? "I want to practice." (Requires 1 Spirit Bead) "I want to play." (Requires 50 Spirit Beads) "What is a Spirit Bead?" "How do you play the game?" "I don't want to play." [30846-05a.htm] Blacksmith Wilbert: The game should run continuously. When you're ready to begin, just say the word. Start playing. Quit the game. [30846-06.htm] Blacksmith Wilbert: When a being's thought or spirit energy comes together into the shape of a bead, we call that a Spirit Bead. Artisans like me need them to make good weapons. That's why we gamble with them -- as they're worth a lot to us. In this area, they say that you can easily get Spirit Beads if you go to Aden Cemetery, The Ancient Battlegrounds and the Fields of Massacre. First, at The Cemetery, you can obtain Spirit Beads from the undead creatures known as the Spiteful Ghost of Ruin, Soldier of Grief, Cruel Punisher, Roving Soul, Tortured Undead and Wasted Soul. Second, at the Ancient Battlegrounds, you can obtain Spirit Beads from the undead known as Past Knight, Ghostly Warrior, Hungered Corpse, the Dark Guard, Death Agent and Nihil Invader and from the demons known as Bloody Lord, Bloody Priest, Bloody Knight and Bloody Ghost. Lastly, at the Fields of Massacre, you can obtain Spirit Beads from the undead known as Doom Scout, Doom Servant, Doom Guard, Doom Archer, Doom Trooper, Doom Warrior, Doom Knight, Wretched Archer, Spiteful Soul Leader, Spiteful Soul Wizard and Spiteful Soul Fighter. I think that's enough information for you to get started. Is there anything else you'd like to know? "How do you play the game of War Between the Sun and the Moon?" "What do you get for winning the game?" "I want to practice." (Need 1 Spirit Bead.) "Let's play!" (Need 50 Spirit Beads.) [30846-07.htm] Blacksmith Wilbert: Actually, we once played this game using the images on the Spirit Beads themselves, but it became easier to just use cards marked with images of Suns or Moons. Listen up! There are 10 types of cards, each marked with 1 to 5 pictures of the Sun or Moon. Here's how to play: First, cards are dealt to each person in order. The last card drawn is placed face up. Check how many pictures your cards have on them. If there is more than one more card with 5 pictures on it, the person who got the card last wins. Simple, eh? Anything else you'd like to know? "What is a Spirit Bead?" "What do you get when you win the game?" "I want to practice." (Need 1 Spirit Bead.) "Let's play." (Need 50 Spirit Beads.) [30846-08.htm] Blacksmith Wilbert: If you win the game, the master running it owes you the appropriate amount. The higher the round, the bigger the payout. That's why the game only allows you to win up to 8 rounds in a row. If -- and that's a big if -- you manage to win 8 straight times, the game will end. Keep in mind that if you lose any of the rounds, you get nothing. That's fair warning, my friend. Here's how the prize system works: 1 winning round: 40,000 Adena 2 winning rounds: 80,000 Adena 3 winning rounds: 110,000 Adena, D-grade Enchant Weapon Scroll 4 winning rounds: 199,000 Adena, C-grade Enchant Weapon Scroll 5 winning rounds: 388,000 Adena, 1 recipe for a B-grade Weapon 6 winning rounds: 675,000 Adena, 1 essential ingredient for a B-grade Weapon 7 winning rounds: 1,284,000 Adena, 2 B-grade Enchant Weapon Scrolls, 2 B-grade Enchant Armor Scrolls 8 winning rounds: 2,384,000 Adena, 1 A-grade Enchant Weapon Scroll, 2 A-grade Enchant Armor Scrolls My advice is to identify what you'd like to win and then to play for that prize. Any questions? "What is a Spirit Bead?" "How do you play the game called War Between the Sun and the Moon?" "I want to practice." (Need 1 Spirit Bead.) "Let's play!" (Need 50 Spirit Beads.) [30846-09.htm] Blacksmith Wilbert: Well, then, ready to get started? I see you've already put in the 50 spirit beads you need to play. Excellent! Whenever you're ready, my friend, draw your card. Draw a card. [30846-09a.htm] Blacksmith Wilbert: Are you ready to get started? Draw your card. Draw a card. [30846-10.htm] Blacksmith Wilbert: You need 50 spirit beads to play. I can plainly see that you don't have enough; why don't you go get some more and come back? [30846-11.htm] Blacksmith Wilbert: Where have you been? I've been sitting here waiting for you. Let's get started, eh? Draw your card. Draw a card. [30846-12.htm] Blacksmith Wilbert: Ah! Thank the gods, it's my turn again. You drew: %card2pic%. The cards on the table are: [Wilbert][ %name% ] %card1pic%%card2pic% Can I draw my card now? Tell him to draw a card. [30846-13.htm] Blacksmith Wilbert: Let's see, now... The card you drew is %card2pic%. The cards on the table are: [Wilbert][ %name% ] %card1pic%%card2pic% Dragon's spore! You've won. If my luck stays this bad, I'm going to have a lot of explaining to do to the missus! By my reckonin', you have %wincount% consecutive wins. Do you want to quit? Or would you like to keep playing? Challenge him again. Quit the game and collect the prize. [30846-14.htm] Blacksmith Wilbert: The card you drew is: %card2pic%. The cards on the table are: [Wilbert][ %name% ] %card1pic%%card2pic% Has it been 8 consecutive wins already!? I've never seen anybody play this well! The gods have truly blessed you with both great skill and great luck. I'd be honored to try my luck against you some time -- please feel free to look me up when you have some free time and an itch to play. In the meantime, take this. [30846-15.htm] Blacksmith Wilbert: Stop interrupting the game! Well, it seems like I get my chance as well. Do you think I can draw my card? Tell him to show his card. [30846-16.htm] Blacksmith Wilbert: You've won %wincount% in a row. Would you like to quit? Or do you want to keep playing? Continue the game. Quit the game and collect the prize. [30846-17.htm] Wilbert: By my mother's braids, I've never seen anyone play this well! You must be chosen by the gods, my friend, for your luck is surely supernatural. Maybe I'm a glutton for punishment, but I'd love to play again sometime. Here, take this. [30846-18.htm] Blacksmith Wilbert: Oh well... Ah, it's your turn again. I drew: %card2pic%. The cards on the table are: [Wilbert][ %name% ] %card2pic%%card1pic% Draw a card. Take out the card. [30846-19.htm] Blacksmith Wilbert: Let's see here... The card I took out is: %card2pic%. The cards on the table are: [Wilbert][ %name% ] %card2pic%%card1pic% Luck! Looks like I win. It was a good game, though, eh? If you'd like to play again, feel free to challenge me. Challenge him again. [30846-20.htm] Blacksmith Wilbert: First just let me warm up a little. Ah...that's better. Let's play! Whenever you're ready, my friend... Tell him you're ready. Tell him you're going to take a little break. [30846-21.htm] Blacksmith Wilbert: My my, you're doing very well, aren't you? I bet you could take everything I have if this keeps up! Well, here's your winnings. Say, how about we keep playing? Continue the game. Stop the game for a while. [30846-21a.htm] Blacksmith Wilbert: First, let me get warmed up. Shall we play again?. When you're ready, just let me know. Say that you're ready. Tell him that you want to take a break. [30846-22.htm] Blacksmith Wilbert: Let's start then! First, give me 1 Spirit Bead. Now pick any card you want from this box. You know the rules, right? When you're ready, go ahead and draw a card. Draw a card. [30846-22a.htm] Blacksmith Wilbert: Don't even think about coming over here if you don't have any beads! [30846-23.htm] Blacksmith Wilbert: I've been waiting for you! Ready to get started? Draw a card. Draw a card. [30846-24.htm] Blacksmith Wilbert: Whew! Thankfully, it's my turn again. The card you drew is: %card2pic%. The cards on the table are: [Wilbert][ %name% ] %card1pic%%card2pic% Can I draw my card now? Tell him to draw a card. [30846-25.htm] Blacksmith Wilbert: The card that you took out is: %card2pic%. The cards on the table are: [Wilbert][ %name% ] %card1pic%%card2pic% So that's how you play the game. Pretty simple, eh? If you want to join a real game, let me know. I want to practice some more. (Need 1 Spirit Bead.) Let's play the game. (Need 50 Spirit Beads.) Let's play later. [30846-26.htm] Blacksmith Wilbert: Stop interrupting the game! Ah, well, it seems as though I get a chance as well. Tell me, my friend, do you think I can draw my card? Tell him to draw a card. [30846-28.htm] Blacksmith Wilbert: OK, now it's your turn. I drew: %card2pic%. The cards on the table are: [Wilbert] [ %name% ] %card2pic% %card1pic% Go ahead and draw a card. Take out the card. [30846-29.htm] Blacksmith Wilbert: I drew %card2pic%. The cards on the table are: [Wilbert][ %name% ] %card2pic%%card1pic% What luck! Looks like I win. Still, it was a pretty exciting practice run, eh? If you want to play again, feel free to challenge me. "I'd like to keep practicing." "I want to play the game now." "I want to quit." [30846-30.htm] Blacksmith Wilbert: Well, it's a shame that you want to stop. If you want to play again, come by any time. I certainly enjoyed it! [30846-31.htm] Blacksmith Wilbert: What's the matter? You started the game, so you should finish it. Are you really going to quit now? "I'll come by next time." "I don't want to play any more." [30846-32.htm] Blacksmith Wilbert: Very well. You look very tired. Come back when you are rested. I'll be waiting for you here.
Исходник условий и наград (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.Q00663_SeductiveWhispers;

import java.util.HashMap;
import java.util.Map;

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 Q00663_SeductiveWhispers extends Quest
{
	// NPC
	private static final int WILBERT = 30846;
	
	// Quest item
	private static final int SPIRIT_BEAD = 8766;
	
	// Rewards
	private static final int ADENA = 57;
	private static final int ENCHANT_WEAPON_A = 729;
	private static final int ENCHANT_ARMOR_A = 730;
	private static final int ENCHANT_WEAPON_B = 947;
	private static final int ENCHANT_ARMOR_B = 948;
	private static final int ENCHANT_WEAPON_C = 951;
	private static final int ENCHANT_WEAPON_D = 955;
	private static final int[] RECIPES =
	{
		2353,
		4963,
		4967,
		5000,
		5001,
		5002,
		5004,
		5005,
		5006,
		5007
	};
	private static final int[] BLADES =
	{
		2115,
		4104,
		4108,
		4114,
		4115,
		4116,
		4118,
		4119,
		4120,
		4121
	};
	
	// Text of cards
	private static final Map<Integer, String> CARDS = new HashMap<>();
	static
	{
		CARDS.put(0, "No such card");
		CARDS.put(11, "<font color=\"ff453d\"> Sun Card: 1 </font>");
		CARDS.put(12, "<font color=\"ff453d\"> Sun Card: 2 </font>");
		CARDS.put(13, "<font color=\"ff453d\"> Sun Card: 3 </font>");
		CARDS.put(14, "<font color=\"ff453d\"> Sun Card: 4 </font>");
		CARDS.put(15, "<font color=\"ff453d\"> Sun Card: 5 </font>");
		CARDS.put(21, "<font color=\"fff802\"> Moon Card: 1 </font>");
		CARDS.put(22, "<font color=\"fff802\"> Moon Card: 2 </font>");
		CARDS.put(23, "<font color=\"fff802\"> Moon Card: 3 </font>");
		CARDS.put(24, "<font color=\"fff802\"> Moon Card: 4 </font>");
		CARDS.put(25, "<font color=\"fff802\"> Moon Card: 5 </font>");
	}
	
	// Drop chances
	private static final Map<Integer, Integer> CHANCES = new HashMap<>();
	static
	{
		CHANCES.put(20674, 807000); // Doom Knight
		CHANCES.put(20678, 372000); // Tortured Undead
		CHANCES.put(20954, 460000); // Hungered Corpse
		CHANCES.put(20955, 537000); // Ghost War
		CHANCES.put(20956, 540000); // Past Knight
		CHANCES.put(20957, 565000); // Nihil Invader
		CHANCES.put(20958, 425000); // Death Agent
		CHANCES.put(20959, 682000); // Dark Guard
		CHANCES.put(20960, 372000); // Bloody Ghost
		CHANCES.put(20961, 547000); // Bloody Knight
		CHANCES.put(20962, 522000); // Bloody Priest
		CHANCES.put(20963, 498000); // Bloody Lord
		CHANCES.put(20974, 1000000); // Spiteful Soul Leader
		CHANCES.put(20975, 975000); // Spiteful Soul Wizard
		CHANCES.put(20976, 825000); // Spiteful Soul Fighter
		CHANCES.put(20996, 385000); // Spiteful Ghost of Ruins
		CHANCES.put(20997, 342000); // Soldier of Grief
		CHANCES.put(20998, 377000); // Cruel Punisher
		CHANCES.put(20999, 450000); // Roving Soul
		CHANCES.put(21000, 395000); // Soul of Ruins
		CHANCES.put(21001, 535000); // Wretched Archer
		CHANCES.put(21002, 472000); // Doom Scout
		CHANCES.put(21006, 502000); // Doom Servant
		CHANCES.put(21007, 540000); // Doom Guard
		CHANCES.put(21008, 692000); // Doom Archer
		CHANCES.put(21009, 740000); // Doom Trooper
		CHANCES.put(21010, 595000); // Doom Warrior
	}
	
	public Q00663_SeductiveWhispers()
	{
		super(663, "Seductive Whispers");
		registerQuestItems(SPIRIT_BEAD);
		addStartNpc(WILBERT);
		addTalkId(WILBERT);
		addKillId(CHANCES.keySet());
	}
	
	@Override
	public String onEvent(String event, Npc npc, Player player)
	{
		String htmltext = event;
		final QuestState st = getQuestState(player, false);
		if (st == null)
		{
			return htmltext;
		}
		
		final int state = st.getInt("state");
		switch (event)
		{
			case "30846-03.htm":
			{
				st.startQuest();
				st.set("state", "1");
				break;
			}
			case "30846-09.htm":
			{
				if (((state % 10) <= 4))
				{
					if ((state / 10) < 1)
					{
						if (getQuestItemsCount(player, SPIRIT_BEAD) >= 50)
						{
							takeItems(player, SPIRIT_BEAD, 50);
							st.set("state", "5");
						}
						else
						{
							htmltext = "30846-10.htm";
						}
					}
					else
					{
						st.set("state", String.valueOf(((state / 10) * 10) + 5));
						st.set("stateEx", "0");
						htmltext = "30846-09a.htm";
					}
				}
				break;
			}
			case "30846-14.htm":
			{
				if (((state % 10) == 5) && ((state / 1000) == 0))
				{
					final int i0 = st.getInt("stateEx");
					final int i1 = i0 % 10;
					final int i2 = (i0 - i1) / 10;
					final int param1 = getRandom(2) + 1;
					final int param2 = getRandom(5) + 1;
					final int i5 = state / 10;
					final int param3 = (param1 * 10) + param2;
					if (param1 == i2)
					{
						final int i3 = param2 + i1;
						if (((i3 % 5) == 0) && (i3 != 10))
						{
							if (((state % 100) / 10) >= 7)
							{
								st.set("state", "4");
								rewardItems(player, ADENA, 2384000);
								rewardItems(player, ENCHANT_WEAPON_A, 1);
								rewardItems(player, ENCHANT_ARMOR_A, 1);
								rewardItems(player, ENCHANT_ARMOR_A, 1);
								htmltext = getHtm(player, "30846-14.htm", i0, param3, player.getName());
							}
							else
							{
								st.set("state", String.valueOf(((state / 10) * 10) + 7));
								htmltext = getHtm(player, "30846-13.htm", i0, param3, player.getName()).replace("%wincount%", String.valueOf(i5 + 1));
							}
						}
						else
						{
							st.set("state", String.valueOf(((state / 10) * 10) + 6));
							st.set("stateEx", String.valueOf(param3));
							htmltext = getHtm(player, "30846-12.htm", i0, param3, player.getName());
						}
					}
					else
					{
						if ((param2 == 5) || (i1 == 5))
						{
							if (((state % 100) / 10) >= 7)
							{
								st.set("state", "4");
								rewardItems(player, ADENA, 2384000);
								rewardItems(player, ENCHANT_WEAPON_A, 1);
								rewardItems(player, ENCHANT_ARMOR_A, 1);
								rewardItems(player, ENCHANT_ARMOR_A, 1);
								htmltext = getHtm(player, "30846-14.htm", i0, param3, player.getName());
							}
							else
							{
								st.set("state", String.valueOf(((state / 10) * 10) + 7));
								htmltext = getHtm(player, "30846-13.htm", i0, param3, player.getName()).replace("%wincount%", String.valueOf(i5 + 1));
							}
						}
						else
						{
							st.set("state", String.valueOf(((state / 10) * 10) + 6));
							st.set("stateEx", String.valueOf((param1 * 10) + param2));
							htmltext = getHtm(player, "30846-12.htm", i0, param3, player.getName());
						}
					}
				}
				break;
			}
			case "30846-19.htm":
			{
				if (((state % 10) == 6) && ((state / 1000) == 0))
				{
					final int i0 = st.getInt("stateEx");
					final int i1 = i0 % 10;
					final int i2 = (i0 - i1) / 10;
					final int param1 = getRandom(2) + 1;
					final int param2 = getRandom(5) + 1;
					final int param3 = (param1 * 10) + param2;
					if (param1 == i2)
					{
						final int i3 = param1 + i1;
						if (((i3 % 5) == 0) && (i3 != 10))
						{
							st.set("state", "1");
							st.set("stateEx", "0");
							htmltext = getHtm(player, "30846-19.htm", i0, param3, player.getName());
						}
						else
						{
							st.set("state", String.valueOf(((state / 10) * 10) + 5));
							st.set("stateEx", String.valueOf(param3));
							htmltext = getHtm(player, "30846-18.htm", i0, param3, player.getName());
						}
					}
					else
					{
						if ((param2 == 5) || (i1 == 5))
						{
							st.set("state", "1");
							htmltext = getHtm(player, "30846-19.htm", i0, param3, player.getName());
						}
						else
						{
							st.set("state", String.valueOf(((state / 10) * 10) + 5));
							st.set("stateEx", String.valueOf(param3));
							htmltext = getHtm(player, "30846-18.htm", i0, param3, player.getName());
						}
					}
				}
				break;
			}
			case "30846-20.htm":
			{
				if (((state % 10) == 7) && ((state / 1000) == 0))
				{
					st.set("state", String.valueOf((((state / 10) + 1) * 10) + 4));
					st.set("stateEx", "0");
				}
				break;
			}
			case "30846-21.htm":
			{
				if (((state % 10) == 7) && ((state / 1000) == 0))
				{
					final int round = state / 10;
					if (round == 0)
					{
						rewardItems(player, ADENA, 40000);
					}
					else if (round == 1)
					{
						rewardItems(player, ADENA, 80000);
					}
					else if (round == 2)
					{
						rewardItems(player, ADENA, 110000);
						rewardItems(player, ENCHANT_WEAPON_D, 1);
					}
					else if (round == 3)
					{
						rewardItems(player, ADENA, 199000);
						rewardItems(player, ENCHANT_WEAPON_C, 1);
					}
					else if (round == 4)
					{
						rewardItems(player, ADENA, 388000);
						rewardItems(player, getRandomEntry(RECIPES), 1);
					}
					else if (round == 5)
					{
						rewardItems(player, ADENA, 675000);
						rewardItems(player, getRandomEntry(BLADES), 1);
					}
					else if (round == 6)
					{
						rewardItems(player, ADENA, 1284000);
						rewardItems(player, ENCHANT_WEAPON_B, 1);
						rewardItems(player, ENCHANT_ARMOR_B, 1);
						rewardItems(player, ENCHANT_WEAPON_B, 1);
						rewardItems(player, ENCHANT_ARMOR_B, 1);
					}
					
					st.set("state", "1");
					st.set("stateEx", "0");
				}
				break;
			}
			case "30846-22.htm":
			{
				if ((state % 10) == 1)
				{
					if (hasQuestItems(player, SPIRIT_BEAD))
					{
						st.set("state", "1005");
						takeItems(player, SPIRIT_BEAD, 1);
					}
					else
					{
						htmltext = "30846-22a.htm";
					}
				}
				break;
			}
			case "30846-25.htm":
			{
				if (state == 1005)
				{
					final int i0 = st.getInt("stateEx");
					final int i1 = i0 % 10;
					final int i2 = (i0 - i1) / 10;
					final int param1 = getRandom(2) + 1;
					final int param2 = getRandom(5) + 1;
					final int param3 = (param1 * 10) + param2;
					if (param1 == i2)
					{
						final int i3 = param2 + i1;
						if (((i3 % 5) == 0) && (i3 != 10))
						{
							st.set("state", "1");
							st.set("stateEx", "0");
							rewardItems(player, ADENA, 800);
							htmltext = getHtm(player, "30846-25.htm", i0, param3, player.getName()).replace("%card1%", String.valueOf(i1));
						}
						else
						{
							st.set("state", "1006");
							st.set("stateEx", String.valueOf(param3));
							htmltext = getHtm(player, "30846-24.htm", i0, param3, player.getName());
						}
					}
					else
					{
						if ((param2 == 5) || (i2 == 5))
						{
							st.set("state", "1");
							st.set("stateEx", "0");
							rewardItems(player, ADENA, 800);
							htmltext = getHtm(player, "30846-25.htm", i0, param3, player.getName()).replace("%card1%", String.valueOf(i1));
						}
						else
						{
							st.set("state", "1006");
							st.set("stateEx", String.valueOf(param3));
							htmltext = getHtm(player, "30846-24.htm", i0, param3, player.getName());
						}
					}
				}
				break;
			}
			case "30846-29.htm":
			{
				if (state == 1006)
				{
					final int i0 = st.getInt("stateEx");
					final int i1 = i0 % 10;
					final int i2 = (i0 - i1) / 10;
					final int param1 = getRandom(2) + 1;
					final int param2 = getRandom(5) + 1;
					final int param3 = (param1 * 10) + param2;
					if (param1 == i2)
					{
						final int i3 = param2 + i1;
						if (((i3 % 5) == 0) && (i3 != 10))
						{
							st.set("state", "1");
							st.set("stateEx", "0");
							rewardItems(player, ADENA, 800);
							htmltext = getHtm(player, "30846-29.htm", i0, param3, player.getName()).replace("%card1%", String.valueOf(i1));
						}
						else
						{
							st.set("state", "1005");
							st.set("stateEx", String.valueOf(param3));
							htmltext = getHtm(player, "30846-28.htm", i0, param3, player.getName());
						}
					}
					else
					{
						if ((param2 == 5) || (i1 == 5))
						{
							st.set("state", "1");
							st.set("stateEx", "0");
							htmltext = getHtm(player, "30846-29.htm", i0, param3, player.getName());
						}
						else
						{
							st.set("state", "1005");
							st.set("stateEx", String.valueOf(param3));
							htmltext = getHtm(player, "30846-28.htm", i0, param3, player.getName());
						}
					}
				}
				break;
			}
			case "30846-30.htm":
			{
				st.exitQuest(true, true);
				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() < 50) ? "30846-02.htm" : "30846-01.htm";
				break;
			}
			case State.STARTED:
			{
				final int state = st.getInt("state");
				if (state < 4)
				{
					if (hasQuestItems(player, SPIRIT_BEAD))
					{
						htmltext = "30846-05.htm";
					}
					else
					{
						htmltext = "30846-04.htm";
					}
				}
				else if ((state % 10) == 4)
				{
					htmltext = "30846-05a.htm";
				}
				else if ((state % 10) == 5)
				{
					htmltext = "30846-11.htm";
				}
				else if ((state % 10) == 6)
				{
					htmltext = "30846-15.htm";
				}
				else if ((state % 10) == 7)
				{
					final int round = (state % 100) / 10;
					if (round >= 7)
					{
						rewardItems(player, ADENA, 2384000);
						rewardItems(player, ENCHANT_WEAPON_A, 1);
						rewardItems(player, ENCHANT_ARMOR_A, 1);
						rewardItems(player, ENCHANT_ARMOR_A, 1);
						htmltext = "30846-17.htm";
					}
					else
					{
						htmltext = getHtm(player, "30846-16.htm").replace("%wincount%", String.valueOf((state / 10) + 1));
					}
				}
				else if (state == 1005)
				{
					htmltext = "30846-23.htm";
				}
				else if (state == 1006)
				{
					htmltext = "30846-26.htm";
				}
				break;
			}
		}
		
		return htmltext;
	}
	
	@Override
	public void onKill(Npc npc, Player player, boolean isPet)
	{
		final QuestState st = getRandomPartyMemberState(player, -1, 3, npc);
		if ((st == null) || !st.isStarted())
		{
			return;
		}
		
		if (getRandom(1000000) < CHANCES.get(npc.getId()))
		{
			final Player partyMember = st.getPlayer();
			giveItems(partyMember, SPIRIT_BEAD, 1);
			playSound(partyMember, QuestSound.ITEMSOUND_QUEST_ITEMGET);
		}
	}
	
	private String getHtm(Player player, String html, int index, int param3, String name)
	{
		return getHtm(player, html).replace("%card1pic%", CARDS.get(index)).replace("%card2pic%", CARDS.get(param3)).replace("%name%", name);
	}
}