---------------------------------
------- NPC Missão 1.0 ---------
--- by Fox - xtibia.com/forum ---
---------------------------------
--------------
--- Config ---
--------------
-- item necessário para fazer a busca
local i_required = 2349
-- contagem de item necessário para fazer a busca
local i_required_count = 1
-- recompensa padrão id item (christmas token)
local i_reward = 6527
-- contagem de recompensa id padrão (10)
local i_reward_count = 10
-- --
local storage = 60307
-- --
local questname = "fox quest"
-- NPC Messages --
local npc_message ={
"I need some item to complete this mission, procced?",
"You dont have any items to this mission.",
"Thank You for Help me, {take it.}",
"You have Already done this {mission}.",
"The Mission {"..questname.."} is, really serius, i need your help to complete it, if you help me i can give some items to you?"
}
-------------------
--- End Confing ---
-------------------
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
if(msgcontains(msg, 'blue note')) then
selfSay(npc_message[5], cid)
end
if(msgcontains(msg, questname)) then
selfSay(npc_message[1], cid)
talkState[talkUser] = 1
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
if (getPlayerStorageValue(cid,storage) > 0) then
selfSay(npc_message[4], cid)
else
if(doPlayerRemoveItem(cid,i_required,i_required_count)) then
setPlayerStorageValue(cid,storage,1)
doPlayerAddItem(cid,i_reward,i_reward_count)
selfSay(npc_message[3], cid)
doSendMagicEffect(getCreaturePosition(cid), 10)
doCreatureSay(cid, "Congratulations!", TALKTYPE_ORANGE_1)
else
selfSay(npc_message[2], cid)
end
end
return true
end
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())