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
local function Cptl(f, r)
return f:upper()..r:lower()
end
function creatureSayCallback(cid, type, msg)
local player, cmsg = Player(cid), msg:gsub("(%a)([%w_']*)", Cptl)
if not npcHandler:isFocused(cid) then
if msg == "bring me to jungle" then -- here use your own formula
npcHandler:addFocus(cid)
local jngl = {x=306, y=34, z=7} -- set proper location coords and name
local playerpos = player:getPosition()
if (doPlayerRemoveMoney(cid, 320) == TRUE) then -- set instant travel cost
doTeleportThing(cid,jngl) -- change 'jngl' name if needed
doSendMagicEffect(playerpos,3)
doSendMagicEffect(jngl,11) -- change 'jngl' name if needed
else
selfSay('Not enough gold.')
npcHandler:releaseFocus(cid)
end
elseif msg == "bring me to loren" then
npcHandler:addFocus(cid)
local lor = {x=15, y=454, z=7}
local playerpos = player:getPosition()
if (doPlayerRemoveMoney(cid, 260) == TRUE) then
doTeleportThing(cid,lor)
doSendMagicEffect(playerpos,3)
doSendMagicEffect(lor,11)
else
selfSay('Not enough gold.')
npcHandler:releaseFocus(cid)
end
end
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())