local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
local voc = {}

function onCreatureAppear(cid)                          npcHandler:onCreatureAppear(cid)                        end
function onCreatureDisappear(cid)                       npcHandler:onCreatureDisappear(cid)                     end
function onCreatureSay(cid, type, msg)                  npcHandler:onCreatureSay(cid, type, msg)                end
function onThink()                                      npcHandler:onThink()                                    end

function creatureSayCallback(cid, type, msg)
        if(not npcHandler:isFocused(cid)) then
            return false
        end
        local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_PRIVATE and 0 or cid

        if(msgcontains(msg, 'help')) then
            selfSay('My machine is not working because I cant get the conections right, you can try to help me if you want. ({Continue})', cid)
		else
			if(msgcontains(msg, 'Continue')) then
				selfSay('You must defeat the four bosses. In order to fit it please use the levers in the room below. Using each lever requires about 100 demonic stones. After defeating bosses take over their power and you\'ll be able to fix the machine.', cid)			
			else
	
            selfSay('Will you agree to help me repair my machine? ({help})', cid)
            talkState[talkUser] = 0
			end
		end

end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new()) 