Advertisement
Guest User

Untitled

a guest
Apr 19th, 2020
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.44 KB | None | 0 0
  1. local ultimateHealthPot = 8473
  2. local greatHealthPot = 7591
  3. local greatManaPot = 7590
  4. local greatSpiritPot = 8472
  5. local strongHealthPot = 7588
  6. local strongManaPot = 7589
  7. local healthPot = 7618
  8. local manaPot = 7620
  9. local smallHealthPot = 8704
  10. local antidotePot = 8474
  11. local greatEmptyPot = 7635
  12. local strongEmptyPot = 7634
  13. local emptyPot = 7636
  14.  
  15. local antidote = Combat()
  16. antidote:setParameter(COMBAT_PARAM_TYPE, COMBAT_HEALING)
  17. antidote:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
  18. antidote:setParameter(COMBAT_PARAM_TARGETCASTERORTOPMOST, true)
  19. antidote:setParameter(COMBAT_PARAM_AGGRESSIVE, false)
  20. antidote:setParameter(COMBAT_PARAM_DISPEL, CONDITION_POISON)
  21.  
  22. local exhaust = Condition(CONDITION_EXHAUST_HEAL)
  23. exhaust:setParameter(CONDITION_PARAM_TICKS, (configManager.getNumber(configKeys.EX_ACTIONS_DELAY_INTERVAL) - 100))
  24. -- 1000 - 100 due to exact condition timing. -100 doesn't hurt us, and players don't have reminding ~50ms exhaustion.
  25.  
  26. function onUse(player, item, fromPosition, target, toPosition, isHotkey)
  27. if target == nil or not target:isPlayer() then
  28. return true
  29. end
  30.  
  31. if player:getCondition(CONDITION_EXHAUST_HEAL) then
  32. player:sendTextMessage(MESSAGE_STATUS_SMALL, Game.getReturnMessage(RETURNVALUE_YOUAREEXHAUSTED))
  33. return true
  34. end
  35.  
  36. local itemId = item:getId()
  37. if itemId == antidotePot then
  38. if not antidote:execute(target, numberToVariant(target:getId())) then
  39. return false
  40. end
  41.  
  42. player:addCondition(exhaust)
  43. target:say("Aaaah...", TALKTYPE_MONSTER_SAY)
  44.  
  45.  
  46. elseif itemId == smallHealthPot then
  47. if not doTargetCombatHealth(0, target, COMBAT_HEALING, 60, 90, CONST_ME_MAGIC_BLUE) then
  48. return false
  49. end
  50.  
  51. player:addCondition(exhaust)
  52. target:say("Aaaah...", TALKTYPE_MONSTER_SAY)
  53.  
  54.  
  55. elseif itemId == healthPot then
  56. if not doTargetCombatHealth(0, target, COMBAT_HEALING, 125, 175, CONST_ME_MAGIC_BLUE) then
  57. return false
  58. end
  59.  
  60. player:addCondition(exhaust)
  61. target:say("Aaaah...", TALKTYPE_MONSTER_SAY)
  62.  
  63.  
  64. elseif itemId == manaPot then
  65. if not doTargetCombatMana(0, target, 75, 125, CONST_ME_MAGIC_BLUE) then
  66. return false
  67. end
  68.  
  69. player:addCondition(exhaust)
  70. target:say("Aaaah...", TALKTYPE_MONSTER_SAY)
  71.  
  72.  
  73. elseif itemId == strongHealthPot then
  74. if (not isInArray({3, 4, 7, 8}, target:getVocation():getId()) or target:getLevel() < 50) and not getPlayerFlagValue(player, PlayerFlag_IgnoreSpellCheck) then
  75. player:say("This potion can only be consumed by paladins and knights of level 50 or higher.", TALKTYPE_MONSTER_SAY)
  76. return true
  77. end
  78.  
  79. if not doTargetCombatHealth(0, target, COMBAT_HEALING, 250, 350, CONST_ME_MAGIC_BLUE) then
  80. return false
  81. end
  82.  
  83. player:addCondition(exhaust)
  84. target:say("Aaaah...", TALKTYPE_MONSTER_SAY)
  85.  
  86.  
  87. elseif itemId == strongManaPot then
  88. if (not isInArray({1, 2, 3, 5, 6, 7}, target:getVocation():getId()) or target:getLevel() < 50) and not getPlayerFlagValue(player, PlayerFlag_IgnoreSpellCheck) then
  89. player:say("This potion can only be consumed by sorcerers, druids and paladins of level 50 or higher.", TALKTYPE_MONSTER_SAY)
  90. return true
  91. end
  92.  
  93. if not doTargetCombatMana(0, target, 115, 185, CONST_ME_MAGIC_BLUE) then
  94. return false
  95. end
  96.  
  97. player:addCondition(exhaust)
  98. target:say("Aaaah...", TALKTYPE_MONSTER_SAY)
  99.  
  100.  
  101. elseif itemId == greatSpiritPot then
  102. if (not isInArray({3, 7, 11}, target:getVocation():getId()) or target:getLevel() < 80) and not getPlayerFlagValue(player, PlayerFlag_IgnoreSpellCheck) then
  103. player:say("This potion can only be consumed by paladins of level 80 or higher.", TALKTYPE_MONSTER_SAY)
  104. return true
  105. end
  106.  
  107. if not doTargetCombatHealth(0, target, COMBAT_HEALING, 250, 350, CONST_ME_MAGIC_BLUE) or not doTargetCombatMana(0, target, 100, 200, CONST_ME_MAGIC_BLUE) then
  108. return false
  109. end
  110.  
  111. player:addCondition(exhaust)
  112. target:say("Aaaah...", TALKTYPE_MONSTER_SAY)
  113.  
  114.  
  115. elseif itemId == greatHealthPot then
  116. if (not isInArray({4, 8, 12}, target:getVocation():getId()) or target:getLevel() < 80) and not getPlayerFlagValue(player, PlayerFlag_IgnoreSpellCheck) then
  117. player:say("This potion can only be consumed by knights of level 80 or higher.", TALKTYPE_MONSTER_SAY)
  118. return true
  119. end
  120.  
  121. if not doTargetCombatHealth(0, target, COMBAT_HEALING, 425, 575, CONST_ME_MAGIC_BLUE) then
  122. return false
  123. end
  124.  
  125. player:addCondition(exhaust)
  126. target:say("Aaaah...", TALKTYPE_MONSTER_SAY)
  127.  
  128.  
  129. elseif itemId == greatManaPot then
  130. if (not isInArray({1,2,5,6,9,10}, target:getVocation():getId()) or target:getLevel() < 80) and not getPlayerFlagValue(player, PlayerFlag_IgnoreSpellCheck) then
  131. player:say("This potion can only be consumed by sorcerers and druids of level 80 or higher.", TALKTYPE_MONSTER_SAY)
  132. return true
  133. end
  134.  
  135. if not doTargetCombatMana(0, target, 150, 250, CONST_ME_MAGIC_BLUE) then
  136. return false
  137. end
  138. player:addCondition(exhaust)
  139. target:say("Aaaah...", TALKTYPE_MONSTER_SAY)
  140.  
  141.  
  142. elseif itemId == ultimateHealthPot then
  143. if (not isInArray({4, 8, 12}, target:getVocation():getId()) or target:getLevel() < 130) and not getPlayerFlagValue(player, PlayerFlag_IgnoreSpellCheck) then
  144. player:say("This potion can only be consumed by knights of level 130 or higher.", TALKTYPE_MONSTER_SAY)
  145. return true
  146. end
  147.  
  148. if not doTargetCombatHealth(0, target, COMBAT_HEALING, 650, 850, CONST_ME_MAGIC_BLUE) then
  149. return false
  150. end
  151.  
  152. player:addCondition(exhaust)
  153. target:say("Aaaah...", TALKTYPE_MONSTER_SAY)
  154.  
  155.  
  156. end
  157. return true
  158. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement