ZURSULUS L2

The Wishing Potion

ID
334
Название
The Wishing Potion
start_npcs_json
[30738]
npc_ids_json
[20078,20087,20088,20168,20192,20193,20199,20227,20248,20249,20250,27135,27136,27138,27139,27153,27154,27155,30557,30738,30742,30743]
constants_json
{"GRIMA":27135,"SUCCUBUS_OF_SEDUCTION":27136,"GREAT_DEMON_KING":27138,"SECRET_KEEPER_TREE":27139,"SANCHES":27153,"BONAPARTERIUS":27154,"RAMSEBALIUS":27155,"TORAI":30557,"ALCHEMIST_MATILD":30738,"RUPINA":30742,"WISDOM_CHEST":30743,"WHISPERING_WIND":20078,"ANT_SOLDIER":20087,"ANT_WARRIOR_CAPTAIN":20088,"SILENOS":20168,"TYRANT":20192,"TYRANT_KINGPIN":20193,"AMBER_BASILISK":20199,"HORROR_MIST_RIPPER":20227,"TURAK_BUGBEAR":20248,"TURAK_BUGBEAR_WARRIOR":20249,"GLASS_JAGUAR":20250,"DEMONS_TUNIC_ID":441,"DEMONS_STOCKINGS_ID":472,"NECKLACE_OF_GRACE_ID":931,"SPELLBOOK_ICEBOLT_ID":1049,"SPELLBOOK_BATTLEHEAL_ID":1050,"DEMONS_TUNIC_FABRIC_ID":1979,"DEMONS_STOCKINGS_PATTERN_ID":1980,"DEMONS_BOOTS_ID":2435,"DEMONS_GLOVES_ID":2459,"DEMONS_BOOTS_FABRIC_ID":2952,"DEMONS_GLOVES_FABRIC_ID":2953,"WISH_POTION_ID":3467,"ANCIENT_CROWN_ID":3468,"CERTIFICATE_OF_ROYALTY_ID":3469,"GOLD_BAR_ID":3470,"ALCHEMY_TEXT_ID":3678,"SECRET_BOOK_ID":3679,"POTION_RECIPE_1_ID":3680,"POTION_RECIPE_2_ID":3681,"MATILDS_ORB_ID":3682,"FORBIDDEN_LOVE_SCROLL_ID":3683,"HEART_OF_PAAGRIO_ID":3943,"AMBER_SCALE_ID":3684,"WIND_SOULSTONE_ID":3685,"GLASS_EYE_ID":3686,"HORROR_ECTOPLASM_ID":3687,"SILENOS_HORN_ID":3688,"ANT_SOLDIER_APHID_ID":3689,"TYRANTS_CHITIN_ID":3690,"BUGBEAR_BLOOD_ID":3691,"DROP_CHANCE_FORBIDDEN_LOVE_SCROLL_ID":3,"DROP_CHANCE_NECKLACE_OF_GRACE_ID":5,"DROP_CHANCE_GOLD_BAR_ID":10}
Статус разбора
metadata_only; dynamic Java conditions/rewards retained in source; unresolved starts: []
Источник
game/data/scripts/quests/Q00334_TheWishingPotion/Q00334_TheWishingPotion.java

NPC квеста

IDНазваниеСтарт квестаУровень
20078Whispering WindНет30
20087Ant SoldierНет35
20088Ant Warrior CaptainНет36
20168SilenosНет30
20192TyrantНет35
20193Tyrant KingpinНет36
20199Amber BasiliskНет30
20227Horror Mist RipperНет27
20248Turak BugbearНет31
20249Turak Bugbear WarriorНет33
20250Glass JaguarНет27
27135GrimaНет50
27136Succubus Of SeductionНет40
27138Great Demon KingНет60
27139Secret Keeper TreeНет47
27153Alexandro SanchesНет3
27154BonaparteriusНет3
27155RamsebaliusНет3
30557ToraiНет70
30738MatildДа70
30742RupinaНет70
30743Wisdom ChestНет70

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

if (st.getPlayer().getLevel() <= 29)

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

