Try this:
import sys
from net.sf.l2j.gameserver.network.serverpackets import CreatureSay
from java.lang import System
from net.sf.l2j.gameserver.model.actor.instance import L2PcInstance
from net.sf.l2j.gameserver.model.base import Experience
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
from java.util import Iterator
from net.sf.l2j.gameserver.datatables import SkillTable
from net.sf.l2j import L2DatabaseFactory
from net.sf.l2j.gameserver.network.serverpackets import SetupGauge
qn = "7105_Delevel"
NPC=[7108]
MEDAL = 57
QuestId = 7105
QuestName = "Delevel"
QuestDesc = "custom"
InitialHtml = "1.htm"
print "INFO Loaded: Delevel Manager by promo"
class Quest (JQuest) :
def __init__(self,id,name,descr): JQuest.__init__(self,id,name,descr)
def onEvent(self,event,st):
htmltext = event
if st.getPlayer().getLevel() < 41 :
st.getPlayer().sendPacket(CreatureSay(st.getPlayer().getObjectId(), 2, "Delevel Manager", "Ban khong du level!"))
elif st.getQuestItemsCount(MEDAL) < 10000000 :
st.getPlayer().sendPacket(CreatureSay(st.getPlayer().getObjectId(), 2, "Delevel Manager", "Ban khong co du adena !"))
elif st.getPlayer().getKarma() > 0 :
st.getPlayer().sendPacket(CreatureSay(st.getPlayer().getObjectId(), 2, "Delevel Manager", "Diem karma cua ban qua cao!"))
elif st.getPlayer().getPvpFlag() != 0 :
st.getPlayer().sendPacket(CreatureSay(st.getPlayer().getObjectId(), 2, "Delevel Manager", "Ban dang trong tinh trang chien dau!"))
elif st.getPlayer().isAttackingNow() == True :
st.getPlayer().sendPacket(CreatureSay(st.getPlayer().getObjectId(), 2, "Delevel Manager", "Dont hit me, Plz!!!!"))
elif st.getPlayer().getLevel() < 48 :
SkillTable.getInstance().getInfo(1389,3).getEffects(st.getPlayer(),st.getPlayer())
st.getPlayer().sendPacket(CreatureSay(st.getPlayer().getObjectId(), 2, "Delevel Manager", "Ban khong the su dung tiep tuc neu ban duoi cap 48"))
else:
st.getPlayer().setTarget(st.getPlayer())
if event == "2":
st.takeItems(MEDAL,10000000)
st.getPlayer().getStat().removeExpAndSp((st.getPlayer().getExp() - Experience.LEVEL[st.getPlayer().getStat().getLevel() - 1]),0)
st.getPlayer().sendPacket(CreatureSay(st.getPlayer().getObjectId(), 3, "Delevel Manager", "Ban da duoc giam di 1 level"))
return "1.htm"
st.setState(State.COMPLETED)
st.exitQuest(1)
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> I dont have anything to say .</body></html>"
st.setState(State.STARTED)
return InitialHtml
QUEST = Quest(QuestId,str(QuestId) + "_" + QuestName,QuestDesc)
for npcId in NPC:
QUEST.addStartNpc(npcId)
QUEST.addTalkId(npcId)
--------------