local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local Topic = {}
function onCreatureAppear(cid) npcHandler

nCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler

nCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler

nCreatureSay(cid, type, msg) end
function onThink() npcHandler

nThink() end
local red_eggs = 6542 ----- ID OF RED EGG
local yellow_eggs = 6541 ----- ID OF YELLOW EGG
function creatureSayCallback(cid, type, msg)
if (msgcontains(msg, 'eggs') or msgcontains(msg, 'trade')) then
npcHandler:say('Really you change you 50 yellow eggs for me 50 red eggs?', cid)
Topic[cid] = 1
if msgcontains(msg, 'yes') and getPlayerItemCount(cid,yellow_eggs) >= 50 and Topic[cid] == 1 then
npcHandler:say('Okay, here you go!', cid)
doPlayerRemoveItem(cid,yellow_eggs,50)
doPlayerAddItem(cid,red_eggs, 1)
Topic[cid] = 0
else
npcHandler:say('You do not have the required eggs for this trade', cid)
end
elseif msgcontains(msg, 'no') and Topic[cid] == 1 then
npcHandler:say('Then leave', cid)
Topic[cid] = 0
return true
end
end
npcHandler:setCallback(CALLBACK_GREET, greetCallback)
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())