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
function AncientHelmet(cid, message, keywords, parameters, node)
if(not npcHandler:isFocused(cid)) then
return false
end
if getPlayerItemCount(cid,2335) >= 1 and getPlayerItemCount(cid,2336) >= 1 and getPlayerItemCount(cid,2337) >= 1 and getPlayerItemCount(cid,2338) >= 1 and getPlayerItemCount(cid,2339) >= 1 and getPlayerItemCount(cid,2340) >= 1 and getPlayerItemCount(cid,2341) >= 1 then
if doPlayerRemoveItem(cid,2335,1) and doPlayerRemoveItem(cid,2336,1) and doPlayerRemoveItem(cid,2337,1) and doPlayerRemoveItem(cid,2338,1) and doPlayerRemoveItem(cid,2339,1) and doPlayerRemoveItem(cid,2340,1) and doPlayerRemoveItem(cid,2341,1) then
npcHandler:say('Here is your helmet of the ancients!', cid)
doPlayerAddItem(cid,2342,1)
end
else
npcHandler:say('You don\'t have these items!', cid)
end
end
keywordHandler:addKeyword({'help'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I can change 7 pieces of damaged helmet for a helmet of the ancients."})
local node1 = keywordHandler:addKeyword({'helmet of the ancients'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to trade 7 pieces of damaged helmet for a helmet of the ancients?'})
node1:addChildKeyword({'yes'}, AncientHelmet, {npcHandler = npcHandler, onlyFocus = true, reset = true})
node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got the neccessary items.', reset = true})
npcHandler:addModule(FocusModule:new())