def onTalk(self, npc, player):
    htmltext = "<html><body>You are either not carrying out your quest or don't meet the criteria.</body></html>"
    st = player.getQuestState(qn)
    if (not st):
        return htmltext
    npcId = npc.getNpcId()
    id = st.getState()
    if (id == CREATED):
        if (player.getLevel() >= MIN_LEVEL):
            htmltext = '30829-00.htm'
        else:
            st.exitQuest(1)
            htmltext = ('<html><body>This quest can only be taken by characters that have a minimum level of %s. Return when you are more experienced.</body></html>' % MIN_LEVEL)
    elif (id == STARTED):
        cond = st.getInt('cond')
        if (npcId == COOPER):
            if (cond == 1):
                if (not st.getQuestItemsCount(CRAFTED_DAGGER)):
                    htmltext = '30829-01a.htm'
                else:
                    htmltext = '30829-02.htm'
            elif (cond == 2):
                htmltext = '30829-03a.htm'
            elif (cond == 3):
                htmltext = '30829-04.htm'
            elif (cond == 4):
                htmltext = '30829-05a.htm'
            elif (cond == 5):
                htmltext = '30829-06.htm'
        elif (npcId == GALLADUCCI):
            if ((cond == 4) and st.getQuestItemsCount(MAP)):
                htmltext = '30097-05.htm'
    elif (id == COMPLETED):
        st.exitQuest(0)
        htmltext = '<html><body>This quest has already been completed.</body></html>'
    return htmltext
def onTalk(self, npc, player):
    htmltext = "<html><body>You are either not carrying out your quest or don't meet the criteria.</body></html>"
    st = player.getQuestState(qn)
    if (not st):
        return htmltext
    npcId = npc.getNpcId()
    id = st.getState()
    if (id == CREATED):
        if (player.getLevel() >= MIN_LEVEL):
            htmltext = '30829-00.htm'
        else:
            st.exitQuest(1)
            htmltext = ('<html><body>This quest can only be taken by characters that have a minimum level of %s. Return when you are more experienced.</body></html>' % MIN_LEVEL)
    elif (id == STARTED):
        cond = st.getInt('cond')
        if (npcId == COOPER):
            if (cond == 1):
                if (not st.getQuestItemsCount(CRAFTED_DAGGER)):
                    htmltext = '30829-01a.htm'
                else:
                    htmltext = '30829-02.htm'
            elif (cond == 2):
                htmltext = '30829-03a.htm'
            elif (cond == 3):
                htmltext = '30829-04.htm'
            elif (cond == 4):
                htmltext = '30829-05a.htm'
            elif (cond == 5):
                htmltext = '30829-06.htm'
        elif (npcId == GALLADUCCI):
            if ((cond == 4) and st.getQuestItemsCount(MAP)):
                htmltext = '30097-05.htm'
    elif (id == COMPLETED):
        st.exitQuest(0)
        htmltext = '<html><body>This quest has already been completed.</body></html>'
    return htmltext