giveItems(player, ALCHEMY_TEXT_ID, 1);
giveItems(player, POTION_RECIPE_1_ID, 1);
giveItems(player, POTION_RECIPE_2_ID, 1);
giveItems(player, MATILDS_ORB_ID, 1);
giveItems(player, WISH_POTION_ID, 1);
giveAdena(player, 10000, true);
giveAdena(player, (getRandom(10) + 1) * 1000000, true);
giveItems(player, CERTIFICATE_OF_ROYALTY_ID, 1);
giveItems(player, ANCIENT_CROWN_ID, 1);
giveItems(player, SPELLBOOK_ICEBOLT_ID, 1);
giveItems(player, SPELLBOOK_BATTLEHEAL_ID, 1);
giveItems(player, POTION_RECIPE_1_ID, 1);
giveItems(player, POTION_RECIPE_2_ID, 1);
giveAdena(player, 500000, true);
giveItems(player, SPELLBOOK_ICEBOLT_ID, 1);
giveItems(player, SPELLBOOK_BATTLEHEAL_ID, 1);
giveItems(player, HEART_OF_PAAGRIO_ID, 1);
giveItems(player, NECKLACE_OF_GRACE_ID, 1);
giveItems(player, DEMONS_TUNIC_FABRIC_ID, 1);
giveItems(player, DEMONS_STOCKINGS_PATTERN_ID, 1);
giveItems(player, DEMONS_BOOTS_FABRIC_ID, 1);
giveItems(player, DEMONS_GLOVES_FABRIC_ID, 1);
giveItems(player, element[4], element[7]);
giveItems(player, element[4], element[7]);
giveItems(player, FORBIDDEN_LOVE_SCROLL_ID, 1);
giveItems(player, GOLD_BAR_ID, getRandom(5) + 1);
giveItems(player, DEMONS_BOOTS_ID, 1);
giveItems(player, DEMONS_GLOVES_ID, 1);
giveItems(player, DEMONS_STOCKINGS_ID, 1);
giveItems(player, DEMONS_TUNIC_ID, 1);

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

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

