Try This
import sys
from net.sf.l2j.gameserver.model.actor.instance import L2PcInstance
from java.util import Iterator
from net.sf.l2j.gameserver.datatables import SkillTable
from net.sf.l2j import L2DatabaseFactory
from net.sf.l2j.gameserver.model.quest import State
from net.sf.l2j.gameserver.model.quest import QuestState
from net.sf.l2j.gameserver.model.quest.jython import QuestJython as JQuest
qn = "60551_NPCBuffer"
NPCS=[60551]
ADENA_ID=57
QuestId = 60551
QuestName = "NPCBuffer"
QuestDesc = "custom"
print "Loaded: 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(ADENA_ID)
if count < 0 or st.getPlayer().getLevel() < 1 :
htmltext = "<html><head><body>Come back later.<br></body></html>"
else:
st.takeItems(ADENA_ID,0)
st.getPlayer().setTarget(st.getPlayer())
if event == "100":
st.getPlayer().stopAllEffects()
st.getPlayer().restoreHPMP()
return "1.htm"
st.setState(COMPLETED)
if event == "101":
st.getPlayer().restoreHPMP()
return "1.htm"
st.setState(COMPLETED)
if htmltext != event:
st.setState(State.COMPLETED)
st.exitQuest(1)
return htmltext
def onTalk (self,npc,player):
st = player.getQuestState(qn)
htmltext = "<html><head><body><center>ERROR<br1>Please, contact the administrator.</center></body></html>"
st.setState(State.STARTED)
return InitialHtml
QUEST = Quest(QuestId,str(QuestId) + "_" + QuestName,QuestDesc)
for npcId in NPCS:
QUEST.addStartNpc(npcId)
QUEST.addTalkId(npcId)