local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
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
if msgcontains(msg, 'help') then
selfSay('Eu vendo {Crown armor} por 100 laranjas.', cid)
elseif msgcontains(msg, 'crown armor') then
if getPlayerItemCount(cid,2675) >= 100 then
selfSay('Voce vai mesmo me dar 100 laranjas pela crown armor?', cid)
talk_state = 1
else
selfSay('O que?? Mas voce nem tem as laranjas!', cid)
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 1 then
talk_state = 0
if doPlayerRemoveItem(cid,2675,100) == TRUE then
doPlayerAddItem(cid,2487,1)
selfSay('Obrigado, oba laranjas...', cid)
end
elseif msgcontains(msg, 'no') and (talk_state >= 1) then
selfSay('Que pena, adoro laranjas.', cid)
talk_state = 0
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())