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
function creatureSayCallback(cid, type, msg)
if(npcHandler.focus ~= cid) then
return false
end
if msgcontains(msg,'travel') then
if getPlayerLevel(cid) > 0 then
selfSay('I can travel you to {Yalahar} and {Vengoth}.')
else
selfSay('Sorry, you need level 1 or higher to travel with me.')
end
end
return 1
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
local node1 = keywordHandler:addKeyword({'Yalahar'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you like travel to yalahar for 50 gold coins?'})
node1:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, price = 50, level = 10})
node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Then not.', reset = true})
local node2 = keywordHandler:addKeyword({'Vengoth'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you like travel to vengoth for 100 gold coins?'})
node2:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, price = 100, level = 10})
node2:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Then not.', reset = true})
npcHandler:addModule(FocusModule:new())