Advertisement
Guest User

Untitled

a guest
Jul 18th, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.45 KB | None | 0 0
  1. MB_manacosts={
  2. ["Prayer of Fortitude"]=3400,
  3. ["Prayer of Spirit"]=1940,
  4. ["Gift of the Wild"]=1200,
  5. ["Prayer of Shadow Protection"]=1300,
  6. ["Arcane Brilliance"]=3230,
  7. ["Amplify Magic"]=450,
  8. ["Not Specified"]=3399,
  9. }
  10. function MB_Raidbuff(spell, target)--target can be nil, but used for special types of boffs
  11. local Reqspell = spell
  12.  
  13. local i = 1
  14. local x = 10
  15. local spacejam = "party" or "raid"
  16.  
  17. if target then
  18. TargetByName(target);
  19. if not MB_buffed(spell, "target") then CastSpellByName(spell) end
  20. return end
  21.  
  22. if not spell then
  23. return
  24. end
  25.  
  26. if not knowSpell(spell) then
  27. RunLine("/raid I dont know spell: "..spell..". its time you take me to a trainer or the auctionhouse! Empty=macro not specifying spell");
  28. return
  29. end
  30.  
  31. if not MB_manacosts[spell] == nil then
  32. MB_manacosts[spell] = MB_manacosts["Not Specified"]
  33. end
  34.  
  35. if mana("player") < MB_manacosts[spell] then smartdrink(); end
  36.  
  37. if UnitInRaid("player") then
  38. x = GetNumRaidMembers();
  39. spacejam = ("raid"..i);
  40. elseif UnitInParty("player") and not UnitInRaid("player") then
  41. x = GetNumPartyMembers();
  42. spacejam = ("party"..i);
  43. RunLine("/p im buffing a partymember with spell: "..spell.." ");
  44. else
  45. x = 5;
  46. spacejam = "target"
  47. RunLine("/s no raid no parteh whats to buff eyh");
  48. end
  49.  
  50. if spacejam == nil then
  51. local myname = UnitName("player");
  52. TargetUnit(myname);
  53. spacejam = "target";
  54. end
  55.  
  56. for i=1,x do
  57. if UnitLevel(spacejam)~=nil and UnitIsVisible(spacejam) and UnitIsConnected(spacejam) and not UnitIsGhost(spacejam) and not UnitIsDead(spacejam) and not UnitIsEnemy(spacejam,"player") and not UnitCanAttack("player",spacejam) and not MB_buffed(spell, spacejam) and not MB_buffed(spell, spacejam) then
  58. if not spacejam == "target" then
  59. TargetUnit(spacejam)
  60. elseif spacejam == "target" then
  61. TargetNearestFriend()
  62. end
  63. CastSpellByName(spell)
  64. return end
  65. end
  66. end
  67. function MB_buffed(spell, target)
  68. if spell == "Prayer of Fortitude" then
  69. return MB_buffCheck("Interface\\Icons\\Spell_Holy_PrayerOfFortitude", target, "Prayer of Fortitude")
  70.  
  71. elseif spell == "Power Word: Fortitude" then
  72. return MB_buffCheck("Interface\\Icons\\Spell_Holy_WordFortitude", target, "Power Word: Fortitude")
  73.  
  74. elseif spell == "Prayer of Spirit" then
  75. return MB_buffCheck("Interface\\Icons\\Spell_Holy_PrayerofSpirit", target, "Prayer of Spirit")
  76.  
  77. elseif spell == "Prayer of Shadow Protection" then
  78. return MB_buffCheck("Interface\\Icons\\Spell_Holy_PrayerofShadowProtection", target, "Prayer of Shadow Protection")
  79.  
  80. elseif spell == "Gift of the Wild" then
  81. return MB_buffCheck("Interface\\Icons\\Spell_Nature_Regeneration", target, "Gift of the Wild")
  82.  
  83. elseif spell == "Thorns" then
  84. return MB_buffCheck("Interface\\Icons\\Spell_Nature_Thorns", target, "Thorns")
  85.  
  86. elseif spell == "Arcane Brilliance" then
  87. return MB_buffCheck("Interface\\Icons\\Spell_Holy_ArcaneIntellect", target, "Arcane Brilliance")
  88.  
  89. elseif spell == "Ignite" then
  90. return MB_debuffCheck("Interface\\Icons\\Spell_Fire_Incinerate", target, "Ignite", "5")--barongeddons ignite mana same debuff.
  91.  
  92. elseif spell == "Ignite Mana" then
  93. return MB_debuffCheck("Interface\\Icons\\Spell_Fire_Incinerate", target, "Ignite Mana")--ignite same debuff.
  94.  
  95. elseif spell == "Flame Buffet" then
  96. return MB_debuffCheck("Interface\\Icons\\Spell_Fire_Fireball", target, "Flame Buffet", "6") --FireBall?
  97.  
  98. elseif spell == "Scorch" then
  99. return MB_debuffCheck("Interface\\Icons\\Spell_Fire_SoulBurn", target, "Scorch", "5") --spell_shadow_curseoftounges - curse of tounges, and curse of weakness: spell_shadow_curseofmannoro
  100.  
  101. elseif spell == "Curse of Recklessness" then
  102. return MB_debuffCheck("Interface\\Icons\\Spell_Shadow_UnholyStrength", target, "Curse of Recklessness")
  103.  
  104. elseif spell == "Curse of Shadow" then
  105. return MB_debuffCheck("Interface\\Icons\\Spell_Shadow_CurseOfAchimonde", target, "Curse of Shadow")
  106.  
  107. elseif spell == "Curse of the Elements" then
  108. return MB_debuffCheck("Interface\\Icons\\Spell_Shadow_ChillTouch", target, "Curse of the Elements") --spell_holy_powerwordshield
  109.  
  110. elseif spell == "Curse of Tongues" then
  111. return MB_debuffCheck("Interface\\Icons\\Spell_Shadow_CurseOfTounges", target, "Curse of Tongues")
  112.  
  113. elseif spell == "Curse of Weakness" then
  114. return MB_debuffCheck("Interface\\Icons\\Spell_Shadow_CurseOfMannoroth", target, "Curse of Weakness")
  115.  
  116. elseif spell == "Power Word: Shield" then
  117. local isdebuffed = MB_debuffCheck("Interface\\Icons\\Spell_Holy_AshesToAshes", target, "Weakened Soul")
  118. local isbuffed = MB_buffCheck("Interface\\Icons\\Spell_Holy_PowerWordShield", target, "Power Word: Shield")
  119. if not isdebuffed and not isbuffed then
  120. return false
  121. elseif not isdebuffed and isbuffed then
  122. return true
  123. elseif isdebuffed and not isbuffed then
  124. return true
  125. elseif isdebuffed and isbuffed then
  126. return true
  127. end
  128. else --if you havent specified any buffname+its iconpath it will default and use Supermacros buffed, remember that MB_buffed is ALOT faster if you can search through icons as here.
  129. return buffed(spell, target) --but ex giants in aq20 debuff has same icon but different names, so have to tooltipscrape like supermacros buffed does. but otherwise try to change all your buffed to MB_buffed(spellname, unit)
  130. end
  131. end
  132. function MB_buffCheck(text, target, buffname, amount)
  133. local buffname = buffname or nil
  134. local i = 1
  135. local buff, buffApplications = UnitBuff(target, i)
  136. while buff do
  137. if buff == text then
  138. if amount then
  139. local amounts = tonumber(amount);
  140. local amounta = tonumber(debuffApplications);
  141. if amounts == amounta then
  142. return true
  143. elseif amounts ~= amounta then
  144. return false
  145. end
  146. end
  147. return true
  148. end
  149. i = i + 1
  150. buff = UnitBuff(target, i)
  151. end
  152. return
  153. end
  154. function MB_debuffCheck(text, target, debuffname, amount)
  155. local debuffname = debuffname or nil
  156. local i = 1
  157. local debuffTexture, debuffApplications, debuffDispelType = UnitDebuff(target, i)
  158. while debuffTexture do
  159. if debuffTexture == text then
  160. if amount then
  161. local amounts = tonumber(amount);
  162. local amounta = tonumber(debuffApplications);
  163. if amounts == amounta then
  164. return true
  165. elseif amounts ~= amounta then
  166. return false
  167. end
  168. end
  169. return true
  170. end
  171. i = i + 1
  172. debuffTexture = UnitDebuff(target, i)
  173. end
  174. return
  175. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement