local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local t = {}
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
elseif msgcontains(msg, 'mission') and getCreatureStorage(cid, 12256) == 1 then
npcHandler:say('My son was captured by trolls? Doesn\'t sound like him, but if you say so. Now you want a reward, huh?...', cid)
t[cid] = 1
elseif t[cid] == 1 then
if msgcontains(msg, 'yes') then
doCreatureSetStorage(cid, 12256, 2)
npcHandler:say('Look at these dwarven legs. They were forged years ago by a dwarf who was rather tall for our kind. I want you to have them. Thank you for rescuing my son ' .. getCreatureName(cid) .. '.', cid)
doPlayerAddItem(cid, 2504, 1)
else
npcHandler:say('Bye.', cid)
end
t[cid] = nil
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())