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)
- local t = {}
- 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
- elseif msgcontains(msg, 'blessing') then
- if isPremium(cid) == true then
- local v = getPlayerLevel(cid)
- if v < 31 then
- v = 10000
- elseif v > 119 then
- v = 120000
- else
- v = (200 * (v - 30) + 2000) * 5 * 1.0
- end
- npcHandler:say('Do you want to receive the blessing of the inquisition - which means all five available blessings - for ' .. v .. ' gold?', cid)
- t[cid] = 1
- if t[cid] == 1 and msgcontains(msg, 'yes') then
- if not(getPlayerBlessing(cid, 1) and getPlayerBlessing(cid, 2) and getPlayerBlessing(cid, 3) and getPlayerBlessing(cid, 4) and getPlayerBlessing(cid, 5)) then
- local v = getPlayerLevel(cid)
- if v < 31 then
- v = 11000
- elseif v > 119 then
- v = 110000
- else
- v = (200 * (v - 30) + 2000) * 5 * 1.1
- end
- if doPlayerRemoveMoney(cid, v) then
- npcHandler:say('So be it!', cid)
- for i = 1, 5 do
- doPlayerAddBlessing(cid, i)
- end
- doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
- else
- npcHandler:say('You don\'t have enough money.', cid)
- end
- else
- npcHandler:say('You already have all blessings.', cid)
- end
- t[cid] = 0
- end
- else
- npcHandler:say('Sorry, you need a premium account to get my blessings.', cid) -- MENSAGEM CASO NÃO FOR PREMIUM
- end
- end
- return true
- end
- npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
- npcHandler:addModule(FocusModule:new())
Add Comment
Please, Sign In to add comment