12-18-2010, 11:20 AM
Как исправить шанс появления Quest moba "Honey Bear"?
[src=#python]
def onKill(self,npc,player,isPet):
st = player.getQuestState(qn)
if not st : return
if st.getState() != State.STARTED : return
npcId = npc.getNpcId()
if npcId == 20777 :
if st.getInt("cond") and st.getQuestItemsCount(BEAR_PIC) == 1 and st.getQuestItemsCount(HONEY_JAR) < 5 :
if st.getInt("id") > 20 :
n = ((st.getInt("id")-20)*10)
if st.getRandom(100) <= n :
st.addSpawn(27058)
st.set("id","0")
else:
st.set("id",str(st.getInt("id")+1))
else:
st.set("id",str(st.getInt("id")+1))
elif npcId == 27058 :
if st.getInt("cond") and st.getQuestItemsCount(BEAR_PIC) == 1 and st.getQuestItemsCount(HONEY_JAR) < 5 :
if npc.isSpoil() :
st.giveItems(HONEY_JAR,1)
if st.getQuestItemsCount(HONEY_JAR) == 5 :
st.playSound("ItemSound.quest_middle")
st.set("cond","6")
else:
st.playSound("ItemSound.quest_itemget")
[/src]
[src=#python]
def onKill(self,npc,player,isPet):
st = player.getQuestState(qn)
if not st : return
if st.getState() != State.STARTED : return
npcId = npc.getNpcId()
if npcId == 20777 :
if st.getInt("cond") and st.getQuestItemsCount(BEAR_PIC) == 1 and st.getQuestItemsCount(HONEY_JAR) < 5 :
if st.getInt("id") > 20 :
n = ((st.getInt("id")-20)*10)
if st.getRandom(100) <= n :
st.addSpawn(27058)
st.set("id","0")
else:
st.set("id",str(st.getInt("id")+1))
else:
st.set("id",str(st.getInt("id")+1))
elif npcId == 27058 :
if st.getInt("cond") and st.getQuestItemsCount(BEAR_PIC) == 1 and st.getQuestItemsCount(HONEY_JAR) < 5 :
if npc.isSpoil() :
st.giveItems(HONEY_JAR,1)
if st.getQuestItemsCount(HONEY_JAR) == 5 :
st.playSound("ItemSound.quest_middle")
st.set("cond","6")
else:
st.playSound("ItemSound.quest_itemget")
[/src]