local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
-- OTServ event handling functions start
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
-- OTServ event handling functions end
function creatureSayCallback(cid, type, msg)
-- Place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not have to take care of that yourself.
if(npcHandler.focus ~= cid) then
return false
end
local PostmanStorage = XXXX -- change this to the storage you want for the quest
if msgcontains(msg, 'sniff banana skin') then
if getPlayerItemCount(cid,2219) >= 1 then
npcHandler:say('<sniff><sniff>', cid)
talk_state = 1
elseif msgcontains(msg, 'do you like that?') and talk_state == 1 then
npcHandler:say('Woof!', cid)
talk_state = 1
elseif msgcontains(msg, 'sniff dirty fur') then
if getPlayerItemCoutn(cid,2220) >= 1 then
npcHandler:say('<sniff><sniff>', cid)
talk_state = 2
elseif msgcontains(msg, 'do you like that?') and talk_state == 2 then
npcHandler:say('Woof!', cid)
talk_state = 2
elseif msgcontains(msg, 'sniff moldy cheese') then
if getPlayerItemCount(cid,2235) >= 1 then
npcHandler:say('Woof!', cid)
talk_state = 3
elseif msgcontains(msg, 'do you like that?') and talk_state == 3 then
npcHandler:say('Meeep! Grrrrr! <spits>', cid)
setPlayerStorageValue(cid, PostmanStorage,1)
talk_state = 3
end
return true
end
end
end
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())