# Made by Kerberos
# this script is part of the Official L2J Datapack Project.
# Visit http://www.l2jdp.com/forum/ for more details.
import sys
from com.l2jserver.gameserver.instancemanager import QuestManager
from com.l2jserver.gameserver.model.quest import State
from com.l2jserver.gameserver.model.quest import QuestState
from com.l2jserver.gameserver.model.quest.jython import QuestJython as JQuest

qn = "998_FallenAngelSelect"

NATOOLS = 30894

class Quest (JQuest) :

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

 def onEvent (self,event,st) :
    if event == "dawn" :
       q1 = QuestManager.getInstance().getQuest("142_FallenAngelRequestOfDawn")
       if q1 :
          qs1 = q1.newQuestState(st.getPlayer())
          qs1.setState(State.STARTED)
          q1.notifyEvent("30894-01.htm",None,st.getPlayer())
          st.setState(State.COMPLETED)
       return
    elif event == "dusk" :
       q2 = QuestManager.getInstance().getQuest("143_FallenAngelRequestOfDusk")
       if q2 :
          qs2 = q2.newQuestState(st.getPlayer())
          qs2.setState(State.STARTED)
          q2.notifyEvent("30894-01.htm",None,st.getPlayer())
          st.setState(State.COMPLETED)
       return
    return event

 def onTalk (self,npc,player):
    htmltext = "<html><body>You are either not on a quest that involves this NPC, or you don't meet this NPC's minimum quest requirements.</body></html>"
    st = player.getQuestState(qn)
    if not st : return htmltext
    id = st.getState()
    if id == State.STARTED :
       htmltext = "30894-01.htm"
    return htmltext

QUEST       = Quest(998,qn,"Fallen Angel - Select")

QUEST.addTalkId(NATOOLS)
[((16, 38, 16, 73), 'com.l2jserver.gameserver.model.quest.jython.QuestJython.__init__', 'JQuest.__init__', ({(16, 54, 16, 58): 'self', (16, 59, 16, 61): 'id', (16, 62, 16, 66): 'name', (16, 67, 16, 72): 'descr'}, {}), '(self, id, name, descr)', True, 'from com.l2jserver.gameserver.model.quest.jython import QuestJython as JQuest\n'), ((20, 12, 20, 38), 'com.l2jserver.gameserver.instancemanager.QuestManager.getInstance', 'QuestManager.getInstance', ({}, {}), '()', False, 'from com.l2jserver.gameserver.instancemanager import QuestManager\n'), ((28, 12, 28, 38), 'com.l2jserver.gameserver.instancemanager.QuestManager.getInstance', 'QuestManager.getInstance', ({}, {}), '()', False, 'from com.l2jserver.gameserver.instancemanager import QuestManager\n')]