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 talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
--[[
REMEMBER TO SET YOUR STORAGE AS YOURSTORAGE!
]]--
local function delay(func, msg, cid)
return isPlayer(cid) and func(msg, cid)
end
local storage = 7423
if(msgcontains(msg, 'hotel') or msgcontains(msg, 'quest') or msgcontains(msg, 'abacus') or msgcontains(msg, 'mission') or msgcontains(msg, 'help')) then
if(getPlayerStorageValue(cid, storage) < 1) then
selfSay("I need you travel to lacost city, and bring me an abacus that Lucius has.", cid)
addEvent(delay, 3000, selfSay, "He is in the Burj al arab Hotel.", cid)
addEvent(delay, 6000, selfSay, "Ohh, give him this note please.", cid)
doPlayerAddItem(cid, 7726, 1)
setPlayerStorageValue(cid, storage, 1)
elseif(getPlayerStorageValue(cid, storage) == 1) then
npcHandler:say("Do you have my abacus?", cid)
talkState[talkUser] = 1
elseif(getPlayerStorageValue(cid, storage) == 2) then
npcHandler:say("Sorry, you have already helped me.", cid)
end
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
if(doPlayerRemoveItem(cid,5798,1) == TRUE) then
npcHandler:say("You saved me,take this item for an addon!!!", cid)
doPlayerAddItem(cid, 6107, 1)
doPlayerAddExperience(cid, 30000)
setPlayerStorageValue(cid, storage, 2)
talkState[talkUser] = 0
else
npcHandler:say("I need my abacus now!!!.", cid)
talkState[talkUser] = 0
end
elseif(msgcontains(msg, 'no') and talkState[talkUser] > 0) then
npcHandler:say("Then not.", cid)
talkState[talkUser] = 0
end
return TRUE
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())