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
local item = 'I\'m sorry, but you do not have the parts of jester doll for trade! <giggles>.'
local done = 'Goodie! Here you are! <giggles>.'
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
if msgcontains(msg, 'jester doll') then
if getPlayerItemCount(cid,9694) >= 1 and getPlayerItemCount(cid,9695) >= 1 and getPlayerItemCount(cid,9696) >= 1 and getPlayerItemCount(cid,9697) >= 1 and getPlayerItemCount(cid,9698) >= 1 then
selfSay('Oh! <giggles> Have you found all six parts of a jester doll and would like to assemble them?', cid)
talk_state = 1
else
selfSay('I\'m sorry, but you do not have the parts of jester doll for trade! <giggles>.', cid)
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 1 then
talk_state = 0
if getPlayerItemCount(cid,9694) >= 1 and getPlayerItemCount(cid,9695) >= 1 and getPlayerItemCount(cid,9696) >= 1 and getPlayerItemCount(cid,9697) >= 1 and getPlayerItemCount(cid,9698) >= 1 then
for i = 1, 4 do
doPlayerRemoveItem(cid, 9694, i)
doPlayerRemoveItem(cid, 9695, i)
doPlayerRemoveItem(cid, 9696, i)
doPlayerRemoveItem(cid, 9697, i)
doPlayerRemoveItem(cid, 9698, i)
end
doPlayerAddItem(cid,9693,1)
selfSay(done, cid)
else
selfSay(item, cid)
end
elseif msgcontains(msg, 'no') and talk_state >= 1 then
selfSay('Well, then leave.')
talk_state = 0
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())