local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
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_DEFAULT and 0 or cid
if(msgcontains(msg, 'kevnan')) and getPlayerStorageValue(cid, 3987) >= 1 then
selfSay('Voc\ê j\á vingou a morte de meu filho.', cid)
talkState[talkUser] = 0
end
if(msgcontains(msg, 'kevnan')) and getPlayerStorageValue(cid, 3987) <= 0 then
selfSay('Ah você conhece meu filho Kevnan? Que ótimo conhecer você. A vários dias ele saiu em uma jornada perigosa e até então não tenho notícias dele, você sabe algo a respeito?', cid)
elseif(msgcontains(msg, 'botas')) then
selfSay('Voc\ê falou botas? Diga {yes} ou {no}', cid)
talkState[talkUser] = 1
elseif(msgcontains(msg, 'mais')) then
selfSay('Acredito que quem matou meu filho foi um poderoso monstro que anda aterrorizando a região, há boatos que é um dragão jamais visto antes, se você vingar a morte do meu filho vou te dar algo que pertencia a Kevnan, algo que ele gostava muito, volte aqui quando cumprir sua {missao}.', cid)
talkState[talkUser] = 2
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
if (getPlayerItemCount(cid, 6530) >= 1) then
selfSay('Ma.. Mas que triste notícia..... Meu filho querido, mamãe também te ama, que esteja bem onde quer que esteja..Quer saber {mais}?', cid)
talkState[talkUser] = 0
else
selfSay('De quais botas você está falando?', cid)
talkState[talkUser] = 0
end
elseif(msgcontains(msg, 'missao') and talkState[talkUser] == 2) then
if(getPlayerStorageValue(cid, 3987) <= 0) then
if(getPlayerItemCount(cid, 11366) >= 1) then
selfSay('Muito obrigado por ter vingado a morte de meu filho Kevnan. Como prometido aqui está a sua recompensa.', cid)
doPlayerRemoveItem(cid, 11366, 1)
doPlayerAddItem(cid, 15407, 1)
setPlayerStorageValue(cid, 3987, 1)
talkState[talkUser] = 0
else
selfSay('Ainda n\ão vingou a morte do meu filho Kevnan? Lembre-se que eh um dragão jamais visto antes que esta pelas regioes geladas. Voc\ê precisa trazer algo que prove que foi este monstro que matou meu filho', cid)
talkState[talkUser] = 0
end
else
selfSay('Voc\ê j\á vingou a morte do meu filho', cid)
talkState[talkUser] = 0
end
return TRUE
end
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())