/Tukui/core/functions.lua

http://github.com/Asphyxia/Tukui · Lua · 1335 lines · 1155 code · 127 blank · 53 comment · 441 complexity · 81ac438be0ecf1eccc30dbe7aaf196b6 MD5 · raw file

  1. local T, C, L = unpack(select(2, ...)) -- Import: T - functions, constants, variables; C - config; L - locales
  2. T.IsPTRVersion = function()
  3. if T.toc > 40200 then
  4. return true
  5. else
  6. return false
  7. end
  8. end
  9. -- just for creating text
  10. T.SetFontString = function(parent, fontName, fontHeight, fontStyle)
  11. local fs = parent:CreateFontString(nil, "OVERLAY")
  12. fs:SetFont(fontName, fontHeight, fontStyle)
  13. fs:SetJustifyH("LEFT")
  14. fs:SetShadowColor(0, 0, 0)
  15. fs:SetShadowOffset(1.25, -1.25)
  16. return fs
  17. end
  18. -- datatext panel position
  19. T.PP = function(p, obj)
  20. local left = TukuiInfoLeft
  21. local right = TukuiInfoRight
  22. local mapleft = TukuiMinimapStatsLeft
  23. local mapright = TukuiMinimapStatsRight
  24. local center = TukuiInfoCenter
  25. local centerleft = TukuiInfoCenterLeft
  26. local centerright = TukuiInfoCenterRight
  27. if p == 1 then
  28. obj:SetParent(left)
  29. obj:SetHeight(left:GetHeight())
  30. obj:SetPoint("LEFT", left, 30, 1)
  31. obj:SetPoint('TOP', left)
  32. obj:SetPoint('BOTTOM', left)
  33. elseif p == 2 then
  34. obj:SetParent(left)
  35. obj:SetHeight(left:GetHeight())
  36. obj:SetPoint('TOP', left)
  37. obj:SetPoint('BOTTOM', left)
  38. elseif p == 3 then
  39. obj:SetParent(left)
  40. obj:SetHeight(left:GetHeight())
  41. obj:SetPoint("RIGHT", left, -30, 1)
  42. obj:SetPoint('TOP', left)
  43. obj:SetPoint('BOTTOM', left)
  44. elseif p == 4 then
  45. obj:SetParent(right)
  46. obj:SetHeight(right:GetHeight())
  47. obj:SetPoint("LEFT", right, 30, 1)
  48. obj:SetPoint('TOP', right)
  49. obj:SetPoint('BOTTOM', right)
  50. elseif p == 5 then
  51. obj:SetParent(right)
  52. obj:SetHeight(right:GetHeight())
  53. obj:SetPoint('TOP', right)
  54. obj:SetPoint('BOTTOM', right)
  55. elseif p == 6 then
  56. obj:SetParent(right)
  57. obj:SetHeight(right:GetHeight())
  58. obj:SetPoint("RIGHT", right, -30, 1)
  59. obj:SetPoint('TOP', right)
  60. obj:SetPoint('BOTTOM', right)
  61. elseif p == 7 then
  62. obj:SetParent(TukuiInfoCenterLeft)
  63. obj:Height(TukuiInfoCenterLeft:GetHeight())
  64. obj:Point("CENTER", TukuiInfoCenterLeft, 0, 1)
  65. elseif p == 8 then
  66. obj:SetParent(center)
  67. obj:SetHeight(center:GetHeight())
  68. obj:SetPoint("LEFT", center, 30, 1)
  69. obj:SetPoint('TOP', center, 0, 1)
  70. obj:SetPoint('BOTTOM', center)
  71. elseif p == 9 then
  72. obj:SetParent(center)
  73. obj:SetHeight(center:GetHeight())
  74. obj:SetPoint('TOP', center, 0, 1)
  75. obj:SetPoint('BOTTOM', center)
  76. elseif p ==10 then
  77. obj:SetParent(center)
  78. obj:SetHeight(center:GetHeight())
  79. obj:SetPoint("RIGHT", center, -30, 1)
  80. obj:SetPoint('TOP', center, 0, 1)
  81. obj:SetPoint('BOTTOM', center)
  82. elseif p == 11 then
  83. obj:SetParent(TukuiInfoCenterRight)
  84. obj:Height(TukuiInfoCenterRight:GetHeight())
  85. obj:Point("CENTER", TukuiInfoCenterRight, 0, 1)
  86. elseif p == 12 then
  87. obj:SetParent(Tukuiwatch)
  88. obj:Height(Tukuiwatch:GetHeight())
  89. obj:Point("CENTER", Tukuiwatch, 0, 1)
  90. end
  91. end
  92. --[[if TukuiMinimap then
  93. if p == 7 then
  94. obj:SetParent(mapleft)
  95. obj:SetHeight(mapleft:GetHeight())
  96. obj:SetPoint('TOP', mapleft)
  97. obj:SetPoint('BOTTOM', mapleft)
  98. elseif p == 8 then
  99. obj:SetParent(mapright)
  100. obj:SetHeight(mapright:GetHeight())
  101. obj:SetPoint('TOP', mapright)
  102. obj:SetPoint('BOTTOM', mapright)
  103. end
  104. end--]]
  105. T.DataTextTooltipAnchor = function(self)
  106. local panel = self:GetParent()
  107. local anchor = "ANCHOR_TOP"
  108. local xoff = 0
  109. local yoff = T.Scale(5)
  110. if panel == TukuiInfoLeft then
  111. anchor = "ANCHOR_TOPLEFT"
  112. elseif panel == TukuiInfoRight then
  113. anchor = "ANCHOR_TOPRIGHT"
  114. elseif panel == TukuiMinimapStatsLeft or panel == TukuiMinimapStatsRight then
  115. local position = TukuiMinimap:GetPoint()
  116. if position:match("LEFT") then
  117. anchor = "ANCHOR_BOTTOMRIGHT"
  118. yoff = T.Scale(-6)
  119. xoff = 0 - TukuiMinimapStatsRight:GetWidth()
  120. elseif position:match("RIGHT") then
  121. anchor = "ANCHOR_BOTTOMLEFT"
  122. yoff = T.Scale(-6)
  123. xoff = TukuiMinimapStatsRight:GetWidth()
  124. else
  125. anchor = "ANCHOR_BOTTOM"
  126. yoff = T.Scale(-6)
  127. end
  128. end
  129. return anchor, panel, xoff, yoff
  130. end
  131. -- Classcolored Datatext
  132. if C["datatext"].classcolored == true then
  133. C["datatext"].color = T.oUF_colors.class[T.myclass]
  134. end
  135. -- convert datatext color from rgb decimal to hex
  136. local dr, dg, db = unpack(C["datatext"].color)
  137. T.datacolor = ("|cff%.2x%.2x%.2x"):format(dr * 255, dg * 255, db * 255)
  138. T.DataBarPoint = function(p, obj)
  139. obj:SetPoint("TOPRIGHT", T.databars[p], "TOPRIGHT", -2, -2)
  140. obj:SetPoint("BOTTOMLEFT", T.databars[p], "BOTTOMLEFT", 2, 2)
  141. end
  142. T.DataBarTooltipAnchor = function(barNum)
  143. local xoff = -T.databars[barNum]:GetWidth()
  144. local yoff = T.Scale(-5)
  145. if C.databars.settings.vertical then
  146. xoff = T.Scale(5)
  147. yoff = T.databars[barNum]:GetHeight()
  148. end
  149. return xoff, yoff
  150. end
  151. T.TukuiShiftBarUpdate = function()
  152. local numForms = GetNumShapeshiftForms()
  153. local texture, name, isActive, isCastable
  154. local button, icon, cooldown
  155. local start, duration, enable
  156. for i = 1, NUM_SHAPESHIFT_SLOTS do
  157. button = _G["ShapeshiftButton"..i]
  158. icon = _G["ShapeshiftButton"..i.."Icon"]
  159. if i <= numForms then
  160. texture, name, isActive, isCastable = GetShapeshiftFormInfo(i)
  161. icon:SetTexture(texture)
  162. cooldown = _G["ShapeshiftButton"..i.."Cooldown"]
  163. if texture then
  164. cooldown:SetAlpha(1)
  165. else
  166. cooldown:SetAlpha(0)
  167. end
  168. start, duration, enable = GetShapeshiftFormCooldown(i)
  169. CooldownFrame_SetTimer(cooldown, start, duration, enable)
  170. if isActive then
  171. ShapeshiftBarFrame.lastSelected = button:GetID()
  172. button:SetChecked(1)
  173. else
  174. button:SetChecked(0)
  175. end
  176. if isCastable then
  177. icon:SetVertexColor(1.0, 1.0, 1.0)
  178. else
  179. icon:SetVertexColor(0.4, 0.4, 0.4)
  180. end
  181. end
  182. end
  183. end
  184. T.TukuiPetBarUpdate = function(self, event)
  185. local petActionButton, petActionIcon, petAutoCastableTexture, petAutoCastShine
  186. for i=1, NUM_PET_ACTION_SLOTS, 1 do
  187. local buttonName = "PetActionButton" .. i
  188. petActionButton = _G[buttonName]
  189. petActionIcon = _G[buttonName.."Icon"]
  190. petAutoCastableTexture = _G[buttonName.."AutoCastable"]
  191. petAutoCastShine = _G[buttonName.."Shine"]
  192. local name, subtext, texture, isToken, isActive, autoCastAllowed, autoCastEnabled = GetPetActionInfo(i)
  193. if not isToken then
  194. petActionIcon:SetTexture(texture)
  195. petActionButton.tooltipName = name
  196. else
  197. petActionIcon:SetTexture(_G[texture])
  198. petActionButton.tooltipName = _G[name]
  199. end
  200. petActionButton.isToken = isToken
  201. petActionButton.tooltipSubtext = subtext
  202. if isActive and name ~= "PET_ACTION_FOLLOW" then
  203. petActionButton:SetChecked(1)
  204. if IsPetAttackAction(i) then
  205. PetActionButton_StartFlash(petActionButton)
  206. end
  207. else
  208. petActionButton:SetChecked(0)
  209. if IsPetAttackAction(i) then
  210. PetActionButton_StopFlash(petActionButton)
  211. end
  212. end
  213. if autoCastAllowed then
  214. petAutoCastableTexture:Show()
  215. else
  216. petAutoCastableTexture:Hide()
  217. end
  218. if autoCastEnabled then
  219. AutoCastShine_AutoCastStart(petAutoCastShine)
  220. else
  221. AutoCastShine_AutoCastStop(petAutoCastShine)
  222. end
  223. -- grid display
  224. if name then
  225. if not C["actionbar"].showgrid then
  226. petActionButton:SetAlpha(1)
  227. end
  228. else
  229. if not C["actionbar"].showgrid then
  230. petActionButton:SetAlpha(0)
  231. end
  232. end
  233. if texture then
  234. if GetPetActionSlotUsable(i) then
  235. SetDesaturation(petActionIcon, nil)
  236. else
  237. SetDesaturation(petActionIcon, 1)
  238. end
  239. petActionIcon:Show()
  240. else
  241. petActionIcon:Hide()
  242. end
  243. -- between level 1 and 10 on cata, we don't have any control on Pet. (I lol'ed so hard)
  244. -- Setting desaturation on button to true until you learn the control on class trainer.
  245. -- you can at least control "follow" button.
  246. if not PetHasActionBar() and texture and name ~= "PET_ACTION_FOLLOW" then
  247. PetActionButton_StopFlash(petActionButton)
  248. SetDesaturation(petActionIcon, 1)
  249. petActionButton:SetChecked(0)
  250. end
  251. end
  252. end
  253. -- Define action bar buttons size
  254. T.buttonsize = T.Scale(C.actionbar.buttonsize)
  255. T.petbuttonsize = T.Scale(C.actionbar.petbuttonsize)
  256. T.stancebuttonsize = T.Scale(C.actionbar.stancebuttonsize)
  257. T.buttonspacing = T.Scale(C.actionbar.buttonspacing)
  258. T.Round = function(number, decimals)
  259. if not decimals then decimals = 0 end
  260. return (("%%.%df"):format(decimals)):format(number)
  261. end
  262. T.Round = function(number, decimals)
  263. if not decimals then decimals = 0 end
  264. return (("%%.%df"):format(decimals)):format(number)
  265. end
  266. T.RGBToHex = function(r, g, b)
  267. r = r <= 1 and r >= 0 and r or 0
  268. g = g <= 1 and g >= 0 and g or 0
  269. b = b <= 1 and b >= 0 and b or 0
  270. return string.format("|cff%02x%02x%02x", r*255, g*255, b*255)
  271. end
  272. --Check Player's Role
  273. local RoleUpdater = CreateFrame("Frame")
  274. local function CheckRole(self, event, unit)
  275. local tree = GetPrimaryTalentTree()
  276. local resilience
  277. local resilperc = GetCombatRatingBonus(COMBAT_RATING_RESILIENCE_PLAYER_DAMAGE_TAKEN)
  278. if resilperc > GetDodgeChance() and resilperc > GetParryChance() then
  279. resilience = true
  280. else
  281. resilience = false
  282. end
  283. if ((T.myclass == "PALADIN" and tree == 2) or
  284. (T.myclass == "WARRIOR" and tree == 3) or
  285. (T.myclass == "DEATHKNIGHT" and tree == 1)) and
  286. resilience == false or
  287. (T.myclass == "DRUID" and tree == 2 and GetBonusBarOffset() == 3) then
  288. T.Role = "Tank"
  289. else
  290. local playerint = select(2, UnitStat("player", 4))
  291. local playeragi = select(2, UnitStat("player", 2))
  292. local base, posBuff, negBuff = UnitAttackPower("player");
  293. local playerap = base + posBuff + negBuff;
  294. if (((playerap > playerint) or (playeragi > playerint)) and not (T.myclass == "SHAMAN" and tree ~= 1 and tree ~= 3) and not (UnitBuff("player", GetSpellInfo(24858)) or UnitBuff("player", GetSpellInfo(65139)))) or T.myclass == "ROGUE" or T.myclass == "HUNTER" or (T.myclass == "SHAMAN" and tree == 2) then
  295. T.Role = "Melee"
  296. else
  297. T.Role = "Caster"
  298. end
  299. end
  300. end
  301. RoleUpdater:RegisterEvent("PLAYER_ENTERING_WORLD")
  302. RoleUpdater:RegisterEvent("ACTIVE_TALENT_GROUP_CHANGED")
  303. RoleUpdater:RegisterEvent("PLAYER_TALENT_UPDATE")
  304. RoleUpdater:RegisterEvent("CHARACTER_POINTS_CHANGED")
  305. RoleUpdater:RegisterEvent("UNIT_INVENTORY_CHANGED")
  306. RoleUpdater:RegisterEvent("UPDATE_BONUS_ACTIONBAR")
  307. RoleUpdater:SetScript("OnEvent", CheckRole)
  308. CheckRole()
  309. --Return short value of a number
  310. function T.ShortValue(v)
  311. if v >= 1e6 then
  312. return ("%.1fm"):format(v / 1e6):gsub("%.?0+([km])$", "%1")
  313. elseif v >= 1e3 or v <= -1e3 then
  314. return ("%.1fk"):format(v / 1e3):gsub("%.?0+([km])$", "%1")
  315. else
  316. return v
  317. end
  318. end
  319. --Add time before calling a function
  320. --Usage T.Delay(seconds, functionToCall, ...)
  321. local waitTable = {}
  322. local waitFrame
  323. function T.Delay(delay, func, ...)
  324. if(type(delay)~="number" or type(func)~="function") then
  325. return false
  326. end
  327. if(waitFrame == nil) then
  328. waitFrame = CreateFrame("Frame","WaitFrame", UIParent)
  329. waitFrame:SetScript("onUpdate",function (self,elapse)
  330. local count = #waitTable
  331. local i = 1
  332. while(i<=count) do
  333. local waitRecord = tremove(waitTable,i)
  334. local d = tremove(waitRecord,1)
  335. local f = tremove(waitRecord,1)
  336. local p = tremove(waitRecord,1)
  337. if(d>elapse) then
  338. tinsert(waitTable,i,{d-elapse,f,p})
  339. i = i + 1
  340. else
  341. count = count - 1
  342. f(unpack(p))
  343. end
  344. end
  345. end)
  346. end
  347. tinsert(waitTable,{delay,func,{...}})
  348. return true
  349. end
  350. function T.update_alpha(self)
  351. if self.parent:GetAlpha() == 0 then
  352. self.parent:Hide()
  353. self:Hide()
  354. end
  355. end
  356. function T.fadeOut(self)
  357. UIFrameFadeOut(self,.4,1,0)
  358. self.frame:Show()
  359. end
  360. function T.fadeIn(p)
  361. p.frame = CreateFrame("Frame", nil , p)
  362. p.frame:Hide()
  363. p.frame.parent = p -- lol!
  364. p.frame:SetScript("OnUpdate",T.update_alpha)
  365. p:SetScript("OnShow", function()
  366. p.frame:Hide()
  367. UIFrameFadeIn(p,.4,0,1)
  368. end)
  369. p.fadeOut = T.fadeOut
  370. end
  371. --[[function T.ApplyHover(self)
  372. self:HookScript("OnEnter", T.SetModifiedBackdrop)
  373. self:HookScript("OnLeave", T.SetOriginalBackdrop)
  374. end--]]
  375. ------------------------------------------------------------------------
  376. -- unitframes Functions
  377. ------------------------------------------------------------------------
  378. local ADDON_NAME, ns = ...
  379. local oUF = ns.oUF or oUF
  380. assert(oUF, "Tukui was unable to locate oUF install.")
  381. T.updateAllElements = function(frame)
  382. for _, v in ipairs(frame.__elements) do
  383. v(frame, "UpdateElement", frame.unit)
  384. end
  385. end
  386. local SetUpAnimGroup = function(self)
  387. self.anim = self:CreateAnimationGroup("Flash")
  388. self.anim.fadein = self.anim:CreateAnimation("ALPHA", "FadeIn")
  389. self.anim.fadein:SetChange(1)
  390. self.anim.fadein:SetOrder(2)
  391. self.anim.fadeout = self.anim:CreateAnimation("ALPHA", "FadeOut")
  392. self.anim.fadeout:SetChange(-1)
  393. self.anim.fadeout:SetOrder(1)
  394. end
  395. local Flash = function(self, duration)
  396. if not self.anim then
  397. SetUpAnimGroup(self)
  398. end
  399. self.anim.fadein:SetDuration(duration)
  400. self.anim.fadeout:SetDuration(duration)
  401. self.anim:Play()
  402. end
  403. local StopFlash = function(self)
  404. if self.anim then
  405. self.anim:Finish()
  406. end
  407. end
  408. T.SpawnMenu = function(self)
  409. local unit = self.unit:gsub("(.)", string.upper, 1)
  410. if unit == "Targettarget" or unit == "focustarget" or unit == "pettarget" then return end
  411. if _G[unit.."FrameDropDown"] then
  412. ToggleDropDownMenu(1, nil, _G[unit.."FrameDropDown"], "cursor")
  413. elseif (self.unit:match("party")) then
  414. ToggleDropDownMenu(1, nil, _G["PartyMemberFrame"..self.id.."DropDown"], "cursor")
  415. else
  416. FriendsDropDown.unit = self.unit
  417. FriendsDropDown.id = self.id
  418. FriendsDropDown.initialize = RaidFrameDropDown_Initialize
  419. ToggleDropDownMenu(1, nil, FriendsDropDown, "cursor")
  420. end
  421. end
  422. T.PostUpdatePower = function(element, unit, min, max)
  423. element:GetParent().Health:SetHeight(max ~= 0 and 20 or 22)
  424. end
  425. local ShortValue = function(value)
  426. if value >= 1e6 then
  427. return ("%.1fm"):format(value / 1e6):gsub("%.?0+([km])$", "%1")
  428. elseif value >= 1e3 or value <= -1e3 then
  429. return ("%.1fk"):format(value / 1e3):gsub("%.?0+([km])$", "%1")
  430. else
  431. return value
  432. end
  433. end
  434. local ShortValueNegative = function(v)
  435. if v <= 999 then return v end
  436. if v >= 1000000 then
  437. local value = string.format("%.1fm", v/1000000)
  438. return value
  439. elseif v >= 1000 then
  440. local value = string.format("%.1fk", v/1000)
  441. return value
  442. end
  443. end
  444. T.PostUpdateHealth = function(health, unit, min, max)
  445. if not UnitIsConnected(unit) or UnitIsDead(unit) or UnitIsGhost(unit) then
  446. if not UnitIsConnected(unit) then
  447. health.value:SetText("|cffD7BEA5"..L.unitframes_ouf_offline.."|r")
  448. elseif UnitIsDead(unit) then
  449. health.value:SetText("|cffD7BEA5"..L.unitframes_ouf_dead.."|r")
  450. elseif UnitIsGhost(unit) then
  451. health.value:SetText("|cffD7BEA5"..L.unitframes_ouf_ghost.."|r")
  452. end
  453. else
  454. local r, g, b
  455. if C.unitframes.gradienthealth and C.unitframes.unicolor then
  456. local r, g, b = oUF.ColorGradient(min/max, unpack(C["unitframes"].gradient))
  457. health:SetStatusBarColor(r, g, b)
  458. end
  459. T.AuraFilter = function(icons, unit, icon, name, rank, texture, count, dtype, duration, timeLeft, caster, isStealable, shouldConsolidate, spellID)
  460. local inInstance, instanceType = IsInInstance()
  461. icon.owner = caster
  462. icon.isStealable = isStealable
  463. if (unit and unit:find("arena%d")) then --Arena frames
  464. if dtype then
  465. if T.DebuffWhiteList[name] then
  466. return true
  467. else
  468. return false
  469. end
  470. else
  471. if T.ArenaBuffWhiteList[name] then
  472. return true
  473. else
  474. return false
  475. end
  476. end
  477. elseif unit == "target" or (unit and unit:find("boss%d")) then --Target/Boss Only
  478. if C["unitframes"].playerdebuffsonly == true then
  479. -- Show all debuffs on friendly targets
  480. if UnitIsFriend("player", "target") then return true end
  481. local isPlayer
  482. if(caster == 'player' or caster == 'vehicle') then
  483. isPlayer = true
  484. else
  485. isPlayer = false
  486. end
  487. if isPlayer then
  488. return true
  489. elseif T.DebuffWhiteList[name] or (inInstance and ((instanceType == "pvp" or instanceType == "arena") and T.TargetPVPOnly[name])) then
  490. return true
  491. else
  492. return false
  493. end
  494. else
  495. return true
  496. end
  497. else --Everything else
  498. if unit ~= "player" and unit ~= "targettarget" and unit ~= "focus" and inInstance and (instanceType == "pvp" or instanceType == "arena") then
  499. if T.DebuffWhiteList[name] or T.TargetPVPOnly[name] then
  500. return true
  501. else
  502. return false
  503. end
  504. else
  505. if T.DebuffBlacklist[name] then
  506. return false
  507. else
  508. return true
  509. end
  510. end
  511. end
  512. end
  513. -- overwrite healthbar color for enemy player (a tukui option if enabled), target vehicle/pet too far away returning unitreaction nil and friend unit not a player. (mostly for overwrite tapped for friendly)
  514. -- I don't know if we really need to call C["unitframes"].unicolor but anyway, it's safe this way.
  515. if (C["unitframes"].unicolor ~= true and C["unitframes"].enemyhcolor and unit == "target" and UnitIsEnemy(unit, "player") and UnitIsPlayer(unit)) or (C["unitframes"].unicolor ~= true and unit == "target" and not UnitIsPlayer(unit) and UnitIsFriend(unit, "player")) then
  516. local c = T.oUF_colors.reaction[UnitReaction(unit, "player")]
  517. if c then
  518. r, g, b = c[1], c[2], c[3]
  519. health:SetStatusBarColor(r, g, b)
  520. else
  521. -- if "c" return nil it's because it's a vehicle or pet unit too far away, we force friendly color
  522. -- this should fix color not updating for vehicle/pet too far away from yourself.
  523. r, g, b = 75/255, 175/255, 76/255
  524. health:SetStatusBarColor(r, g, b)
  525. end
  526. end
  527. if min ~= max then
  528. local r, g, b
  529. r, g, b = oUF.ColorGradient(min/max, 0.69, 0.31, 0.31, 0.65, 0.63, 0.35, 0.33, 0.59, 0.33)
  530. if unit == "player" and health:GetAttribute("normalUnit") ~= "pet" then
  531. if C["unitframes"].showtotalhpmp == true then
  532. health.value:SetFormattedText("|cff559655%s|r |cffD7BEA5|||r |cff559655%s|r", ShortValue(min), ShortValue(max))
  533. else
  534. health.value:SetFormattedText("|cffAF5050%d|r |cffD7BEA5-|r |cff%02x%02x%02x%d%%|r", min, r * 255, g * 255, b * 255, floor(min / max * 100))
  535. end
  536. elseif unit == "target" or (unit and unit:find("boss%d")) then
  537. if C["unitframes"].showtotalhpmp == true then
  538. health.value:SetFormattedText("|cff559655%s|r |cffD7BEA5|||r |cff559655%s|r", ShortValue(min), ShortValue(max))
  539. else
  540. health.value:SetFormattedText("|cffAF5050%s|r |cffD7BEA5-|r |cff%02x%02x%02x%d%%|r", ShortValue(min), r * 255, g * 255, b * 255, floor(min / max * 100))
  541. end
  542. elseif (unit and unit:find("arena%d")) or unit == "focus" or unit == "focustarget" then
  543. health.value:SetText("|cff559655"..ShortValue(min).."|r")
  544. else
  545. health.value:SetText("|cff559655-"..ShortValueNegative(max-min).."|r")
  546. end
  547. else
  548. if unit == "player" and health:GetAttribute("normalUnit") ~= "pet" then
  549. health.value:SetText("|cff559655"..max.."|r")
  550. elseif unit == "target" or unit == "focus" or unit == "focustarget" or (unit and unit:find("arena%d")) then
  551. health.value:SetText("|cff559655"..ShortValue(max).."|r")
  552. else
  553. health.value:SetText(" ")
  554. end
  555. end
  556. end
  557. end
  558. T.PostUpdateHealthRaid = function(health, unit, min, max)
  559. if not UnitIsConnected(unit) or UnitIsDead(unit) or UnitIsGhost(unit) then
  560. if not UnitIsConnected(unit) then
  561. health.value:SetText("|cffD7BEA5"..L.unitframes_ouf_offline.."|r")
  562. elseif UnitIsDead(unit) then
  563. health.value:SetText("|cffD7BEA5"..L.unitframes_ouf_dead.."|r")
  564. elseif UnitIsGhost(unit) then
  565. health.value:SetText("|cffD7BEA5"..L.unitframes_ouf_ghost.."|r")
  566. end
  567. else
  568. -- doing this here to force friendly unit (vehicle or pet) very far away from you to update color correcly
  569. -- because if vehicle or pet is too far away, unitreaction return nil and color of health bar is white.
  570. if not UnitIsPlayer(unit) and UnitIsFriend(unit, "player") and C["unitframes"].unicolor ~= true then
  571. local c = T.oUF_colors.reaction[5]
  572. local r, g, b = c[1], c[2], c[3]
  573. health:SetStatusBarColor(r, g, b)
  574. health.bg:SetTexture(.1, .1, .1)
  575. end
  576. if C.unitframes.gradienthealth and C.unitframes.unicolor then
  577. if not UnitIsConnected(unit) or UnitIsDead(unit) or UnitIsGhost(unit) then return end
  578. if not health.classcolored then
  579. local r, g, b = oUF.ColorGradient(min/max, unpack(C["unitframes"].gradient))
  580. health:SetStatusBarColor(r, g, b)
  581. end
  582. end
  583. if min ~= max then
  584. health.value:SetText("|cff559655-"..ShortValueNegative(max-min).."|r")
  585. else
  586. health.value:SetText(" ")
  587. end
  588. end
  589. end
  590. T.PostUpdatePetColor = function(health, unit, min, max)
  591. -- doing this here to force friendly unit (vehicle or pet) very far away from you to update color correcly
  592. -- because if vehicle or pet is too far away, unitreaction return nil and color of health bar is white.
  593. if not UnitIsPlayer(unit) and UnitIsFriend(unit, "player") and C["unitframes"].unicolor ~= true then
  594. local c = T.oUF_colors.reaction[5]
  595. local r, g, b = c[1], c[2], c[3]
  596. if health then health:SetStatusBarColor(r, g, b) end
  597. if health.bg then health.bg:SetTexture(.1, .1, .1) end
  598. end
  599. end
  600. T.PostNamePosition = function(self)
  601. self.Name:ClearAllPoints()
  602. if (self.Power.value:GetText() and UnitIsEnemy("player", "target") and C["unitframes"].targetpowerpvponly == true) or (self.Power.value:GetText() and C["unitframes"].targetpowerpvponly == false) then
  603. self.Name:SetPoint("CENTER", health, "CENTER", 0, 3)
  604. if C["unitframes"].style == "Smelly" then
  605. self.Name:SetPoint("CENTER", self.Health, "CENTER", 0, 3)
  606. end
  607. else
  608. self.Power.value:SetAlpha(0)
  609. self.Name:SetPoint("LEFT", self.Health, "LEFT", 4, 3)
  610. end
  611. end
  612. T.PreUpdatePower = function(power, unit)
  613. local _, pType = UnitPowerType(unit)
  614. local color = T.oUF_colors.power[pType]
  615. if color then
  616. power:SetStatusBarColor(color[1], color[2], color[3])
  617. end
  618. end
  619. T.PostUpdatePower = function(power, unit, min, max)
  620. local self = power:GetParent()
  621. local pType, pToken = UnitPowerType(unit)
  622. local color = T.oUF_colors.power[pToken]
  623. if color then
  624. power.value:SetTextColor(color[1], color[2], color[3])
  625. end
  626. if not UnitIsPlayer(unit) and not UnitPlayerControlled(unit) or not UnitIsConnected(unit) then
  627. power.value:SetText()
  628. elseif UnitIsDead(unit) or UnitIsGhost(unit) then
  629. power.value:SetText()
  630. else
  631. if min ~= max then
  632. if pType == 0 then
  633. if unit == "target" then
  634. if C["unitframes"].showtotalhpmp == true then
  635. power.value:SetFormattedText("%s |cffD7BEA5|||r %s", ShortValue(max - (max - min)), ShortValue(max))
  636. else
  637. power.value:SetFormattedText("%d%% |cffD7BEA5-|r %s", floor(min / max * 100), ShortValue(max - (max - min)))
  638. end
  639. elseif unit == "player" and self:GetAttribute("normalUnit") == "pet" or unit == "pet" then
  640. if C["unitframes"].showtotalhpmp == true then
  641. power.value:SetFormattedText("%s |cffD7BEA5|||r %s", ShortValue(max - (max - min)), ShortValue(max))
  642. else
  643. power.value:SetFormattedText("%d%%", floor(min / max * 100))
  644. end
  645. elseif (unit and unit:find("arena%d")) or unit == "focus" or unit == "focustarget" then
  646. power.value:SetText(ShortValue(min))
  647. else
  648. if C["unitframes"].showtotalhpmp == true then
  649. power.value:SetFormattedText("%s |cffD7BEA5|||r %s", ShortValue(max - (max - min)), ShortValue(max))
  650. else
  651. power.value:SetFormattedText("%d%% |cffD7BEA5-|r %d", floor(min / max * 100), max - (max - min))
  652. end
  653. end
  654. else
  655. power.value:SetText(max - (max - min))
  656. end
  657. else
  658. if unit == "pet" or unit == "target" or unit == "focus" or unit == "focustarget" or (unit and unit:find("arena%d")) then
  659. power.value:SetText(ShortValue(min))
  660. else
  661. power.value:SetText(min)
  662. end
  663. end
  664. end
  665. if self.Name then
  666. if unit == "target" then T.PostNamePosition(self, power) end
  667. end
  668. end
  669. T.CustomCastTimeText = function(self, duration)
  670. self.Time:SetText(("%.1f / %.1f"):format(self.channeling and duration or self.max - duration, self.max))
  671. end
  672. T.CustomCastDelayText = function(self, duration)
  673. self.Time:SetText(("%.1f |cffaf5050%s %.1f|r"):format(self.channeling and duration or self.max - duration, self.channeling and "- " or "+", self.delay))
  674. end
  675. local FormatTime = function(s)
  676. local day, hour, minute = 86400, 3600, 60
  677. if s >= day then
  678. return format("%dd", ceil(s / day))
  679. elseif s >= hour then
  680. return format("%dh", ceil(s / hour))
  681. elseif s >= minute then
  682. return format("%dm", ceil(s / minute))
  683. elseif s >= minute / 12 then
  684. return floor(s)
  685. end
  686. return format("%.1f", s)
  687. end
  688. local CreateAuraTimer = function(self, elapsed)
  689. if self.timeLeft then
  690. self.elapsed = (self.elapsed or 0) + elapsed
  691. if self.elapsed >= 0.1 then
  692. if not self.first then
  693. self.timeLeft = self.timeLeft - self.elapsed
  694. else
  695. self.timeLeft = self.timeLeft - GetTime()
  696. self.first = false
  697. end
  698. if self.timeLeft > 0 then
  699. local time = FormatTime(self.timeLeft)
  700. self.remaining:SetText(time)
  701. if self.timeLeft <= 5 then
  702. self.remaining:SetTextColor(0.99, 0.31, 0.31)
  703. else
  704. self.remaining:SetTextColor(1, 1, 1)
  705. end
  706. else
  707. self.remaining:Hide()
  708. self:SetScript("OnUpdate", nil)
  709. end
  710. self.elapsed = 0
  711. end
  712. end
  713. end
  714. T.PostCreateAura = function(element, button)
  715. button:SetTemplate("Default")
  716. button.remaining = T.SetFontString(button, C["media"].font, C["unitframes"].auratextscale, "THINOUTLINE")
  717. button.remaining:Point("CENTER", 1, 0)
  718. button.cd.noOCC = true -- hide OmniCC CDs
  719. button.cd.noCooldownCount = true -- hide CDC CDs
  720. button.cd:SetReverse()
  721. button.icon:Point("TOPLEFT", 2, -2)
  722. button.icon:Point("BOTTOMRIGHT", -2, 2)
  723. button.icon:SetTexCoord(0.08, 0.92, 0.08, 0.92)
  724. button.icon:SetDrawLayer('ARTWORK')
  725. button.count:Point("BOTTOMRIGHT", 3, 3)
  726. button.count:SetJustifyH("RIGHT")
  727. button.count:SetFont(C["media"].font, 9, "THICKOUTLINE")
  728. button.count:SetTextColor(0.84, 0.75, 0.65)
  729. button.overlayFrame = CreateFrame("frame", nil, button, nil)
  730. button.cd:SetFrameLevel(button:GetFrameLevel() + 1)
  731. button.cd:ClearAllPoints()
  732. button.cd:Point("TOPLEFT", button, "TOPLEFT", 2, -2)
  733. button.cd:Point("BOTTOMRIGHT", button, "BOTTOMRIGHT", -2, 2)
  734. button.overlayFrame:SetFrameLevel(button.cd:GetFrameLevel() + 1)
  735. button.overlay:SetParent(button.overlayFrame)
  736. button.count:SetParent(button.overlayFrame)
  737. button.remaining:SetParent(button.overlayFrame)
  738. button.Glow = CreateFrame("Frame", nil, button)
  739. button.Glow:Point("TOPLEFT", button, "TOPLEFT", -3, 3)
  740. button.Glow:Point("BOTTOMRIGHT", button, "BOTTOMRIGHT", 3, -3)
  741. button.Glow:SetFrameStrata("BACKGROUND")
  742. button.Glow:SetBackdrop{edgeFile = C["media"].glowTex, edgeSize = 3, insets = {left = 0, right = 0, top = 0, bottom = 0}}
  743. button.Glow:SetBackdropColor(0, 0, 0, 0)
  744. button.Glow:SetBackdropBorderColor(0, 0, 0)
  745. end
  746. T.PostUpdateAura = function(icons, unit, icon, index, offset, filter, isDebuff, duration, timeLeft)
  747. local _, _, _, _, dtype, duration, expirationTime, unitCaster, _ = UnitAura(unit, index, icon.filter)
  748. if(icon.debuff) then
  749. if(not UnitIsFriend("player", unit) and icon.owner ~= "player" and icon.owner ~= "vehicle") then
  750. icon:SetBackdropBorderColor(unpack(C["media"].bordercolor))
  751. icon.icon:SetDesaturated(true)
  752. else
  753. local color = DebuffTypeColor[dtype] or DebuffTypeColor.none
  754. icon:SetBackdropBorderColor(color.r * 0.6, color.g * 0.6, color.b * 0.6)
  755. icon.icon:SetDesaturated(false)
  756. end
  757. else
  758. if (isStealable or ((T.myclass == "MAGE" or T.myclass == "PRIEST" or T.myclass == "SHAMAN") and dtype == "Magic")) and not UnitIsFriend("player", unit) then
  759. icon:SetBackdropBorderColor(1, 0.85, 0, 1)
  760. else
  761. icon:SetBackdropBorderColor(unpack(C.media.bordercolor))
  762. end
  763. end
  764. if duration and duration > 0 then
  765. if C["unitframes"].auratimer == true then
  766. icon.remaining:Show()
  767. else
  768. icon.remaining:Hide()
  769. end
  770. else
  771. icon.remaining:Hide()
  772. end
  773. icon.duration = duration
  774. icon.timeLeft = expirationTime
  775. icon.first = true
  776. icon:SetScript("OnUpdate", CreateAuraTimer)
  777. end
  778. T.HidePortrait = function(self, unit)
  779. if self.unit == "target" then
  780. if not UnitExists(self.unit) or not UnitIsConnected(self.unit) or not UnitIsVisible(self.unit) then
  781. self.Portrait:SetAlpha(0)
  782. else
  783. self.Portrait:SetAlpha(1)
  784. end
  785. end
  786. end
  787. T.PortraitUpdate = function(self, unit)
  788. --Fucking Furries
  789. if self:GetModel() and self:GetModel().find and self:GetModel():find("worgenmale") then
  790. self:SetCamera(1)
  791. end
  792. end
  793. -- jasje castbar
  794. T.PostCastStart = function(self, unit, name, rank, castid)
  795. if unit == "vehicle" then unit = "player" end
  796. --Fix blank castbar with opening text
  797. if name == "Opening" then
  798. self.Text:SetText("Opening")
  799. end
  800. if self.interrupt and unit ~= "player" then
  801. if UnitCanAttack("player", unit) then
  802. self:SetStatusBarColor(unpack(C["castbar"].nointerruptcolor))
  803. else
  804. self:SetStatusBarColor(unpack(C["castbar"].nointerruptcolor))
  805. end
  806. else
  807. if C["castbar"].classcolor and (unit == "player" or unit == "target") then
  808. self:SetStatusBarColor(unpack(oUF.colors.class[select(2, UnitClass(unit))]))
  809. else
  810. self:SetStatusBarColor(unpack(C["castbar"].castbarcolor))
  811. end
  812. end
  813. end
  814. T.UpdateShards = function(self, event, unit, powerType)
  815. if(self.unit ~= unit or (powerType and powerType ~= 'SOUL_SHARDS')) then return end
  816. local num = UnitPower(unit, SPELL_POWER_SOUL_SHARDS)
  817. for i = 1, SHARD_BAR_NUM_SHARDS do
  818. if(i <= num) then
  819. self.SoulShards[i]:SetAlpha(1)
  820. else
  821. self.SoulShards[i]:SetAlpha(.2)
  822. end
  823. end
  824. end
  825. T.Phasing = function(self, event)
  826. local inPhase = UnitInPhase(self.unit)
  827. local picon = self.PhaseIcon
  828. if not UnitIsPlayer(self.unit) then picon:Hide() return end
  829. -- TO BE COMPLETED
  830. end
  831. T.UpdateHoly = function(self, event, unit, powerType)
  832. if(self.unit ~= unit or (powerType and powerType ~= 'HOLY_POWER')) then return end
  833. local num = UnitPower(unit, SPELL_POWER_HOLY_POWER)
  834. for i = 1, MAX_HOLY_POWER do
  835. if(i <= num) then
  836. self.HolyPower[i]:SetAlpha(1)
  837. else
  838. self.HolyPower[i]:SetAlpha(.2)
  839. end
  840. end
  841. end
  842. T.EclipseDirection = function(self)
  843. if ( GetEclipseDirection() == "sun" ) then
  844. self.Text:SetText("|cffE5994C"..L.unitframes_ouf_starfirespell.."|r")
  845. elseif ( GetEclipseDirection() == "moon" ) then
  846. self.Text:SetText("|cff4478BC"..L.unitframes_ouf_wrathspell.."|r")
  847. else
  848. self.Text:SetText("")
  849. end
  850. end
  851. T.DruidBarDisplay = function(self, login)
  852. local eb = self.EclipseBar
  853. local dm = self.DruidMana
  854. local txt = self.EclipseBar.Text
  855. local shadow = self.shadow
  856. local bg = self.DruidManaBackground
  857. local buffs = self.Buffs
  858. local flash = self.FlashInfo
  859. if login then
  860. dm:SetScript("OnUpdate", nil)
  861. end
  862. if eb:IsShown() or dm:IsShown() then
  863. if eb:IsShown() then
  864. txt:Show()
  865. flash:Hide()
  866. end
  867. --self.shadow:Point("TOPLEFT", -4, 12)
  868. bg:SetAlpha(1)
  869. if T.lowversion then
  870. if buffs then buffs:SetPoint("TOPLEFT", self, "TOPLEFT", 0, 34) end
  871. else
  872. if buffs then buffs:SetPoint("TOPLEFT", self, "TOPLEFT", 0, 38) end
  873. end
  874. else
  875. txt:Hide()
  876. flash:Show()
  877. --self.shadow:Point("TOPLEFT", -4, 4)
  878. bg:SetAlpha(0)
  879. if T.lowversion then
  880. if buffs then buffs:SetPoint("TOPLEFT", self, "TOPLEFT", 0, 26) end
  881. else
  882. if buffs then buffs:SetPoint("TOPLEFT", self, "TOPLEFT", 0, 30) end
  883. end
  884. end
  885. end
  886. T.MLAnchorUpdate = function (self)
  887. if self.Leader:IsShown() then
  888. self.MasterLooter:SetPoint("TOPLEFT", 14, 8)
  889. else
  890. self.MasterLooter:SetPoint("TOPLEFT", 2, 8)
  891. end
  892. end
  893. T.UpdateReputationColor = function(self, event, unit, bar)
  894. local name, id = GetWatchedFactionInfo()
  895. bar:SetStatusBarColor(FACTION_BAR_COLORS[id].r, FACTION_BAR_COLORS[id].g, FACTION_BAR_COLORS[id].b)
  896. end
  897. T.UpdateName = function(self,event)
  898. if self.Name then self.Name:UpdateTag(self.unit) end
  899. end
  900. local UpdateManaLevelDelay = 0
  901. T.UpdateManaLevel = function(self, elapsed)
  902. UpdateManaLevelDelay = UpdateManaLevelDelay + elapsed
  903. if self.parent.unit ~= "player" or UpdateManaLevelDelay < 0.2 or UnitIsDeadOrGhost("player") or UnitPowerType("player") ~= 0 then return end
  904. UpdateManaLevelDelay = 0
  905. local percMana = UnitMana("player") / UnitManaMax("player") * 100
  906. if percMana <= C.unitframes.lowThreshold then
  907. self.ManaLevel:SetText("|cffaf5050"..L.unitframes_ouf_lowmana.."|r")
  908. Flash(self, 0.3)
  909. else
  910. self.ManaLevel:SetText()
  911. StopFlash(self)
  912. end
  913. end
  914. T.UpdateDruidMana = function(self)
  915. if self.unit ~= "player" then return end
  916. local num, str = UnitPowerType("player")
  917. if num ~= 0 then
  918. local min = UnitPower("player", 0)
  919. local max = UnitPowerMax("player", 0)
  920. local percMana = min / max * 100
  921. if percMana <= C["unitframes"].lowThreshold then
  922. self.FlashInfo.ManaLevel:SetText("|cffaf5050"..L.unitframes_ouf_lowmana.."|r")
  923. Flash(self.FlashInfo, 0.3)
  924. else
  925. self.FlashInfo.ManaLevel:SetText()
  926. StopFlash(self.FlashInfo)
  927. end
  928. if min ~= max then
  929. if self.Power.value:GetText() then
  930. self.DruidManaText:SetPoint("LEFT", self.Power.value, "RIGHT", 1, 0)
  931. self.DruidManaText:SetFormattedText("|cffD7BEA5-|r |cff4693FF%d%%|r|r", floor(min / max * 100))
  932. else
  933. self.DruidManaText:SetPoint("LEFT", self.panel, "LEFT", 4, 1)
  934. self.DruidManaText:SetFormattedText("%d%%", floor(min / max * 100))
  935. end
  936. else
  937. self.DruidManaText:SetText()
  938. end
  939. self.DruidManaText:SetAlpha(1)
  940. else
  941. self.DruidManaText:SetAlpha(0)
  942. end
  943. end
  944. T.UpdateThreat = function(self, event, unit)
  945. if (self.unit ~= unit) or (unit == "target" or unit == "pet" or unit == "focus" or unit == "focustarget" or unit == "targettarget") then return end
  946. local threat = UnitThreatSituation(self.unit)
  947. if (threat == 3) then
  948. if self.HealthBorder then
  949. self.HealthBorder:SetBackdropBorderColor(5 ,0, 0,1)
  950. else
  951. self.Name:SetTextColor(1,0.1,0.1)
  952. end
  953. else
  954. if self.HealthBorder then
  955. self.HealthBorder:SetBackdropBorderColor(unpack(C["media"].bordercolor))
  956. else
  957. self.Name:SetTextColor(1,1,1)
  958. end
  959. end
  960. end
  961. -- AuraTracker Function
  962. function updateAuraTrackerTime(self, elapsed)
  963. if (self.active) then
  964. self.timeleft = self.timeleft - elapsed
  965. if (self.timeleft <= 5) then
  966. self.text:SetTextColor(1, 0, 0)
  967. else
  968. self.text:SetTextColor(1, 1, 1)
  969. end
  970. if (self.timeleft <= 0) then
  971. self.icon:SetTexture("")
  972. self.text:SetText("")
  973. end
  974. self.text:SetFormattedText("%.1f", self.timeleft)
  975. end
  976. end
  977. --------------------------------------------------------------------------------------------
  978. -- THE AURAWATCH FUNCTION ITSELF. HERE BE DRAGONS!
  979. --------------------------------------------------------------------------------------------
  980. T.countOffsets = {
  981. TOPLEFT = {6*C["unitframes"].gridscale, 1},
  982. TOPRIGHT = {-6*C["unitframes"].gridscale, 1},
  983. BOTTOMLEFT = {6*C["unitframes"].gridscale, 1},
  984. BOTTOMRIGHT = {-6*C["unitframes"].gridscale, 1},
  985. LEFT = {6*C["unitframes"].gridscale, 1},
  986. RIGHT = {-6*C["unitframes"].gridscale, 1},
  987. TOP = {0, 0},
  988. BOTTOM = {0, 0},
  989. }
  990. T.CreateAuraWatchIcon = function(self, icon)
  991. icon:SetTemplate("Default")
  992. icon.icon:Point("TOPLEFT", 1, -1)
  993. icon.icon:Point("BOTTOMRIGHT", -1, 1)
  994. icon.icon:SetTexCoord(.08, .92, .08, .92)
  995. icon.icon:SetDrawLayer("ARTWORK")
  996. if (icon.cd) then
  997. icon.cd:SetReverse()
  998. end
  999. icon.overlay:SetTexture()
  1000. end
  1001. T.createAuraWatch = function(self, unit)
  1002. local auras = CreateFrame("Frame", nil, self)
  1003. auras:SetPoint("TOPLEFT", self.Health, 2, -2)
  1004. auras:SetPoint("BOTTOMRIGHT", self.Health, -2, 2)
  1005. auras.presentAlpha = 1
  1006. auras.missingAlpha = 0
  1007. auras.icons = {}
  1008. auras.PostCreateIcon = T.CreateAuraWatchIcon
  1009. if (not C["unitframes"].auratimer) then
  1010. auras.hideCooldown = true
  1011. end
  1012. local buffs = {}
  1013. if (T.buffids["ALL"]) then
  1014. for key, value in pairs(T.buffids["ALL"]) do
  1015. tinsert(buffs, value)
  1016. end
  1017. end
  1018. if (T.buffids[T.myclass]) then
  1019. for key, value in pairs(T.buffids[T.myclass]) do
  1020. tinsert(buffs, value)
  1021. end
  1022. end
  1023. -- "Cornerbuffs"
  1024. if (buffs) then
  1025. for key, spell in pairs(buffs) do
  1026. local icon = CreateFrame("Frame", nil, auras)
  1027. icon.spellID = spell[1]
  1028. icon.anyUnit = spell[4]
  1029. icon:Width(6*C["unitframes"].gridscale)
  1030. icon:Height(6*C["unitframes"].gridscale)
  1031. icon:SetPoint(spell[2], 0, 0)
  1032. local tex = icon:CreateTexture(nil, "OVERLAY")
  1033. tex:SetAllPoints(icon)
  1034. tex:SetTexture(C.media.blank)
  1035. if (spell[3]) then
  1036. tex:SetVertexColor(unpack(spell[3]))
  1037. else
  1038. tex:SetVertexColor(0.8, 0.8, 0.8)
  1039. end
  1040. local count = icon:CreateFontString(nil, "OVERLAY")
  1041. count:SetFont(C["media"].uffont, 8*C["unitframes"].gridscale, "THINOUTLINE")
  1042. count:SetPoint("CENTER", unpack(T.countOffsets[spell[2]]))
  1043. icon.count = count
  1044. auras.icons[spell[1]] = icon
  1045. end
  1046. end
  1047. self.AuraWatch = auras
  1048. end
  1049. if C["unitframes"].raidunitdebuffwatch == true then
  1050. -- Classbuffs { spell ID, position [, {r,g,b,a}][, anyUnit] }
  1051. -- For oUF_AuraWatch
  1052. do
  1053. T.buffids = {
  1054. PRIEST = {
  1055. {6788, "TOPLEFT", {1, 0, 0}, true}, -- Weakened Soul
  1056. {33076, "TOPRIGHT", {0.2, 0.7, 0.2}}, -- Prayer of Mending
  1057. {139, "BOTTOMLEFT", {0.4, 0.7, 0.2}}, -- Renew
  1058. {17, "BOTTOMRIGHT", {0.81, 0.85, 0.1}, true}, -- Power Word: Shield
  1059. },
  1060. DRUID = {
  1061. {774, "TOPLEFT", {0.8, 0.4, 0.8}}, -- Rejuvenation
  1062. {8936, "TOPRIGHT", {0.2, 0.8, 0.2}}, -- Regrowth
  1063. {33763, "BOTTOMLEFT", {0.4, 0.8, 0.2}}, -- Lifebloom
  1064. {48438, "BOTTOMRIGHT", {0.8, 0.4, 0}}, -- Wild Growth
  1065. },
  1066. PALADIN = {
  1067. {53563, "TOPLEFT", {0.7, 0.3, 0.7}}, -- Beacon of Light
  1068. },
  1069. SHAMAN = {
  1070. {61295, "TOPLEFT", {0.7, 0.3, 0.7}}, -- Riptide
  1071. {51945, "TOPRIGHT", {0.2, 0.7, 0.2}}, -- Earthliving
  1072. {16177, "BOTTOMLEFT", {0.4, 0.7, 0.2}}, -- Ancestral Fortitude
  1073. {974, "BOTTOMRIGHT", {0.7, 0.4, 0}, true}, -- Earth Shield
  1074. },
  1075. ALL = {
  1076. {14253, "RIGHT", {0, 1, 0}}, -- Abolish Poison
  1077. {23333, "LEFT", {1, 0, 0}}, -- Warsong flag xD
  1078. },
  1079. }
  1080. end
  1081. local _, ns = ...
  1082. -- Raid debuffs (now using it with oUF_RaidDebuff instead of oUF_Aurawatch)
  1083. do
  1084. local ORD = ns.oUF_RaidDebuffs or oUF_RaidDebuffs
  1085. if not ORD then return end
  1086. ORD.ShowDispelableDebuff = true
  1087. ORD.FilterDispellableDebuff = true
  1088. ORD.MatchBySpellName = true
  1089. local function SpellName(id)
  1090. local name, _, _, _, _, _, _, _, _ = GetSpellInfo(id)
  1091. return name
  1092. end
  1093. T.debuffids = {
  1094. -- Other debuff
  1095. SpellName(67479), -- Impale
  1096. --CATA DEBUFFS
  1097. --Baradin Hold
  1098. SpellName(95173), -- Consuming Darkness
  1099. --Blackwing Descent
  1100. --Magmaw
  1101. SpellName(91911), -- Constricting Chains
  1102. SpellName(94679), -- Parasitic Infection
  1103. SpellName(94617), -- Mangle
  1104. --Omintron Defense System
  1105. SpellName(79835), --Poison Soaked Shell
  1106. SpellName(91433), --Lightning Conductor
  1107. SpellName(91521), --Incineration Security Measure
  1108. --Maloriak
  1109. SpellName(77699), -- Flash Freeze
  1110. SpellName(77760), -- Biting Chill
  1111. --Atramedes
  1112. SpellName(92423), -- Searing Flame
  1113. SpellName(92485), -- Roaring Flame
  1114. SpellName(92407), -- Sonic Breath
  1115. --Chimaeron
  1116. SpellName(82881), -- Break
  1117. SpellName(89084), -- Low Health
  1118. --Nefarian
  1119. --Sinestra
  1120. SpellName(92956), --Wrack
  1121. --The Bastion of Twilight
  1122. --Valiona & Theralion
  1123. SpellName(92878), -- Blackout
  1124. SpellName(86840), -- Devouring Flames
  1125. SpellName(95639), -- Engulfing Magic
  1126. --Halfus Wyrmbreaker
  1127. SpellName(39171), -- Malevolent Strikes
  1128. --Twilight Ascendant Council
  1129. SpellName(92511), -- Hydro Lance
  1130. SpellName(82762), -- Waterlogged
  1131. SpellName(92505), -- Frozen
  1132. SpellName(92518), -- Flame Torrent
  1133. SpellName(83099), -- Lightning Rod
  1134. SpellName(92075), -- Gravity Core
  1135. SpellName(92488), -- Gravity Crush
  1136. --Cho'gall
  1137. SpellName(86028), -- Cho's Blast
  1138. SpellName(86029), -- Gall's Blast
  1139. --Throne of the Four Winds
  1140. --Conclave of Wind
  1141. --Nezir <Lord of the North Wind>
  1142. SpellName(93131), --Ice Patch
  1143. --Anshal <Lord of the West Wind>
  1144. SpellName(86206), --Soothing Breeze
  1145. SpellName(93122), --Toxic Spores
  1146. --Rohash <Lord of the East Wind>
  1147. SpellName(93058), --Slicing Gale
  1148. --Al'Akir
  1149. SpellName(93260), -- Ice Storm
  1150. SpellName(93295), -- Lightning Rod
  1151. -- Firelands, thanks Kaelhan :)
  1152. -- Beth'tilac
  1153. SpellName(99506), -- Widows Kiss
  1154. SpellName(97202), -- Fiery Web Spin
  1155. SpellName(49026), -- Fixate
  1156. SpellName(97079), -- Seeping Venom
  1157. -- Lord Rhyolith
  1158. -- none, hehe, fake boss
  1159. -- Alysrazor
  1160. SpellName(101296), -- Fieroblast
  1161. SpellName(100723), -- Gushing Wound
  1162. SpellName(99389), -- Imprinted
  1163. SpellName(101729), -- Blazing Claw
  1164. -- Shannox
  1165. SpellName(99837), -- Crystal Prison
  1166. SpellName(99937), -- Jagged Tear
  1167. -- Baleroc
  1168. SpellName(99256), -- Torment
  1169. SpellName(99403), -- Tormented
  1170. SpellName(99252), -- Blaze of Glory
  1171. SpellName(99516), -- Countdown
  1172. -- Majordomo Staghelm
  1173. SpellName(98450), -- Searing Seeds
  1174. -- Ragnaros
  1175. SpellName(99399), -- Burning Wound
  1176. SpellName(100293), -- Lava Wave
  1177. SpellName(98313), -- Magma Blast
  1178. SpellName(100675), -- Dreadflame
  1179. }
  1180. T.ReverseTimer = {
  1181. [92956] = true, -- Sinestra (Wrack)
  1182. },
  1183. ORD:RegisterDebuffs(T.debuffids)
  1184. end
  1185. end