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 creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
if msgcontains(msg, 'items') then
selfSay('Eu vendo {knight set}, {paladin set}, {mage set}, também vendo {crimson sword}, {spiked squelcher}, {glorious axe}, {blessed sceptre} e {queen sceptre}', cid)
elseif msgcontains(msg, 'knight set') then
if getPlayerItemCount(cid,2157) >= 20 then
selfSay('você tem 20 gold nugget?', cid)
talk_state = 1
else
selfSay('você precisa de 20 gold nugget para comprar esse set.', cid)
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 1 then
talk_state = 0
if getPlayerItemCount(cid,2157) >= 20 then
if doPlayerRemoveItem(cid,2157, 20) == TRUE then
selfSay(done, cid)
doPlayerAddItem(cid, 2501, 1)
doPlayerAddItem(cid, 2503, 1)
doPlayerAddItem(cid, 2404, 1)
doPlayerAddItem(cid, 9933, 1)
doPlayerAddItem(cid, 2524, 1)
end
else
selfSay(item, cid)
end
elseif msgcontains(msg, 'paladin set') then
if getPlayerItemCount(cid,2157) >= 20 then
selfSay('você tem 20 gold nugget?', cid)
talk_state = 1
else
selfSay('você precisa de 20 gold nugget para comprar esse set.', cid)
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 1 then
talk_state = 0
if getPlayerItemCount(cid,2157) >= 20 then
if doPlayerRemoveItem(cid,2157, 20) == TRUE then
selfSay(done, cid)
doPlayerAddItem(cid, 7885, 1)
doPlayerAddItem(cid, 7884, 1)
doPlayerAddItem(cid, 7886, 1)
doPlayerAddItem(cid, 7903, 1)
end
else
selfSay(item, cid)
end
elseif msgcontains(msg, 'mage set') then
if getPlayerItemCount(cid,2157) >= 20 then
selfSay('você tem 20 gold nugget?', cid)
talk_state = 1
else
selfSay('você precisa de 20 gold nugget para comprar esse set.', cid)
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 1 then
talk_state = 0
if getPlayerItemCount(cid,2157) >= 20 then
if doPlayerRemoveItem(cid,2157, 20) == TRUE then
selfSay(done, cid)
doPlayerAddItem(cid, 7902, 1)
doPlayerAddItem(cid, 7897, 1)
doPlayerAddItem(cid, 7896, 1)
doPlayerAddItem(cid, 7892, 1)
doPlayerAddItem(cid, 8900, 1)
end
else
selfSay(item, cid)
end
elseif msgcontains(msg, 'crimson sword') then
if getPlayerItemCount(cid,2157) >= 10 then
selfSay('você tem 20 gold nugget?', cid)
talk_state = 1
else
selfSay('você precisa de 10 gold nugget para comprar essa sword.', cid)
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 1 then
talk_state = 0
if getPlayerItemCount(cid,2157) >= 10 then
if doPlayerRemoveItem(cid,2157, 10) == TRUE then
selfSay(done, cid)
doPlayerAddItem(cid, 7385, 1)
end
else
selfSay(item, cid)
end
elseif msgcontains(msg, 'spiked squelcher') then
if getPlayerItemCount(cid,2157) >= 10 then
selfSay('você tem 20 gold nugget?', cid)
talk_state = 1
else
selfSay('você precisa de 10 gold nugget para comprar esse club.', cid)
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 1 then
talk_state = 0
if getPlayerItemCount(cid,2157) >= 10 then
if doPlayerRemoveItem(cid,2157, 10) == TRUE then
selfSay(done, cid)
doPlayerAddItem(cid, 7452, 1)
end
else
selfSay(item, cid)
end
elseif msgcontains(msg, 'glorious axe') then
if getPlayerItemCount(cid,2157) >= 10 then
selfSay('você tem 20 gold nugget?', cid)
talk_state = 1
else
selfSay('você precisa de 10 gold nugget para comprar esse axe.', cid)
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 1 then
talk_state = 0
if getPlayerItemCount(cid,2157) >= 10 then
if doPlayerRemoveItem(cid,2157, 10) == TRUE then
selfSay(done, cid)
doPlayerAddItem(cid, 7454, 1)
end
else
selfSay(item, cid)
end
elseif msgcontains(msg, 'blessed sceptre') then
if getPlayerItemCount(cid,2157) >= 10 then
selfSay('você tem 20 gold nugget?', cid)
talk_state = 1
else
selfSay('você precisa de 10 gold nugget para comprar essa wand/rod.', cid)
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 1 then
talk_state = 0
if getPlayerItemCount(cid,2157) >= 10 then
if doPlayerRemoveItem(cid,2157, 10) == TRUE then
selfSay(done, cid)
doPlayerAddItem(cid, 7429, 1)
end
else
selfSay(item, cid)
end
elseif msgcontains(msg, 'queen sceptre') then
if getPlayerItemCount(cid,2157) >= 10 then
selfSay('você tem 20 gold nugget?', cid)
talk_state = 1
else
selfSay('você precisa de 10 gold nugget para comprar essa wand/rod.', cid)
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 1 then
talk_state = 0
if getPlayerItemCount(cid,2157) >= 10 then
if doPlayerRemoveItem(cid,2157, 10) == TRUE then
selfSay(done, cid)
doPlayerAddItem(cid, 7410, 1)
end
else
selfSay(item, cid)
end
elseif msgcontains(msg, 'no') and (talk_state >= 1 and talk_state <= 5) then
selfSay('Ok than.')
talk_state = 0
end
-- Place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not have to take care of that yourself.
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())