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 ="Manaphy"
local pokemon2 = "White Genesect"
local pokemon3 = "Mini Raikou"
local pokemon5 = "Kyurem"
local pokemon6 = "Hydreigon"

-- Conversa Jogador/NPC  
if(msgcontains(msg, 'offer') or msgcontains(msg, 'Offer')) then
selfSay('I sell shinystone e boost stone2, Manaphy, White genesect, Mini Raikou, Kyurem and Hydreigon and pergaminhos exp 100, 200, 300, 400 and 500', cid) 
elseif(msgcontains(msg, 'Shinystone') or msgcontains(msg, 'shinystone')) then
selfSay('the Shiny Stone costs 40 Diamonds, you really want this?', cid) 
talkState[talkUser] = 1 
elseif(msgcontains(msg, 'boost stone2') or msgcontains(msg, 'Boost Stone2')) then
selfSay('the Boost Stone2 costs 20 Diamonds, you really want this?', cid) 
talkState[talkUser] = 2
elseif(msgcontains(msg, 'Kyurem') or msgcontains(msg, 'kyurem')) then
selfSay('the kyurem costs 100 Diamonds, you really want this?', cid) 
talkState[talkUser] = 3
elseif(msgcontains(msg, 'Hydreigon') or msgcontains(msg, 'hydreigon')) then
selfSay('the Hydreigon costs 120 Diamonds, you really want this?', cid) 
talkState[talkUser] = 4
elseif(msgcontains(msg, 'manaphy') or msgcontains(msg, 'manaphy')) then
selfSay('the manaphy costs 130 Diamonds, you really want this?', cid) 
talkState[talkUser] = 5
elseif(msgcontains(msg, 'white genesect') or msgcontains(msg, 'genesect')) then
selfSay('the white genesect costs 80 Diamonds, you really want this?', cid) 
talkState[talkUser] = 6
elseif(msgcontains(msg, 'mini raikou') or msgcontains(msg, 'raikou')) then
selfSay('the mini raikou costs 200 Diamonds, you really want this?', cid) 
talkState[talkUser] = 7
elseif(msgcontains(msg, '300') or msgcontains(msg, '3')) then
selfSay('the Exp 300% costs 60 Diamonds, you really want this?', cid) 
talkState[talkUser] = 8
elseif(msgcontains(msg, '400') or msgcontains(msg, '4')) then
selfSay('the Exp 400% costs 80 Diamonds, you really want this?', cid) 
talkState[talkUser] = 9
elseif(msgcontains(msg, '500') or msgcontains(msg, '5')) then
selfSay('the Exp 500% costs 100 Diamonds, you really want this?', cid) 
talkState[talkUser] = 10
elseif(msgcontains(msg, 'saffari') or msgcontains(msg, 'saffari ball')) then
selfSay('Voce tem certeza que deseja comprar 100 saffari ball por 15 diamonds?', cid) 
talkState[talkUser] = 11
elseif(msgcontains(msg, '100') or msgcontains(msg, '1')) then
selfSay('the Exp 100% costs 100 Diamonds, you really want this?', cid) 
talkState[talkUser] = 12
elseif(msgcontains(msg, '200') or msgcontains(msg, '2')) then
selfSay('the Exp 200% costs 100 Diamonds, you really want this?', cid) 
talkState[talkUser] = 13

local btype = "normal"
local pokemon1 ="Manaphy"
local pokemon2 = "White Genesect"
local pokemon3 = "Mini Raikou"
local pokemon4 = "Spiritonb"
local pokemon5 = "Kyurem"
local pokemon6 = "Hydreigon"

