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  
 local btype = "normal"
local pokemon1 ="Mini Zapdos"
local pokemon2 = "Mini Articuno"
local pokemon3 = "Psic Mewtwo"
local pokemon4 = "Fallen Jirachi"
local pokemon5 = "Black Arceus"
local pokemon6 = "Mini Moltres"
-- Conversa Jogador/NPC  
if(msgcontains(msg, 'offer') or msgcontains(msg, 'Offer')) then
selfSay('Eu vendo, minis articuno, zapdos, moltres, black arceus, fallen jirachi e psic mewtwo ', cid) 
elseif(msgcontains(msg, 'mini articuno') or msgcontains(msg, 'articuno')) then
selfSay('Mini articuno custa 70 diamonds você tem certeza?', cid) 
talkState[talkUser] = 2
elseif(msgcontains(msg, 'mini moltres') or msgcontains(msg, 'moltres')) then
selfSay('Mini moltres custa 70 diamonds você tem certeza?', cid) 
talkState[talkUser] = 3
elseif(msgcontains(msg, 'mini zapdos') or msgcontains(msg, 'zapdos')) then
selfSay('Mini zapdos custa 70 diamonds você tem certeza?', cid) 
talkState[talkUser] = 4
elseif(msgcontains(msg, 'black arceus') or msgcontains(msg, 'arceus')) then
selfSay('Black Arceus custa 100 diamonds, voce tem certeza?', cid) 
talkState[talkUser] = 5
elseif(msgcontains(msg, 'fallen jirachi') or msgcontains(msg, 'jirachi')) then
selfSay('Fallen jirachi custa 140 diamonds, você tem certeza?', cid) 
talkState[talkUser] = 6
elseif(msgcontains(msg, 'psic mewtwo') or msgcontains(msg, 'mewtwo')) then
selfSay('Psic Mewtwo custa 80 diamonds, você tem certeza?', cid) 
talkState[talkUser] = 7
 local btype = "normal"
local pokemon1 ="Mini Zapdos"
local pokemon2 = "Mini Articuno"
local pokemon3 = "Psic Mewtwo"
local pokemon4 = "Fallen Jirachi"
local pokemon5 = "Black Arceus"
local pokemon6 = "Mini Moltres"
-- Confirmação da Compra  
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 2) then  
if(doPlayerRemoveItem(cid, 12237, 70) == true) then  
selfSay('Thanks! You Received your mini articuno', cid) 
addPokeToPlayer(cid, pokemon2, 0, nil, btype)
talkState[talkUser] = 0 
else  
selfSay('You do not have enough black diamonds.', cid) 
talkState[talkUser] = 0  
end
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 3) then  
if(doPlayerRemoveItem(cid, 12237, 70) == true) then  
selfSay('Thanks! You Received your mini moltres', cid) 
addPokeToPlayer(cid, pokemon6, 0, nil, btype)
talkState[talkUser] = 0 
else  
selfSay('You do not have enough black diamonds.', cid) 
talkState[talkUser] = 0  
end
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 4) then  
if(doPlayerRemoveItem(cid, 12237, 70) == true) then  
selfSay('Thanks! You Received your mini zapdos', cid) 
addPokeToPlayer(cid, pokemon1, 0, nil, btype)
talkState[talkUser] = 0 
else  
selfSay('You do not have enough black diamonds.', cid) 
talkState[talkUser] = 0  
end
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 5) then  
if(doPlayerRemoveItem(cid, 12237, 100) == true) then  
selfSay('Thanks! You Received your black arceus', cid) 
addPokeToPlayer(cid, pokemon5, 0, nil, btype)
talkState[talkUser] = 0 
else  
selfSay('You do not have enough black diamonds.', cid) 
talkState[talkUser] = 0  
end
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 6) then  
if(doPlayerRemoveItem(cid, 12237, 140) == true) then  
selfSay('Thanks! You Received your fallen jirachi', cid) 
addPokeToPlayer(cid, pokemon4, 0, nil, btype)
talkState[talkUser] = 0 
else  
selfSay('You do not have enough black diamonds.', cid) 
talkState[talkUser] = 0  
end
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 7) then  
if(doPlayerRemoveItem(cid, 12237, 80) == true) then  
selfSay('Thanks! You Received your Psic Mewtwo', cid) 
addPokeToPlayer(cid, pokemon3, 0, nil, btype)
talkState[talkUser] = 0 
else  
selfSay('You do not have enough black diamonds.', cid) 
talkState[talkUser] = 0  
end

end 
return TRUE
end
 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) 
npcHandler:addModule(FocusModule:new())