- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
import sys
from ru.hastel.gameserver.model.quest import State
from ru.hastel.gameserver.model.quest import QuestState
from ru.hastel.gameserver.model.quest.jython import QuestJython as JQuest
qn = "2008_christmas"
class Quest (JQuest) :
def __init__(self,id,name,descr): JQuest.__init__(self,id,name,descr)
def onEvent (self,event,st) :
htmltext = event
if event == "1":
if st.getQuestItemsCount(5556) >= 4 and st.getQuestItemsCount(5557) >= 4 and st.getQuestItemsCount(5558) >= 10 and st.getQuestItemsCount(5559) >= 1:
st.takeItems(5556,4)
st.takeItems(5557,4)
st.takeItems(5558,10)
st.takeItems(5559,1)
st.giveItems(5560,1)
htmltext = "<html><body>Merry Christmas.</body></html>"
else:
htmltext = "31863-2.htm"
elif event == "2":
if st.getQuestItemsCount(5560) >= 10 :
st.takeItems(5560,10)
st.giveItems(5561,1)
htmltext = "<html><body>Merry Christmas.</body></html>"
else:
htmltext = "31863-3.htm"
if htmltext != event:
st.setState(COMPLETED)
st.exitQuest(1)
return htmltext
def onTalk (self,npc,player):
st = player.getQuestState(qn)
if not st : return
npcId = npc.getNpcId()
if npcId == 31863 :
htmltext = "31863-1.htm"
st.setState(STARTED)
return htmltext
QUEST = Quest(2008,qn,"custom")
CREATED = State('Start', QUEST)
STARTED = State('Started', QUEST)
COMPLETED = State('Completed', QUEST)
QUEST.setInitialState(CREATED)
QUEST.addStartNpc(31863)
QUEST.addTalkId(31863)