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
local rnd_sounds = 0
function onThink()
if(rnd_sounds < os.time()) then
rnd_sounds = (os.time() + 5)
if(math.random(100) < 25) then
Npc():say("Feel the wind in your hair during one of my carpet rides!", TALKTYPE_SAY)
end
end
npcHandler:onThink()
end
keywordHandler:addKeyword({'name'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I am known as Uzon Ibn Kalith."})
keywordHandler:addKeyword({'passage'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "You'll have to leave this unholy place first!"})
keywordHandler:addKeyword({'transport'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "You'll have to leave this unholy place first!"})
keywordHandler:addKeyword({'ride'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "You'll have to leave this unholy place first!"})
keywordHandler:addKeyword({'trip'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "You'll have to leave this unholy place first!"})
local function creatureSayCallback(cid, type, msg)
local player = Player(cid)
if(not npcHandler:isFocused(cid)) then
return false
end
if isInArray({"back", "leave", "passage"}, msg) then
npcHandler:say('Do you really want to leave this unholy place?', cid)
npcHandler.topic[cid] = 1
elseif(msgcontains(msg, "yes")) then
if(npcHandler.topic[cid] == 1) then
player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
player:teleportTo({x = 32535, y = 31837, z = 4}, false)
player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
npcHandler:say('So be it!', cid)
npcHandler.topic[cid] = 0
end
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:setMessage(MESSAGE_GREET, "Daraman's blessings, traveller |PLAYERNAME|.")
npcHandler:setMessage(MESSAGE_FAREWELL, "Daraman's blessings")
npcHandler:setMessage(MESSAGE_WALKAWAY, "Daraman's blessings")
npcHandler:addModule(FocusModule:new())