Advertisement
Guest User

Untitled

a guest
Nov 17th, 2017
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.00 KB | None | 0 0
  1. -------------------------------------------
  2. -- Script
  3. -------------------------------------------
  4. if player:getExhaustion(exhaustStorage) > 0 then
  5. player:getPosition():sendMagicEffect(CONST_ME_POFF)
  6. player:sendTextMessage(MESSAGE_STATUS_DEFAULT, "You are exhausted." )
  7. return true
  8. end
  9.  
  10. local rune
  11. for k,v in pairs(config) do
  12. if item:getId() == v.itemId then
  13. rune = k
  14. end
  15. end
  16.  
  17. if rune == nil then
  18. print("Rune ID not found in confg")
  19. return true
  20. end
  21.  
  22.  
  23. local settings = config[rune]
  24. local amount = math.random(settings.formulas.min, settings.formulas.max)
  25. local playerVoc = player:getVocation():getId()
  26.  
  27. if rune == "manaRune" then
  28. if table.contains(settings.allowedVocs, playerVoc) then
  29. player:say('+'..amount.."mp", TALKTYPE_MONSTER_SAY)
  30. player:addMana(amount)
  31. player:getPosition():sendMagicEffect(settings.effect)
  32. else
  33. player:getPosition():sendMagicEffect(CONST_ME_POFF)
  34. player:sendTextMessage(MESSAGE_STATUS_DEFAULT, "You cannot use this rune." )
  35. return true
  36. end
  37.  
  38. elseif rune == "healthRune" then
  39. if table.contains(settings.allowedVocs, playerVoc) then
  40. player:say('+'..amount.."hp", TALKTYPE_MONSTER_SAY)
  41. player:addMana(amount)
  42. player:getPosition():sendMagicEffect(settings.effect)
  43. else
  44. player:getPosition():sendMagicEffect(CONST_ME_POFF)
  45. player:sendTextMessage(MESSAGE_STATUS_DEFAULT, "You cannot use this rune." )
  46. return true
  47. end
  48.  
  49. elseif rune == "paladinRune" then
  50. if table.contains(settings.allowedVocs, playerVoc) then
  51. player:say('+'..amount.."mp", TALKTYPE_MONSTER_SAY)
  52. player:say('+'..amount.."hp", TALKTYPE_MONSTER_SAY)
  53. player:addMana(amount)
  54. player:addHealth(amount)
  55. player:getPosition():sendMagicEffect(settings.effect)
  56. else
  57. player:getPosition():sendMagicEffect(CONST_ME_POFF)
  58. player:sendTextMessage(MESSAGE_STATUS_DEFAULT, "You cannot use this rune." )
  59. return true
  60. end
  61. end
  62.  
  63. player:setExhaustion(exhaustStorage, settings.cooldown)
  64. return true
  65. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement