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 ="Arceus"
local pokemon2 = "Mega Mewtwo"
-- Conversa Jogador/NPC  
if(msgcontains(msg, 'offer') or msgcontains(msg, 'Offer')) then
selfSay('I sell Super box, Special box +1, +2, +3, +4 e +5, arceus e hydra stone.', cid) 
elseif(msgcontains(msg, 'super') or msgcontains(msg, 'Super')) then
selfSay('the Super Box (Lugia, Ho-oh) costs 30 Black Diamonds, you really want this?', cid) 
talkState[talkUser] = 2
elseif(msgcontains(msg, 'special') or msgcontains(msg, 'Special')) then
selfSay('the Special Box 1 (Sh. Lucario, Sh. Magmortar, Sh. Electivire) costs 20 Black Diamonds, you really want this?', cid) 
talkState[talkUser] = 3
elseif(msgcontains(msg, 'hydra') or msgcontains(msg, 'Hydra')) then
selfSay('the Hydra Stone (Evolui certos pokemons como: Dialga, Arceus e Tangela) costs 60 Black Diamonds, you really want this?', cid) 
talkState[talkUser] = 4
elseif(msgcontains(msg, 'Special3') or msgcontains(msg, 'special3')) then
selfSay('the Special Box 3 (Xerneas, Hydreigon, Yveltal) costs 45 Black Diamonds, you really want this?', cid) 
talkState[talkUser] = 5
elseif(msgcontains(msg, 'Special4') or msgcontains(msg, 'special4')) then
selfSay('the Special Box 4 (White Kyurem, Black Kyurem, Cresselia) costs 60 Black Diamonds, you really want this?', cid) 
talkState[talkUser] = 6
elseif(msgcontains(msg, 'Special5') or msgcontains(msg, 'special5')) then
selfSay('the Special Box 5 (Supreme Blastoise, Supreme Charizard) costs 85 Black Diamonds, you really want this?', cid) 
talkState[talkUser] = 7
 elseif(msgcontains(msg, 'Arceus') or msgcontains(msg, 'arceus')) then
selfSay('the Arceus (Arceus) costs 150 Black Diamonds, you really want this?', cid) 
talkState[talkUser] = 8

 local btype = "normal"
local pokemon1 ="Arceus"
local pokemon2 = "Mega Mewtwo"
-- Confirmação da Compra  
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then  
if(doPlayerRemoveItem(cid, 12237, 25) == true) then  
selfSay('Thanks! You Received your Parchment', cid) 
doPlayerAddItem(cid, 13204, 1)
talkState[talkUser] = 0 
else  
selfSay('You do not have enough black diamonds.', cid) 
talkState[talkUser] = 0  
end  
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 2) then  
if(doPlayerRemoveItem(cid, 12237, 30) == true) then  
selfSay('Thanks! You Received your Super Box', cid) 
doPlayerAddItem(cid, 13130, 1)
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, 20) == true) then  
selfSay('Thanks! You Received your Special Box', cid) 
doPlayerAddItem(cid, 13173, 1)
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, 60) == true) then  
selfSay('Thanks! You Received your Hydra Stone', cid) 
doPlayerAddItem(cid, 12415, 1)
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, 45) == true) then  
selfSay('Thanks! You Received your Special box +3', cid) 
doPlayerAddItem(cid, 13175, 1)
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, 60) == true) then  
selfSay('Thanks! You Received your Special box +4', cid) 
doPlayerAddItem(cid, 13176, 1)
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, 85) == true) then  
selfSay('Thanks! You Received your Special box +5', cid) 
doPlayerAddItem(cid, 13177, 1)
talkState[talkUser] = 0 
else  
selfSay('You do not have enough black diamonds.', cid) 
talkState[talkUser] = 0  
end
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 8) then  
if(doPlayerRemoveItem(cid, 12237, 150) == true) then  
selfSay('Thanks! You Received your Arceus.', cid) 
addPokeToPlayer(cid, pokemon1, 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())