01-31-2013, 11:26 PM
я добавил новый квест, сборка lucera.
помогите исправить ошибку:
__init__.py :
помогите исправить ошибку:
Код:
Error on: /root/server/game/data/scripts/quests/q902_FeatherGathering/__init__.py.error.log
Line: -1 - Column: -1
Traceback (innermost last):
File "__init__.py", line 124, in ?
NameError: QUEST
__init__.py :
Код:
import sys
from ru.catssoftware import Config
from ru.catssoftware.tools.random import Rnd
from ru.catssoftware.gameserver.model.quest import State
from ru.catssoftware.gameserver.model.quest import QuestState
from ru.catssoftware.gameserver.model.quest.jython import QuestJython as JQuest
qn = "q902_FeatherGathering"
NPC = 300301
MOBS = [22132,22130,22131,22135]
BOSS = 25450
FEATHER = 2129
FEATHER_COUNT_MIN = 1
FEATHER_COUNT_MAX = 1
FEATHER_NEED = 100
FEATHER_CHANCE = 100
BOSS_ITEM = 2125
WINNER = 7058
WINNER_COUNT_MIN = 1
WINNER_COUNT_MAX = 1
WINNER_ENCHANT = 0
class Quest (JQuest) :
def __init__(self,id,name,descr) :
JQuest.__init__(self,id,name,descr)
def onEvent (self,event,st) :
htmltext = event
count = Rnd.get(WINNER_COUNT_MIN, WINNER_COUNT_MAX)
if event == "accept.htm":
st.setState(STARTED)
st.playSound("ItemSound.quest_accept")
st.set("cond","1")
elif event == "finish.htm":
if st.getQuestItemsCount(FEATHER) >= FEATHER_NEED and st.getQuestItemsCount(BOSS_ITEM) >= 1:
st.takeItems(FEATHER, -1)
st.takeItems(BOSS_ITEM, -1)
st.giveItems(WINNER, count, WINNER_ENCHANT)
st.set("cond","0")
st.playSound("ItemSound.quest_finish")
st.setState(COMPLETED)
else:
htmltext = "mobs.htm"
return htmltext
def onTalk (self,npc,player):
st = player.getQuestState(qn)
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>"
if not st:
return htmltext
npcId = npc.getNpcId()
idd = st.getState()
cond = st.getInt("cond")
if npcId == NPC:
if idd == State.COMPLETED :
htmltext = "completed.htm"
if idd == State.CREATED :
htmltext = "hello1.htm"
elif cond == 1:
if st.getQuestItemsCount(FEATHER) >= FEATHER_NEED and st.getQuestItemsCount(BOSS_ITEM) >= 1:
htmltext = "mobs2.htm"
else:
htmltext = "mobs.htm"
return htmltext
def onKill(self,npc,player,isPet):
st = player.getQuestState(qn)
if not st or st.getInt("cond") != 1:
return
npcId = npc.getNpcId()
reward = 0
limit = 1
chance = 100
count = 1
if npcId in MOBS:
reward = FEATHER
limit = FEATHER_NEED
chance = FEATHER_CHANCE
count = Rnd.get(FEATHER_COUNT_MIN,FEATHER_COUNT_MAX)
if npcId == BOSS:
reward = BOSS_ITEM
limit = 1
count = 1
if reward > 0:
party = player.getParty()
if party:
for member in party.getPartyMembers():
if not member.isAlikeDead():
st = member.getQuestState("q902_FeatherGathering")
if st and st.getQuestItemsCount(reward) < limit and st.getRandom(100) <= chance:
st.giveItems(reward, count)
st.playSound("ItemSound.quest_itemget")
if st.getQuestItemsCount(reward) >= limit:
st.playSound("ItemSound.quest_middle")
else:
if st.getQuestItemsCount(reward) < limit and st.getRandom(100) <= chance:
st.giveItems(reward, count)
st.playSound("ItemSound.quest_itemget")
return
QUEST.addStartNpc(NPC)
QUEST.addTalkId(NPC)
QUEST.addKillId(BOSS)
QUEST.addKillId(MOBS)