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
local storage,storage1 = 60133,60134
if(msgcontains(msg, 'sam send me') or msgcontains(msg, 'SAM SEND ME')) then
if getPlayerStorageValue(cid,storage) >= 1 and getPlayerStorageValue(cid,storage1) <= 0 then
selfSay('Oh, so its you, he wrote me about? Sadly I have no dwarven armor in stock. But I give you the permission to retrive one from the mines!', cid)
setPlayerStorageValue(cid,storage1, 1)
selfSay('The problem is, some giant spiders made the tunnels where the storage is their new home. Goo!', cid)
talkState[talkUser] = 0
else
selfSay('Are trying to fool me that memories are not all pleasant', cid)
talkState[talkUser] = 0
end
elseif msg == "no" and talkState[talkUser] >= 1 then
selfSay("I you thank, too", cid)
talkState[talkUser] = 0
npcHandler:releaseFocus(cid)
end
return TRUE
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())