08-11-2011, 08:16 AM
сам код:
как таковой ошибки в логах нету... после нажатия на "Я согласен" окно закрываеться и ничего не происходит.. квест не даеться
да и почему как только я пытаюсь менять в коде, зачастую сервак не импортит квест вообще, а меняю то пустяк, те же строчки st.set("cond","1") и st.setState(STARTED) местами меняю и ппц...
поковырявшись, дошел до того, что онТолк начинает свою работу правильно, а вот онИвент даже не пытаеться проверять мой уровень, хз как так.. код вроде же элементарный(
1
# by disKret
print "importing quests: 624: The Finest Ingredients - Part 1"
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 = "624_TheFinestIngredientsPart1"
#NPC
JEREMY = 8521
#ITEMS
TRUNK_OF_NEPENTHES=7202
FOOT_OF_BANDERSNATCHLING=7203
SECRET_SPICE=7204
SAUCE=7206
CRYOLITE=7080
#MOBS
MOBS = HOT_SPRINGS_ATROX,HOT_SPRINGS_ATROXSPAWN,HOT_SPRINGS_BANDERSNATCH,HOT_SPRINGS_NEPENTHES = 1321,1317,1322,1319
ITEMS={
HOT_SPRINGS_ATROX:SECRET_SPICE,
HOT_SPRINGS_ATROXSPAWN:SECRET_SPICE,
HOT_SPRINGS_BANDERSNATCH:FOOT_OF_BANDERSNATCHLING,
HOT_SPRINGS_NEPENTHES:TRUNK_OF_NEPENTHES
}
class Quest (JQuest) :
def __init__(self,id,name,descr): JQuest.__init__(self,id,name,descr)
def onEvent (self,event,st) :
htmltext = event
trunk = st.getQuestItemsCount(TRUNK_OF_NEPENTHES)
foot = st.getQuestItemsCount(FOOT_OF_BANDERSNATCHLING)
spice = st.getQuestItemsCount(SECRET_SPICE)
if event == "31521-1.htm" :
if st.getPlayer().getLevel() < 73 :
st.set("cond","1")
st.setState(STARTED)
st.playSound("ItemSound.quest_accept")
else:
htmltext = "31521-0a.htm"
st.exitQuest(1)
elif event == "31521-4.htm" :
if trunk==foot==spice==50 :
st.takeItems(TRUNK_OF_NEPENTHES,-1)
st.takeItems(FOOT_OF_BANDERSNATCHLING,-1)
st.takeItems(SECRET_SPICE,-1)
st.playSound("ItemSound.quest_finish")
st.giveItems(SAUCE,1)
st.giveItems(CRYOLITE,1)
htmltext = "31521-4.htm"
st.exitQuest(1)
else:
htmltext="31521-5.htm"
st.set("cond","1")
return htmltext
def onTalk (Self,npc,st):
id = st.getState()
htmltext = "<html><head><body>I have nothing to say you</body></html>"
if id :
st.setState(CREATED)
st.set("cond","0")
npcId = npc.getNpcId()
if int(st.get("cond")) == 0 :
htmltext = "31521-0.htm"
elif st.getState() == STARTED:
if int(st.get("cond")) != 3 :
htmltext = "31521-2.htm"
else :
htmltext = "31521-3.htm"
return htmltext
def onKill (self,npc,player):
# todo: with the current code, a player who has completed up to 2 out of 3
# item collections may consume the party drop (i.e. become the selected
# player in the random, but get nothing because it was the wrong mob)
# this ought to be corrected later...
partyMember = self.getRandomPartyMember(player,"1")
if not partyMember: return
st = partyMember.getQuestState(qn)
if st :
if st.getState() == STARTED :
npcId = npc.getNpcId()
if st.getInt("cond") == 1:
numItems,chance = divmod(100*Config.RATE_DROP_QUEST,100)
if st.getRandom(100) <chance :
numItems = numItems + 1
numItems = int(numItems)
item = ITEMS[npcId]
count = st.getQuestItemsCount(item)
if count < 50 :
if count + numItems > 50 :
numItems = 50 - count
st.giveItems(item,numItems)
count_trunk = st.getQuestItemsCount(TRUNK_OF_NEPENTHES)
count_foot = st.getQuestItemsCount(FOOT_OF_BANDERSNATCHLING)
count_spice = st.getQuestItemsCount(SECRET_SPICE)
if count_trunk == count_foot == count_spice == 50 :
st.set("cond","3")
st.playSound("ItemSound.quest_middle")
else:
st.playSound("ItemSound.quest_itemget")
return
QUEST = Quest(624,qn,"The Finest Ingredients - Part 1")
CREATED = State('Start', QUEST)
STARTED = State('Started', QUEST)
QUEST.setInitialState(CREATED)
QUEST.addStartNpc(JEREMY)
QUEST.addTalkId(JEREMY)
for i in MOBS :
QUEST.addKillId(i)
STARTED.addQuestDrop(JEREMY,TRUNK_OF_NEPENTHES,1)
STARTED.addQuestDrop(JEREMY,FOOT_OF_BANDERSNATCHLING,1)
STARTED.addQuestDrop(JEREMY,SECRET_SPICE,1)
print "importing quests: 624: The Finest Ingredients - Part 1"
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 = "624_TheFinestIngredientsPart1"
#NPC
JEREMY = 8521
#ITEMS
TRUNK_OF_NEPENTHES=7202
FOOT_OF_BANDERSNATCHLING=7203
SECRET_SPICE=7204
SAUCE=7206
CRYOLITE=7080
#MOBS
MOBS = HOT_SPRINGS_ATROX,HOT_SPRINGS_ATROXSPAWN,HOT_SPRINGS_BANDERSNATCH,HOT_SPRINGS_NEPENTHES = 1321,1317,1322,1319
ITEMS={
HOT_SPRINGS_ATROX:SECRET_SPICE,
HOT_SPRINGS_ATROXSPAWN:SECRET_SPICE,
HOT_SPRINGS_BANDERSNATCH:FOOT_OF_BANDERSNATCHLING,
HOT_SPRINGS_NEPENTHES:TRUNK_OF_NEPENTHES
}
class Quest (JQuest) :
def __init__(self,id,name,descr): JQuest.__init__(self,id,name,descr)
def onEvent (self,event,st) :
htmltext = event
trunk = st.getQuestItemsCount(TRUNK_OF_NEPENTHES)
foot = st.getQuestItemsCount(FOOT_OF_BANDERSNATCHLING)
spice = st.getQuestItemsCount(SECRET_SPICE)
if event == "31521-1.htm" :
if st.getPlayer().getLevel() < 73 :
st.set("cond","1")
st.setState(STARTED)
st.playSound("ItemSound.quest_accept")
else:
htmltext = "31521-0a.htm"
st.exitQuest(1)
elif event == "31521-4.htm" :
if trunk==foot==spice==50 :
st.takeItems(TRUNK_OF_NEPENTHES,-1)
st.takeItems(FOOT_OF_BANDERSNATCHLING,-1)
st.takeItems(SECRET_SPICE,-1)
st.playSound("ItemSound.quest_finish")
st.giveItems(SAUCE,1)
st.giveItems(CRYOLITE,1)
htmltext = "31521-4.htm"
st.exitQuest(1)
else:
htmltext="31521-5.htm"
st.set("cond","1")
return htmltext
def onTalk (Self,npc,st):
id = st.getState()
htmltext = "<html><head><body>I have nothing to say you</body></html>"
if id :
st.setState(CREATED)
st.set("cond","0")
npcId = npc.getNpcId()
if int(st.get("cond")) == 0 :
htmltext = "31521-0.htm"
elif st.getState() == STARTED:
if int(st.get("cond")) != 3 :
htmltext = "31521-2.htm"
else :
htmltext = "31521-3.htm"
return htmltext
def onKill (self,npc,player):
# todo: with the current code, a player who has completed up to 2 out of 3
# item collections may consume the party drop (i.e. become the selected
# player in the random, but get nothing because it was the wrong mob)
# this ought to be corrected later...
partyMember = self.getRandomPartyMember(player,"1")
if not partyMember: return
st = partyMember.getQuestState(qn)
if st :
if st.getState() == STARTED :
npcId = npc.getNpcId()
if st.getInt("cond") == 1:
numItems,chance = divmod(100*Config.RATE_DROP_QUEST,100)
if st.getRandom(100) <chance :
numItems = numItems + 1
numItems = int(numItems)
item = ITEMS[npcId]
count = st.getQuestItemsCount(item)
if count < 50 :
if count + numItems > 50 :
numItems = 50 - count
st.giveItems(item,numItems)
count_trunk = st.getQuestItemsCount(TRUNK_OF_NEPENTHES)
count_foot = st.getQuestItemsCount(FOOT_OF_BANDERSNATCHLING)
count_spice = st.getQuestItemsCount(SECRET_SPICE)
if count_trunk == count_foot == count_spice == 50 :
st.set("cond","3")
st.playSound("ItemSound.quest_middle")
else:
st.playSound("ItemSound.quest_itemget")
return
QUEST = Quest(624,qn,"The Finest Ingredients - Part 1")
CREATED = State('Start', QUEST)
STARTED = State('Started', QUEST)
QUEST.setInitialState(CREATED)
QUEST.addStartNpc(JEREMY)
QUEST.addTalkId(JEREMY)
for i in MOBS :
QUEST.addKillId(i)
STARTED.addQuestDrop(JEREMY,TRUNK_OF_NEPENTHES,1)
STARTED.addQuestDrop(JEREMY,FOOT_OF_BANDERSNATCHLING,1)
STARTED.addQuestDrop(JEREMY,SECRET_SPICE,1)
как таковой ошибки в логах нету... после нажатия на "Я согласен" окно закрываеться и ничего не происходит.. квест не даеться
да и почему как только я пытаюсь менять в коде, зачастую сервак не импортит квест вообще, а меняю то пустяк, те же строчки st.set("cond","1") и st.setState(STARTED) местами меняю и ппц...
поковырявшись, дошел до того, что онТолк начинает свою работу правильно, а вот онИвент даже не пытаеться проверять мой уровень, хз как так.. код вроде же элементарный(