#Made by DooMIta ethernaly@email.it
import sys
from net.sf.l2j import Config
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 = "5999_lordcrown"
#NPC
CROWNMANAGER = 70004
#ITEM
CROWN = 6841
class Quest (JQuest) :
def __init__(self,id,name,descr): JQuest.__init__(self,id,name,descr)
def onTalk (self,npc,player):
st = player.getQuestState(qn)
if st :
npcId = npc.getNpcId()
htmltext = "<html><head><body>I have nothing to say to you</body></html>"
id = st.getState()
if id == CREATED :
if st.getPlayer().isClanLeader() == 1 and st.getQuestItemsCount(CROWN) == 0 and st.getPlayer().getClan().getHasCastle() > 0 :
htmltext = "<html><head><body>My Lord take this Crown!</body></html>"
st.giveItems(CROWN,1)
st.playSound("ItemSound.quest_fanfare_2")
st.setState(COMPLETED)
st.exitQuest(1)
elif id == COMPLETED :
st.exitQuest(1)
htmltext = "<html><head><body>What do you want?? an other Crow? You Are Crazy!</body></html>"
else:
st.exitQuest(1)
htmltext = "<html><head><body>Only a Castle's Lord can take this Crown!</body></html>"
return htmltext
QUEST=Quest(5999,qn,"custom")
CREATED=State('Start', QUEST)
COMPLETED=State('Completed', QUEST)
QUEST.setInitialState(CREATED)
QUEST.addStartNpc(CROWNMANAGER)
QUEST.addTalkId (CROWNMANAGER)
print "importing custom data: 5999: lordcrown"