#By L2JMack
import sys
from com.l2dot.gameserver.model.actor.instance import L2PcInstance
from java.util import Iterator
from com.l2dot.gameserver.datatables import SkillTable
from com.l2dot                         import L2DatabaseFactory
from com.l2dot.gameserver.model.quest import State
from com.l2dot.gameserver.model.quest import QuestState
from com.l2dot.gameserver.model.quest.jython import QuestJython as JQuest

qn = "9998_IL_NPCBuffer"

NPC = [66004]
MIN_LVL = 1     # Minimum lvl from which player can get buffs
MAX_LVL = 90     # Maximum lvl from which player can get buffs
CURRENCY_ID = 57    # Currency ID (Adena - 57, Ancient Adena - 5575) you can use anything you want
MIN_ADENA = 1     # Minimum adena amount in player inventory to be able to get buffs
BUFF_PRICE = 0     # PRP, EE, SE Buffs Price
DANCE_PRICE = 0     # Dances Price
SONG_PRICE = 0     # Songs Price
CHANT_PRICE = 0     # WC Buffs Price
PAAGRIO_PRICE = 0     # OL Buffs Price
PET_PRICE = 0     # Pets Buffs Price
PROPHECY_PRICE = 0     # Prophecies + COV Buffs Price
NOBLE_PRICE = 0     # Noblese Blessing Price
HOT_PRICE = 0     # HOT Buffer
CANCEL_PRICE = 0     # Cancel Buffs Price
QuestId = 9998
QuestName = "IL_NPCBuffer"
QuestDesc = "custom"
InitialHtml = "1.htm"

print "importing 9998: Buffer"

