local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
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)
local leader = "Fool" --getPlayerNameByGUID(getGlobalStorageValue(20002))
if(not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
--------------------MESSAGES------------------------------------------------------------------------------
if msgcontains(msg, 'prison') then
talkState[talkUser] = 1
end
if msgcontains(msg, 'boss') then
talkState[talkUser] = 7
end
----------------------Prison-------------------------------------------------------
if talkState[talkUser] == 1 then
if leader == getCreatureName(cid) then
selfSay('Who would you like to prison?', cid)
talkState[talkUser] = 2
else
selfSay('How dare you giving me the orders? Begone before i call the guards!', cid)
talkState[talkUser] = 0
end
elseif talkState[talkUser] == 2 then
n = msg
if getCreatureByName(n) ~= nil then
if not(isPlayerPzLocked(getCreatureByName(n))) then
if getPlayerGuildId(getCreatureByName(n)) == 8 then
doPlayerSendTextMessage(getCreatureByName(n),22,"you have been imprisoned by " .. leader .. "'s henchman.")
selfSay("It's done, " .. n .. " is behind the bars.", cid)
doPlayerSetTown(getCreatureByName(n),4)
doTeleportThing(getCreatureByName(n), {x = 666, y = 850, z = 5}, true)
talkState[talkUser] = 0
else
selfSay("`But boss, that man aint one of ours! ", cid)
talkState[talkUser] = 0
end
else
selfSay("Ohh, boss, that person has blood on its hands right now. ", cid)
talkState[talkUser] = 0
end
else
selfSay("Sorry boss, can't find that person! ", cid)
talkState[talkUser] = 0
end
elseif talkState[talkUser] == 7 then
selfSay("Yes, " .. leader .. " is my boss.", cid)
end
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())