def onKill(self, npc, player, isPet):
    st = player.getQuestState(qn)
    if (not st):
        return
    id = st.getState()
    npcId = npc.getNpcId()
    skins = st.getQuestItemsCount(TD_BCK_SKN)
    if (((id == STARTING) and ((st.getQuestItemsCount(FSN_LIST) == 1) and (skins < 10))) or ((st.getQuestItemsCount(FSN_LIST_DLX) == 1) and (skins < 20))):
        if (npcId == TD_LORD):
            count = 0
            if (st.getQuestItemsCount(FSN_LIST) == 1):
                count = 10
            else:
                count = 20
            (numItems, chance) = divmod((BACK_DROP * Config.RATE_DROP_QUEST), 100)
            if (st.getRandom(100) <= chance):
                numItems += 1
            numItems = int(numItems)
            if (numItems != 0):
                if (count <= (skins + numItems)):
                    numItems = (count - skins)
                    st.playSound('ItemSound.quest_middle')
                else:
                    st.playSound('ItemSound.quest_itemget')
                st.giveItems(TD_BCK_SKN, numItems)
    elif ((id == STARTED) and (st.get('progress') in ['14', '15', '21', '22'])):
        whom = int(st.get('dragon'))
        if (whom == 1):
            eggs = EX_EGG
            scale = SCALE_1
            eggdropper = LO_LZRD_W
        elif (whom == 2):
            eggs = ZW_EGG
            scale = SCALE_2
            eggdropper = MS_SPIDER
        elif (whom == 3):
            eggs = KA_EGG
            scale = SCALE_3
            eggdropper = RD_SCVNGR
        elif (whom == 4):
            eggs = SU_EGG
            scale = SCALE_4
            eggdropper = BO_OVERLD
        elif (whom == 5):
            eggs = SH_EGG
            scale = SCALE_5
            eggdropper = DD_SEEKER
        prevItems = st.getQuestItemsCount(eggs)
        if ((st.getQuestItemsCount(scale) == 1) and (prevItems < REQUIRED_EGGS)):
            if (npcId == eggdropper):
                chance = (EGG_DROP * Config.RATE_DROP_QUEST)
                (numItems, chance) = divmod(chance, 100)
                if (st.getRandom(100) <= chance):
                    numItems += 1
                numItems = int(numItems)
                if (numItems != 0):
                    if (REQUIRED_EGGS <= (prevItems + numItems)):
                        numItems = (REQUIRED_EGGS - prevItems)
                        st.playSound('ItemSound.quest_middle')
                    else:
                        st.playSound('ItemSound.quest_itemget')
                    st.giveItems(eggs, numItems)
    elif ((id == STARTING) and (st.getQuestItemsCount(FRY_STN_DLX) == 1)):
        if (npcId in (range(20589, 20600) + [20719])):
            st.takeItems(FRY_STN_DLX, 1)
            st.set('progress', '7')
            return 'you lost fairy stone deluxe!'
def onKill(self, npc, player, isPet):
    st = player.getQuestState(qn)
    if (not st):
        return
    id = st.getState()
    npcId = npc.getNpcId()
    skins = st.getQuestItemsCount(TD_BCK_SKN)
    if (((id == STARTING) and ((st.getQuestItemsCount(FSN_LIST) == 1) and (skins < 10))) or ((st.getQuestItemsCount(FSN_LIST_DLX) == 1) and (skins < 20))):
        if (npcId == TD_LORD):
            count = 0
            if (st.getQuestItemsCount(FSN_LIST) == 1):
                count = 10
            else:
                count = 20
            (numItems, chance) = divmod((BACK_DROP * Config.RATE_DROP_QUEST), 100)
            if (st.getRandom(100) <= chance):
                numItems += 1
            numItems = int(numItems)
            if (numItems != 0):
                if (count <= (skins + numItems)):
                    numItems = (count - skins)
                    st.playSound('ItemSound.quest_middle')
                else:
                    st.playSound('ItemSound.quest_itemget')
                st.giveItems(TD_BCK_SKN, numItems)
    elif ((id == STARTED) and (st.get('progress') in ['14', '15', '21', '22'])):
        whom = int(st.get('dragon'))
        if (whom == 1):
            eggs = EX_EGG
            scale = SCALE_1
            eggdropper = LO_LZRD_W
        elif (whom == 2):
            eggs = ZW_EGG
            scale = SCALE_2
            eggdropper = MS_SPIDER
        elif (whom == 3):
            eggs = KA_EGG
            scale = SCALE_3
            eggdropper = RD_SCVNGR
        elif (whom == 4):
            eggs = SU_EGG
            scale = SCALE_4
            eggdropper = BO_OVERLD
        elif (whom == 5):
            eggs = SH_EGG
            scale = SCALE_5
            eggdropper = DD_SEEKER
        prevItems = st.getQuestItemsCount(eggs)
        if ((st.getQuestItemsCount(scale) == 1) and (prevItems < REQUIRED_EGGS)):
            if (npcId == eggdropper):
                chance = (EGG_DROP * Config.RATE_DROP_QUEST)
                (numItems, chance) = divmod(chance, 100)
                if (st.getRandom(100) <= chance):
                    numItems += 1
                numItems = int(numItems)
                if (numItems != 0):
                    if (REQUIRED_EGGS <= (prevItems + numItems)):
                        numItems = (REQUIRED_EGGS - prevItems)
                        st.playSound('ItemSound.quest_middle')
                    else:
                        st.playSound('ItemSound.quest_itemget')
                    st.giveItems(eggs, numItems)
    elif ((id == STARTING) and (st.getQuestItemsCount(FRY_STN_DLX) == 1)):
        if (npcId in (range(20589, 20600) + [20719])):
            st.takeItems(FRY_STN_DLX, 1)
            st.set('progress', '7')
            return 'you lost fairy stone deluxe!'