rendered paste body# Script by Ark
import sys
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
#NPCs
MITCH = 35981
EMMA = 35980
MIKAEL = 35982
#MOBs
MERCENARY = 21382
#ITEMS
ROMANCE_NOVEL = 691
SEALED_SCROLL = 767
ADENA = 57
MUSIC_BOX = 6903
#REWARD
ENCHANT_ARMOR = 6578
class Quest (JQuest) :
def __init__(self,id,name,descr): JQuest.__init__(self,id,name,descr)
def onEvent (self,event,st) :
htmltext = event
if event == "35981-02.htm" :
st.set("cond","1")
st.set("id","1")
st.setState(STARTED)
st.playSound("ItemSound.quest_accept")
if st.getQuestItemsCount(ROMANCE_NOVEL) == 0 :
st.giveItems(ROMANCE_NOVEL,1)
if event == "35981-05.htm" :
st.set("cond","4")
return htmltext
def onTalk (Self,npc,st):
htmltext = "<html><head><body>Greetings, Adventurer. I trust your huntings are going well.</body></html>"
npcId = npc.getNpcId()
id = st.getState()
if id == CREATED :
st.setState(STARTING)
st.set("cond","0")
st.set("onlyone","0")
st.set("id","0")
cond = st.getInt("cond")
onlyone = st.getInt("onlyone")
ItemsCount_RN = st.getQuestItemsCount(ROMANCE_NOVEL)
ItemsCount_SS = st.getQuestItemsCount(SEALED_SCROLL)
ItemsCount_MB = st.getQuestItemsCount(MUSIC_BOX)
if npcId == MITCH and cond == 0 and ItemsCount_RN == 0 and ItemsCount_SS == 0:
htmltext = "35981-01.htm"
if npcId == EMMA and cond == 1 and ItemsCount_RN == 1 and ItemsCount_SS == 0:
st.takeItems(ROMANCE_NOVEL,-1)
st.giveItems(SEALED_SCROLL,1)
st.playSound("ItemSound.quest_middle")
htmltext = "35980-01.htm"
if npcId == MITCH and cond == 1 and ItemsCount_RN == 0 and ItemsCount_SS == 1:
st.takeItems(SEALED_SCROLL,-1)
st.giveItems(ENCHANT_ARMOR,1)
st.playSound("ItemSound.quest_middle")
st.set("cond","2")
htmltext = "35981-03.htm"
if npcId == MIKAEL and cond == 2 and ItemsCount_RN == 0 and ItemsCount_SS == 0:
st.giveItems(ADENA,2000000)
st.set("cond","3")
st.playSound("ItemSound.quest_middle")
htmltext = "35982-01.htm"
if npcId == MITCH and cond == 3 and ItemsCount_RN == 0 and ItemsCount_SS == 0:
htmltext = "35981-04.htm"
if npcId == MITCH and cond == 5 and ItemsCount_MB == 1:
htmltext = "35981-06.htm"
st.set("cond","6")
if npcId == MIKAEL and cond == 6 and ItemsCount_MB == 1:
st.takeItems(MUSIC_BOX,-1)
htmltext ="35982-02.htm"
return htmltext
def onKill (self,npc,st):
npcId = npc.getNpcId()
chance = st.getRandom(100)
cond = st.getInt("cond")
if npcId == MERCENARY :
if cond == 4 and st.getQuestItemsCount(MUSIC_BOX) < 1 :
if chance < CHANCE_FOR_DROP :
st.giveItems(MUSIC_BOX,1)
st.playSound("ItemSound.quest_itemget")
st.set("cond","5")
return
QUEST = Quest(99998,"99998_SGradeArmor","SGrade Armor")
CREATED = State('Start', QUEST)
STARTING = State('Starting', QUEST)
STARTED = State('Started', QUEST)
COMPLETED = State('Completed', QUEST)
QUEST.setInitialState(CREATED)
QUEST.addStartNpc(MITCH)
STARTING.addTalkId(MITCH)
STARTED.addTalkId(EMMA)
STARTED.addTalkId(MIKAEL)
STARTED.addKillId(MERCENARY)
STARTED.addQuestDrop(MITCH,ROMANCE_NOVEL,1)
STARTED.addQuestDrop(EMMA,SEALED_SCROLL,1)
STARTED.addQuestDrop(MITCH,RAIN_SONG,1)
print "importing quests: 99998: S-Grade Armor"