Advertisement
Guest User

Actionbars_Old

a guest
Apr 25th, 2014
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.12 KB | None | 0 0
  1. local BasicUI = LibStub("AceAddon-3.0"):GetAddon("BasicUI")
  2. local BasicUI_Actionbar = BasicUI:NewModule("Actionbar", "AceEvent-3.0")
  3.  
  4. ---------------
  5. -- Actionbar --
  6. ---------------
  7. function BasicUI_Actionbar:OnEnable()
  8. local db = BasicUI.db.profile
  9.  
  10. if db.actionbar.enable ~= true then return end
  11.  
  12. local ccolor = RAID_CLASS_COLORS[select(2, UnitClass("player"))]
  13. -- Hide Keybindings
  14. if db.actionbar.showHotKeys ~= true then
  15. for i=1, 12 do
  16. _G["ActionButton"..i.."HotKey"]:SetAlpha(0) -- main bar
  17. _G["MultiBarBottomRightButton"..i.."HotKey"]:SetAlpha(0) -- bottom right bar
  18. _G["MultiBarBottomLeftButton"..i.."HotKey"]:SetAlpha(0) -- bottom left bar
  19. _G["MultiBarRightButton"..i.."HotKey"]:SetAlpha(0) -- right bar
  20. _G["MultiBarLeftButton"..i.."HotKey"]:SetAlpha(0) -- left bar
  21. end
  22. end
  23.  
  24. -- Hide Macros
  25. if db.actionbar.showMacronames ~= true then
  26. for i=1, 12 do
  27. _G["ActionButton"..i.."Name"]:SetAlpha(0) -- main bar
  28. _G["MultiBarBottomRightButton"..i.."Name"]:SetAlpha(0) -- bottom right bar
  29. _G["MultiBarBottomLeftButton"..i.."Name"]:SetAlpha(0) -- bottom left bar
  30. _G["MultiBarRightButton"..i.."Name"]:SetAlpha(0) -- right bar
  31. _G["MultiBarLeftButton"..i.."Name"]:SetAlpha(0) -- left bar
  32. end
  33. end
  34.  
  35. hooksecurefunc('ActionButton_UpdateUsable', function(self)
  36. if (IsAddOnLoaded('RedRange') or IsAddOnLoaded('GreenRange') or IsAddOnLoaded('tullaRange') or IsAddOnLoaded('RangeColors')) then
  37. return
  38. end
  39.  
  40. local isUsable, notEnoughMana = IsUsableAction(self.action)
  41. if (isUsable) then
  42. _G[self:GetName()..'Icon']:SetVertexColor(1, 1, 1)
  43. elseif (notEnoughMana) then
  44. _G[self:GetName()..'Icon']:SetVertexColor(db.actionbar.color.OutOfMana.r,db.actionbar.color.OutOfMana.g,db.actionbar.color.OutOfMana.b)
  45. else
  46. _G[self:GetName()..'Icon']:SetVertexColor(db.actionbar.color.NotUsable.r, db.actionbar.color.NotUsable.g, db.actionbar.color.NotUsable.b)
  47. end
  48. end)
  49.  
  50. -- BetterBlizzardButtonBorder v1.1.1
  51. -- By Aprikot - http://aprikot.wowinterface.com
  52. -- Based upon functions within nMainbar by Neal, and thek: Buttonskin by thek
  53.  
  54. -- Functions
  55. hooksecurefunc("ActionButton_Update", function(self)
  56. if self:GetName():match("ExtraActionButton") then return end
  57. local bu = _G[self:GetName()]
  58. local ic = _G[self:GetName().."Icon"]
  59. local bo = _G[self:GetName().."NormalTexture"]
  60. bu:SetNormalTexture("Interface\\BUTTONS\\UI-Quickslot2")
  61. ic:SetTexCoord(.05, .95, .05, .95);
  62. ic:SetPoint("TOPLEFT", bu, 0, 0);
  63. ic:SetPoint("BOTTOMRIGHT", bu, 0, 0);
  64. bo:ClearAllPoints()
  65. bo:SetPoint("TOPLEFT", bu, -14, 14)
  66. bo:SetPoint("BOTTOMRIGHT", bu, 14, -14)
  67. if db.misc.classcolor ~= true then
  68. bo:SetVertexColor(db.actionbar.color.r, db.actionbar.color.g, db.actionbar.color.b)
  69. else
  70. bo:SetVertexColor((ccolor.r * 1.2), (ccolor.g * 1.2), (ccolor.b * 1.2))
  71. end
  72. end);
  73.  
  74. hooksecurefunc("ActionButton_UpdateUsable", function(self)
  75. if self:GetName():match("ExtraActionButton") then return end
  76. if db.misc.classcolor ~= true then
  77. (_G[self:GetName().."NormalTexture"]):SetVertexColor(db.actionbar.color.r, db.actionbar.color.g, db.actionbar.color.b)
  78. else
  79. (_G[self:GetName().."NormalTexture"]):SetVertexColor((ccolor.r * 1.2), (ccolor.g * 1.2), (ccolor.b * 1.2))
  80. end
  81. end);
  82.  
  83. hooksecurefunc("ActionButton_ShowGrid", function(self)
  84. if self:GetName():match("ExtraActionButton") then return end
  85. if db.misc.classcolor ~= true then
  86. (_G[self:GetName().."NormalTexture"]):SetVertexColor(db.actionbar.color.r, db.actionbar.color.g, db.actionbar.color.b)
  87. else
  88. (_G[self:GetName().."NormalTexture"]):SetVertexColor((ccolor.r * 1.2), (ccolor.g * 1.2), (ccolor.b * 1.2))
  89. end
  90. end);
  91.  
  92. hooksecurefunc("PetActionBar_Update", function()
  93. for i, v in pairs({"PetActionButton", "ShapeshiftButton", "PossessButton"}) do
  94. for i = 1, 12 do
  95. local bu = _G[v..i]
  96. if bu then
  97. bu:SetNormalTexture("Interface\\BUTTONS\\UI-Quickslot2")
  98. local ic = _G[v..i.."Icon"];
  99. ic:SetTexCoord(.05, .95, .05, .95);
  100. ic:SetPoint("TOPLEFT", bu, -1, 1);
  101. ic:SetPoint("BOTTOMRIGHT", bu, 1, -1);
  102. local bo = _G[v..i.."NormalTexture2"] or _G[v..i.."NormalTexture"]
  103. bo:ClearAllPoints()
  104. bo:SetPoint("TOPLEFT", bu, -15, 15)
  105. bo:SetPoint("BOTTOMRIGHT", bu, 15, -15)
  106. if db.misc.classcolor ~= true then
  107. bo:SetVertexColor(db.actionbar.color.r, db.actionbar.color.g, db.actionbar.color.b)
  108. else
  109. bo:SetVertexColor((ccolor.r * 1.2), (ccolor.g * 1.2), (ccolor.b * 1.2))
  110. end
  111. end
  112. end
  113. end
  114. end);
  115.  
  116. hooksecurefunc("AuraButton_Update", function(self, index)
  117. if db.actionbar.auraborder then
  118. local bu = _G[self..index]
  119. local ic = _G[self..index.."Icon"]
  120. local bo = _G[self..index.."Border"]
  121. if ic then
  122. ic:SetTexCoord(.07, .93, .07, .93);
  123. end
  124. if bo then
  125. bo:SetTexture("Interface\\BUTTONS\\UI-Quickslot2")
  126. bo:ClearAllPoints()
  127. bo:SetPoint("TOPLEFT", bu, -12, 12)
  128. bo:SetPoint("BOTTOMRIGHT", bu, 12, -12)
  129. bo:SetTexCoord(0, 1, 0, 1)
  130. if db.misc.classcolor ~= true then
  131. bo:SetVertexColor(db.color.r, db.color.g, db.color.b)
  132. else
  133. bo:SetVertexColor((ccolor.r * 1.2), (ccolor.g * 1.2), (ccolor.b * 1.2))
  134. end
  135. end
  136. if bu and not bo then
  137. nbo = bu:CreateTexture("$parentOverlay", "ARTWORK")
  138. nbo:SetParent(bu)
  139. nbo:SetTexture("Interface\\BUTTONS\\UI-Quickslot2")
  140. nbo:SetPoint("TOPLEFT", bu, -12, 12)
  141. nbo:SetPoint("BOTTOMRIGHT", bu, 12, -12)
  142. if db.misc.classcolor ~= true then
  143. nbo:SetVertexColor(db.actionbar.color.r, db.actionbar.color.g, db.actionbar.color.b)
  144. else
  145. nbo:SetVertexColor((ccolor.r * 1.2), (ccolor.g * 1.2), (ccolor.b * 1.2))
  146. end
  147. end
  148. end
  149. end);
  150.  
  151. function ActionButton_OnUpdate(self, elapsed)
  152. if (IsAddOnLoaded('RedRange') or IsAddOnLoaded('GreenRange') or IsAddOnLoaded('tullaRange') or IsAddOnLoaded('RangeColors')) then
  153. return
  154. end
  155.  
  156. if (ActionButton_IsFlashing(self)) then
  157. local flashtime = self.flashtime
  158. flashtime = flashtime - elapsed
  159.  
  160. if (flashtime <= 0) then
  161. local overtime = - flashtime
  162. if (overtime >= ATTACK_BUTTON_FLASH_TIME) then
  163. overtime = 0
  164. end
  165.  
  166. flashtime = ATTACK_BUTTON_FLASH_TIME - overtime
  167.  
  168. local flashTexture = _G[self:GetName()..'Flash']
  169. if (flashTexture:IsShown()) then
  170. flashTexture:Hide()
  171. else
  172. flashTexture:Show()
  173. end
  174. end
  175.  
  176. self.flashtime = flashtime
  177. end
  178.  
  179. local rangeTimer = self.rangeTimer
  180. if (rangeTimer) then
  181. rangeTimer = rangeTimer - elapsed
  182. if (rangeTimer <= 0.1) then
  183. local isInRange = false
  184. if (ActionHasRange(self.action) and IsActionInRange(self.action) == 0) then
  185. _G[self:GetName()..'Icon']:SetVertexColor(db.actionbar.color.OutOfRange.r, db.actionbar.color.OutOfRange.g, db.actionbar.color.OutOfRange.b)
  186. isInRange = true
  187. end
  188.  
  189. if (self.isInRange ~= isInRange) then
  190. self.isInRange = isInRange
  191. ActionButton_UpdateUsable(self)
  192. end
  193.  
  194. rangeTimer = TOOLTIP_UPDATE_TIME
  195. end
  196.  
  197. self.rangeTimer = rangeTimer
  198. end
  199. end
  200. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement