local smallcity = {x=107, y=200, z=7}
local namekisland = {x=461, y=447, z=5}
local bigcity = {x=117, y=102, z=7}
local icecity = {x=315, y=179, z=7}
local frozencity = {x=477, y=643, z=7}
local westisland = {x=83, y=39, z=7}
local eastisland = {x=111, y=39, z=7}
local brokencity = {x=99, y=343, z=7}
local assassintower = {x=254, y=393, z=7}
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:lower()) end
function onThink() npcHandler:onThink() end
local talkState = {}
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
if msgcontains(msg, "travel") then
selfSay("Eu posso te levar para {Small City}, {Namek Island}, {Big City}, {Ice City}, {Frozen City}, {West Island}, {East Island}, {Broken City}, {Assassin Tower} e {Castle War}.", cid)
end
if msgcontains(msg, "small city") then
if not isPlayerPzLocked(cid) then
doSendMagicEffect(getThingPos(cid), 10)
npcHandler:releaseFocus(cid)
doTeleportThing(cid, smallcity)
doSendMagicEffect(smallcity, 10)
else
selfSay("Voce deve estar sem pz locked!", cid)
end
talkState[talkUser] = 0
end
if msgcontains(msg, "namek island") then
if not isPlayerPzLocked(cid) then
doSendMagicEffect(getThingPos(cid), 10)
npcHandler:releaseFocus(cid)
doTeleportThing(cid, namekisland)
doSendMagicEffect(namekisland, 10)
else
selfSay("Voce deve estar sem pz locked!", cid)
end
talkState[talkUser] = 0
end
if msgcontains(msg, "big city") then
if not isPlayerPzLocked(cid) then
doSendMagicEffect(getThingPos(cid), 10)
npcHandler:releaseFocus(cid)
doTeleportThing(cid, bigcity)
doSendMagicEffect(bigcity, 10)
else
selfSay("Voce deve estar sem pz locked!", cid)
end
talkState[talkUser] = 0
end
if msgcontains(msg, "ice city") then
if not isPlayerPzLocked(cid) then
doSendMagicEffect(getThingPos(cid), 10)
npcHandler:releaseFocus(cid)
doTeleportThing(cid, icecity)
doSendMagicEffect(icecity, 10)
else
selfSay("Voce deve estar sem pz locked!", cid)
end
talkState[talkUser] = 0
end
if msgcontains(msg, "frozen city") then
if not isPlayerPzLocked(cid) then
doSendMagicEffect(getThingPos(cid), 10)
npcHandler:releaseFocus(cid)
doTeleportThing(cid, frozencity)
doSendMagicEffect(frozencity, 10)
else
selfSay("Voce deve estar sem pz locked!", cid)
end
talkState[talkUser] = 0
end
if msgcontains(msg, "west island") then
if not isPlayerPzLocked(cid) then
doSendMagicEffect(getThingPos(cid), 10)
npcHandler:releaseFocus(cid)
doTeleportThing(cid, westisland)
doSendMagicEffect(westisland, 10)
else
selfSay("Voce deve estar sem pz locked!", cid)
end
talkState[talkUser] = 0
end
if msgcontains(msg, "east island") then
if not isPlayerPzLocked(cid) then
doSendMagicEffect(getThingPos(cid), 10)
npcHandler:releaseFocus(cid)
doTeleportThing(cid, eastisland)
doSendMagicEffect(eastisland, 10)
else
selfSay("Voce deve estar sem pz locked!", cid)
end
talkState[talkUser] = 0
end
if msgcontains(msg, "broken city") then
if not isPlayerPzLocked(cid) then
doSendMagicEffect(getThingPos(cid), 10)
npcHandler:releaseFocus(cid)
doTeleportThing(cid, brokencity)
doSendMagicEffect(brokencity, 10)
else
selfSay("Voce deve estar sem pz locked!", cid)
end
talkState[talkUser] = 0
end
if msgcontains(msg, "assassin tower") then
if not isPlayerPzLocked(cid) then
doSendMagicEffect(getThingPos(cid), 10)
npcHandler:releaseFocus(cid)
doTeleportThing(cid, assassintower)
doSendMagicEffect(assassintower, 10)
else
selfSay("Voce deve estar sem pz locked!", cid)
end
talkState[talkUser] = 0
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())