На работоспособность не проверялось...
import sys
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
from ru.catssoftware.tools.random import Rnd
qn = "902_FeatherGathering"
# ID's NPC используемых в квесте #
#########################################################
# ID NPC Для квеста #
NPC = 99990
# ID Мобов, с которых падает квест итем #
MOBS = [22126,22124,22128,22123,22122,22125]
# ID Босса, которого нужно убить по квесту #
BOSS = 15064
#########################################################
# ID's Items используемых в квест #
#########################################################
# ID Итемов которые будут падать из MOBS #
FEATHER = 13018
# Количество итемов, которое будет падать из MOBS Min #
FEATHER_COUNT_MIN = 1
# Количество итемов, которое будет падать из MOBS Max #
FEATHER_COUNT_MAX = 1
# Количество итемов, нужное собрать с MOBS #
FEATHER_NEED = 1000
# Шанс дропа итемов с MOBS #
FEATHER_CHANCE = 100
# ID Итема которое будет падать из BOSS #
BOSS_ITEM = 13019
#########################################################
# Награда за квест #
#########################################################
# ID Награды за квест #
WINNER = 13017
# Количество награды Min #
WINNER_COUNT_MIN = 1
# Количество награды Max #
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(State.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(State.COMPLETED)
else:
htmltext = "mobs.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()
idd = st.getState()
cond = st.getInt("cond")
if npcId == NPC :
if idd == COMPLETED :
htmltext = "completed.htm"
if idd == 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("902_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 = Quest(902, qn, "Feather Gathering")
QUEST.addStartNpc(NPC)
QUEST.addTalkId(NPC)
QUEST.addKillId(BOSS)
for m in MOBS:
QUEST.addKillId(m)