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) end
function onThink() npcHandler:onThink() end
local storage = 54764
local function creatureSayCallback(cid, type, msg)
if not npcHandler:isFocused(cid) then
return false
end
local player = Player(cid)
if msgcontains(msg, "adventure") then
if player:getStorageValue(storage) == -1 then
npcHandler:say("Do you want some kind of adventure and get 6400 exp?", cid)
npcHandler.topic[cid] = 1
else
npcHandler:say("You already had it.", cid)
end
elseif msgcontains(msg, "yes") and npcHandler.topic[cid] == 1 then
npcHandler:say("Here you are.", cid)
player:setStorageValue(storage, 1)
player:addExperience(6400)
npcHandler.topic[cid] = 0
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())