# Created by Bibigon for RT T0 28.12.07
import sys
from ru.catssoftware.gameserver.model.quest import State
from ru.catssoftware.gameserver.model.quest import QuestState
from ru.catssoftware.gameserver.model.quest.jython import QuestJython as JQuest
qn = "20082_SantaPresent"
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(5560) >= 10 :
st.takeItems(5560,10)
st.giveItems(7836,1)
htmltext = "<html><body>Merry Christmas.</body></html>"
else:
htmltext = "31863-2.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(20082,qn,"custom")
CREATED = State('Start', QUEST)
STARTED = State('Started', QUEST)
COMPLETED = State('Completed', QUEST)
QUEST.setInitialState(CREATED)
QUEST.addStartNpc(31863)
QUEST.addTalkId(31863)
Пробуйте так для начала, посмотрим что будет