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
if msgcontains(msg, 'specialised') or msgcontains(msg, 'recover') then
selfSay('Yes, my fathers was a great blacksmith. When i was just a child he taught me how to mend boots. Did you bring me some boots? Which ones?')
elseif msgcontains(msg, 'fire walker boots') then
selfSay('give me sb and 100cc')
talk_state = 1
elseif msgcontains(msg, 'yes') and talk_state == 1 then
if getPlayerItemCount(cid,6132) >= 1 and getPlayerItemCount(cid,2160) >= 100 then
if doPlayerTakeItem(cid,6530,1) == 0 and doPlayerTakeItem(cid,2160,50) == 0 then
selfSay('Wear them well my friend.')
doPlayerAddItem(cid,[COLOR="Red"]PUTIDOFBOOTSHERE[/COLOR],1)
end
else
selfSay('Well that is to bad.')
end
elseif msgcontains(msg, 'no') and (talk_state >= 1 and talk_state <= 2) then
selfSay('I may starve because of you!')
talk_state = 0
end
-- 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.
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())