Kaiquegabriel

Untitled

Jul 9th, 2018
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.46 KB | None | 0 0
  1. local keywordHandler = KeywordHandler:new()
  2. local npcHandler = NpcHandler:new(keywordHandler)
  3. NpcSystem.parseParameters(npcHandler)
  4.  
  5. local t = {}
  6.  
  7. function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
  8. function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
  9. function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
  10. function onThink() npcHandler:onThink() end
  11.  
  12. function creatureSayCallback(cid, type, msg)
  13. if not npcHandler:isFocused(cid) then
  14. return false
  15. elseif msgcontains(msg, 'blessing') then
  16. if isPremium(cid) == true then
  17. local v = getPlayerLevel(cid)
  18. if v < 31 then
  19. v = 10000
  20. elseif v > 119 then
  21. v = 120000
  22. else
  23. v = (200 * (v - 30) + 2000) * 5 * 1.0
  24. end
  25. npcHandler:say('Do you want to receive the blessing of the inquisition - which means all five available blessings - for ' .. v .. ' gold?', cid)
  26. t[cid] = 1
  27. if t[cid] == 1 and msgcontains(msg, 'yes') then
  28. if not(getPlayerBlessing(cid, 1) and getPlayerBlessing(cid, 2) and getPlayerBlessing(cid, 3) and getPlayerBlessing(cid, 4) and getPlayerBlessing(cid, 5)) then
  29. local v = getPlayerLevel(cid)
  30. if v < 31 then
  31. v = 11000
  32. elseif v > 119 then
  33. v = 110000
  34. else
  35. v = (200 * (v - 30) + 2000) * 5 * 1.1
  36. end
  37. if doPlayerRemoveMoney(cid, v) then
  38. npcHandler:say('So be it!', cid)
  39. for i = 1, 5 do
  40. doPlayerAddBlessing(cid, i)
  41. end
  42. doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
  43. else
  44. npcHandler:say('You don\'t have enough money.', cid)
  45. end
  46. else
  47. npcHandler:say('You already have all blessings.', cid)
  48. end
  49. t[cid] = 0
  50. end
  51. else
  52. npcHandler:say('Sorry, you need a premium account to get my blessings.', cid) -- MENSAGEM CASO NÃO FOR PREMIUM
  53. end
  54. end
  55. return true
  56. end
  57.  
  58. npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
  59. npcHandler:addModule(FocusModule:new())
Add Comment
Please, Sign In to add comment