def onKill(self, npc, player, isPet):
    st = player.getQuestState(qn)
    if (not st):
        return
    if (st.getState() != STARTED):
        return
    npcId = npc.getNpcId()
    cond = st.getInt('cond')
    if (cond == 2):
        (numItems, chance) = divmod((100 * Config.RATE_QUESTS_REWARD), 100)
        if (st.getRandom(100) < chance):
            numItems = (numItems + 1)
        pieces = st.getQuestItemsCount(MAP_PIECE)
        if ((pieces + numItems) >= MAX_COUNT):
            numItems = (MAX_COUNT - pieces)
            if (numItems != 0):
                st.playSound('ItemSound.quest_middle')
                st.set('cond', '3')
        else:
            st.playSound('ItemSound.quest_itemget')
        st.giveItems(MAP_PIECE, int(numItems))
    return
def onKill(self, npc, player, isPet):
    st = player.getQuestState(qn)
    if (not st):
        return
    if (st.getState() != STARTED):
        return
    npcId = npc.getNpcId()
    cond = st.getInt('cond')
    if (cond == 2):
        (numItems, chance) = divmod((100 * Config.RATE_QUESTS_REWARD), 100)
        if (st.getRandom(100) < chance):
            numItems = (numItems + 1)
        pieces = st.getQuestItemsCount(MAP_PIECE)
        if ((pieces + numItems) >= MAX_COUNT):
            numItems = (MAX_COUNT - pieces)
            if (numItems != 0):
                st.playSound('ItemSound.quest_middle')
                st.set('cond', '3')
        else:
            st.playSound('ItemSound.quest_itemget')
        st.giveItems(MAP_PIECE, int(numItems))
    return