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)
if(not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
if msgcontains(msg, 'mission') then
if getPlayerStorageValue(cid, 581923) == -1 then
npcHandler:say('I Have Many Missions For You... Can You Help Me?', cid)
talkState[talkUser] = 1
elseif getPlayerStorageValue(cid, 581924) == 1 then
npcHandler:say('Argh..You Have My Book?!', cid)
talkState[talkUser] = 2
elseif getPlayerStorageValue(cid, 581924) == 2 then
npcHandler:say('Sorry...But You Have Already Completed All My Missions.', cid)
talkState[talkUser] = 3
end
elseif talkState[talkUser] == 1 then
if msgcontains(msg, 'yes') then
npcHandler:say('Good...Then Delivery This Letter To My Mom In The Main Town Her Name Is Surelia.', cid)
doPlayerAddItem(cid,2333,1)
setPlayerStorageValue(cid,581923,1)
talkState[talkUser] = 2
else
selfSay('You already have the delivery...Come back have them...', cid)
end
elseif talkState[talkUser] == 2 then
if msgcontains(msg, 'yes') then
npcHandler:say('Thanks For The Favor Now you Can Enter To My House.', cid)
if doPlayerRemoveItem(cid,2333,1) == TRUE then
setPlayerStorageValue(cid,581924,2)
setPlayerStorageValue(cid,561836,1)
talkState[talkUser] = 3
else
npcHandler:say('Sorry...but you dont have item. Come back When You have them', cid)
end
end
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())