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
function onGreet(cid)
if(msgcontains(msg, "hi")) then
if(getPlayerStorageValue(cid, 8791) == -1) then
npcHandler:say("I need to ask you a {favor}.")
else
npcHandler:say("You've already got the talons?")
talkState[talkUser] = 2
return TRUE
end
end
end
function msgCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
if(msgcontains(msg, 'favor')) then
npcHandler:say("I need you to pick 10 talons for me. You can do it?")
talkState[talkUser] = 1
end
if(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
npcHandler:say("Oh... Thanks a lot. Just be sure you come with the talons ok? {bye}")
setPlayerStorageValue(cid, 8791, 1)
elseif(msgcontains(msg, 'no') and talkState[talkUser] == 1) then
npcHandles:say("Come other time, when you're ready. Don't mess with me.")
talkState[talkUser] == 2)
end
end
if(msgcontains(msg, 'yes') or (msgcontains(msg, 'talons') and talkState[talkUser] == 2) then
if getPlayerItemCount(cid, 2151) >= 5 then
setPlayerStorageValue(cid, 8791, 2)
doPlayerRemoveItem(cid, 2151, 5)
npcHandler:say("Thanks |PLAYERNAME|, you can take this, i'll not need it anymore.)
doPlayerAddExp(cid, 50000)
if getPlayerSkillLevel(cid, 2) > 30 then
doPlayerAddItem(uid, 7429)
elseif getPlayerSkillLevel(cid, 3) > 30 then
doPlayerAddItem(uid, 7418)
elseif getPlayerSkillLevel(cid, 4) > 30 then
doPlayerAddItem(uid, 2454)
else
doPlayerAddItem(uid, 2160)
end
else
npcHandler:say("I told you! Dont mess with me!)
DoPlayerAddHealth(cid, -200)
end
end
if(msgcontains(msg, 'no') and talkState[talkUser] == 2) then
npcHandler:say("So come back when you have talons with you.")
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:setCallback(CALLBACK_GREET, onGreet)
npcHandler:addModule(FocusModule:new())
end