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 onPlayerEndTrade(cid) npcHandler:onPlayerEndTrade(cid) end
function onPlayerCloseChannel(cid) npcHandler:onPlayerCloseChannel(cid) end
function creatureSayCallback(cid, type, msg)
if (not npcHandler:isFocused(cid)) then
return false
end
local t = {
[1] = {town = "Thais", storage = 1000, pos = {x = 1000, y = 1000, z = 7}},
[2] = {town = "Carlin", storage = 1000, pos = {x = 1000, y = 1000, z = 7}},
[3] = {town = "Venore", storage = 1000, pos = {x = 1000, y = 1000, z = 7}},
[4] = {town = "Edron", storage = 1000, pos = {x = 1000, y = 1000, z = 7}}
}
if msgcontains(msg, 'information') then
npcHandler:say('I can fast travel you to any place you have visited before! Such as:', cid)
for i = 1, #t do
npcHandler:say('Name: " .. t[i].town .. ".', cid)
end
if msgcontains(msg, ' " .. t[1].town .. "') then
npcHandler:say('Are you sure you want to travel to " .. t[1].town .. "?', cid)
talkState[talkUser] = 2
end
if msgcontains(msg, 'yes') and talkState[talkUser] == 2 then
if getCreatureCondition(cid, CONDITION_INFIGHT) == true then
return npcHandler:say('Talk to me when you are less violent.', cid)
end
if not isPremium(cid) then
return npcHandler:say('This is a premium service!', cid)
end
if getPlayerStorageValue(uid, t[1].storage) == false then
return npcHandler:say('You must visit the areas first!', cid)
end
else
doTeleportThing(cid, t[1].pos)
end
if msgcontains(msg, ' " .. t[2].town .. "') then
npcHandler:say('Are you sure you want to travel to " .. t[2].town .. "?', cid)
talkState[talkUser] = 3
end
if msgcontains(msg, 'yes') and talkState[talkUser] == 3 then
if getCreatureCondition(cid, CONDITION_INFIGHT) == true then
return npcHandler:say('Talk to me when you are less violent.', cid)
end
if not isPremium(cid) then
return npcHandler:say('This is a premium service!', cid)
end
if getPlayerStorageValue(uid, t[2].storage) == false then
return npcHandler:say('You must visit the areas first!', cid)
end
else
doTeleportThing(cid, t[2].pos)
end
if msgcontains(msg, ' " .. t[3].town .. "') then
npcHandler:say('Are you sure you want to travel to " .. t[3].town .. "?', cid)
talkState[talkUser] = 4
end
if msgcontains(msg, 'yes') and talkState[talkUser] == 4 then
if getCreatureCondition(cid, CONDITION_INFIGHT) == true then
return npcHandler:say('Talk to me when you are less violent.', cid)
end
if not isPremium(cid) then
return npcHandler:say('This is a premium service!', cid)
end
if getPlayerStorageValue(uid, t[3].storage) == false then
return npcHandler:say('You must visit the areas first!', cid)
end
else
doTeleportThing(cid, t[3].pos)
end
if msgcontains(msg, ' " .. t[4].town .. "') then
npcHandler:say('Are you sure you want to travel to " .. t[4].town .. "?', cid)
talkState[talkUser] = 5
end
if msgcontains(msg, 'yes') and talkState[talkUser] == 5 then
if getCreatureCondition(cid, CONDITION_INFIGHT) == true then
return npcHandler:say('Talk to me when you are less violent.', cid)
end
if not isPremium(cid) then
return npcHandler:say('This is a premium service!', cid)
end
if getPlayerStorageValue(uid, t[4].storage) == false then
return npcHandler:say('You must visit the areas first!', cid)
end
else
doTeleportThing(cid, t[4].pos)
return true
end
end
npcHandler:addModule(FocusModule:new())