class Quest (JQuest) :

	def __init__(self,id,name,descr): JQuest.__init__(self,id,name,descr)

	def onEvent(self,event,st):
		htmltext = event
		count = st.getQuestItemsCount(CURRENCY_ID)
		level = st.getPlayer().getLevel()
		if count < MIN_ADENA  :
			htmltext = "<html><head><body>You don't have enouth Adena.<br>Or your lvl doesn't mach requirements.<br>You must be between 40-60 lvl.</body></html>"
		else:
			st.takeItems(CURRENCY_ID,0)
			st.getPlayer().setTarget(st.getPlayer())

			# Might 3
			if event == "2":
				st.takeItems(CURRENCY_ID,BUFF_PRICE)
				SkillTable.getInstance().getInfo(1068,3).getEffects(st.getPlayer(),st.getPlayer())
				return "2.htm"		
				st.setState(Started)

			# Shield 3
			if event == "3":
				st.takeItems(CURRENCY_ID,BUFF_PRICE)
				SkillTable.getInstance().getInfo(1040,3).getEffects(st.getPlayer(),st.getPlayer())
				return "2.htm"		
				st.setState(Started)

			# Acumen 3
			if event == "4":
				st.takeItems(CURRENCY_ID,BUFF_PRICE)
				SkillTable.getInstance().getInfo(1085,3).getEffects(st.getPlayer(),st.getPlayer())
				return "2.htm"		
				st.setState(Started)

			# Concentration 6
			if event == "5":
				st.takeItems(CURRENCY_ID,BUFF_PRICE)
				SkillTable.getInstance().getInfo(1078,6).getEffects(st.getPlayer(),st.getPlayer())
				return "2.htm"		
				st.setState(Started)

			# Argument P.Atk 10
			if event == "6":
				st.takeItems(CURRENCY_ID,BUFF_PRICE)
				SkillTable.getInstance().getInfo(3132,10).getEffects(st.getPlayer(),st.getPlayer())
				return "8.htm"		
				st.setState(Started)

			# Wind Walk 2
			if event == "7":
				st.takeItems(CURRENCY_ID,BUFF_PRICE)
				SkillTable.getInstance().getInfo(1204,2).getEffects(st.getPlayer(),st.getPlayer())
				return "2.htm"		
				st.setState(Started)

			# Focus 3
			if event == "8":
				st.takeItems(CURRENCY_ID,BUFF_PRICE)
				SkillTable.getInstance().getInfo(1077,3).getEffects(st.getPlayer(),st.getPlayer())
				return "2.htm"		
				st.setState(Started)

			#Argument M.Atk 10
			if event == "9":
				st.takeItems(CURRENCY_ID,BUFF_PRICE)
				SkillTable.getInstance().getInfo(3133,10).getEffects(st.getPlayer(),st.getPlayer())
				return "8.htm"		
				st.setState(Started)

			# Mental Shield 4
			if event == "10":
				st.takeItems(CURRENCY_ID,BUFF_PRICE)
				SkillTable.getInstance().getInfo(1035,4).getEffects(st.getPlayer(),st.getPlayer())
				return "2.htm"		
				st.setState(Started)

			#Heroic Miracle 1
			if event == "11":
				st.takeItems(CURRENCY_ID,BUFF_PRICE)
				SkillTable.getInstance().getInfo(395,1).getEffects(st.getPlayer(),st.getPlayer())
				return "8.htm"		
				st.setState(Started)

			# Berserker Spirit 2
			if event == "12":
				st.takeItems(CURRENCY_ID,BUFF_PRICE)
				SkillTable.getInstance().getInfo(1062,2).getEffects(st.getPlayer(),st.getPlayer())
				return "2.htm"		
				st.setState(Started)

			# Heroic Valor 1
			if event == "13":
				st.takeItems(CURRENCY_ID,BUFF_PRICE)
				SkillTable.getInstance().getInfo(1374,1).getEffects(st.getPlayer(),st.getPlayer())
				return "8.htm"		
				st.setState(Started)

			# Bless Shield 6
			if event == "14":
				st.takeItems(CURRENCY_ID,BUFF_PRICE)
				SkillTable.getInstance().getInfo(1243,6).getEffects(st.getPlayer(),st.getPlayer())
				return "2.htm"		
				st.setState(Started)

			# Death Whisper 3
			if event == "15":
				st.takeItems(CURRENCY_ID,BUFF_PRICE)
				SkillTable.getInstance().getInfo(1242,3).getEffects(st.getPlayer(),st.getPlayer())
				return "2.htm"		
				st.setState(Started)

			# Guidance 3
			if event == "16":
				st.takeItems(CURRENCY_ID,BUFF_PRICE)
				SkillTable.getInstance().getInfo(1240,3).getEffects(st.getPlayer(),st.getPlayer())
				return "2.htm"		
				st.setState(Started)

			# salvation 1
			if event == "17":
				st.takeItems(CURRENCY_ID,BUFF_PRICE)
				SkillTable.getInstance().getInfo(1410,1).getEffects(st.getPlayer(),st.getPlayer())
				return "8.htm"		
				st.setState(Started)

			# Blessed Body 6
			if event == "18":
				st.takeItems(CURRENCY_ID,BUFF_PRICE)
				SkillTable.getInstance().getInfo(1045,6).getEffects(st.getPlayer(),st.getPlayer())
				return "2.htm"		
				st.setState(Started)

			# Blessed Soul 6
			if event == "19":
				st.takeItems(CURRENCY_ID,BUFF_PRICE)
				SkillTable.getInstance().getInfo(1048,6).getEffects(st.getPlayer(),st.getPlayer())
				return "2.htm"		
				st.setState(Started)

			# Haste 2
			if event == "20":
				st.takeItems(CURRENCY_ID,BUFF_PRICE)
				SkillTable.getInstance().getInfo(1086,2).getEffects(st.getPlayer(),st.getPlayer())
				return "2.htm"		
				st.setState(Started)

			# Magic Barrier 2
			if event == "21":
				st.takeItems(CURRENCY_ID,BUFF_PRICE)
				SkillTable.getInstance().getInfo(1036,2).getEffects(st.getPlayer(),st.getPlayer())
				return "2.htm"		
				st.setState(Started)

			# Greater Might 3
			if event == "22":
				st.takeItems(CURRENCY_ID,BUFF_PRICE)
				SkillTable.getInstance().getInfo(1388,3).getEffects(st.getPlayer(),st.getPlayer())
				return "2.htm"		
				st.setState(Started)

			# Greater Shield 3
			if event == "23":
				st.takeItems(CURRENCY_ID,BUFF_PRICE)
				SkillTable.getInstance().getInfo(1389,3).getEffects(st.getPlayer(),st.getPlayer())
				return "2.htm"		
				st.setState(Started)

			# Argument.Focus 10
			if event == "24":
				st.takeItems(CURRENCY_ID,BUFF_PRICE)
				SkillTable.getInstance().getInfo(3141,10).getEffects(st.getPlayer(),st.getPlayer())
				return "8.htm"		
				st.setState(Started)

			# Argument.Wild 10
			if event == "25":
				st.takeItems(CURRENCY_ID,BUFF_PRICE)
				SkillTable.getInstance().getInfo(3142,10).getEffects(st.getPlayer(),st.getPlayer())
				return "8.htm"		
				st.setState(Started)

			# Great Migh 3 
			if event == "26":
				st.takeItems(CURRENCY_ID,BUFF_PRICE)
				SkillTable.getInstance().getInfo(1388,3).getEffects(st.getPlayer(),st.getPlayer())
				return "8.htm"		
				st.setState(Started)

			# Great Shild  3
			if event == "27":
				st.takeItems(CURRENCY_ID,BUFF_PRICE)
				SkillTable.getInstance().getInfo(1389,3).getEffects(st.getPlayer(),st.getPlayer())
				return "8.htm"		
				st.setState(Started)

			# Resist Poison 3
			if event == "28":
				st.takeItems(CURRENCY_ID,BUFF_PRICE)
				SkillTable.getInstance().getInfo(1033,3).getEffects(st.getPlayer(),st.getPlayer())
				return "8.htm"		
				st.setState(Started)

			# Elemental Protection 1
			if event == "29":
				st.takeItems(CURRENCY_ID,BUFF_PRICE)
				SkillTable.getInstance().getInfo(1352,1).getEffects(st.getPlayer(),st.getPlayer())
				return "8.htm"		
				st.setState(Started)

			# Prophecy of Fire 1
			if event == "30":
				st.takeItems(CURRENCY_ID,PROPHECY_PRICE)
				SkillTable.getInstance().getInfo(1356,1).getEffects(st.getPlayer(),st.getPlayer())
				return "5.htm"		
				st.setState(Started)

			# Agility 3
			if event == "31":
				st.takeItems(CURRENCY_ID,BUFF_PRICE)
				SkillTable.getInstance().getInfo(1087,3).getEffects(st.getPlayer(),st.getPlayer())
				return "2.htm"		
				st.setState(Started)

			# Decrease Weight 3
			if event == "32":
				st.takeItems(CURRENCY_ID,BUFF_PRICE)
				SkillTable.getInstance().getInfo(1257,3).getEffects(st.getPlayer(),st.getPlayer())
				return "8.htm"		
				st.setState(Started)

			# Resist Shock 4
			if event == "33":
				st.takeItems(CURRENCY_ID,BUFF_PRICE)
				SkillTable.getInstance().getInfo(1259,4).getEffects(st.getPlayer(),st.getPlayer())
				return "2.htm"		
				st.setState(Started)

			# Advanced Block 3
			if event == "34":
				st.takeItems(CURRENCY_ID,BUFF_PRICE)
				SkillTable.getInstance().getInfo(1304,3).getEffects(st.getPlayer(),st.getPlayer())
				return "2.htm"		
				st.setState(Started)

			# Clarity 3
			if event == "35":
				st.takeItems(CURRENCY_ID,BUFF_PRICE)
				SkillTable.getInstance().getInfo(1397,3).getEffects(st.getPlayer(),st.getPlayer())
				return "2.htm"		
				st.setState(Started)

			# Wild Magic 2
			if event == "36":
				st.takeItems(CURRENCY_ID,BUFF_PRICE)
				SkillTable.getInstance().getInfo(1303,2).getEffects(st.getPlayer(),st.getPlayer())
				return "2.htm"		
				st.setState(Started)

			# Arcane Protection 1
			if event == "37":
				st.takeItems(CURRENCY_ID,BUFF_PRICE)
				SkillTable.getInstance().getInfo(1354,1).getEffects(st.getPlayer(),st.getPlayer())
				return "8.htm"		
				st.setState(Started)

			# Divine Protection 1
			if event == "38":
				st.takeItems(CURRENCY_ID,BUFF_PRICE)
				SkillTable.getInstance().getInfo(1353,1).getEffects(st.getPlayer(),st.getPlayer())
				return "8.htm"		
				st.setState(Started)

			# Prophecy of Water 1
			if event == "39":
				st.takeItems(CURRENCY_ID,PROPHECY_PRICE)
				SkillTable.getInstance().getInfo(1355,1).getEffects(st.getPlayer(),st.getPlayer())
				return "5.htm"		
				st.setState(Started)

			# Empower 3
			if event == "40":
				st.takeItems(CURRENCY_ID,BUFF_PRICE)
				SkillTable.getInstance().getInfo(1059,3).getEffects(st.getPlayer(),st.getPlayer())
				return "2.htm"		
				st.setState(Started)

			# Vampiric Rage 4
			if event == "41":
				st.takeItems(CURRENCY_ID,BUFF_PRICE)
				SkillTable.getInstance().getInfo(1268,4).getEffects(st.getPlayer(),st.getPlayer())
				return "2.htm"		
				st.setState(Started)

			# Prophecy of Wind 1
			if event == "42":
				st.takeItems(CURRENCY_ID,PROPHECY_PRICE)
				SkillTable.getInstance().getInfo(1357,1).getEffects(st.getPlayer(),st.getPlayer())
				return "5.htm"		
				st.setState(Started)

			# Dance of the Warrior 1
			if event == "43":
				st.takeItems(CURRENCY_ID,DANCE_PRICE)
				SkillTable.getInstance().getInfo(271,1).getEffects(st.getPlayer(),st.getPlayer())
				return "3.htm"		
				st.setState(Started)

			# Dance of Inspiration 1
			if event == "44":
				st.takeItems(CURRENCY_ID,DANCE_PRICE)
				SkillTable.getInstance().getInfo(272,1).getEffects(st.getPlayer(),st.getPlayer())
				return "3.htm"		
				st.setState(Started)

			# Dance of the Mystic 1
			if event == "45":
				st.takeItems(CURRENCY_ID,DANCE_PRICE)
				SkillTable.getInstance().getInfo(273,1).getEffects(st.getPlayer(),st.getPlayer())
				return "3.htm"		
				st.setState(Started)

			# Dance of Fire 1
			if event == "46":
				st.takeItems(CURRENCY_ID,DANCE_PRICE)
				SkillTable.getInstance().getInfo(274,1).getEffects(st.getPlayer(),st.getPlayer())
				return "3.htm"		
				st.setState(Started)

			# Dance of Fury 1
			if event == "47":
				st.takeItems(CURRENCY_ID,DANCE_PRICE)
				SkillTable.getInstance().getInfo(275,1).getEffects(st.getPlayer(),st.getPlayer())
				return "3.htm"		
				st.setState(Started)

			# Dance of Concentration 1
			if event == "48":
				st.takeItems(CURRENCY_ID,DANCE_PRICE)
				SkillTable.getInstance().getInfo(276,1).getEffects(st.getPlayer(),st.getPlayer())
				return "3.htm"		
				st.setState(Started)

			# Dance of Light 1
			if event == "49":
				st.takeItems(CURRENCY_ID,DANCE_PRICE)
				SkillTable.getInstance().getInfo(277,1).getEffects(st.getPlayer(),st.getPlayer())
				return "3.htm"		
				st.setState(Started)

			# Dance of Aqua Guard 1
			if event == "50":
				st.takeItems(CURRENCY_ID,DANCE_PRICE)
				SkillTable.getInstance().getInfo(307,1).getEffects(st.getPlayer(),st.getPlayer())
				return "3.htm"		
				st.setState(Started)

			# Dance of Earth Guard 1
			if event == "51":
				st.takeItems(CURRENCY_ID,DANCE_PRICE)
				SkillTable.getInstance().getInfo(309,1).getEffects(st.getPlayer(),st.getPlayer())
				return "3.htm"		
				st.setState(Started)

			# Dance of the Vampire 1
			if event == "52":
				st.takeItems(CURRENCY_ID,DANCE_PRICE)
				SkillTable.getInstance().getInfo(310,1).getEffects(st.getPlayer(),st.getPlayer())
				return "3.htm"		
				st.setState(Started)

			# Dance of Protection 1
			if event == "53":
				st.takeItems(CURRENCY_ID,DANCE_PRICE)
				SkillTable.getInstance().getInfo(311,1).getEffects(st.getPlayer(),st.getPlayer())
				return "3.htm"		
				st.setState(Started)

			# Dance of Shadows 1
			if event == "54":
				st.takeItems(CURRENCY_ID,DANCE_PRICE)
				SkillTable.getInstance().getInfo(366,1).getEffects(st.getPlayer(),st.getPlayer())
				return "3.htm"		
				st.setState(Started)

			# Siren's Dance 1
			if event == "55":
				st.takeItems(CURRENCY_ID,DANCE_PRICE)
				SkillTable.getInstance().getInfo(365,1).getEffects(st.getPlayer(),st.getPlayer())
				return "3.htm"		
				st.setState(Started)

			# Song of Earth 1
			if event == "56":
				st.takeItems(CURRENCY_ID,SONG_PRICE)
				SkillTable.getInstance().getInfo(264,1).getEffects(st.getPlayer(),st.getPlayer())
				return "4.htm"		
				st.setState(Started)

			# Song of Life 1
			if event == "57":
				st.takeItems(CURRENCY_ID,SONG_PRICE)
				SkillTable.getInstance().getInfo(265,1).getEffects(st.getPlayer(),st.getPlayer())
				return "4.htm"		
				st.setState(Started)

			# Song of Water 1
			if event == "58":
				st.takeItems(CURRENCY_ID,SONG_PRICE)
				SkillTable.getInstance().getInfo(266,1).getEffects(st.getPlayer(),st.getPlayer())
				return "4.htm"		
				st.setState(Started)

			# Song of Warding 1
			if event == "59":
				st.takeItems(CURRENCY_ID,SONG_PRICE)
				SkillTable.getInstance().getInfo(267,1).getEffects(st.getPlayer(),st.getPlayer())
				return "4.htm"		
				st.setState(Started)

			# Song of Wind 1
			if event == "60":
				st.takeItems(CURRENCY_ID,SONG_PRICE)
				SkillTable.getInstance().getInfo(268,1).getEffects(st.getPlayer(),st.getPlayer())
				return "4.htm"		
				st.setState(Started)

			# Song of Hunter 1
			if event == "61":
				st.takeItems(CURRENCY_ID,SONG_PRICE)
				SkillTable.getInstance().getInfo(269,1).getEffects(st.getPlayer(),st.getPlayer())
				return "4.htm"		
				st.setState(Started)

			# Song of Invocation 1
			if event == "62":
				st.takeItems(CURRENCY_ID,SONG_PRICE)
				SkillTable.getInstance().getInfo(270,1).getEffects(st.getPlayer(),st.getPlayer())
				return "4.htm"		
				st.setState(Started)

			# Song of Vitality 1
			if event == "63":
				st.takeItems(CURRENCY_ID,SONG_PRICE)
				SkillTable.getInstance().getInfo(304,1).getEffects(st.getPlayer(),st.getPlayer())
				return "4.htm"		
				st.setState(Started)

			# Song of Vengeance 1
			if event == "64":
				st.takeItems(CURRENCY_ID,SONG_PRICE)
				SkillTable.getInstance().getInfo(305,1).getEffects(st.getPlayer(),st.getPlayer())
				return "4.htm"		
				st.setState(Started)

			# Song of Flame Guard 1
			if event == "65":
				st.takeItems(CURRENCY_ID,SONG_PRICE)
				SkillTable.getInstance().getInfo(306,1).getEffects(st.getPlayer(),st.getPlayer())
				return "4.htm"		
				st.setState(Started)

			# Song of Storm Guard 1
			if event == "66":
				st.takeItems(CURRENCY_ID,SONG_PRICE)
				SkillTable.getInstance().getInfo(308,1).getEffects(st.getPlayer(),st.getPlayer())
				return "4.htm"		
				st.setState(Started)

			# Song of Meditation 1
			if event == "67":
				st.takeItems(CURRENCY_ID,SONG_PRICE)
				SkillTable.getInstance().getInfo(363,1).getEffects(st.getPlayer(),st.getPlayer())
				return "4.htm"		
				st.setState(Started)

			# Song of Champion 1
			if event == "68":
				st.takeItems(CURRENCY_ID,SONG_PRICE)
				SkillTable.getInstance().getInfo(364,1).getEffects(st.getPlayer(),st.getPlayer())
				return "4.htm"		
				st.setState(Started)

			# Song of Renewal 1
			if event == "69":
				st.takeItems(CURRENCY_ID,SONG_PRICE)
				SkillTable.getInstance().getInfo(349,1).getEffects(st.getPlayer(),st.getPlayer())
				return "4.htm"		
				st.setState(Started)

			# Chant of Battle 3
			if event == "70":
				st.takeItems(CURRENCY_ID,CHANT_PRICE)
				SkillTable.getInstance().getInfo(1007,3).getEffects(st.getPlayer(),st.getPlayer())
				return "7.htm"
				st.setState(Started)

			# Chant of Fire 3
			if event == "71":
				st.takeItems(CURRENCY_ID,CHANT_PRICE)
				SkillTable.getInstance().getInfo(1006,3).getEffects(st.getPlayer(),st.getPlayer())
				return "7.htm"
				st.setState(Started)

			# Chant of Shielding 3
			if event == "72":
				st.takeItems(CURRENCY_ID,CHANT_PRICE)
				SkillTable.getInstance().getInfo(1009,3).getEffects(st.getPlayer(),st.getPlayer())
				return "7.htm"
				st.setState(Started)

			# Flame Chant 3
			if event == "73":
				st.takeItems(CURRENCY_ID,CHANT_PRICE)
				SkillTable.getInstance().getInfo(1002,3).getEffects(st.getPlayer(),st.getPlayer())
				return "7.htm"
				st.setState(Started)

			# Chant of Evasion 3
			if event == "74":
				st.takeItems(CURRENCY_ID,CHANT_PRICE)
				SkillTable.getInstance().getInfo(1252,3).getEffects(st.getPlayer(),st.getPlayer())
				return "7.htm"
				st.setState(Started)

			# Chant of Rage 3
			if event == "75":
				st.takeItems(CURRENCY_ID,CHANT_PRICE)
				SkillTable.getInstance().getInfo(1253,3).getEffects(st.getPlayer(),st.getPlayer())
				return "7.htm"
				st.setState(Started)

			# Chant of Vampire 4
			if event == "76":
				st.takeItems(CURRENCY_ID,CHANT_PRICE)
				SkillTable.getInstance().getInfo(1310,4).getEffects(st.getPlayer(),st.getPlayer())
				return "7.htm"
				st.setState(Started)

			# Chant of Eagle 3
			if event == "77":
				st.takeItems(CURRENCY_ID,CHANT_PRICE)
				SkillTable.getInstance().getInfo(1309,3).getEffects(st.getPlayer(),st.getPlayer())
				return "7.htm"
				st.setState(Started)

			# Chant of Fury 2
			if event == "78":
				st.takeItems(CURRENCY_ID,CHANT_PRICE)
				SkillTable.getInstance().getInfo(1251,2).getEffects(st.getPlayer(),st.getPlayer())
				return "7.htm"
				st.setState(Started)

			# Chant of Predator 3
			if event == "79":
				st.takeItems(CURRENCY_ID,CHANT_PRICE)
				SkillTable.getInstance().getInfo(1308,3).getEffects(st.getPlayer(),st.getPlayer())
				return "7.htm"
				st.setState(Started)

                        # Earth Chant 3
			if event == "80":
				st.takeItems(CURRENCY_ID,CHANT_PRICE)
				SkillTable.getInstance().getInfo(1391,3).getEffects(st.getPlayer(),st.getPlayer())
				return "7.htm"
				st.setState(Started)

                        # War Chant 3
			if event == "81":
				st.takeItems(CURRENCY_ID,CHANT_PRICE)
				SkillTable.getInstance().getInfo(1390,3).getEffects(st.getPlayer(),st.getPlayer())
				return "7.htm"
				st.setState(Started)

			# Chant of Revenge 3
			if event == "82":
				st.takeItems(CURRENCY_ID,CHANT_PRICE)
				SkillTable.getInstance().getInfo(1284,3).getEffects(st.getPlayer(),st.getPlayer())
				return "7.htm"
				st.setState(Started)

                        # Chant of Spirit 1
			if event == "83":
				st.takeItems(CURRENCY_ID,CHANT_PRICE)
				SkillTable.getInstance().getInfo(1362,1).getEffects(st.getPlayer(),st.getPlayer())
				return "7.htm"
				st.setState(Started)

			# Chant of Victory 1
			if event == "84":
				st.takeItems(CURRENCY_ID,PROPHECY_PRICE)
				SkillTable.getInstance().getInfo(1363,1).getEffects(st.getPlayer(),st.getPlayer())
				return "5.htm"		
				st.setState(Started)

			# Magnus Chant 1
			if event == "85":
				st.takeItems(CURRENCY_ID,PROPHECY_PRICE)
				SkillTable.getInstance().getInfo(1413,1).getEffects(st.getPlayer(),st.getPlayer())
				return "5.htm"		
				st.setState(Started)

                        # Blessing of Queen 3
			if event == "86":
				st.takeItems(CURRENCY_ID,PET_PRICE)
				SkillTable.getInstance().getInfo(4699,3).getEffects(st.getPlayer(),st.getPlayer())
				return "6.htm"
				st.setState(Started)

                        # Gift of Queen 3
			if event == "87":
				st.takeItems(CURRENCY_ID,PET_PRICE)
				SkillTable.getInstance().getInfo(4700,3).getEffects(st.getPlayer(),st.getPlayer())
				return "6.htm"
				st.setState(Started)

                        # Blessing of Seraphim 3
			if event == "88":
				st.takeItems(CURRENCY_ID,PET_PRICE)
				SkillTable.getInstance().getInfo(4702,3).getEffects(st.getPlayer(),st.getPlayer())
				return "6.htm"
				st.setState(Started)

                        # Gift of Seraphim 3
			if event == "89":
				st.takeItems(CURRENCY_ID,PET_PRICE)
				SkillTable.getInstance().getInfo(4703,3).getEffects(st.getPlayer(),st.getPlayer())
				return "6.htm"
				st.setState(Started)

                        # Pa'agrian Gift 3
			if event == "90":
				st.takeItems(CURRENCY_ID,PAAGRIO_PRICE)
				SkillTable.getInstance().getInfo(1003,3).getEffects(st.getPlayer(),st.getPlayer())
				return "9.htm"
				st.setState(Started)

                        # Blessings of Pa'agrio 3
			if event == "91":
				st.takeItems(CURRENCY_ID,PAAGRIO_PRICE)
				SkillTable.getInstance().getInfo(1005,3).getEffects(st.getPlayer(),st.getPlayer())
				return "9.htm"
				st.setState(Started)

                        # The Glory of Pa'agrio 3
			if event == "92":
				st.takeItems(CURRENCY_ID,PAAGRIO_PRICE)
				SkillTable.getInstance().getInfo(1008,3).getEffects(st.getPlayer(),st.getPlayer())
				return "9.htm"
				st.setState(Started)

                        # The Tact of Pa'agrio 3
			if event == "93":
				st.takeItems(CURRENCY_ID,PAAGRIO_PRICE)
				SkillTable.getInstance().getInfo(1260,3).getEffects(st.getPlayer(),st.getPlayer())
				return "9.htm"
				st.setState(Started)

                        # The Wisdom of Pa'agrio 3
			if event == "94":
				st.takeItems(CURRENCY_ID,PAAGRIO_PRICE)
				SkillTable.getInstance().getInfo(1004,3).getEffects(st.getPlayer(),st.getPlayer())
				return "9.htm"
				st.setState(Started)

                        # Under the Protection of Pa'agrio 3
			if event == "95":
				st.takeItems(CURRENCY_ID,PAAGRIO_PRICE)
				SkillTable.getInstance().getInfo(1250,3).getEffects(st.getPlayer(),st.getPlayer())
				return "9.htm"
				st.setState(Started)

                        # The Rage of Pa'agrio 2
			if event == "96":
				st.takeItems(CURRENCY_ID,PAAGRIO_PRICE)
				SkillTable.getInstance().getInfo(1261,2).getEffects(st.getPlayer(),st.getPlayer())
				return "9.htm"
				st.setState(Started)

                        # The Vision of Pa'agrio 3
			if event == "97":
				st.takeItems(CURRENCY_ID,PAAGRIO_PRICE)
				SkillTable.getInstance().getInfo(1249,3).getEffects(st.getPlayer(),st.getPlayer())
				return "9.htm"
				st.setState(Started)

                        # Pa'agrian Haste 2
			if event == "98":
				st.takeItems(CURRENCY_ID,PAAGRIO_PRICE)
				SkillTable.getInstance().getInfo(1282,2).getEffects(st.getPlayer(),st.getPlayer())
				return "9.htm"
				st.setState(Started)

                        # Eye of Pa'agrio 1
			if event == "99":
				st.takeItems(CURRENCY_ID,PAAGRIO_PRICE)
				SkillTable.getInstance().getInfo(1364,1).getEffects(st.getPlayer(),st.getPlayer())
				return "9.htm"
				st.setState(Started)

                        # Soul of Pa'agrio 1
			if event == "100":
				st.takeItems(CURRENCY_ID,PAAGRIO_PRICE)
				SkillTable.getInstance().getInfo(1365,1).getEffects(st.getPlayer(),st.getPlayer())
				return "9.htm"
				st.setState(Started)

                        # Pa'agrio's Emblem 1
			if event == "101":
				st.takeItems(CURRENCY_ID,PAAGRIO_PRICE)
				SkillTable.getInstance().getInfo(1415,1).getEffects(st.getPlayer(),st.getPlayer())
				return "9.htm"
				st.setState(Started)

                        # Pa'agrio's Fist 1
			if event == "102":
				st.takeItems(CURRENCY_ID,PROPHECY_PRICE)
				SkillTable.getInstance().getInfo(1416,1).getEffects(st.getPlayer(),st.getPlayer())
				return "5.htm"
				st.setState(Started)

                        # Victory of Pa'agrio 1
			if event == "103":
				st.takeItems(CURRENCY_ID,PROPHECY_PRICE)
				SkillTable.getInstance().getInfo(1414,1).getEffects(st.getPlayer(),st.getPlayer())
				st.getPlayer().restoreHPMP()
				return "5.htm"
				st.setState(Started)

			# Noblesse Blessing 1
			if event == "104":
				st.takeItems(CURRENCY_ID,NOBLE_PRICE)
				SkillTable.getInstance().getInfo(1323,1).getEffects(st.getPlayer(),st.getPlayer())
				st.getPlayer().restoreHPMP()
				return "1.htm"		
				st.setState(Started)

			# Flu 3 
			if event == "105":
				st.takeItems(CURRENCY_ID,HOT_PRICE)
				SkillTable.getInstance().getInfo(4553,3).getEffects(st.getPlayer(),st.getPlayer())
				return "10.htm"
				st.setState(Started)			
				
			# Malaria 3 
			if event == "106":
				st.takeItems(CURRENCY_ID,HOT_PRICE)
				SkillTable.getInstance().getInfo(4554,3).getEffects(st.getPlayer(),st.getPlayer())
				return "10.htm"
				st.setState(Started)						
				
			# Arkeiros Achers
			if event == "107":
				st.takeItems(CURRENCY_ID,BUFF_PRICE)
				st.getPlayer().stopAllEffects()
				SkillTable.getInstance().getInfo(4344,3).getEffects(st.getPlayer(),st.getPlayer())
				SkillTable.getInstance().getInfo(4346,4).getEffects(st.getPlayer(),st.getPlayer())
				SkillTable.getInstance().getInfo(4349,2).getEffects(st.getPlayer(),st.getPlayer())
				SkillTable.getInstance().getInfo(4345,3).getEffects(st.getPlayer(),st.getPlayer())
				SkillTable.getInstance().getInfo(1388,3).getEffects(st.getPlayer(),st.getPlayer())
				SkillTable.getInstance().getInfo(4347,6).getEffects(st.getPlayer(),st.getPlayer())
				SkillTable.getInstance().getInfo(4352,2).getEffects(st.getPlayer(),st.getPlayer())
				SkillTable.getInstance().getInfo(1087,3).getEffects(st.getPlayer(),st.getPlayer())
				SkillTable.getInstance().getInfo(4360,3).getEffects(st.getPlayer(),st.getPlayer())
				SkillTable.getInstance().getInfo(4358,3).getEffects(st.getPlayer(),st.getPlayer())
				SkillTable.getInstance().getInfo(4357,2).getEffects(st.getPlayer(),st.getPlayer())
				SkillTable.getInstance().getInfo(4359,3).getEffects(st.getPlayer(),st.getPlayer())
				SkillTable.getInstance().getInfo(4342,2).getEffects(st.getPlayer(),st.getPlayer())
				SkillTable.getInstance().getInfo(264,1).getEffects(st.getPlayer(),st.getPlayer())
				SkillTable.getInstance().getInfo(266,1).getEffects(st.getPlayer(),st.getPlayer())
				SkillTable.getInstance().getInfo(267,1).getEffects(st.getPlayer(),st.getPlayer())
				SkillTable.getInstance().getInfo(268,1).getEffects(st.getPlayer(),st.getPlayer())
				SkillTable.getInstance().getInfo(269,1).getEffects(st.getPlayer(),st.getPlayer())
				SkillTable.getInstance().getInfo(304,1).getEffects(st.getPlayer(),st.getPlayer())
				SkillTable.getInstance().getInfo(271,1).getEffects(st.getPlayer(),st.getPlayer())
				SkillTable.getInstance().getInfo(274,1).getEffects(st.getPlayer(),st.getPlayer())
				SkillTable.getInstance().getInfo(275,1).getEffects(st.getPlayer(),st.getPlayer())
				SkillTable.getInstance().getInfo(1363,1).getEffects(st.getPlayer(),st.getPlayer())
				SkillTable.getInstance().getInfo(1323,1).getEffects(st.getPlayer(),st.getPlayer())
				st.getPlayer().restoreHPMP()
				return "1.htm"
				st.setState(COMPLETED)
				
			# Magos Mystic
			if event == "108": 
				st.takeItems(CURRENCY_ID,BUFF_PRICE)
				st.getPlayer().stopAllEffects()
				SkillTable.getInstance().getInfo(4344,3).getEffects(st.getPlayer(),st.getPlayer())
				SkillTable.getInstance().getInfo(4346,4).getEffects(st.getPlayer(),st.getPlayer())
				SkillTable.getInstance().getInfo(4349,2).getEffects(st.getPlayer(),st.getPlayer())
				SkillTable.getInstance().getInfo(1389,3).getEffects(st.getPlayer(),st.getPlayer())
				SkillTable.getInstance().getInfo(4347,6).getEffects(st.getPlayer(),st.getPlayer())
				SkillTable.getInstance().getInfo(4348,6).getEffects(st.getPlayer(),st.getPlayer())
				SkillTable.getInstance().getInfo(4355,3).getEffects(st.getPlayer(),st.getPlayer())
				SkillTable.getInstance().getInfo(4356,3).getEffects(st.getPlayer(),st.getPlayer())
				SkillTable.getInstance().getInfo(4352,2).getEffects(st.getPlayer(),st.getPlayer())
				SkillTable.getInstance().getInfo(1303,1).getEffects(st.getPlayer(),st.getPlayer())
				SkillTable.getInstance().getInfo(264,1).getEffects(st.getPlayer(),st.getPlayer())
				SkillTable.getInstance().getInfo(266,1).getEffects(st.getPlayer(),st.getPlayer())
				SkillTable.getInstance().getInfo(268,1).getEffects(st.getPlayer(),st.getPlayer())
				SkillTable.getInstance().getInfo(267,1).getEffects(st.getPlayer(),st.getPlayer())
				SkillTable.getInstance().getInfo(269,1).getEffects(st.getPlayer(),st.getPlayer())
				SkillTable.getInstance().getInfo(304,1).getEffects(st.getPlayer(),st.getPlayer())
				SkillTable.getInstance().getInfo(349,1).getEffects(st.getPlayer(),st.getPlayer())
				SkillTable.getInstance().getInfo(273,1).getEffects(st.getPlayer(),st.getPlayer())
				SkillTable.getInstance().getInfo(276,1).getEffects(st.getPlayer(),st.getPlayer())
				SkillTable.getInstance().getInfo(365,1).getEffects(st.getPlayer(),st.getPlayer())
				SkillTable.getInstance().getInfo(1413,1).getEffects(st.getPlayer(),st.getPlayer())
				SkillTable.getInstance().getInfo(1323,1).getEffects(st.getPlayer(),st.getPlayer())
				st.getPlayer().restoreHPMP()
				return "1.htm"
				st.setState(COMPLETED)
								
			# Cancel 
			if event == "109":
				st.takeItems(CURRENCY_ID,CANCEL_PRICE)
				st.getPlayer().stopAllEffects()
				return "1.htm"
				st.setState(Started)						
				
			if htmltext != event:
				st.setState(Started)
				st.exitQuest(1)
		return htmltext


	def onTalk (self,npc,player):
	   st = player.getQuestState(qn)
	   htmltext = "<html><head><body>I have nothing to say to you.</body></html>"
	   st.setState(STARTED)
	   return InitialHtml

QUEST = Quest(QuestId,str(QuestId) + "_" + QuestName,QuestDesc)
CREATED = State('Start',QUEST)
STARTED = State('Started',QUEST)
COMPLETED = State('Completed',QUEST)

QUEST.setInitialState(CREATED)

for npcId in NPC:
 QUEST.addStartNpc(npcId)
 QUEST.addTalkId(npcId)