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
-- Storage IDs --
local citizen = 22001
local newaddon = 'Here you are, enjoy your brand new addon!'
local noitems = 'You do not have all the required items.'
local noitems2 = 'You do not have all the required items or you do not have the first addon, which by the way, is a requirement for this addon.'
local already = 'It seems you already have this addon, don\'t you try to mock me son!'
-- CITIZEN START --
function CitizenFirst(cid, message, keywords, parameters, node)
if(not npcHandler:isFocused(cid)) then
return false
end
if isPremium(cid) then
addon = getPlayerStorageValue(cid,citizen)
if addon == -1 then
if getPlayerItemCount(cid,5878) >= 100 then
if doPlayerRemoveItem(cid,5878,100) then
selfSay(newaddon)
doSendMagicEffect(getCreaturePosition(cid), 13)
doPlayerAddOutfit(cid, 128, 1)
doPlayerAddOutfit(cid, 136, 1)
setPlayerStorageValue(cid,citizen,1)
end
else
selfSay(noitems)
end
else
selfSay(already)
end
end
end
function CitizenSecond(cid, message, keywords, parameters, node)
if(not npcHandler:isFocused(cid)) then
return false
end
if isPremium(cid) then
addon = getPlayerStorageValue(cid,citizen+1)
if addon == -1 then
if getPlayerItemCount(cid,5890) >= 100 and getPlayerItemCount(cid,5902) >= 50 and getPlayerItemCount(cid,2480) >= 1 then
if doPlayerRemoveItem(cid,5890,100) and doPlayerRemoveItem(cid,5902,50) and doPlayerRemoveItem(cid,2480,1) then
selfSay(newaddon)
doSendMagicEffect(getCreaturePosition(cid), 13)
doPlayerAddOutfit(cid, 128, 2)
doPlayerAddOutfit(cid, 136, 2)
setPlayerStorageValue(cid,citizen+1,1)
end
else
selfSay(noitems)
end
else
selfSay(already)
end
end
end
keywordHandler:addKeyword({'addons'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I can offer you first & second addons of the Citizen outfit."})
keywordHandler:addKeyword({'help'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "What you do is that you type 'first citizen addon' or 'second citizen addon'. Assuming that you already collected all the required pieces, say 'yes' and voíla - you got yourself an addon!"})
local node1 = keywordHandler:addKeyword({'first citizen addon'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'To achieve the first citizen addon you need to give me 100 minotaur leathers. Do you have them with you?'})
node1:addChildKeyword({'yes'}, CitizenFirst, {npcHandler = npcHandler, onlyFocus = true, reset = true})
node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got all neccessary items.', reset = true})
local node2 = keywordHandler:addKeyword({'second citizen addon'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'To achieve the first citizen addon you need to give me 100 chicken feathers, 50 honeycombs and a legion helmet. Do you have them with you?'})
node2:addChildKeyword({'yes'}, CitizenSecond, {npcHandler = npcHandler, onlyFocus = true, reset = true})
node2:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got all neccessary items.', reset = true})
npcHandler:addModule(FocusModule:new())