[help] Sub Class
5 ответов153 просмотровСейчас просматривают: 1
· 28.07.2009, 06:21
Урежте плиз чтоб работал так, покупаешь стар подходишь к лад, он просит мимир Элексир даешь ему и КВ сделан! кто может сделайте !
Раскрывающийся текст
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
from net.sf.l2j.gameserver.model.base import Race
#Quest info
qn = "235_MimirsElixir"
QUEST_NUMBER,QUEST_NAME,QUEST_DESCRIPTION = 235,"MimirsElixir","Mimir's Elixir"
DROP_RATE = 20
#prerequisites:
STAR_OF_DESTINY = 5011
MINLEVEL = 75
#Quest items
MIMIRS_ELIXIR = 6319
SCROLL_ENCHANT_WEAPON_A = 729
#NPCs
JOAN=30718
#Mobs, cond, Drop
class Quest (JQuest) :
def __init__(self,id,name,descr): JQuest.__init__(self,id,name,descr)
def onEvent (self,event,st) :
if event == "1" :
st.setState(State.STARTED)
st.set("cond","1")
htmltext = "30166-02a.htm"
elif event == "30718_1" :
st.set("cond","3")
htmltext = "30718-01a.htm"
return htmltext
def onTalk (self,npc,player):
htmltext = "<html><body>You are either not on a quest that involves this NPC, or you don't meet this NPC's minimum quest requirements.</body></html>"
st = player.getQuestState(qn)
if not st : return htmltext
npcId = npc.getNpcId()
id = st.getState()
cond = st.getInt("cond")
if npcId == LADD :
if id == State.CREATED :
st.set("cond","0")
if player.getLevel() < MINLEVEL :
st.exitQuest(1)
htmltext = "30166-01.htm" #not qualified
elif not st.getQuestItemsCount(STAR_OF_DESTINY) :
st.exitQuest(1)
htmltext = "30166-01a.htm" #not qualified
elif st.getInt("cond")==0 :
htmltext = "30166-02.htm" # Successful start: Bring me Pure silver from Reagents quest
elif id == State.COMPLETED :
htmltext = "<html><body>You have already completed this quest.</body></html>"
# cond for this quest is set to 8 from Supplier or Reagents, when you create Mimir's Elixir.
# Finally, all is done...time to learn how to use the Elixir...
elif cond==8 :
htmltext = "30166-10.htm" # here's what you do...
st.takeItems(MIMIRS_ELIXIR,-1) #remove this line for compatibility with L2JServer revisions prior to 376
st.giveItems(SCROLL_ENCHANT_WEAPON_A,1)
st.exitQuest(False)
st.unset("cond")
st.set("cond","5")
htmltext = "30718-03.htm" # here you go...take the gold. Now go back to ladd.
elif cond>=5 :
htmltext = "30718-04.htm" # Go back to ladd already!
return htmltext
def onKill(self,npc,player,isPet):
st = player.getQuestState(qn)
if not st : return
if st.getState() != State.STARTED : return
npcId = npc.getNpcId()
drop = st.getRandom(100)
cond = st.getInt("cond")
dropcond = DROPLIST[npcId][0]
if drop < DROP_RATE and cond == dropcond :
if st.getQuestItemsCount(DROPLIST[npcId][1]) == 0 :
st.giveItems(DROPLIST[npcId][1],1)
st.playSound("ItemSound.quest_itemget")
st.set("cond",str(cond+1))
return
# Quest class and state definition
QUEST = Quest(QUEST_NUMBER, qn, QUEST_DESCRIPTION)
# Quest NPC starter initialization
QUEST.addStartNpc(LADD)
# Quest initialization
QUEST.addTalkId(LADD)
QUEST.addTalkId(JOAN)
for i in DROPLIST.keys():
QUEST.addKillId(i)
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 net.sf.l2j.gameserver.model.base import Race
#Quest info
qn = "235_MimirsElixir"
QUEST_NUMBER,QUEST_NAME,QUEST_DESCRIPTION = 235,"MimirsElixir","Mimir's Elixir"
DROP_RATE = 20
#prerequisites:
STAR_OF_DESTINY = 5011
MINLEVEL = 75
#Quest items
MIMIRS_ELIXIR = 6319
SCROLL_ENCHANT_WEAPON_A = 729
#NPCs
JOAN=30718
#Mobs, cond, Drop
class Quest (JQuest) :
def __init__(self,id,name,descr): JQuest.__init__(self,id,name,descr)
def onEvent (self,event,st) :
if event == "1" :
st.setState(State.STARTED)
st.set("cond","1")
htmltext = "30166-02a.htm"
elif event == "30718_1" :
st.set("cond","3")
htmltext = "30718-01a.htm"
return htmltext
def onTalk (self,npc,player):
htmltext = "<html><body>You are either not on a quest that involves this NPC, or you don't meet this NPC's minimum quest requirements.</body></html>"
st = player.getQuestState(qn)
if not st : return htmltext
npcId = npc.getNpcId()
id = st.getState()
cond = st.getInt("cond")
if npcId == LADD :
if id == State.CREATED :
st.set("cond","0")
if player.getLevel() < MINLEVEL :
st.exitQuest(1)
htmltext = "30166-01.htm" #not qualified
elif not st.getQuestItemsCount(STAR_OF_DESTINY) :
st.exitQuest(1)
htmltext = "30166-01a.htm" #not qualified
elif st.getInt("cond")==0 :
htmltext = "30166-02.htm" # Successful start: Bring me Pure silver from Reagents quest
elif id == State.COMPLETED :
htmltext = "<html><body>You have already completed this quest.</body></html>"
# cond for this quest is set to 8 from Supplier or Reagents, when you create Mimir's Elixir.
# Finally, all is done...time to learn how to use the Elixir...
elif cond==8 :
htmltext = "30166-10.htm" # here's what you do...
st.takeItems(MIMIRS_ELIXIR,-1) #remove this line for compatibility with L2JServer revisions prior to 376
st.giveItems(SCROLL_ENCHANT_WEAPON_A,1)
st.exitQuest(False)
st.unset("cond")
st.set("cond","5")
htmltext = "30718-03.htm" # here you go...take the gold. Now go back to ladd.
elif cond>=5 :
htmltext = "30718-04.htm" # Go back to ladd already!
return htmltext
def onKill(self,npc,player,isPet):
st = player.getQuestState(qn)
if not st : return
if st.getState() != State.STARTED : return
npcId = npc.getNpcId()
drop = st.getRandom(100)
cond = st.getInt("cond")
dropcond = DROPLIST[npcId][0]
if drop < DROP_RATE and cond == dropcond :
if st.getQuestItemsCount(DROPLIST[npcId][1]) == 0 :
st.giveItems(DROPLIST[npcId][1],1)
st.playSound("ItemSound.quest_itemget")
st.set("cond",str(cond+1))
return
# Quest class and state definition
QUEST = Quest(QUEST_NUMBER, qn, QUEST_DESCRIPTION)
# Quest NPC starter initialization
QUEST.addStartNpc(LADD)
# Quest initialization
QUEST.addTalkId(LADD)
QUEST.addTalkId(JOAN)
for i in DROPLIST.keys():
QUEST.addKillId(i)
0
Войдите или зарегистрируйтесь чтобы ответить




