local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local Topic = {}
local storage = 35000
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 greetCallback(cid)
Topic[cid] = 0
return true
end
function creatureSayCallback(cid, type, msg)
if not npcHandler:isFocused(cid) then
return false
elseif (msgcontains(msg, 'quest') or msgcontains(msg, 'mission')) and getPlayerStorageValue(cid, storage) == -1 then
npcHandler:say('Do you want to join the mission?', cid)
Topic[cid] = 1
elseif msgcontains(msg, 'yes') and Topic[cid] == 1 then
npcHandler:say('Ask me for a {mission}, and after you completed it you can make the xxx quest!.', cid)
setPlayerStorageValue(cid, storage, 1)
else
npcHandler:say('Okay, as you want!', cid)
end
Topic[cid] = 0
elseif msgcontains(msg, 'mission') then
local v = getPlayerStorageValue(cid, storage)
if v == 1 then -- Start Mission 1
npcHandler:say('Let\'s see if you are worthy. Bring me 10 demon shields', cid)
setPlayerStorageValue(cid, storage, 2)
Topic[cid] = 0
elseif v == 2 then
npcHandler:say("Your current mission is to bring 10 demon shields, are you done with that mission?", cid)
Topic[cid] = 2
end
elseif Topic[cid] == 2 then -- Finish mission 1
if msgcontains(msg, 'yes') then
if doPlayerRemoveItem(cid,2520,10) then
npcHandler:say('You have been very brave! You now can go to xxxx quest!', cid)
setPlayerStorageValue(cid, storage, 3)
else
npcHandler:say("Continue your mission and return to me after you're done.", cid)
end
else
npcHandler:say("You better don't return here until you've finished your mission.", cid)
end
Topic[cid] = 0
end
return true
end
npcHandler:setMessage(MESSAGE_GREET, "Greetings, fellow believer |PLAYERNAME|!")
npcHandler:setMessage(MESSAGE_FAREWELL, "Always be on guard, |PLAYERNAME|!")
npcHandler:setMessage(MESSAGE_WALKAWAY, "This ungraceful haste is most suspicious!")
npcHandler:setCallback(CALLBACK_GREET, greetCallback)
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())