Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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
- local moeda = 9020
- local msg = string.lower(msg)
- local t = {
- ["boots of haste"] = {15, 2195},
- ["demon helmet"] = {25, 2493},
- ["frozen starlight"] = {30, 2361},
- ["royal crossbow"] = {20, 8851},
- ["solar axe"] = {30, 8925},
- ["soft boots"] = {50, 2640},
- ["demon armor"] = {100, 2494},
- ["firewalker boots"] = {50, 9932},
- ["magic plate armor"] = {70, 2472},
- ["flame blade"] = {100, 8931}
- }
- local player = Player(cid)
- if msgcontains(msg, 'trade') then
- local str = ""
- str = str .. "Eu vendo estes items: "
- for name, pos in pairs(t) do
- str = str.." {"..name.."} = "..pos[1].." Moedas /"
- end
- str = str .. "."
- npcHandler:say(str, cid)
- elseif t[msg] then
- if player:removeItem(moeda, t[msg][1]) then
- player:addItem(t[msg][2], 1)
- npcHandler:say("Aqui está seu ".. ItemType(t[msg][2]):getName() .."!", cid)
- else
- npcHandler:say("Você não tem "..t[msg][1].." ".. ItemType(moeda):getName(), cid)
- end
- end
- return true
- end
- npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
- npcHandler:addModule(FocusModule:new())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement