здравствуйте форум,хочу чтоб этот квест после завершения давал несколько итемов.
как это сделать ? ASSASS = [13048,13049] написал так но не пашет.
или нужно добавить еще итем и прописать: st.giveItems(ASSASS1, 1)
как это сделать ? ASSASS = [13048,13049] написал так но не пашет.
или нужно добавить еще итем и прописать: st.giveItems(ASSASS1, 1)
Код:
import sys
from ru.catssoftware import Config
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 = 50021
## Мобы
MOBS = [20314]
## Дроп
#id перьев с мобов в мос
FEATHER = 8253
#сколько нужно?
FEATHER_NEED = 10
#шанс дропа, %
FEATHER_CHANCE = 15
##Награда
#id item
WINGS = 13048
ROUTES={
1:[149703,173432,-5026,0],
2:[149364,172672,-948,0],
}
class Quest (JQuest) :
def __init__(self,id,name,descr) : JQuest.__init__(self,id,name,descr)
def onEvent (self,event,st) :
htmltext = event
if event == "accept.htm":
st.setState(State.STARTED)
st.playSound("ItemSound.quest_accept")
st.set("cond","1")
elif event == "finish.htm":
if st.getQuestItemsCount(FEATHER) >= FEATHER_NEED :
st.takeItems(FEATHER, -1)
st.giveItems(WINGS, 1)
st.set("cond","0")
st.playSound("ItemSound.quest_finish")
st.setState(State.COMPLETED)
else:
htmltext = "mobs.htm"
return htmltext
def onTalk (self,npc,player):
st = player.getQuestState(qn)
if not st:
return "<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>"
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 :
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
if npcId in MOBS:
reward = FEATHER
limit = FEATHER_NEED
chance = FEATHER_CHANCE
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, 1)
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, 1)
st.playSound("ItemSound.quest_itemget")
return
QUEST = Quest(902, qn, "Assassins Quest")
QUEST.addStartNpc(NPC)
QUEST.addTalkId(NPC)
for m in MOBS:
QUEST.addKillId(m)
Последнее редактирование: