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
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 config = {
storage = 5321,
fish = 2227,
count = 10
}
if msgcontains(msg, 'misja1') then
if getPlayerStorageValue(cid, config.storage) == -1 then
selfSay('Przynies mi {10 ryb}.', cid)
doPlayerSetStorageValue(cid, config.storage, 0)
elseif getPlayerStorageValue(cid, config.storage) == 0 then
selfSay('Przyniosles mi to {10 ryb}?', cid)
talkState[talkUser] = 1
end
elseif msgcontains(msg, 'misja2') then
if getPlayerStorageValue(cid, config.storage) == 1 then
selfSay('Idz zabij {10 demonow}.', cid)
doPlayerSetStorageValue(cid, config.storage, 2)
elseif getPlayerStorageValue(cid, config.storage) == 2 then
selfSay('Zabiles {10 demonow}?', cid)
talkState[talkUser] = 2
end
elseif msgcontains(msg, 'yes') then
if talkState[talkUser] == 1 then
if doPlayerRemoveItem(cid, config.fish, config.count) then
selfSay('Dzieki bardzo. Mozesz teraz wziac {misja2}.', cid)
doPlayerSetStorageValue(cid, config.storage, 1)
end
elseif talkState[talkUser] == 2 and getPlayerStorageValue(cid, config.storage) == 3 then
selfSay('Gratz.', cid)
doPlayerSetStorageValue(cid, config.storage, 3)
end
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())