[30557-01.htm] Torai: Oh my! This... is a priceless book. Sell it to me...! I'll give you a high price for it... Heh heh heh... [30738-01.htm] Alchemist Matild: Since I learned herbal medicine when I was young and started to make magic potions 20 years ago, people say that I'm the very best in my field. But I think I've still got a long way to go. There are many mysterious potions passed down only through the ancient lore that I haven't made yet. But hey, just a short time ago I came to know by accident where the secret method for making one of the mysterious potions is stored. There is a clue written inside the book that I have. So it would be good if you would help me... Ask what you can do to help. [30738-02.htm] Alchemist Matild: This alchemy textbook tells about the place where the book of problems is hidden. I'd like you to refer to this and find the secret book. Say that you will find the secret book. [30738-03.htm] Alchemist Matild: Thank you. Ah, and take this book. Follow the clues written in this book and bring me the secret book of alchemy that is hidden. OK? Then I will definitely give you a surprising reward. [30738-04.htm] Alchemist Matild: Is the work of finding the secret book progressing well? Haven't finished yet? Then hurry, please. [30738-05.htm] Alchemist Matild: You brought the secret book! But... Oh, I'm sorry. Actually, while you were away, somebody came with some precious ingredients and I spent my last adena purching them. Hmm... What if I do this instead? The method for making wish potion is what's written in the secret book that you brought! I got most of the ingredients with this last purchase but there are still a few things I'm short of. If you'll just bring me those, I'll make wish potion for you that will grant you all of your wishes. How about that? Is that a good deal? Say that you will bring the ingredients. [30738-06.htm] Alchemist Matild: Yahoo! Done deal! Thank you for putting up with my unreasonableness. OK, here is the ingredient list. Go get what's written here. Please! [30738-07.htm] Alchemist Matild: I'm sorry to say this but... We're still short on ingredients. What should we do? I just really can't start the work until you've gotten all the ingredients. [30738-08.htm] Alchemist Matild: Umm... You've collected all the ingredients. You've done a great job. OK, shall we start? Ask to make wish potion. [30738-09.htm] Alchemist Matild: Then take this herbal sap and apply it gently here! Yeah, if you mix it in well... the color changes, no? OK, next add it to this bottle and mix it... Could you give me that red bottle over there now? Hand over red bottle. [30738-10.htm] Alchemist Matild: Then carefully add wish scent... OK! It's done. Oh, but talk to me before using the wish potion. That's because there are some things to prepare before getting your wish. And take this. It's my proof, but if you bring it I'll make you wish potion again. Of course, you'll have to gather together the ingredients then too. Alright, so this is gratitude enough, don't you think? [30738-11.htm] Alchemist Matild: Ah, you there! Do you remember? You made a promise to me... What's the reason this time...? Are you wanting to take the wish potion? Or are you getting together the ingredients to make more wish potion? Say that you will take the wish potion. Say that you'll get the ingredients. [30738-12.htm] Alchemist Matild: OK, just like you did last time, please gather the ingredients written here. I don't need to give you a long explanation about it, do I? [30738-13.htm] Alchemist Matild: Huh? You already have wish potion. What a greedy person you are...! How about just taking the wish potion you've got first and then making more? Alright? [30738-14.htm] Alchemist Matild: Umm... I'm sure that you didn't make any more wish potion after asking for your wish last time... [30738-15.htm] Alchemist Matild: Umm, you can make your wish after taking the potion. Normally you can ask for one of these four wishes. OK, take a look at the card and choose. Please make me into a loving person. I want to become an extremely rich person. How about 10 million adena?! I want to be a king in this world. I'd like to become the wisest person in the world. [30738-16.htm] Alchemist Matild: OK, then if you apply blood of crow to your forehead first... then shake wing of fairy three times... and start the ceremony... [30738-17.htm] Alchemist Matild: OK, then if you apply blood of crow to your forehead first... then shake leaf of timitran three times... and start the ceremony... [30738-18.htm] Alchemist Matild: OK, then if you apply blood of crow to your forehead first... then put crown of glory on your head... and start the ceremony... [30738-19.htm] Alchemist Matild: OK, then if you apply blood of crow to your forehead first... then hit your head three times with sage's staff... Bang! Bang! Bang! and start the ceremony... [30738-20.htm] Alchemist Matild: Someone else is making a wish right now! Wait your turn. [30738-21.htm] Alchemist Matild: Many people have their eyes on the secrets of alchemy. You don't look like you'd be strong enough to protect those secrets from bad folks. I'm sorry but I can't talk to you about alchemy. (This is a quest that can only be performed by characters at level 30 and above.) [30742-01.htm] Fairy of Love Rupina: Love a lot. Love, love, love, love love, love, love, love, love, love love, love, love, love, love, love love, love, love, love, love, love, love love, love, love, love, love love, love, love love, love love Love each other! [30743-01.htm] Chest of Wisdom: (A voice comes out of the chest.) They are magic scrolls that contain the wisdom of sages! [30743-02.htm] Chest of Wisdom: (A voice comes out of the chest.) I will give you a valuable piece of wisdom that will make you rich. If you find and take the forbidden love scroll and go see Torai, you can make yourself a huge amount of money. [30743-03.htm] Chest of Wisdom: (A voice comes out of the chest.) I will teach you a wise method to increase your wealth. Warehouse Keeper Sorint, Sorceress Paige, Researcher Lorain, Warehouse Keeper Hagger, Guard Stan, Blacksmith Dunning, Magic Trader Ralph, Head Blacksmith Ferris, Warehouse Keeper Collob, and Grocer Pano... All these people are crazy about collecting weird coins! [30743-04.htm] Chest of Wisdom: (A voice comes out of the chest.) I will tell you about the method of using the Wish Potion wisely. If you make a wish to become a ruler, I heard that you will be able to meet the Devil himself... [30743-05.htm] Chest of Wisdom: (A voice comes out of the chest.) I will tell you about the method of using the Wish Potion wisely. If you make a wish to obtain love, a succubus that will take pleasure in seducing and then giving pain to a man will appear. But why, when it is a woman, will a succubus still show up? [30743-06.htm] Chest of Wisdom: (A voice comes out of the chest.) You are the chosen one. I present to you the treasure of knowledge as a gift.
Исходник условий и наград (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.Q00334_TheWishingPotion;

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;

/**
 * Adapted from FirstTeam Interlude
 */
public class Q00334_TheWishingPotion extends Quest
{
	private static final int GRIMA = 27135;
	private static final int SUCCUBUS_OF_SEDUCTION = 27136;
	private static final int GREAT_DEMON_KING = 27138;
	private static final int SECRET_KEEPER_TREE = 27139;
	private static final int SANCHES = 27153;
	private static final int BONAPARTERIUS = 27154;
	private static final int RAMSEBALIUS = 27155;
	private static final int TORAI = 30557;
	private static final int ALCHEMIST_MATILD = 30738;
	private static final int RUPINA = 30742;
	private static final int WISDOM_CHEST = 30743;
	private static final int WHISPERING_WIND = 20078;
	private static final int ANT_SOLDIER = 20087;
	private static final int ANT_WARRIOR_CAPTAIN = 20088;
	private static final int SILENOS = 20168;
	private static final int TYRANT = 20192;
	private static final int TYRANT_KINGPIN = 20193;
	private static final int AMBER_BASILISK = 20199;
	private static final int HORROR_MIST_RIPPER = 20227;
	private static final int TURAK_BUGBEAR = 20248;
	private static final int TURAK_BUGBEAR_WARRIOR = 20249;
	private static final int GLASS_JAGUAR = 20250;
	private static final int DEMONS_TUNIC_ID = 441;
	private static final int DEMONS_STOCKINGS_ID = 472;
	private static final int NECKLACE_OF_GRACE_ID = 931;
	private static final int SPELLBOOK_ICEBOLT_ID = 1049;
	private static final int SPELLBOOK_BATTLEHEAL_ID = 1050;
	private static final int DEMONS_TUNIC_FABRIC_ID = 1979;
	private static final int DEMONS_STOCKINGS_PATTERN_ID = 1980;
	private static final int DEMONS_BOOTS_ID = 2435;
	private static final int DEMONS_GLOVES_ID = 2459;
	private static final int DEMONS_BOOTS_FABRIC_ID = 2952;
	private static final int DEMONS_GLOVES_FABRIC_ID = 2953;
	private static final int WISH_POTION_ID = 3467;
	private static final int ANCIENT_CROWN_ID = 3468;
	private static final int CERTIFICATE_OF_ROYALTY_ID = 3469;
	private static final int GOLD_BAR_ID = 3470;
	private static final int ALCHEMY_TEXT_ID = 3678;
	private static final int SECRET_BOOK_ID = 3679;
	private static final int POTION_RECIPE_1_ID = 3680;
	private static final int POTION_RECIPE_2_ID = 3681;
	private static final int MATILDS_ORB_ID = 3682;
	private static final int FORBIDDEN_LOVE_SCROLL_ID = 3683;
	private static final int HEART_OF_PAAGRIO_ID = 3943;
	private static final int AMBER_SCALE_ID = 3684;
	private static final int WIND_SOULSTONE_ID = 3685;
	private static final int GLASS_EYE_ID = 3686;
	private static final int HORROR_ECTOPLASM_ID = 3687;
	private static final int SILENOS_HORN_ID = 3688;
	private static final int ANT_SOLDIER_APHID_ID = 3689;
	private static final int TYRANTS_CHITIN_ID = 3690;
	private static final int BUGBEAR_BLOOD_ID = 3691;
	private static final int DROP_CHANCE_FORBIDDEN_LOVE_SCROLL_ID = 3;
	private static final int DROP_CHANCE_NECKLACE_OF_GRACE_ID = 5;
	private static final int DROP_CHANCE_GOLD_BAR_ID = 10;
	private static final int[][] DROPLIST_COND =
	{// @formatter:off
		{1, 2, SECRET_KEEPER_TREE, 0, SECRET_BOOK_ID, 1, 100, 1},
		{3, 0, AMBER_BASILISK, 0, AMBER_SCALE_ID, 1, 15, 1},
		{3, 0, WHISPERING_WIND, 0, WIND_SOULSTONE_ID, 1, 20, 1},
		{3, 0, GLASS_JAGUAR, 0, GLASS_EYE_ID, 1, 35, 1},
		{3, 0, HORROR_MIST_RIPPER, 0, HORROR_ECTOPLASM_ID, 1, 15, 1},
		{3, 0, SILENOS, 0, SILENOS_HORN_ID, 1, 30, 1},
		{3, 0, ANT_SOLDIER, 0, ANT_SOLDIER_APHID_ID, 1, 40, 1},
		{3, 0, ANT_WARRIOR_CAPTAIN, 0, ANT_SOLDIER_APHID_ID, 1, 40, 1},
		{3, 0, TYRANT, 0, TYRANTS_CHITIN_ID, 1, 50, 1},
		{3, 0, TYRANT_KINGPIN, 0, TYRANTS_CHITIN_ID, 1, 50, 1},
		{3, 0, TURAK_BUGBEAR, 0, BUGBEAR_BLOOD_ID, 1, 15, 1},
		{3, 0, TURAK_BUGBEAR_WARRIOR, 0, BUGBEAR_BLOOD_ID, 1, 25, 1}
		
	}; // @formatter:on
	
	public Q00334_TheWishingPotion()
	{
		super(334, "The Wishing Potion");
		addStartNpc(ALCHEMIST_MATILD);
		addTalkId(ALCHEMIST_MATILD, TORAI, WISDOM_CHEST, RUPINA);
		registerQuestItems(ALCHEMY_TEXT_ID, SECRET_BOOK_ID, POTION_RECIPE_1_ID, POTION_RECIPE_2_ID, AMBER_SCALE_ID, WIND_SOULSTONE_ID, GLASS_EYE_ID, HORROR_ECTOPLASM_ID, SILENOS_HORN_ID, ANT_SOLDIER_APHID_ID, TYRANTS_CHITIN_ID, BUGBEAR_BLOOD_ID);
		for (int[] element : DROPLIST_COND)
		{
			addKillId(element[2]);
		}
		
		// Monsters summoned by the Wishing Potion, handled after the drop list.
		addKillId(GRIMA, SUCCUBUS_OF_SEDUCTION, SANCHES, BONAPARTERIUS, RAMSEBALIUS, GREAT_DEMON_KING);
	}
	
	@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 "30738-03.htm":
			{
				st.startQuest();
				giveItems(player, ALCHEMY_TEXT_ID, 1);
				break;
			}
			case "30738-06.htm":
			{
				if (getQuestItemsCount(player, WISH_POTION_ID) == 0)
				{
					takeItems(player, ALCHEMY_TEXT_ID, -1);
					takeItems(player, SECRET_BOOK_ID, -1);
					if (getQuestItemsCount(player, POTION_RECIPE_1_ID) == 0)
					{
						giveItems(player, POTION_RECIPE_1_ID, 1);
					}
					
					if (getQuestItemsCount(player, POTION_RECIPE_2_ID) == 0)
					{
						giveItems(player, POTION_RECIPE_2_ID, 1);
					}
					
					if (getQuestItemsCount(player, MATILDS_ORB_ID) == 0)
					{
						htmltext = "30738-06.htm";
					}
					else
					{
						htmltext = "30738-12.htm";
					}
					
					st.setCond(3);
				}
				else if ((getQuestItemsCount(player, MATILDS_ORB_ID) >= 1) && (getQuestItemsCount(player, WISH_POTION_ID) >= 1))
				{
					htmltext = "30738-13.htm";
				}
				break;
			}
			case "30738-10.htm":
			{
				if (checkIngr(st, player))
				{
					playSound(player, QuestSound.ITEMSOUND_QUEST_FINISH);
					takeItems(player, ALCHEMY_TEXT_ID, -1);
					takeItems(player, SECRET_BOOK_ID, -1);
					takeItems(player, POTION_RECIPE_1_ID, -1);
					takeItems(player, POTION_RECIPE_2_ID, -1);
					takeItems(player, AMBER_SCALE_ID, -1);
					takeItems(player, WIND_SOULSTONE_ID, -1);
					takeItems(player, GLASS_EYE_ID, -1);
					takeItems(player, HORROR_ECTOPLASM_ID, -1);
					takeItems(player, SILENOS_HORN_ID, -1);
					takeItems(player, ANT_SOLDIER_APHID_ID, -1);
					takeItems(player, TYRANTS_CHITIN_ID, -1);
					takeItems(player, BUGBEAR_BLOOD_ID, -1);
					if (getQuestItemsCount(player, MATILDS_ORB_ID) == 0)
					{
						giveItems(player, MATILDS_ORB_ID, 1);
					}
					
					giveItems(player, WISH_POTION_ID, 1);
					st.setCond(0);
				}
				else
				{
					htmltext = "<html><head><body>You don't have required items</body></html>";
				}
				break;
			}
			case "30738-14.htm":
			{
				if (getQuestItemsCount(player, WISH_POTION_ID) >= 1)
				{
					htmltext = "30738-15.htm";
				}
				break;
			}
			case "30738-16.htm":
			{
				if (getQuestItemsCount(player, WISH_POTION_ID) >= 1)
				{
					takeItems(player, WISH_POTION_ID, 1);
					if (getRandom(100) < 50)
					{
						addSpawn(SUCCUBUS_OF_SEDUCTION, player);
						addSpawn(SUCCUBUS_OF_SEDUCTION, player);
						addSpawn(SUCCUBUS_OF_SEDUCTION, player);
					}
					else
					{
						addSpawn(RUPINA, player);
					}
				}
				else
				{
					htmltext = "30738-14.htm";
				}
				break;
			}
			case "30738-17.htm":
			{
				if (getQuestItemsCount(player, WISH_POTION_ID) >= 1)
				{
					takeItems(player, WISH_POTION_ID, 1);
					final int WISH_CHANCE = getRandom(100) + 1;
					if (WISH_CHANCE <= 33)
					{
						addSpawn(GRIMA, player);
						addSpawn(GRIMA, player);
						addSpawn(GRIMA, player);
					}
					else if (WISH_CHANCE >= 66)
					{
						giveAdena(player, 10000, true);
					}
					else if (getRandom(100) < 2)
					{
						giveAdena(player, (getRandom(10) + 1) * 1000000, true);
					}
					else
					{
						addSpawn(GRIMA, player);
						addSpawn(GRIMA, player);
						addSpawn(GRIMA, player);
					}
				}
				else
				{
					htmltext = "30738-14.htm";
				}
				break;
			}
			case "30738-18.htm":
			{
				if (getQuestItemsCount(player, WISH_POTION_ID) >= 1)
				{
					takeItems(player, WISH_POTION_ID, 1);
					final int WISH_CHANCE = getRandom(100) + 1;
					if (WISH_CHANCE <= 33)
					{
						giveItems(player, CERTIFICATE_OF_ROYALTY_ID, 1);
					}
					else if (WISH_CHANCE >= 66)
					{
						giveItems(player, ANCIENT_CROWN_ID, 1);
					}
					else
					{
						addSpawn(SANCHES, player);
					}
				}
				else
				{
					htmltext = "30738-14.htm";
				}
				break;
			}
			case "30738-19.htm":
			{
				if (getQuestItemsCount(player, WISH_POTION_ID) >= 1)
				{
					takeItems(player, 3467, 1);
					final int WISH_CHANCE = getRandom(100) + 1;
					if (WISH_CHANCE <= 33)
					{
						giveItems(player, SPELLBOOK_ICEBOLT_ID, 1);
					}
					else if (WISH_CHANCE <= 66)
					{
						giveItems(player, SPELLBOOK_BATTLEHEAL_ID, 1);
					}
					else
					{
						addSpawn(WISDOM_CHEST, player);
					}
				}
				else
				{
					htmltext = "30738-14.htm";
				}
				break;
			}
		}
		
		return htmltext;
	}
	
	@Override
	public String onTalk(Npc npc, Player player)
	{
		String htmltext = getNoQuestMsg(player);
		final QuestState st = getQuestState(player, true);
		
		final int npcId = npc.getId();
		final int id = st.getState();
		int cond = 0;
		if (id != 0)
		{
			cond = st.getCond();
		}
		
		switch (npcId)
		{
			case ALCHEMIST_MATILD:
			{
				if (cond == 0)
				{
					if (st.getPlayer().getLevel() <= 29)
					{
						htmltext = "30738-21.htm";
						st.exitQuest(true);
					}
					else if (getQuestItemsCount(player, MATILDS_ORB_ID) == 0)
					{
						htmltext = "30738-01.htm";
					}
					else if (getQuestItemsCount(player, 3467) == 0)
					{
						// A repeat after an abort starts from a new quest state, which has to be started before the condition applies.
						st.setState(State.STARTED);
						st.setCond(3);
						if (getQuestItemsCount(player, POTION_RECIPE_1_ID) == 0)
						{
							giveItems(player, POTION_RECIPE_1_ID, 1);
						}
						
						if (getQuestItemsCount(player, POTION_RECIPE_2_ID) == 0)
						{
							giveItems(player, POTION_RECIPE_2_ID, 1);
						}
						
						htmltext = "30738-12.htm";
					}
					else
					{
						htmltext = "30738-11.htm";
					}
				}
				else if ((cond == 1) && (getQuestItemsCount(player, ALCHEMY_TEXT_ID) == 1))
				{
					htmltext = "30738-04.htm";
				}
				else if (cond == 2)
				{
					if ((getQuestItemsCount(player, SECRET_BOOK_ID) == 1) && (getQuestItemsCount(player, ALCHEMY_TEXT_ID) == 1))
					{
						htmltext = "30738-05.htm";
					}
				}
				else if (cond == 4)
				{
					if (checkIngr(st, player))
					{
						htmltext = "30738-08.htm";
					}
					else
					{
						htmltext = "30738-07.htm";
					}
				}
				break;
			}
			case TORAI:
			{
				if (getQuestItemsCount(player, FORBIDDEN_LOVE_SCROLL_ID) >= 1)
				{
					takeItems(player, FORBIDDEN_LOVE_SCROLL_ID, 1);
					giveAdena(player, 500000, true);
					htmltext = "30557-01.htm";
				}
				else
				{
					htmltext = getNoQuestMsg(player);
				}
				break;
			}
			case WISDOM_CHEST:
			{
				final int dropChance = getRandom(100);
				if (dropChance < 20)
				{
					giveItems(player, SPELLBOOK_ICEBOLT_ID, 1);
					giveItems(player, SPELLBOOK_BATTLEHEAL_ID, 1);
					st.getPlayer().getTarget().decayMe();
					htmltext = "30743-06.htm";
				}
				else if (dropChance < 30)
				{
					giveItems(player, HEART_OF_PAAGRIO_ID, 1);
					st.getPlayer().getTarget().decayMe();
					htmltext = "30743-06.htm";
				}
				else
				{
					st.getPlayer().getTarget().decayMe();
					htmltext = "30743-0" + (getRandom(5) + 1) + ".htm";
				}
				break;
			}
			case RUPINA:
			{
				if (getRandom(100) < DROP_CHANCE_NECKLACE_OF_GRACE_ID)
				{
					giveItems(player, NECKLACE_OF_GRACE_ID, 1);
				}
				else
				{
					final int dropChance = getRandom(100) + 1;
					if (dropChance <= 25)
					{
						giveItems(player, DEMONS_TUNIC_FABRIC_ID, 1);
					}
					else if (dropChance <= 50)
					{
						giveItems(player, DEMONS_STOCKINGS_PATTERN_ID, 1);
					}
					else if (dropChance <= 75)
					{
						giveItems(player, DEMONS_BOOTS_FABRIC_ID, 1);
					}
					else
					{
						giveItems(player, DEMONS_GLOVES_FABRIC_ID, 1);
					}
				}
				
				st.getPlayer().getTarget().decayMe();
				htmltext = "30742-01.htm";
				break;
			}
		}
		
		return htmltext;
	}
	
	@Override
	public void onKill(Npc npc, Player player, boolean isPet)
	{
		final QuestState st = player.getQuestState(getName());
		if (st == null)
		{
			return;
		}
		
		final int npcId = npc.getId();
		final int cond = st.getCond();
		for (int[] element : DROPLIST_COND)
		{
			if ((cond == element[0]) && (npcId == element[2]) && ((element[3] == 0) || (getQuestItemsCount(player, element[3]) > 0)))
			{
				if (element[5] == 0)
				{
					if (getRandom(100) < element[6])
					{
						giveItems(player, element[4], element[7]);
					}
				}
				else if ((getRandom(100) < element[6]) && (getQuestItemsCount(player, element[4]) < element[5]))
				{
					giveItems(player, element[4], element[7]);
					if (cond == 3)
					{
						checkIngr(st, player);
					}
					
					if ((element[1] != cond) && (element[1] != 0))
					{
						st.setCond(element[1]);
						st.setState(State.STARTED);
					}
				}
			}
		}
		
		final int dropChance = getRandom(100) + 1;
		if ((npcId == SUCCUBUS_OF_SEDUCTION) && (dropChance <= DROP_CHANCE_FORBIDDEN_LOVE_SCROLL_ID))
		{
			playSound(player, QuestSound.ITEMSOUND_QUEST_ITEMGET);
			giveItems(player, FORBIDDEN_LOVE_SCROLL_ID, 1);
		}
		else if ((npcId == GRIMA) && (dropChance <= DROP_CHANCE_GOLD_BAR_ID))
		{
			playSound(player, QuestSound.ITEMSOUND_QUEST_ITEMGET);
			giveItems(player, GOLD_BAR_ID, getRandom(5) + 1);
		}
		else if ((npcId == SANCHES) && (getRandom(100) < 50))
		{
			addSpawn(BONAPARTERIUS, player);
		}
		else if ((npcId == BONAPARTERIUS) && (getRandom(100) < 50))
		{
			addSpawn(RAMSEBALIUS, player);
		}
		else if ((npcId == RAMSEBALIUS) && (getRandom(100) < 50))
		{
			addSpawn(GREAT_DEMON_KING, player);
		}
		else if ((npcId == GREAT_DEMON_KING) && (getRandom(100) < 50))
		{
			if (dropChance <= 25)
			{
				giveItems(player, DEMONS_BOOTS_ID, 1);
			}
			else if (dropChance <= 50)
			{
				giveItems(player, DEMONS_GLOVES_ID, 1);
			}
			else if (dropChance <= 75)
			{
				giveItems(player, DEMONS_STOCKINGS_ID, 1);
			}
			else
			{
				giveItems(player, DEMONS_TUNIC_ID, 1);
			}
			
			playSound(player, QuestSound.ITEMSOUND_QUEST_ITEMGET);
		}
	}
	
	public boolean checkIngr(QuestState st, Player player)
	{
		if ((getQuestItemsCount(player, AMBER_SCALE_ID) == 1) && (getQuestItemsCount(player, WIND_SOULSTONE_ID) == 1) && (getQuestItemsCount(player, GLASS_EYE_ID) == 1) && (getQuestItemsCount(player, HORROR_ECTOPLASM_ID) == 1) && (getQuestItemsCount(player, SILENOS_HORN_ID) == 1) && (getQuestItemsCount(player, ANT_SOLDIER_APHID_ID) == 1) && (getQuestItemsCount(player, TYRANTS_CHITIN_ID) == 1) && (getQuestItemsCount(player, BUGBEAR_BLOOD_ID) == 1))
		{
			st.setCond(4, true);
			return true;
		}
		
		st.setCond(3, true);
		return false;
	}
}