-- Confirmação da Compra  
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then  
if(doPlayerRemoveItem(cid, 2145, 40) == true) then  
selfSay('Thanks! You Received your Shiny Stone', cid) 
doPlayerAddItem(cid, 13165, 1)
talkState[talkUser] = 0 
else  
selfSay('You do not have enough diamonds.', cid) 
talkState[talkUser] = 0  
end  
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 2) then  
if(doPlayerRemoveItem(cid, 2145, 20) == true) then  
selfSay('Thanks! You Received your Boosts Stone2', cid) 
doPlayerAddItem(cid, 13199, 1)
talkState[talkUser] = 0 
else  
selfSay('You do not have enough diamonds.', cid) 
talkState[talkUser] = 0  
end
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 3) then  
if(doPlayerRemoveItem(cid, 2145, 100) == true) then  
selfSay('Thanks! You Received your Kyurem', cid) 
addPokeToPlayer(cid, pokemon5, 0, nil, btype)
talkState[talkUser] = 0 
else  
selfSay('You do not have enough diamonds.', cid) 
talkState[talkUser] = 0  
end  
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 4) then  
if(doPlayerRemoveItem(cid, 2145, 120) == true) then  
selfSay('Thanks! You Received your Hydreigon', cid) 
addPokeToPlayer(cid, pokemon6, 0, nil, btype)
talkState[talkUser] = 0 
else  
selfSay('You do not have enough diamonds.', cid) 
talkState[talkUser] = 0  
end  
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 5) then  
if(doPlayerRemoveItem(cid, 2145, 130) == true) then  
selfSay('Thanks! You Received your Manaphy', cid) 
addPokeToPlayer(cid, pokemon1, 0, nil, btype)
talkState[talkUser] = 0 
else  
selfSay('You do not have enough diamonds.', cid) 
talkState[talkUser] = 0  
end  
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 6) then  
if(doPlayerRemoveItem(cid, 2145, 80) == true) then  
selfSay('Thanks! You Received your White Genesect', cid) 
addPokeToPlayer(cid, pokemon2, 0, nil, btype)
talkState[talkUser] = 0 
else  
selfSay('You do not have enough diamonds.', cid) 
talkState[talkUser] = 0  
end  
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 7) then  
if(doPlayerRemoveItem(cid, 2145, 200) == true) then  
selfSay('Thanks! You Received your Mini Raikou', cid) 
addPokeToPlayer(cid, pokemon3, 0, nil, btype)
talkState[talkUser] = 0 
else  
selfSay('You do not have enough diamonds.', cid) 
talkState[talkUser] = 0  
end  
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 8) then  
if(doPlayerRemoveItem(cid, 2145, 60) == true) then  
selfSay('Thanks! You Received your pergaminho Level 300.', cid) 
doPlayerAddItem(cid, 13204, 1)
talkState[talkUser] = 0 
else  
selfSay('You do not have enough diamonds.', cid) 
talkState[talkUser] = 0  
end  
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 9) then  
if(doPlayerRemoveItem(cid, 2145, 80) == true) then  
selfSay('Thanks! You Received your pergaminho Level 400.', cid) 
doPlayerAddItem(cid, 13205, 1)
talkState[talkUser] = 0 
else  
selfSay('You do not have enough diamonds.', cid) 
talkState[talkUser] = 0  
end  
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 10) then  
if(doPlayerRemoveItem(cid, 2145, 100) == true) then  
selfSay('Thanks! You Received your pergaminho Level 500.', cid) 
doPlayerAddItem(cid, 13206, 1)
talkState[talkUser] = 0 
else  
selfSay('You do not have enough diamonds.', cid) 
talkState[talkUser] = 0  
end  
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 11) then  
if(doPlayerRemoveItem(cid, 2145, 15) == true) then  
selfSay('Thanks! You Received your Saffari Ball', cid) 
doPlayerAddItem(cid, 12617, 100)
talkState[talkUser] = 0 
else  
selfSay('You do not have enough diamonds.', cid) 
talkState[talkUser] = 0  
end
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 12) then  
if(doPlayerRemoveItem(cid, 2145, 20) == true) then  
selfSay('Thanks! You Received your EXP 100', cid) 
doPlayerAddItem(cid, 13303, 100)
talkState[talkUser] = 0 
else  
selfSay('You do not have enough diamonds.', cid) 
talkState[talkUser] = 0  
end
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 13) then  
if(doPlayerRemoveItem(cid, 2145, 40) == true) then  
selfSay('Thanks! You Received your EXP 200', cid) 
doPlayerAddItem(cid, 13305, 100)
talkState[talkUser] = 0 
else  
selfSay('You do not have enough diamonds.', cid) 
talkState[talkUser] = 0  
end
end 
return TRUE
end

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