Advertisement
scrable

Untitled

Oct 15th, 2014
352
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 74.20 KB | None | 0 0
  1. local addon, ns = ...
  2. local cfg = ns.cfg
  3. local tags = ns.tags
  4. local _, playerClass = UnitClass('player')
  5. local _, class = UnitClass('player')
  6.  
  7. local blankTex = "Interface\\Buttons\\WHITE8x8"
  8. local backdrop = {edgeFile = blankTex, edgeSize = 1}
  9. local backdrop2 = {bgFile = blankTex}
  10. --backdrop3 = {bgFile = blankTex, edgeFile = blankTex, edgeSize = 1, insets = { left = -1, right = -1, top = -1, bottom = -1}}
  11. local backdrop3 = {bgFile = blankTex, insets = { left = -1, right = -1, top = -1, bottom = -1}}
  12.  
  13. -- change some colors
  14. local colors = setmetatable({
  15. power = setmetatable({
  16. ["MANA"] = {0.36, 0.45, 0.88},
  17. ["RAGE"] = {0.8, 0.21, 0.31},
  18. ["FUEL"] = {0, 0.55, 0.5},
  19. ["FOCUS"] = {0.71, 0.43, 0.27},
  20. ["ENERGY"] = {0.85, 0.83, 0.35},
  21. ["AMMOSLOT"] = {0.8, 0.6, 0},
  22. ["RUNIC_POWER"] = {0, 0.82, 1},
  23. ["POWER_TYPE_STEAM"] = {0.55, 0.57, 0.61},
  24. ["POWER_TYPE_PYRITE"] = {0.60, 0.09, 0.17},
  25. }, {__index = oUF.colors.power}),
  26. }, {__index = oUF.colors})
  27.  
  28. -- format numbers
  29. function round(num, idp)
  30. if idp and idp > 0 then
  31. local mult = 10^idp
  32. return math.floor(num * mult + 0.5) / mult
  33. end
  34. return math.floor(num + 0.5)
  35. end
  36.  
  37. function CoolNumber(num)
  38. if(num >= 1e6) then
  39. return round(num/1e6,cfg.Numberzzz).."m"
  40. elseif(num >= 1e3) then
  41. return round(num/1e3,cfg.Numberzzz).."k"
  42. else
  43. return num
  44. end
  45. end
  46.  
  47. fs = function(parent, layer, font, fontsiz, outline, r, g, b, justify)
  48. local string = parent:CreateFontString(nil, layer)
  49. string:SetFont(font, fontsiz, outline)
  50. string:SetShadowOffset(0, 0)
  51. string:SetTextColor(r, g, b)
  52. if justify then
  53. string:SetJustifyH(justify)
  54. end
  55. return string
  56. end
  57.  
  58.  
  59. framebd = function(parent, anchor)
  60. local frame = CreateFrame('Frame', nil, parent)
  61. frame:SetFrameStrata('BACKGROUND')
  62. frame:SetPoint('TOPLEFT', anchor, 'TOPLEFT', -4, 4)
  63. frame:SetPoint('BOTTOMRIGHT', anchor, 'BOTTOMRIGHT', 4, -4)
  64. frame:SetBackdrop({
  65. -- edgeFile = 'Interface\\AddOns\\Media\\glowTex', edgeSize = 5,
  66. bgFile = [=[Interface\ChatFrame\ChatFrameBackground]=],
  67. insets = {left = 3, right = 3, top = 3, bottom = 3}})
  68. frame:SetBackdropColor(.05, .05, .05)
  69. frame:SetBackdropBorderColor(0, 0, 0)
  70. return frame
  71. end
  72.  
  73. local fixStatusbar = function(bar)
  74. bar:GetStatusBarTexture():SetHorizTile(false)
  75. bar:GetStatusBarTexture():SetVertTile(false)
  76. end
  77.  
  78. createStatusbar = function(parent, tex, layer, height, width, r, g, b, alpha)
  79. local bar = CreateFrame'StatusBar'
  80. bar:SetParent(parent)
  81. if height then
  82. bar:SetHeight(height)
  83. end
  84. if width then
  85. bar:SetWidth(width)
  86. end
  87. bar:SetStatusBarTexture(tex, layer)
  88. bar:SetStatusBarColor(r, g, b, alpha)
  89. fixStatusbar(bar)
  90. return bar
  91. end
  92.  
  93. -- health update
  94. local PostUpdateHealth = function(Health, unit, min, max)
  95. local self = Health:GetParent()
  96. local d =(round(min/max, 2)*100)
  97. local c = UnitClassification(unit)
  98.  
  99. if(UnitIsDead(unit)) then
  100. Health:SetValue(0)
  101. Health.value:SetText"RIP"
  102. elseif(UnitIsGhost(unit)) then
  103. Health:SetValue(0)
  104. Health.value:SetText"GHO"
  105. elseif(not UnitIsConnected(unit)) then
  106. Health.value:SetText"OFF"
  107. --elseif(UnitIsTapped(unit) and not UnitIsTappedByPlayer(unit)) then
  108. --Health.value:SetText"TPD"
  109. else
  110. Health.value:SetText(CoolNumber(min))
  111. end
  112.  
  113. -- set text color
  114. if(unit) then
  115. if(d <= 35 and d >= 25) then
  116. Health.value:SetTextColor(253/255, 238/255, 80/255)
  117. elseif(d < 25 and d >= 20) then
  118. Health.value:SetTextColor(250/255, 130/255, 0/255)
  119. elseif(d < 20) then
  120. Health.value:SetTextColor(200/255, 20/255, 40/255)
  121. else
  122. Health.value:SetTextColor(unpack(cfg.sndcolor))
  123. end
  124. end
  125. end
  126.  
  127. -- health update transparency mode
  128. local PostUpdateHealthTM = function(Health, unit, min, max)
  129. local self = Health:GetParent()
  130. local d =(round(min/max, 2)*100)
  131. local c = UnitClassification(unit)
  132.  
  133. local HPheight = Health:GetHeight()
  134. self.Health.bg:SetPoint('LEFT', Health:GetStatusBarTexture(), 'RIGHT')
  135. self.Health.bg:SetHeight(HPheight)
  136.  
  137. --[[local htext = fs(self.Health, 'OVERLAY', cfg.NameFont, 8, cfg.FontF, 1, 1, 1)
  138. htext:SetPoint('RIGHT', -2, 0)
  139. htext.frequentUpdates = .1
  140. self:Tag(htext, '[player:hp]')
  141. ]]--
  142. if(UnitIsDead(unit)) then
  143. Health.value:SetText"RIP"
  144. elseif(UnitIsGhost(unit)) then
  145. Health.value:SetText"GHO"
  146. elseif(not UnitIsConnected(unit)) then
  147. Health.value:SetText"OFF"
  148. elseif(UnitIsTapped(unit) and not UnitIsTappedByPlayer(unit)) then
  149. Health.value:SetText"TPD"
  150. elseif(c == 'worldboss') then
  151. Health.value:SetText(CoolNumber(min).." "..(round(min/max, 2)*100))
  152. else
  153. Health.value:SetText(CoolNumber(min))
  154. end
  155.  
  156. -- set health background color
  157. if not cfg.solidHPBGcolor then
  158. local _, class = UnitClass(unit)
  159. local color = CUSTOM_CLASS_COLORS and CUSTOM_CLASS_COLORS[class] or RAID_CLASS_COLORS[class]
  160.  
  161. if UnitIsPlayer(unit) and color then
  162. self.Health.bg:SetVertexColor(color.r, color.g, color.b, 0.9)
  163. else
  164. local r, g, b = UnitSelectionColor(unit)
  165. self.Health.bg:SetVertexColor(r, g, b, 0.9)
  166. end
  167.  
  168. if UnitLevel(unit) == 0 then
  169. self.Health.bg:SetVertexColor(0, 0, 0, 0.5)
  170. elseif UnitIsConnected(unit) ~= 1 then
  171. self.Health.bg:SetVertexColor(0, 0, 0, 0.5)
  172. elseif UnitIsDeadOrGhost(unit) == 1 then
  173. self.Health.bg:SetVertexColor(200/255, 20/255, 40/255, 0.5)
  174. end
  175. else
  176. if UnitIsDeadOrGhost(unit) == 1 then
  177. self.Health.bg:SetVertexColor(200/255, 20/255, 40/255, 0.5)
  178. else
  179. hpBGr, hpBGg, hpBGb = unpack(cfg.hpBGcolor)
  180. self.Health.bg:SetVertexColor(hpBGr, hpBGg, hpBGb, 1)
  181. end
  182. end
  183.  
  184. -- set text color
  185. if(unit) then
  186. if(d <= 35 and d >= 25) then
  187. Health.value:SetTextColor(253/255, 238/255, 80/255)
  188. elseif(d < 25 and d >= 20) then
  189. Health.value:SetTextColor(250/255, 130/255, 0/255)
  190. elseif(d < 20) then
  191. Health.value:SetTextColor(200/255, 20/255, 40/255)
  192. else
  193. Health.value:SetTextColor(unpack(cfg.sndcolor))
  194. end
  195. end
  196. end
  197.  
  198.  
  199.  
  200.  
  201.  
  202. -- power update
  203. local PostUpdatePower = function(Power, unit, min, max)
  204. local dp =(round(min/max, 2)*100)
  205.  
  206. if(min == 0 or max == 0 or not UnitIsConnected(unit)) then
  207. Power.value:SetText()
  208. Power:SetValue(0)
  209. elseif(UnitIsDead(unit) or UnitIsGhost(unit)) then
  210. Power:SetValue(0)
  211. Power.value:SetText()
  212. elseif(unit == "player") then
  213. if(dp < 100) then
  214. Power.value:Show()
  215. Power.value:SetText(CoolNumber(min))
  216. else
  217. Power.value:Hide()
  218. end
  219. else
  220. Power.value:SetText(CoolNumber(min))
  221. end
  222.  
  223. -- color power text by power type
  224. local _, ptype = UnitPowerType(unit)
  225. if(colors.power[ptype]) then
  226. r, g, b = unpack(colors.power[ptype])
  227. end
  228.  
  229. Power.value:SetTextColor(r, g, b)
  230. end
  231.  
  232. local PostUpdatePowerRaid = function(Power, unit)
  233. local powertype, _ = UnitPowerType(unit)
  234. --if powertype ~= SPELL_POWER_MANA then
  235. -- Power:Hide()
  236. --else
  237. Power:Show()
  238.  
  239. end
  240.  
  241. -- custom castbar text (curCastTime/maxCastTime)
  242. local function CustomTimeText(self, duration)
  243. if self.casting then
  244. self.Time:SetFormattedText('%.2f /', (self.max - duration))
  245. self.Time2:SetFormattedText(' %.2f', self.max)
  246. elseif self.channeling then
  247. self.Time:SetFormattedText('%.2f /', duration)
  248. self.Time2:SetFormattedText(' %.2f', self.max)
  249. end
  250. end
  251.  
  252. --------------------
  253. -- aura functions --
  254. --------------------
  255. -- filter some crap
  256. local Whitelist = RaidDebuffs
  257. local CustomFilter = function(icons, unit, icon, name, rank, texture, count, dtype, duration, timeLeft, caster, isStealable, shouldConsolidate, spellID)
  258. if(spellID) then
  259. return true
  260. end
  261. end
  262.  
  263. --[[local CustomFilter = function(icons, ...)
  264. local _, icon, name, _, _, _, _, _, _, caster = ...
  265. local isPlayer
  266. if (caster == 'player' or caster == 'vechicle') then
  267. isPlayer = true
  268. end
  269. if((icons.onlyShowPlayer and isPlayer) or (not icons.onlyShowPlayer and name)) then
  270. icon.isPlayer = isPlayer
  271. icon.owner = caster
  272. return true
  273. end
  274. end]]--
  275.  
  276.  
  277. -- format time
  278. local FormatTime = function(s)
  279. local day, hour, minute = 86400, 3600, 60
  280. if s >= day then
  281. return format("%dd", floor(s/day + 0.5)), s % day
  282. elseif s >= hour then
  283. return format("%dh", floor(s/hour + 0.5)), s % hour
  284. elseif s >= minute then
  285. if s <= minute * 5 then
  286. return format('%d:%02d', floor(s/60), s % minute), s - floor(s)
  287. end
  288. return format("%dm", floor(s/minute + 0.5)), s % minute
  289. elseif s >= minute / 12 then
  290. return floor(s + 0.5), (s * 100 - floor(s * 100))/100
  291. end
  292. return format("%d", s), (s * 100 - floor(s * 100))/100
  293. end
  294.  
  295.  
  296. -- aura timer
  297. local CreateAuraTimer = function(self, elapsed)
  298. self.elapsed = (self.elapsed or 0) + elapsed
  299. if self.elapsed >= 0.1 then
  300. if not self.first then
  301. self.timeLeft = self.timeLeft - self.elapsed
  302. else
  303. self.timeLeft = self.timeLeft - GetTime()
  304. self.first = false
  305. end
  306. if self.timeLeft > 0 then
  307. local time = FormatTime(self.timeLeft)
  308. self.time:SetText(time)
  309. if self.timeLeft < 5 then
  310. self.time:SetTextColor(1, 1, 1)
  311. --elseif self.timeLeft >= 5 and self.timeLeft < cfg.HideAuraTimer then
  312. -- self.time:SetTextColor(unpack(cfg.sndcolor))
  313. ---else
  314. -- self.time:SetText('')
  315. -- self.time:SetTextColor(unpack(cfg.sndcolor))
  316. else
  317. self.time:SetTextColor(1, 1, 1)
  318. end
  319. --else
  320. --self.time:Hide()
  321. end
  322. self.elapsed = 0
  323. end
  324. end
  325.  
  326. -- icon style
  327. local PostCreateIcon = function(Auras, button)
  328. local buttonwidth = button:GetWidth()
  329. button.cd.noOCC = true -- hide OmniCC CDs
  330. button.cd.noCooldownCount = true -- hide CDC CDs
  331. Auras.disableCooldown = true -- hide CD spiral
  332. Auras.showDebuffType = false -- show debuff border type color
  333.  
  334. button.overlay:SetTexture("Interface\\Addons\\rActionButtonStyler\\media\\flash")
  335. button.overlay:SetPoint("TOPLEFT", button.icon, "TOPLEFT", -2, 2)
  336. button.overlay:SetPoint("BOTTOMRIGHT", button.icon, "BOTTOMRIGHT", 2, -2)
  337. button.overlay:SetTexCoord(0, 1, 0, 1)
  338. button.overlay.Hide = function(self) self:SetVertexColor(unpack(cfg.brdcolor)) end
  339. --button.overlay:SetBackground()
  340.  
  341. button.time = button:CreateFontString(nil, 'OVERLAY')
  342. button.time:SetFont(cfg.NumbFont, 8, cfg.fontFNum)
  343. button.time:SetPoint("TOPLEFT", button, 3, -2)
  344. button.time:SetJustifyH('CENTER')
  345. button.time:SetVertexColor(unpack(cfg.sndcolor))
  346.  
  347. button:SetSize(cfg.buSize, cfg.buSize*cfg.buHeightMulti)
  348.  
  349. local count = button.count
  350. count:ClearAllPoints()
  351. count:SetPoint("BOTTOMRIGHT", button, 0, 2)
  352. count:SetFont(cfg.NumbFont, 8, cfg.fontFNum)
  353. count:SetVertexColor(unpack(cfg.sndcolor))
  354.  
  355. button.icon:SetTexCoord(.08, .92, .08, .92)
  356. end
  357.  
  358. -- weapon enchant icon
  359. local function WeapEnchantIcon(self, icon, icons)
  360. local iconwidth = icon:GetWidth()
  361. icon.time = icon:CreateFontString(nil, 'OVERLAY')
  362. icon.time:SetFont(cfg.NumbFont, iconwidth/2.6, cfg.fontFNum)
  363. icon.time:SetPoint("BOTTOM", icon, 0, -2)
  364. icon.time:SetJustifyH('CENTER')
  365. icon.time:SetVertexColor(unpack(cfg.sndcolor))
  366.  
  367. icon.overlay:SetTexture(cfg.Auratex)
  368. icon.overlay:SetTexCoord(0, 1, 0, 1)
  369. icon.overlay:SetVertexColor(unpack(cfg.brdcolor))
  370.  
  371. icon.icon:SetTexCoord(.08, .92, .08, .92)
  372. end
  373.  
  374. local AWIcon = function(AWatch, icon, spellID, name, self)
  375. local count = fs(icon, 'OVERLAY', cfg.aura.font, cfg.aura.fontsize, cfg.aura.fontflag, 1, 1, 1)
  376. count:SetPoint('BOTTOMRIGHT', icon, 5, -5)
  377. icon.count = count
  378. icon.cd:SetReverse(true)
  379. end
  380.  
  381. local createAuraWatch = function(self, unit)
  382. if cfg.aw.enable then
  383. local auras = CreateFrame('Frame', nil, self)
  384. auras:SetAllPoints(self.Health)
  385. auras.onlyShowPresent = cfg.aw.onlyShowPresent
  386. auras.anyUnit = cfg.aw.anyUnit
  387. auras.icons = {}
  388. auras.PostCreateIcon = AWIcon
  389.  
  390. for i, v in pairs(cfg.spellIDs[class]) do
  391. local icon = CreateFrame('Frame', nil, auras)
  392. icon.spellID = v[1]
  393. icon:SetSize(8, 8)
  394. if v[3] then
  395. icon:SetPoint(v[3])
  396. else
  397. icon:SetPoint('BOTTOMLEFT', self.Health, 'BOTTOMRIGHT', -8 * i, 16)
  398. end
  399. icon:SetBackdrop(backdrop_1px)
  400. icon:SetBackdropColor(0, 0, 0, 1)
  401.  
  402. local tex = icon:CreateTexture(nil, 'ARTWORK')
  403. tex:SetAllPoints(icon)
  404. tex:SetTexCoord(.1, .9, .1, .9)
  405. tex:SetTexture(cfg.texture)
  406. tex:SetVertexColor(unpack(v[2]))
  407. icon.icon = tex
  408.  
  409. auras.icons[v[1]] = icon
  410. end
  411. self.AuraWatch = auras
  412. end
  413. end
  414.  
  415. local CreateEnchantTimer = function(self, icons)
  416. for i = 1, 2 do
  417. local icon = icons[i]
  418. if icon.expTime then
  419. icon.timeLeft = icon.expTime - GetTime()
  420. icon.time:Show()
  421. else
  422. icon.time:Hide()
  423. end
  424. icon:SetScript("OnUpdate", CreateAuraTimer)
  425. end
  426. end
  427.  
  428. -- update icon
  429. local PostUpdateIcon
  430. do
  431. local playerUnits = {
  432. player = true,
  433. pet = true,
  434. vehicle = true,
  435. }
  436.  
  437. PostUpdateIcon = function(icons, unit, icon, index, offset, filter, isDebuff)
  438. local name, _, _, _, dtype, duration, expirationTime, unitCaster, _ = UnitAura(unit, index, icon.filter)
  439. local texture = icon.icon
  440.  
  441. if unit == "target" or unit == "focus" then
  442. if duration and duration > 0 and spellID or (playerUnits[icon.owner]) then
  443. icon.time:Show()
  444. icon.timeLeft = expirationTime
  445. icon:SetScript("OnUpdate", CreateAuraTimer)
  446. else
  447. icon.time:Hide()
  448. end
  449. else
  450. if duration and duration > 0 then
  451. icon.time:Show()
  452. icon.timeLeft = expirationTime
  453. icon:SetScript("OnUpdate", CreateAuraTimer)
  454. else
  455. icon.time:Hide()
  456. end
  457. end
  458.  
  459. if unit == "target" or unit == "focus" then
  460. if (playerUnits[icon.owner]) then
  461. if dtype == "Magic" or dtype == "Disease" or dtype == "Poison" or dtype == "Curse" then
  462. local color = DebuffTypeColor[dtype] or DebuffTypeColor.none
  463. icon.overlay:SetVertexColor(color.r*0.9, color.g*0.9, color.b*0.9)
  464. texture:SetDesaturated(false)
  465. end
  466. else
  467. icons.showDebuffType = false
  468. icon.overlay:SetVertexColor(unpack(cfg.brdcolor))
  469. texture:SetDesaturated(false)
  470. end
  471. end
  472.  
  473. icon.first = true
  474. end
  475. end
  476.  
  477. -- right click menu
  478. local dropdown = CreateFrame("Frame", "MyAddOnUnitDropDownMenu", UIParent, "UIDropDownMenuTemplate")
  479. UIDropDownMenu_Initialize(dropdown, function(self)
  480. local unit = self:GetParent().unit
  481. if not unit then return end
  482.  
  483. local menu, name, id
  484. if UnitIsUnit(unit, "player") then
  485. menu = "SELF"
  486. elseif UnitIsUnit(unit, "vehicle") then
  487. menu = "VEHICLE"
  488. elseif UnitIsUnit(unit, "pet") then
  489. menu = "PET"
  490. elseif UnitIsPlayer(unit) then
  491. id = UnitInRaid(unit)
  492. if id then
  493. menu = "RAID_PLAYER"
  494. name = GetRaidRosterInfo(id)
  495. elseif UnitInParty(unit) then
  496. menu = "PARTY"
  497. else
  498. menu = "PLAYER"
  499. end
  500. else
  501. menu = "TARGET"
  502. name = RAID_TARGET_ICON
  503. end
  504. if menu then
  505. UnitPopup_ShowMenu(self, menu, unit, name, id)
  506. end
  507. end, "MENU")
  508.  
  509. local menu = function(self)
  510. dropdown:SetParent(self)
  511. ToggleDropDownMenu(1, nil, dropdown, "cursor", 0, 0)
  512. end
  513.  
  514.  
  515. -- threat highlight
  516. local function updateThreatStatus(self, event, u)
  517. if (self.unit ~= u) then return end
  518. local s = UnitThreatSituation(u)
  519. if s and s > 1 then
  520. local r, g, b = GetThreatStatusColor(s)
  521. self.ThreatHlt:Show()
  522. self.ThreatHlt:SetVertexColor(r, g, b, 1.0)
  523. else
  524. self.ThreatHlt:Hide()
  525. end
  526. end
  527.  
  528. -- debuff highlight
  529. local CanDispel = {
  530. PRIEST = { Magic = true, Disease = false, },
  531. SHAMAN = { Magic = true, Curse = true},
  532. PALADIN = { Magic = true, Poison = true, Disease = true, },
  533. MAGE = { Curse = true, },
  534. DRUID = { Magic = true, Curse = true, Poison = true},
  535. }
  536. local dispellist = CanDispel[playerClass] or {}
  537.  
  538. local function GetDebuffType(unit)
  539. if not UnitCanAssist("player", unit) then return nil end
  540. local i = 1
  541. while true do
  542. local name, rank, texture, count, debufftype, duration, expirationTime, source = UnitDebuff(unit, i)
  543. if not texture then break end
  544. if debufftype and dispellist[debufftype] then
  545. return debufftype
  546. end
  547. i = i + 1
  548. end
  549. end
  550.  
  551. --[[local function updateDispel(self, event, u)
  552. if not u or self.unit ~= u then return end
  553. local debufftype = GetDebuffType(u)
  554. if debufftype then
  555. local color = DebuffTypeColor[debufftype]
  556. self.dHlight:Show()
  557. self.dHlight:SetVertexColor(color.r, color.g, color.b)
  558. self.dHlight2:Show()
  559. self.dHlight2:SetVertexColor(color.r, color.g, color.b)
  560. else
  561. self.dHlight:Hide()
  562. self.dHlight2:Hide()
  563. end
  564. end]]--
  565.  
  566. -- mouseover highlight
  567. local UnitFrame_OnEnter = function(self)
  568. UnitFrame_OnEnter(self)
  569. self.Mouseover:Show()
  570. end
  571.  
  572. local UnitFrame_OnLeave = function(self)
  573. UnitFrame_OnLeave(self)
  574. self.Mouseover:Hide()
  575. end
  576.  
  577. --[[
  578.  
  579. local AWIcon = function(AWatch, icon, spellID, name, self)
  580. local count = fs(icon, 'OVERLAY', cfg.NumbFont, 8, cfg.FontF, 1, 1, 1)
  581. count:SetPoint('BOTTOMRIGHT', icon, 5, -5)
  582. icon.count = count
  583. icon.cd:SetReverse(true)
  584. end
  585.  
  586. --]]
  587.  
  588. -- castbar ticks
  589.  
  590. --[[local channelingTicks = {
  591. [GetSpellInfo(44203)] = 4, -- Tranquility
  592. [GetSpellInfo(16914)] = 10, -- Hurricane
  593. [GetSpellInfo(106996)] = 10,-- Astral Storm
  594. -- Mage
  595. [GetSpellInfo(5143)] = 5, -- Arcane Missiles
  596. [GetSpellInfo(10)] = 8, -- Blizzard
  597. [GetSpellInfo(12051)] = 4, -- Evocation
  598. -- Monk
  599. [GetSpellInfo(115175)] = 9, -- Soothing Mist
  600. -- Priest
  601. [GetSpellInfo(15407)] = 3, -- Mind Flay
  602. [GetSpellInfo(48045)] = 5, -- Mind Sear
  603. -- [GetSpellInfo(129197)],
  604. [GetSpellInfo(47540)] = 2, -- Penance
  605. [GetSpellInfo(64901)] = 4, -- Hymn of Hope
  606. [GetSpellInfo(64843)] = 4, -- Divine Hymn
  607. -- Warlock
  608. [GetSpellInfo(689)] = 6, -- Drain Life
  609. [GetSpellInfo(108371)] = 6, -- Harvest Life
  610. [GetSpellInfo(1120)] = 6, -- Drain Soul
  611. [GetSpellInfo(755)] = 6, -- Health Funnel
  612. [GetSpellInfo(1949)] = 15, -- Hellfire
  613. [GetSpellInfo(5740)] = 4, -- Rain of Fire
  614. [GetSpellInfo(103103)] = 3, -- Malefic Grasp
  615. }
  616.  
  617. local ticks = {}
  618.  
  619. local setBarTicks = function(Castbar, ticknum)
  620. if ticknum and ticknum > 0 then
  621. local delta = Castbar:GetWidth() / ticknum
  622. for k = 1, ticknum do
  623. if not ticks[k] then
  624. ticks[k] = Castbar:CreateTexture(nil, 'OVERLAY')
  625. ticks[k]:SetTexture(cfg.texture)
  626. ticks[k]:SetVertexColor(0.6, 0.6, 0.6)
  627. ticks[k]:SetWidth(1)
  628. ticks[k]:SetHeight(21)
  629. end
  630. ticks[k]:ClearAllPoints()
  631. ticks[k]:SetPoint('CENTER', Castbar, 'LEFT', delta * k, 0 )
  632. ticks[k]:Show()
  633. end
  634. else
  635. for k, v in pairs(ticks) do
  636. v:Hide()
  637. end
  638. end
  639. end]]--
  640.  
  641. -- hide/show unitname/spellname while casting
  642. local PostCastStart = function(Castbar, unit, spell, spellrank)
  643. Castbar:GetParent().Name:Hide()
  644. Castbar:GetParent().Status:Hide()
  645.  
  646. --[[if unit == 'player' then
  647. local sf = Castbar.SafeZone
  648. if not sf then return end
  649. if not sf.sendTime then sf.sendTime = GetTime() end
  650. sf.timeDiff = GetTime() - sf.sendTime
  651. sf.timeDiff = sf.timeDiff > self.max and self.max or sf.timeDiff
  652. sf:SetWidth(self:GetWidth() * sf.timeDiff / self.max)
  653. if not UnitInVehicle('player') then sf:Show() else sf:Hide() end
  654. if self.casting then
  655. setBarTicks(self, 0)
  656. else
  657. local spell = UnitChannelInfo(unit)
  658. self.channelingTicks = channelingTicks[spell] or 0
  659. setBarTicks(self, self.channelingTicks)
  660. end
  661. end]]--
  662.  
  663. if Castbar.interrupt and UnitCanAttack("player", unit) then
  664. --self.Shield:Show()
  665. Castbar:SetStatusBarColor(1, 1, 0, 1)
  666. if cfg.useSpellIcon then
  667. Castbar.IconGlow:SetBackdropColor(0.9, 0, 1.0, 0.6)
  668. end
  669. else if unit == "player" then
  670. local cbR, cbG, cbB = unpack(cfg.trdcolor)
  671. Castbar:SetStatusBarColor(cbR, cbG, cbB, 1)
  672. if cfg.useSpellIcon then
  673. Castbar.IconGlow:SetBackdropColor(unpack(cfg.brdcolor))
  674. end
  675. else
  676. local cbbR, cbbG, cbbB = unpack(cfg.enemycast)
  677. Castbar:SetStatusBarColor(cbbR, cbbG, cbbB, 1)
  678. if cfg.useSpellIcon then
  679. Castbar.IconGlow:SetBackdropColor(unpack(cfg.brdcolor))
  680. end
  681. end
  682. end
  683. end
  684.  
  685. local PostCastStop = function(Castbar, unit)
  686. local self = Castbar:GetParent()
  687. self.Name:Show()
  688. self.Status:Show()
  689. end
  690.  
  691. local PostCastStopUpdate = function(self, event, unit)
  692. if(unit ~= self.unit) then return end
  693. return PostCastStop(self.Castbar, unit)
  694. end
  695.  
  696. -- skin mirror bars
  697. function MirrorBars()
  698. if(MirrorBars) then
  699. for _, bar in pairs({
  700. 'MirrorTimer1',
  701. 'MirrorTimer2',
  702. 'MirrorTimer3',
  703. }) do
  704. local bg = select(1, _G[bar]:GetRegions())
  705. bg:Hide()
  706.  
  707. _G[bar]:SetBackdrop(backdrop3)
  708. _G[bar]:SetBackdropColor(unpack(cfg.brdcolor))
  709.  
  710. _G[bar..'Border']:Hide()
  711.  
  712. _G[bar]:SetParent(UIParent)
  713. _G[bar]:SetScale(1)
  714. _G[bar]:SetHeight(4)
  715. _G[bar]:SetWidth(160)
  716.  
  717. _G[bar..'Background'] = _G[bar]:CreateTexture(bar..'Background', 'BACKGROUND', _G[bar])
  718. _G[bar..'Background']:SetTexture(blankTex)
  719. _G[bar..'Background']:SetAllPoints(_G[bar])
  720. _G[bar..'Background']:SetVertexColor(0, 0, 0, 0.5)
  721.  
  722. _G[bar..'Text']:SetFont(cfg.NameFont, cfg.NameFS, cfg.FontF)
  723. _G[bar..'Text']:ClearAllPoints()
  724. _G[bar..'Text']:SetPoint('TOP', MirrorTimer1StatusBar, 'BOTTOM', 0, -2)
  725.  
  726. _G[bar..'StatusBar']:SetStatusBarTexture(cfg.HPtex)
  727.  
  728. _G[bar..'StatusBar']:SetAllPoints(_G[bar])
  729. end
  730. end
  731. end
  732.  
  733. --------------------------------
  734. -- shared stuff for all units --
  735. --------------------------------
  736. local Shared = function(self, unit, isSingle)
  737. local _, playerClass = UnitClass('player')
  738.  
  739. self.menu = menu
  740. self:SetAttribute("*type2", "menu")
  741.  
  742. self:SetScript("OnEnter", UnitFrame_OnEnter)
  743. self:SetScript("OnLeave", UnitFrame_OnLeave)
  744.  
  745. self:RegisterForClicks"AnyUp"
  746.  
  747. -- set/clear focus with shift + left click
  748.  
  749. if cfg.ShiftClickFocus then
  750. local ModKey = 'Shift'
  751. local MouseButton = 1
  752. local key = ModKey .. '-type' .. (MouseButton or '')
  753. if(self.unit == 'focus') then
  754. self:SetAttribute(key, 'macro')
  755. self:SetAttribute('macrotext', '/clearfocus')
  756. else
  757. self:SetAttribute(key, 'focus')
  758. end
  759. end
  760.  
  761. if cfg.HideBlizzardAuras == true then
  762. -- hide blizzard buff, debuff and weapon enchant frame
  763. local BlizzFrame = _G['BuffFrame']
  764. BlizzFrame:UnregisterEvent('UNIT_AURA')
  765. BlizzFrame:Hide()
  766. BlizzFrame = _G['TemporaryEnchantFrame']
  767. BlizzFrame:Hide()
  768. end
  769.  
  770. -- hp
  771. local hp = CreateFrame("StatusBar", nil, self)
  772. hp:SetHeight(cfg.heightHP)
  773. hp:SetStatusBarTexture(cfg.HPtex)
  774. hp:SetPoint"TOP"
  775. hp:SetPoint"LEFT"
  776. hp:SetPoint"RIGHT"
  777. hp:GetStatusBarTexture():SetHorizTile(true)
  778. hp:SetFrameLevel(3)
  779. hp.frequentUpdates = true
  780. hp.Smooth = true
  781. self.Health = hp
  782.  
  783. if cfg.TransparencyMode then
  784. local tmR, tmG, tmB = unpack(cfg.hpTransMcolor)
  785. hp:SetStatusBarColor(tmR, tmG, tmB, cfg.hpTransMalpha)
  786.  
  787. self.Health.PostUpdate = PostUpdateHealthTM
  788. else
  789. hp.colorTapping = true
  790. hp.colorClass = true
  791. hp.colorReaction = true
  792.  
  793. self.Health.PostUpdate = PostUpdateHealth
  794. end
  795.  
  796. -- hp border
  797. self.Glow = CreateFrame("Frame", nil, hp)
  798. self.Glow:SetPoint("TOPLEFT", hp, "TOPLEFT", -1, 1)
  799. self.Glow:SetPoint("BOTTOMRIGHT", hp, "BOTTOMRIGHT", 1, -1)
  800. self.Glow:SetBackdrop(backdrop)
  801. self.Glow:SetBackdropBorderColor(unpack(cfg.brdcolor))
  802. self.Glow:SetFrameLevel(3)
  803.  
  804. local Framewidth = self:GetWidth()
  805.  
  806. -- hp bg
  807. hpbg = hp:CreateTexture(nil, "BACKGROUND")
  808. hpbg:SetTexture(cfg.Itex)
  809. hp.bg = hpbg
  810.  
  811. if cfg.TransparencyMode then
  812. hpbg:SetPoint"LEFT"
  813. hpbg:SetPoint"RIGHT"
  814. hpbg:SetPoint("LEFT", hp:GetStatusBarTexture(), "RIGHT")
  815. else
  816. hpbg:SetAllPoints(hp)
  817. hpbg:SetAlpha(0.6)
  818. hpbg.multiplier = 0.4
  819. end
  820.  
  821. -- pp
  822. local pp = CreateFrame("StatusBar", nil, self)
  823. pp:SetSize(cfg.widthP, cfg.heightPP)
  824. pp:SetStatusBarTexture(cfg.PPtex)
  825. pp:SetPoint("TOPLEFT", self.Health, "BOTTOMLEFT", 0, -cfg.PPyOffset)
  826. pp:GetStatusBarTexture():SetHorizTile(true)
  827. pp:SetFrameLevel(1)
  828.  
  829. pp.frequentUpdates = true
  830. pp.colorPower = false
  831. self.Power = pp
  832. self.Power.PostUpdate = PostUpdatePower
  833.  
  834. self.Power.Smooth = false
  835. self.Power.colorPower = false
  836. self.Power.colorClass = true
  837.  
  838. -- pp border
  839. self.Glow.pp = CreateFrame("Frame", nil, pp)
  840. self.Glow.pp:SetPoint("TOPLEFT", pp, "TOPLEFT", -1, 1)
  841. self.Glow.pp:SetPoint("BOTTOMRIGHT", pp, "BOTTOMRIGHT", 1, -1)
  842. self.Glow.pp:SetBackdrop(backdrop)
  843. self.Glow.pp:SetBackdropBorderColor(unpack(cfg.brdcolor))
  844. self.Glow.pp:SetFrameLevel(1)
  845.  
  846. -- pp bg
  847. local ppBG = pp:CreateTexture(nil, 'BORDER')
  848. ppBG:SetAllPoints()
  849. ppBG:SetTexture(cfg.Itex)
  850. ppBG.multiplier = 0.4
  851. ppBG:SetAlpha(0.5)
  852. pp.bg = ppBG
  853.  
  854. if cfg.TransparencyMode then
  855. pp:SetAlpha(0.8)
  856. else
  857. pp:SetAlpha(1)
  858. end
  859.  
  860. -- enable custom colors
  861. self.colors = colors
  862.  
  863. -- font strings
  864. self.Health.value = hp:CreateFontString(nil, "OVERLAY")
  865. self.Health.value:SetFont(cfg.NumbFont, cfg.hpNumbFS, cfg.fontFNum)
  866.  
  867. self.Power.value = hp:CreateFontString(nil, "OVERLAY")
  868. self.Power.value:SetFont(cfg.NumbFont, cfg.NumbFS, cfg.fontFNum)
  869.  
  870. self.Name = hp:CreateFontString(nil, "OVERLAY")
  871. self.Name:SetFont(cfg.NameFont, cfg.NameFS, cfg.FontF)
  872. self:Tag(self.Name, '[raidcolor][abbrevname]')
  873.  
  874. self.Status = hp:CreateFontString(nil, "OVERLAY")
  875. self.Status:SetFont(cfg.NameFont, cfg.NameFS, cfg.FontF)
  876. self:Tag(self.Status, '[afkdnd][difficulty][smartlevel] ')
  877.  
  878. -- mouseover highlight
  879. local mov = self.Health:CreateTexture(nil, "OVERLAY")
  880. mov:SetAllPoints(self.Health)
  881. mov:SetTexture("Interface\\AddOns\\dMedia\\highlight")
  882. mov:SetVertexColor(1, 1, 1, 0.3)
  883. mov:SetTexCoord(0,1,1,0)
  884. mov:SetBlendMode("ADD")
  885. mov:Hide()
  886. self.Mouseover = mov
  887.  
  888. -- debuff highlight
  889. --local dHlight = self.Health:CreateTexture(nil, "OVERLAY")
  890. --dHlight:SetSize(64,16)
  891. --dHlight:SetPoint("TOPLEFT", self.Health, -4, 4)
  892. --dHlight:SetTexture("Interface\\AddOns\\dMedia\\dHlight")
  893. --dHlight:Hide()
  894. --self.dHlight = dHlight
  895.  
  896. --local dHlight2 = self.Health:CreateTexture(nil, "OVERLAY")
  897. --dHlight2:SetSize(64,16)
  898. --dHlight2:SetPoint("TOPRIGHT", self.Health, 4, 4)
  899. --dHlight2:SetTexture("Interface\\AddOns\\dMedia\\dHlight")
  900. --dHlight2:SetTexCoord(1,0,0,1)
  901. --dHlight2:Hide()
  902. --self.dHlight2 = dHlight2
  903.  
  904. -- threat highlight
  905. --local Thrt = self.Health:CreateTexture(nil, "OVERLAY")
  906. --Thrt:SetPoint("TOPLEFT", self.Health, 1/5, 3)
  907. --Thrt:SetPoint("TOPRIGHT", self.Health, -1/5, 3)
  908. --Thrt:SetHeight(2)
  909. --Thrt:SetTexture("Interface\\AddOns\\dMedia\\threat")
  910. --Thrt:Hide()
  911. --self.ThreatHlt = Thrt
  912.  
  913. -- update threat
  914. --self:RegisterEvent("UNIT_THREAT_LIST_UPDATE", updateThreatStatus)
  915. --self:RegisterEvent("UNIT_THREAT_SITUATION_UPDATE", updateThreatStatus)
  916. end
  917.  
  918. ----------------------
  919. -- object functions --
  920. ----------------------
  921.  
  922. -- castbar
  923. local createCastbar = function(self, unit)
  924. local cb = CreateFrame("StatusBar", nil, self)
  925. cb:SetStatusBarTexture(cfg.CBtex)
  926. cb:GetStatusBarTexture():SetHorizTile(true)
  927. cb:SetFrameLevel(4)
  928.  
  929. self.Castbar = cb
  930.  
  931. cb.Text = cb:CreateFontString(nil, 'ARTWORK')
  932. cb.Text:SetJustifyH("LEFT")
  933. cb.Text:SetFont(cfg.NameFont, cfg.CastFS, cfg.FontF)
  934. cb.Text:SetTextColor(unpack(cfg.sndcolor))
  935.  
  936. cb.Time = cb:CreateFontString(nil, 'ARTWORK')
  937. cb.Time:SetFont(cfg.NumbFont, cfg.CastFS, cfg.fontFNum)
  938. cb.Time:SetJustifyH('RIGHT')
  939. cb.Time:SetTextColor(unpack(cfg.sndcolor))
  940.  
  941. cb.Time2 = cb:CreateFontString(nil, 'ARTWORK')
  942. cb.Time2:SetFont(cfg.NumbFont, cfg.CastFS, cfg.fontFNum)
  943. cb.Time2:SetJustifyH('RIGHT')
  944. cb.Time2:SetTextColor(unpack(cfg.sndcolor))
  945.  
  946. cb.CustomTimeText = CustomTimeText
  947.  
  948. if cfg.useSpellIcon then
  949. cb.Icon = cb:CreateTexture(nil, 'OVERLAY')
  950. cb.Icon:SetSize(28,28)
  951. cb.Icon:SetTexCoord(0.1,0.9,0.1,0.9)
  952.  
  953. cb.IconGlow = CreateFrame("Frame", nil, cb)
  954. cb.IconGlow:SetPoint("TOPLEFT", cb.Icon, "TOPLEFT", -1, 1)
  955. cb.IconGlow:SetPoint("BOTTOMRIGHT", cb.Icon, "BOTTOMRIGHT", 1, -1)
  956. cb.IconGlow:SetBackdrop(backdrop2)
  957. cb.IconGlow:SetBackdropColor(unpack(cfg.brdcolor))
  958. cb.IconGlow:SetFrameLevel(0)
  959. end
  960.  
  961. cb.Spark = cb:CreateTexture(nil, 'OVERLAY')
  962. cb.Spark:SetBlendMode('ADD')
  963. cb.Spark:SetSize(6, cfg.heightP*2.5)
  964.  
  965. self:RegisterEvent('UNIT_NAME_UPDATE', PostCastStopUpdate)
  966. table.insert(self.__elements, PostCastStopUpdate)
  967.  
  968. cb.PostCastStart = PostCastStart
  969. cb.PostChannelStart = PostCastStart
  970. cb.PostCastStop = PostCastStop
  971. cb.PostChannelStop = PostCastStop
  972. end
  973.  
  974. -- buffs
  975. local createBuffs = function(self)
  976. local Buffs = CreateFrame("Frame", nil, self)
  977. Buffs.num = 40
  978. Buffs.spacing = 2
  979. Buffs.size = cfg.buSize
  980.  
  981. self.Buffs = Buffs
  982.  
  983. Buffs.PostCreateIcon = PostCreateIcon
  984. Buffs.PostUpdateIcon = PostUpdateIcon
  985. end
  986.  
  987. -- debuffs
  988. local createDebuffs = function(self)
  989. local Debuffs = CreateFrame("Frame", nil, self)
  990. Debuffs.spacing = 2
  991. Debuffs.size = cfg.buSize
  992.  
  993. self.Debuffs = Debuffs
  994.  
  995. Debuffs.PostCreateIcon = PostCreateIcon
  996. Debuffs.PostUpdateIcon = PostUpdateIcon
  997. end
  998.  
  999. -- phase icon
  1000. local createPhaseIcon = function(self)
  1001. local pIcon = self.Health:CreateTexture(nil, 'OVERLAY')
  1002. pIcon:SetSize(18, 18)
  1003. self.PhaseIcon = pIcon
  1004. end
  1005.  
  1006. -- quest icon
  1007. --[[local createQuestIcon = function(self)
  1008. local qIcon = self.Health:CreateTexture(nil, 'OVERLAY')
  1009. qIcon:SetSize(18, 18)
  1010. self.QuestIcon = qIcon
  1011. end]]--
  1012.  
  1013. local createQuestIcon = function(self)
  1014. local q = fs(self.Health, 'OVERLAY', cfg.NumbFont, 12, cfg.FontF, 1, 1, 1)
  1015. q:SetPoint('LEFT', name, 'RIGHT', 1, 0)
  1016. q:SetText('|cff8AFF30!|r')
  1017. self.QuestIcon = q
  1018. end
  1019.  
  1020. -- raid icons
  1021. local createRaidIcon = function(self)
  1022. RI = self.Health:CreateTexture(nil, "OVERLAY")
  1023. RI:SetTexture("Interface\\AddOns\\dMedia\\raidicons.blp")
  1024. RI:SetSize(20, 20)
  1025. self.RaidIcon = RI
  1026. end
  1027.  
  1028. -- class (healer) specific tags
  1029. local classTags = function(self)
  1030. local PriestTags = "[NivPWS] [NivRenew] [NivPoM] [NivGS] [NivFW]"
  1031. local PaladinTags = "[NivBoL]"
  1032. local DruidTags = "[NivRej] [NivReg] [NivLB] [NivWG] [NivInn]"
  1033. local ShamanTags = "[NivES] [NivRipT] [NivErLiv]"
  1034.  
  1035. self.Text = self.Health:CreateFontString(nil, "ARTWORK")
  1036. self.Text:SetFont(cfg.NumbFont, cfg.RaidFS, cfg.fontFNum)
  1037. self.Text:SetTextColor(unpack(cfg.sndcolor))
  1038. --self.Text:SetPoint("TOPLEFT", self.Health, "TOPLEFT", cfg.widthR*0.3, 2)
  1039. self.Text:SetPoint("TOPLEFT", self.Health, "TOPLEFT", 1, 2)
  1040. self.Text:SetPoint("BOTTOMRIGHT", self.Health, "BOTTOMRIGHT", -1, 0)
  1041.  
  1042. if playerClass == "PRIEST" then
  1043. self:Tag(self.Text, PriestTags)
  1044. elseif playerClass == "PALADIN" then
  1045. self:Tag(self.Text, PaladinTags)
  1046. elseif playerClass == "DRUID" then
  1047. self:Tag(self.Text, DruidTags)
  1048. elseif playerClass == "SHAMAN" then
  1049. self:Tag(self.Text, ShamanTags)
  1050. else
  1051. self:Tag(self.Text, " ")
  1052. end
  1053. end
  1054.  
  1055. -- plugin support
  1056. local SpellRange = function(self)
  1057. if IsAddOnLoaded("oUF_SpellRange") then
  1058. self.SpellRange = {
  1059. insideAlpha = 1,
  1060. outsideAlpha = cfg.FadeOutAlpha}
  1061. end
  1062. end
  1063.  
  1064. local CombatFeedback = function(self)
  1065. if IsAddOnLoaded("oUF_CombatFeedback") then
  1066. local cbft = self.Health:CreateFontString(nil, "ARTWORK")
  1067. cbft:SetPoint("CENTER", self.Health, "CENTER", 0, 0)
  1068. self.CombatFeedbackText = cbft
  1069. self.CombatFeedbackText:SetFont(cfg.NumbFont, cfg.NumbFS, cfg.fontFNum)
  1070. end
  1071. end
  1072.  
  1073. local BarFader = function(self)
  1074. if IsAddOnLoaded("oUF_BarFader") then
  1075. self.BarFade = true
  1076. self.BarFaderMinAlpha = cfg.BarFadeAlpha
  1077. end
  1078. end
  1079.  
  1080. local HealComm4 = function(self)
  1081. if IsAddOnLoaded("oUF_HealComm4") then
  1082. HCB = CreateFrame('StatusBar', nil, self.Health)
  1083. HCB:SetStatusBarTexture(cfg.HPtex)
  1084. HCB:SetStatusBarColor(0, 0.8, 0, 0.5)
  1085. HCB:SetPoint('LEFT', self.Health, 'LEFT')
  1086. self.HealCommBar = HCB
  1087. self.allowHealCommOverflow = false
  1088. self.HealCommOthersOnly = true
  1089. end
  1090. end
  1091.  
  1092. local WeaponEnchant = function(self)
  1093. if IsAddOnLoaded("oUF_WeaponEnchant") then
  1094. self.Enchant = CreateFrame("Frame", nil, self)
  1095. self.Enchant:SetSize(cfg.WeapEnchantIconSize * 2, cfg.WeapEnchantIconSize)
  1096. self.Enchant:SetPoint("TOPRIGHT", self, 0, 0)
  1097. self.Enchant.size = cfg.WeapEnchantIconSize
  1098. self.Enchant.spacing = 2
  1099. self.Enchant.initialAnchor = "TOPRIGHT"
  1100. self.Enchant["growth-x"] = "LEFT"
  1101. self.Enchant:SetFrameLevel(10)
  1102. self.PostCreateEnchantIcon = WeapEnchantIcon
  1103. self.PostUpdateEnchantIcons = CreateEnchantTimer
  1104. end
  1105. end
  1106.  
  1107. local TotemBar = function(self)
  1108. if IsAddOnLoaded("oUF_TotemBar") then
  1109. self.TotemBar = {}
  1110. for i = 1, 4 do
  1111. self.TotemBar[i] = CreateFrame("StatusBar", nil, self)
  1112. self.TotemBar[i]:SetHeight(cfg.ClassBarHeight)
  1113. self.TotemBar[i]:SetWidth(((cfg.widthP - 9)/4))
  1114. if (i == 1) then
  1115. self.TotemBar[i]:SetPoint("BOTTOMLEFT", self, "TOPLEFT", 0, 4)
  1116. else
  1117. self.TotemBar[i]:SetPoint("TOPLEFT", self.TotemBar[i-1], "TOPRIGHT", 3, 0)
  1118. end
  1119. self.TotemBar[i]:SetStatusBarTexture(cfg.Itex)
  1120. self.TotemBar[i]:SetMinMaxValues(0, 1)
  1121. self.TotemBar[i].destroy = true
  1122.  
  1123. self.TotemBar[i].bg = self.TotemBar[i]:CreateTexture(nil, "BORDER")
  1124. self.TotemBar[i].bg:SetAllPoints(self.TotemBar[i])
  1125. self.TotemBar[i].bg:SetTexture(cfg.Itex)
  1126. self.TotemBar[i].bg.multiplier = 0.3
  1127. self.TotemBar[i].bg:SetAlpha(1.0)
  1128.  
  1129. self.TotemBarBorder = CreateFrame("Frame", nil, self)
  1130. self.TotemBarBorder:SetPoint("TOPLEFT", self.TotemBar[i], "TOPLEFT", -1, 1)
  1131. self.TotemBarBorder:SetPoint("BOTTOMRIGHT", self.TotemBar[i], "BOTTOMRIGHT", 1, -1)
  1132. self.TotemBarBorder:SetBackdrop(backdrop2)
  1133. self.TotemBarBorder:SetBackdropColor(unpack(cfg.brdcolor))
  1134. self.TotemBarBorder:SetFrameLevel(0)
  1135. end
  1136. end
  1137. end
  1138.  
  1139.  
  1140.  
  1141. -------------------------
  1142. -- unit specific stuff --
  1143. -------------------------
  1144. local UnitSpecific = {
  1145. player = function(self, ...)
  1146. Shared(self, ...)
  1147. MirrorBars()
  1148.  
  1149. if cfg.useCastbar then
  1150. createCastbar(self)
  1151.  
  1152. -- disable blizzards pet castbar
  1153. PetCastingBarFrame:UnregisterAllEvents()
  1154. PetCastingBarFrame.Show = function() end
  1155. PetCastingBarFrame:Hide()
  1156.  
  1157. self.Castbar:SetAllPoints(self.Health)
  1158. self.Castbar.Text:SetPoint("TOPLEFT", self.Power, "BOTTOMLEFT", 0, -2)
  1159. self.Castbar.Time:SetPoint("BOTTOMLEFT", self.Castbar.Text, "BOTTOMRIGHT", 2, 0)
  1160. self.Castbar.Time2:SetPoint("BOTTOMLEFT", self.Castbar.Time, "BOTTOMRIGHT", 0, 0)
  1161.  
  1162. if cfg.useSpellIcon then
  1163. if not cfg.PlayerRightSideSpellIcon then
  1164. self.Castbar.Icon:SetPoint("TOPRIGHT", self.Health, "TOPLEFT", -4, 0)
  1165. else
  1166. self.Castbar.Icon:SetPoint("TOPLEFT", self.Health, "TOPRIGHT", 4, 0)
  1167. end
  1168. end
  1169. end
  1170.  
  1171. --self.Health.value:SetPoint("TOPRIGHT", self.Power, "BOTTOMRIGHT", 0, -2)
  1172.  
  1173.  
  1174. self.Health:SetHeight(cfg.heightP)
  1175. self.Health:SetWidth(cfg.widthP)
  1176. --self.Health:Tag(htext, '[player:hp]')
  1177. self.Power:SetWidth(cfg.widthP)
  1178. local htext = fs(self.Health, 'OVERLAY', cfg.NameFont, 8, cfg.FontF, 1, 1, 1)
  1179. htext:SetPoint('RIGHT', 2, -19)
  1180. htext.frequentUpdates = .1
  1181. self:Tag(htext, '[player:hp]')
  1182. self.Power.value:SetPoint("TOPRIGHT", htext, "BOTTOMRIGHT", 0, -2)
  1183.  
  1184. -- Icons
  1185. local Ihld = CreateFrame("Frame", nil, self)
  1186. Ihld:SetAllPoints(self.Health)
  1187. Ihld:SetFrameLevel(6)
  1188.  
  1189. createRaidIcon(self)
  1190. self.RaidIcon:SetPoint("RIGHT", self.Health, "RIGHT", -4, 0)
  1191. self.RaidIcon:SetParent(Ihld)
  1192.  
  1193. RIc = Ihld:CreateTexture(nil, 'OVERLAY')
  1194. RIc:SetSize(14, 14)
  1195. RIc:SetPoint("TOPLEFT", self.Health, 4, 6)
  1196. self.Resting = RIc
  1197.  
  1198. CIc = Ihld:CreateTexture(nil, 'OVERLAY')
  1199. CIc:SetSize(16, 16)
  1200. CIc:SetPoint("LEFT", RIc, "RIGHT", 4, 0)
  1201. self.Combat = CIc
  1202.  
  1203. LIc = Ihld:CreateTexture(nil, "OVERLAY")
  1204. LIc:SetSize(14, 14)
  1205. LIc:SetPoint("LEFT", CIc, "RIGHT", 4, 0)
  1206. self.Leader = LIc
  1207.  
  1208. MLIc = Ihld:CreateTexture(nil, 'OVERLAY')
  1209. MLIc:SetSize(14, 14)
  1210. MLIc:SetPoint("LEFT", LIc, "RIGHT", 4, 0)
  1211. self.MasterLooter = MLIc
  1212.  
  1213. -- plugins
  1214. CombatFeedback(self)
  1215. BarFader(self)
  1216.  
  1217. -- TotemBar
  1218. if playerClass == "SHAMAN" then
  1219. TotemBar(self)
  1220. end
  1221.  
  1222. if playerClass =="DEATHKNIGHT" then
  1223. self.Runes = CreateFrame("Frame", nil, self)
  1224. for i = 1, 6 do
  1225. self.Runes[i] = CreateFrame("StatusBar", self:GetName().."_Runes"..i, self)
  1226. self.Runes[i]:SetHeight(cfg.ClassBarHeight)
  1227. self.Runes[i]:SetWidth((cfg.widthP - 15) / 6)
  1228. if (i == 1) then
  1229. self.Runes[i]:SetPoint("BOTTOMLEFT", self, "TOPLEFT", 0, 4)
  1230. else
  1231. self.Runes[i]:SetPoint("TOPLEFT", self.Runes[i-1], "TOPRIGHT", 3, 0)
  1232. end
  1233. self.Runes[i]:SetStatusBarTexture(cfg.HPtex)
  1234.  
  1235. self.Runes[i].bg = self.Runes[i]:CreateTexture(nil, "BORDER")
  1236. self.Runes[i].bg:SetPoint("TOPLEFT", self.Runes[i], "TOPLEFT", -0, 0)
  1237. self.Runes[i].bg:SetPoint("BOTTOMRIGHT", self.Runes[i], "BOTTOMRIGHT", 0, -0)
  1238. self.Runes[i].bg:SetTexture(cfg.Itex)
  1239. self.Runes[i].bg.multiplier = 0.34
  1240.  
  1241. self.RunesBorder = CreateFrame("Frame", nil, self)
  1242. self.RunesBorder:SetPoint("TOPLEFT", self.Runes[i], "TOPLEFT", -1, 1)
  1243. self.RunesBorder:SetPoint("BOTTOMRIGHT", self.Runes[i], "BOTTOMRIGHT", 1, -1)
  1244. self.RunesBorder:SetBackdrop(backdrop2)
  1245. self.RunesBorder:SetBackdropColor(unpack(cfg.brdcolor))
  1246. self.RunesBorder:SetFrameLevel(0)
  1247. end
  1248. end
  1249.  
  1250. --[[if playerClass == 'DRUID' then
  1251. local eclipseBar = CreateFrame('Frame', nil, self)
  1252. eclipseBar:SetPoint("BOTTOMLEFT", self, "TOPLEFT", 0, 4)
  1253. eclipseBar:SetSize(cfg.widthP, cfg.ClassBarHeight)
  1254.  
  1255. eclipseBar.Border = CreateFrame("Frame", nil, eclipseBar)
  1256. eclipseBar.Border:SetPoint("TOPLEFT", eclipseBar, "TOPLEFT", -1, 1)
  1257. eclipseBar.Border:SetPoint("BOTTOMRIGHT", eclipseBar, "BOTTOMRIGHT", 1, -1)
  1258. eclipseBar.Border:SetBackdrop(backdrop2)
  1259. eclipseBar.Border:SetBackdropColor(unpack(cfg.brdcolor))
  1260. eclipseBar.Border:SetFrameLevel(0)
  1261.  
  1262. local lunarBar = CreateFrame('StatusBar', nil, eclipseBar)
  1263. lunarBar:SetPoint('LEFT', eclipseBar, 'LEFT', 0, 0)
  1264. lunarBar:SetSize(cfg.widthP, cfg.ClassBarHeight)
  1265. lunarBar:SetStatusBarTexture(cfg.HPtex)
  1266. lunarBar:SetStatusBarColor(0.34, 0.1, 0.86)
  1267. eclipseBar.LunarBar = lunarBar
  1268.  
  1269. local solarBar = CreateFrame('StatusBar', nil, eclipseBar)
  1270. solarBar:SetPoint('LEFT', lunarBar:GetStatusBarTexture(), 'RIGHT', 0, 0)
  1271. solarBar:SetSize(cfg.widthP, cfg.ClassBarHeight)
  1272. solarBar:SetStatusBarTexture(cfg.HPtex)
  1273. solarBar:SetStatusBarColor(0.95, 0.73, 0.15)
  1274. eclipseBar.SolarBar = solarBar
  1275.  
  1276. local eclipseBarText = solarBar:CreateFontString(nil, 'OVERLAY')
  1277. eclipseBarText:SetPoint('CENTER', eclipseBar, 'CENTER', 0, 0)
  1278. eclipseBarText:SetFont(cfg.NumbFont, cfg.NumbFS, cfg.fontFNum)
  1279. self:Tag(eclipseBarText, '[pereclipse]%')
  1280.  
  1281. self.EclipseBar = eclipseBar
  1282. end
  1283. ]]--
  1284. -- update debuff highlight
  1285. --self:RegisterEvent("UNIT_AURA", updateDispel)
  1286.  
  1287. local TFrame = CreateFrame("Frame", nil, self)
  1288. TFrame:SetPoint("TOPLEFT", self, "TOPLEFT", -4, 4)
  1289. TFrame:SetPoint("BOTTOMRIGHT", self.Power, "BOTTOMRIGHT", 4, -4)
  1290. TFrame:SetFrameLevel(0)
  1291.  
  1292. --[[TFrame.bg = TFrame:CreateTexture(nil, "BACKGROUND")
  1293. TFrame.bg:SetPoint("TOPLEFT", TFrame, 0, 0)
  1294. TFrame.bg:SetPoint("TOPRIGHT", TFrame, 0, 0)
  1295. TFrame.bg:SetHeight(1)
  1296. TFrame.bg:SetTexture(blankTex)
  1297. TFrame.bg:SetGradientAlpha("HORIZONTAL", 0, 0, 0, 1, 0, 0, 0, 0.1) -- HORIZONTAL | VERTICAL
  1298.  
  1299. TFrame.bg2 = TFrame:CreateTexture(nil, "BACKGROUND")
  1300. TFrame.bg2:SetPoint("TOPLEFT", TFrame, 0, -1)
  1301. TFrame.bg2:SetPoint("BOTTOMLEFT", TFrame, 0, 0)
  1302. TFrame.bg2:SetWidth(1)
  1303. TFrame.bg2:SetTexture(blankTex)
  1304. TFrame.bg2:SetGradientAlpha("VERTICAL", 0, 0, 0, 0.1, 0, 0, 0, 1.0) -- HORIZONTAL | VERTICAL]]--
  1305.  
  1306. --[[self.dHlight:SetSize(128,16)
  1307. self.dHlight2:SetSize(128,16)
  1308. self.dHlight:SetTexture("Interface\\AddOns\\dMedia\\dHlightL")
  1309. self.dHlight2:SetTexture("Interface\\AddOns\\dMedia\\dHlightL")]]--
  1310.  
  1311. -- xp/rep
  1312. if cfg.showXpRep then
  1313. local XpRepHld = CreateFrame("Frame", nil, self)
  1314. XpRepHld:SetAllPoints(self.Health)
  1315. XpRepHld:SetFrameLevel(10)
  1316.  
  1317. xprep = XpRepHld:CreateFontString(nil, "OVERLAY")
  1318. xprep:SetFont(cfg.NameFont, cfg.NameFS, cfg.FontF)
  1319. xprep:SetTextColor(unpack(cfg.sndcolor))
  1320. xprep:SetAlpha(0)
  1321. xprep:SetPoint("CENTER", self.Health)
  1322. self:Tag(xprep, '[SlimExp] [SlimRep]')
  1323. self.xprep = xprep
  1324.  
  1325. local xprepDummy = XpRepHld:CreateFontString(nil, "OVERLAY")
  1326. xprepDummy:SetFont(cfg.NameFont, cfg.NameFS, cfg.FontF)
  1327. xprepDummy:SetTextColor(unpack(cfg.sndcolor))
  1328. xprepDummy:SetPoint("CENTER", self.Health)
  1329. xprepDummy:SetAlpha(0)
  1330. xprepDummy:Hide()
  1331.  
  1332. local animXPFadeIn = xprepDummy:CreateAnimationGroup()
  1333. local delayXP = animXPFadeIn:CreateAnimation("Alpha")
  1334. delayXP:SetChange(0)
  1335. delayXP:SetDuration(cfg.delay)
  1336. delayXP:SetOrder(1)
  1337. local alphaInXP = animXPFadeIn:CreateAnimation("Alpha")
  1338. alphaInXP:SetChange(1)
  1339. alphaInXP:SetSmoothing("OUT")
  1340. alphaInXP:SetDuration(cfg.delay)
  1341. alphaInXP:SetOrder(2)
  1342.  
  1343. animXPFadeIn:SetScript("OnFinished", function()
  1344. xprep:SetAlpha(1)
  1345. xprepDummy:Hide()
  1346. end)
  1347.  
  1348. self:HookScript("OnEnter", function(_, motion)
  1349. if motion then
  1350. xprepDummy:SetText(self.xprep:GetText())
  1351. xprepDummy:Show()
  1352. animXPFadeIn:Play()
  1353. end
  1354. end)
  1355.  
  1356. self:HookScript("OnLeave", function()
  1357. if animXPFadeIn:IsPlaying() then animXPFadeIn:Stop() end
  1358. xprepDummy:Hide()
  1359. xprep:SetAlpha(0)
  1360. end)
  1361. end
  1362.  
  1363. if cfg.treat.enable then
  1364. local treat = createStatusbar(UIParent, cfg.texture, nil, cfg.treat.height, cfg.treat.width, 1, 1, 1, 1)
  1365. treat:SetFrameStrata('LOW')
  1366. treat:SetPoint(unpack(cfg.treat.pos))
  1367. treat.useRawThreat = false
  1368. treat.usePlayerTarget = false
  1369. treat.bg = treat:CreateTexture(nil, 'BACKGROUND')
  1370. treat.bg:SetAllPoints(treat)
  1371. treat.bg:SetTexture(cfg.texture)
  1372. treat.bg:SetVertexColor(1, 0, 0, 0.2)
  1373. -- treat.Title = fs(treat, 'OVERLAY', cfg.aura.font, cfg.aura.fontsize, cfg.aura.fontflag, 0.8, 0.8, 0.8)
  1374. -- treat.Title:SetText('Threat:')
  1375. -- treat.Title:SetPoint('RIGHT', treat, 'CENTER')
  1376. -- treat.Text = fs(treat, 'OVERLAY', cfg.aura.font, cfg.aura.fontsize, cfg.aura.fontflag, 0.8, 0.8, 0.8)
  1377. -- treat.Text:SetPoint('LEFT', treat, 'CENTER')
  1378. treat.bg = framebd(treat, treat)
  1379. self.ThreatBar = treat
  1380. end
  1381.  
  1382. --[[if cfg.PlayerDebuffs then
  1383. local d = CreateFrame('Frame', nil, self)
  1384. d.size = 28
  1385. d.spacing = 5.6
  1386. d.num = 14
  1387. d:SetPoint('BOTTOMLEFT', self, 'TOPLEFT', 0, 7)
  1388. d:SetSize(cfg.widthP, d.size)
  1389. d.initialAnchor = 'TOPLEFT'
  1390. d.PostCreateIcon = auraIcon
  1391. d.PostUpdateIcon = PostUpdateIcon
  1392. d.CustomFilter = CustomFilter
  1393. self.Debuffs = d
  1394. end]]--
  1395.  
  1396.  
  1397. createDebuffs(self)
  1398. self.Debuffs.size = 32
  1399. self.Debuffs:SetPoint("BOTTOMLEFT", self.Health, "TOPLEFT", 0, 4)
  1400. self.Debuffs.initialAnchor = "BOTTOMLEFT"
  1401. self.Debuffs["growth-x"] = "RIGHT"
  1402. self.Debuffs["growth-y"] = "UP"
  1403. self.Debuffs.num = 14
  1404. self.Debuffs:SetSize(cfg.widthP, self.Debuffs.size)
  1405.  
  1406.  
  1407.  
  1408.  
  1409.  
  1410. self:SetSize(cfg.widthP, cfg.heightP + cfg.NumbFS + cfg.PPyOffset)
  1411. end,
  1412.  
  1413. WpnEnch = function(self, ...)
  1414. WeaponEnchant(self)
  1415. BarFader(self)
  1416.  
  1417. self:SetSize(cfg.WeapEnchantIconSize*2, cfg.WeapEnchantIconSize)
  1418. end,
  1419.  
  1420. pClassPoints = function(self, ...)
  1421. local _, playerClass = UnitClass('player')
  1422.  
  1423. -- plugins
  1424. BarFader(self)
  1425.  
  1426. self.cCount = self:CreateFontString(nil, "OVERLAY")
  1427. self.cCount:SetFont(cfg.NumbFont, cfg.ComboFS, cfg.fontFNum)
  1428. self.cCount:SetPoint("RIGHT", self, 0, 0)
  1429.  
  1430. if playerClass == "DRUID" then
  1431. self:Tag(self.cCount, '[druidPower]')
  1432. elseif playerClass == "PALADIN" then
  1433. self:Tag(self.cCount, '[holyPower]')
  1434. elseif playerClass == "WARLOCK" then
  1435. self:Tag(self.cCount, '[soulShards]')
  1436. --elseif playerClass == "PRIEST" then
  1437. -- self:Tag(self.cCount, '|CFFfcf514[evangelism]|r |CFF911fff[shadoworbs]|r')
  1438. elseif playerClass == "SHAMAN" then
  1439. self:Tag(self.cCount, '|CFFfcf514[maelstrom]|r')
  1440. end
  1441.  
  1442. self:RegisterEvent('PLAYER_REGEN_ENABLED', function(self) self.cCount:SetAlpha(0.3) end)
  1443. self:RegisterEvent('PLAYER_REGEN_DISABLED', function(self) self.cCount:SetAlpha(1) end)
  1444. self:RegisterEvent('PLAYER_ENTERING_WORLD', function(self) self.cCount:SetAlpha(0.3) end)
  1445.  
  1446. self:SetSize(cfg.widthCB, cfg.heightCB)
  1447. end,
  1448.  
  1449. target = function(self, ...)
  1450. Shared(self, ...)
  1451. self.Health:SetHeight(cfg.heightT)
  1452. self.Health:SetWidth(cfg.widthT)
  1453. self.Power:SetWidth(cfg.widthT)
  1454.  
  1455. if cfg.useCastbar then
  1456. createCastbar(self)
  1457. self.Castbar:SetAllPoints(self.Health)
  1458. self.Castbar.Text:SetPoint("TOPRIGHT", self.Power, "BOTTOMRIGHT", 0, -2)
  1459. self.Castbar.Time2:SetPoint("BOTTOMRIGHT", self.Castbar.Text, "BOTTOMLEFT", -5, 0)
  1460. self.Castbar.Time:SetPoint("BOTTOMRIGHT", self.Castbar.Time2, "BOTTOMLEFT", 0, 0)
  1461.  
  1462. if cfg.useSpellIcon then
  1463. if not cfg.TargetRightSideSpellIcon then
  1464. self.Castbar.Icon:SetPoint("TOPRIGHT", self.Health, "TOPLEFT", -4, 0)
  1465. else
  1466. self.Castbar.Icon:SetPoint("TOPLEFT", self.Health, "TOPRIGHT", 4, 0)
  1467. end
  1468. end
  1469. end
  1470.  
  1471. --self.Health.value:SetPoint("TOPLEFT", self.Power, "BOTTOMLEFT", 0, -2)
  1472. --self.Power.value:SetPoint("TOPLEFT", self.Health.value, "BOTTOMLEFT", 0, -2)
  1473. self.Power.frequentUpdates = .1
  1474. self.Name:SetPoint("TOPRIGHT", self.Power, "BOTTOMRIGHT", 0, -3)
  1475. self.Status:SetPoint("TOPRIGHT", self.Name, "TOPLEFT", 0, 0)
  1476.  
  1477. local htext = fs(self.Health, 'OVERLAY', cfg.NameFont, 8, cfg.FontF, 1, 1, 1)
  1478. htext:SetPoint('LEFT', 0, -19)
  1479. htext.frequentUpdates = .1
  1480. self:Tag(htext, '[player:hp]')
  1481. self.Power.value:SetPoint("TOPLEFT", htext, "BOTTOMLEFT", 0, -2)
  1482.  
  1483. -- combo point font string
  1484. local cpoints = self.Health:CreateFontString(nil, 'OVERLAY')
  1485. cpoints:SetPoint("RIGHT", self.Health, "RIGHT", -8, 0)
  1486. cpoints:SetFont(cfg.NumbFont, cfg.ComboFS, cfg.fontFNum)
  1487. cpoints:SetTextColor(unpack(cfg.sndcolor))
  1488. self:Tag(cpoints, '[cpoints]')
  1489.  
  1490. createBuffs(self)
  1491. self.Buffs:SetPoint("BOTTOMLEFT", self.Health, "TOPLEFT", 0, 4)
  1492. self.Buffs.initialAnchor = "BOTTOMLEFT"
  1493. self.Buffs["growth-x"] = "RIGHT"
  1494. self.Buffs.num = 18
  1495. self.Buffs.size = 24
  1496. self.Buffs.spacing = 4
  1497. self.Buffs:SetSize(cfg.widthP, self.Buffs.size)
  1498.  
  1499. createDebuffs(self)
  1500. self.Debuffs:SetPoint("BOTTOMLEFT", self.Health, "TOPLEFT", 0, self.Buffs.size*cfg.buHeightMulti+12)
  1501. self.Debuffs.initialAnchor = "BOTTOMLEFT"
  1502. self.Debuffs["growth-x"] = "RIGHT"
  1503. self.Debuffs["growth-y"] = "UP"
  1504. self.Debuffs.num = 0
  1505. --self.size = 10
  1506. self.Debuffs:SetSize(self.Debuffs.size*13, self.Debuffs.size*2)
  1507.  
  1508. if cfg.onlyShowPlayerBuffs then
  1509. self.Buffs.onlyShowPlayer = true
  1510. end
  1511.  
  1512. if cfg.onlyShowPlayerDebuffs then
  1513. self.Debuffs.onlyShowPlayer = true
  1514. end
  1515.  
  1516. -- plugins
  1517. SpellRange(self)
  1518. CombatFeedback(self)
  1519.  
  1520. --Icons
  1521. local Ihld = CreateFrame("Frame", nil, self)
  1522. Ihld:SetAllPoints(self.Health)
  1523. Ihld:SetFrameLevel(6)
  1524.  
  1525. local q = fs(self.Health, 'OVERLAY', cfg.NameFont, 12, cfg.FontF, 1, 1, 1)
  1526. q:SetPoint('LEFT', name, 'RIGHT', 1, 25)
  1527. q:SetText('|cff8AFF30!|r')
  1528. self.QuestIcon = q
  1529.  
  1530. createRaidIcon(self)
  1531. createQuestIcon(self)
  1532. createPhaseIcon(self)
  1533. self.RaidIcon:SetPoint("LEFT", self.Health, "LEFT", 4, 0)
  1534. self.QuestIcon:SetPoint("LEFT", self.RaidIcon, "RIGHT", 90, -1)
  1535. self.QuestIcon:SetSize(32,32)
  1536. self.PhaseIcon:SetPoint("LEFT", self.QuestIcon, "RIGHT", 4, 0)
  1537. self.RaidIcon:SetParent(Ihld)
  1538. self.QuestIcon:SetParent(Ihld)
  1539. self.PhaseIcon:SetParent(Ihld)
  1540.  
  1541. -- update debuff highlight
  1542. --self:RegisterEvent("UNIT_AURA", updateDispel)
  1543.  
  1544. local TTFrame = CreateFrame("Frame", nil, self)
  1545. TTFrame:SetPoint("TOPLEFT", self, "TOPLEFT", -4, 4)
  1546. TTFrame:SetPoint("BOTTOMRIGHT", self.Power, "BOTTOMRIGHT", 4, -4)
  1547. TTFrame:SetFrameLevel(0)
  1548.  
  1549. --[[TTFrame.bg = TTFrame:CreateTexture(nil, "BACKGROUND")
  1550. TTFrame.bg:SetPoint("TOPLEFT", TTFrame, 0, 0)
  1551. TTFrame.bg:SetPoint("TOPRIGHT", TTFrame, 0, 0)
  1552. TTFrame.bg:SetHeight(1)
  1553. TTFrame.bg:SetTexture(blankTex)
  1554. TTFrame.bg:SetGradientAlpha("HORIZONTAL", 0, 0, 0, 0.2, 0, 0, 0, 1.0) -- HORIZONTAL | VERTICAL
  1555.  
  1556. TTFrame.bg2 = TTFrame:CreateTexture(nil, "BACKGROUND")
  1557. TTFrame.bg2:SetPoint("TOPRIGHT", TTFrame, 0, -1)
  1558. TTFrame.bg2:SetPoint("BOTTOMRIGHT", TTFrame, 0, 0)
  1559. TTFrame.bg2:SetWidth(1)
  1560. TTFrame.bg2:SetTexture(blankTex)
  1561. TTFrame.bg2:SetGradientAlpha("VERTICAL", 0, 0, 0, 0.1, 0, 0, 0, 1.0) -- HORIZONTAL | VERTICAL]]--
  1562.  
  1563. --[[self.dHlight:SetSize(128,16)
  1564. self.dHlight2:SetSize(128,16)
  1565. self.dHlight:SetTexture("Interface\\AddOns\\dMedia\\dHlightL")
  1566. self.dHlight2:SetTexture("Interface\\AddOns\\dMedia\\dHlightL")]]--
  1567.  
  1568. self:SetSize(cfg.widthT, cfg.heightT + cfg.NumbFS + cfg.PPyOffset)
  1569. end,
  1570.  
  1571. focus = function(self, ...)
  1572. Shared(self, ...)
  1573. self.Health:SetHeight(cfg.heightF)
  1574. self.Health:SetWidth(cfg.widthF)
  1575. self.Power:SetWidth(cfg.widthF)
  1576.  
  1577. if cfg.useCastbar then
  1578. createCastbar(self)
  1579. self.Castbar:SetAllPoints(self.Health)
  1580. self.Castbar.Text:SetPoint("TOPRIGHT", self.Power, "BOTTOMRIGHT", 0, -2)
  1581. self.Castbar.Time2:SetPoint("BOTTOMRIGHT", self.Castbar.Text, "BOTTOMLEFT", -5, 0)
  1582. self.Castbar.Time:SetPoint("BOTTOMRIGHT", self.Castbar.Time2, "BOTTOMLEFT", 0, 0)
  1583.  
  1584. if cfg.useSpellIcon then
  1585. if not cfg.FocusRightSideSpellIcon then
  1586. self.Castbar.Icon:SetPoint("TOPRIGHT", self.Health, "TOPLEFT", -4, 0)
  1587. else
  1588. self.Castbar.Icon:SetPoint("TOPLEFT", self.Health, "TOPRIGHT", 4, 0)
  1589. end
  1590. end
  1591. end
  1592.  
  1593. --self.Health.value:SetPoint("TOPLEFT", self.Power, "BOTTOMLEFT", 0, -2)
  1594. --self.Power.value:SetPoint("TOPLEFT", self.Health.value, "BOTTOMLEFT", 0, -2)
  1595. self.Name:SetPoint("TOPRIGHT", self.Power, "BOTTOMRIGHT", 0, -3)
  1596. self.Status:SetPoint("TOPRIGHT", self.Name, "TOPLEFT", 0, 0)
  1597.  
  1598. local htext = fs(self.Health, 'OVERLAY', cfg.NameFont, 8, cfg.FontF, 1, 1, 1)
  1599. htext:SetPoint('LEFT', 0, -19)
  1600. htext.frequentUpdates = .1
  1601. self:Tag(htext, '[player:hp]')
  1602. self.Power.value:SetPoint("TOPLEFT", htext, "BOTTOMLEFT", 0, -2)
  1603.  
  1604. --[[createBuffs(self)
  1605. self.Buffs:SetPoint("BOTTOMLEFT", self.Health, "TOPLEFT", 0, 6)
  1606. self.Buffs.initialAnchor = "BOTTOMLEFT"
  1607. self.Buffs["growth-x"] = "RIGHT"
  1608. self.Buffs.num = 12
  1609. self.Buffs:SetSize(self.Buffs.size*13, self.Buffs.size)]]--
  1610. createBuffs(self)
  1611. self.Buffs:SetPoint("BOTTOMLEFT", self.Health, "TOPLEFT", 0, 4)
  1612. self.Buffs.initialAnchor = "BOTTOMLEFT"
  1613. self.Buffs["growth-x"] = "RIGHT"
  1614. self.Buffs.num = 7
  1615. self.Buffs.size = 24
  1616. self.Buffs.spacing = 5
  1617. self.Buffs:SetSize(cfg.widthP, self.Buffs.size)
  1618.  
  1619. createDebuffs(self)
  1620. self.Debuffs:SetPoint("LEFT", self.Health, "RIGHT", 3, -3)
  1621. self.Debuffs.initialAnchor = "LEFT"
  1622. self.Debuffs["growth-x"] = "RIGHT"
  1623. self.Debuffs["growth-y"] = "UP"
  1624. self.Debuffs.num = 4
  1625. self.Debuffs.size = 20
  1626. self.Debuffs.spacing = 4
  1627. self.Debuffs:SetSize(self.Debuffs.size*13, self.Debuffs.size*2)
  1628.  
  1629. if cfg.onlyShowPlayerBuffs then
  1630. self.Buffs.onlyShowPlayer = true
  1631. end
  1632.  
  1633. --if cfg.onlyShowPlayerDebuffs then
  1634. -- self.Debuffs.onlyShowPlayer = true
  1635. --end
  1636.  
  1637. self.Debuffs.onlyShowPlayer = false
  1638.  
  1639. -- plugins
  1640. SpellRange(self)
  1641. CombatFeedback(self)
  1642.  
  1643. -- Icons
  1644. local Ihld = CreateFrame("Frame", nil, self)
  1645. Ihld:SetAllPoints(self.Health)
  1646. Ihld:SetFrameLevel(6)
  1647.  
  1648. createRaidIcon(self)
  1649. createQuestIcon(self)
  1650. self.RaidIcon:SetPoint("LEFT", self.Health, "LEFT", 4, 0)
  1651. self.QuestIcon:SetPoint("LEFT", self.RaidIcon, "RIGHT", 75, -1)
  1652. self.RaidIcon:SetParent(Ihld)
  1653. self.QuestIcon:SetParent(Ihld)
  1654.  
  1655. -- update and debuff highlight
  1656. --self:RegisterEvent("UNIT_AURA", updateDispel)
  1657.  
  1658. self:SetSize(cfg.widthF, cfg.heightF + cfg.NumbFS + cfg.PPyOffset)
  1659. end,
  1660.  
  1661. pet = function(self, ...)
  1662. Shared(self, ...)
  1663.  
  1664. self.Health:SetHeight(cfg.heightS)
  1665. self.Health:SetWidth(cfg.widthS)
  1666. self.Power:SetWidth(cfg.widthS)
  1667. self.Name:SetPoint("TOP", self.Power, "BOTTOM", 0, -3)
  1668. self:Tag(self.Name, '[raidcolor][shortname]')
  1669.  
  1670. self.Power.colorPower = true
  1671.  
  1672. -- plugins
  1673. SpellRange(self)
  1674. BarFader(self)
  1675.  
  1676. -- Icons
  1677. createRaidIcon(self)
  1678. self.RaidIcon:SetPoint("CENTER", self.Health, "CENTER", 0, 0)
  1679.  
  1680. -- update and debuff highlight
  1681. --self:RegisterEvent("UNIT_AURA", updateDispel)
  1682.  
  1683. self:SetSize(cfg.widthS, cfg.heightS + cfg.NumbFS + cfg.PPyOffset)
  1684. end,
  1685.  
  1686. targettarget = function(self, ...)
  1687. Shared(self, ...)
  1688.  
  1689. self.Health:SetHeight(cfg.heightS)
  1690. self.Health:SetWidth(cfg.widthS)
  1691. self.Power:SetWidth(cfg.widthS)
  1692. self.Name:SetPoint("TOP", self.Power, "BOTTOM", 0, -3)
  1693. self:Tag(self.Name, '[raidcolor][shortname]')
  1694.  
  1695. -- plugins
  1696. SpellRange(self)
  1697.  
  1698. -- Icons
  1699. createRaidIcon(self)
  1700. self.RaidIcon:SetPoint("CENTER", self.Health, "CENTER", 0, 0)
  1701.  
  1702. -- update and debuff highlight
  1703. --self:RegisterEvent("UNIT_AURA", updateDispel)
  1704.  
  1705. self:SetSize(cfg.widthS, cfg.heightS + cfg.NumbFS + cfg.PPyOffset)
  1706. end,
  1707.  
  1708. focustarget = function(self, ...)
  1709. Shared(self, ...)
  1710.  
  1711. self.Health:SetHeight(cfg.heightS)
  1712. self.Health:SetWidth(cfg.widthS)
  1713. self.Power:SetWidth(cfg.widthS)
  1714. self.Name:SetPoint("TOP", self.Power, "BOTTOM", 0, -3)
  1715. self:Tag(self.Name, '[raidcolor][shortname]')
  1716.  
  1717. -- plugins
  1718. SpellRange(self)
  1719.  
  1720. -- Icons
  1721. createRaidIcon(self)
  1722. self.RaidIcon:SetPoint("CENTER", self.Health, "CENTER", 0, 0)
  1723.  
  1724. -- update and debuff highlight
  1725. --self:RegisterEvent("UNIT_AURA", updateDispel)
  1726.  
  1727. self:SetSize(cfg.widthS, cfg.heightS + cfg.NumbFS + cfg.PPyOffset)
  1728. end,
  1729.  
  1730. boss = function(self, ...)
  1731. Shared(self, ...)
  1732.  
  1733. self.Health:SetHeight(cfg.heightM)
  1734. self.Health:SetWidth(cfg.widthM)
  1735. self.Power:Hide()
  1736. self.Name:SetPoint("TOPLEFT", self.Health, 0, cfg.NameFS/2)
  1737. self:Tag(self.Name, '[afkdnd][raidcolor][abbrevname]')
  1738. --self.Health.value:SetPoint("TOPRIGHT", self.Health, 0, cfg.NameFS/2)
  1739.  
  1740. local htext = fs(self.Health, 'OVERLAY', cfg.NameFont, 8, cfg.FontF, 1, 1, 1)
  1741. htext:SetPoint('LEFT', 0, -10)
  1742. htext.frequentUpdates = .1
  1743. self:Tag(htext, '[player:hp]')
  1744. self.Power.value:SetPoint("TOPLEFT", htext, "BOTTOMLEFT", 0, -1)
  1745.  
  1746. local alttext = fs(self.Health, 'OVERLAY', cfg.NameFont, 8, cfg.FontF, 1, 1, 1)
  1747. alttext:SetPoint('RIGHT', 0, -10)
  1748. alttext.frequentUpdates = .1
  1749. self:Tag(alttext, '[altpower]')
  1750.  
  1751. -- plugins
  1752. SpellRange(self)
  1753.  
  1754. -- Icons
  1755. createRaidIcon(self)
  1756. self.RaidIcon:SetPoint("CENTER", self.Health, "CENTER", 0, 0)
  1757.  
  1758. self:SetSize(cfg.widthM, cfg.heightM + cfg.NumbFS + cfg.PPyOffset)
  1759. end,
  1760.  
  1761. MainTank = function(self, ...)
  1762. Shared(self, ...)
  1763.  
  1764. self.Health:SetHeight(cfg.heightM)
  1765. self.Health:SetWidth(cfg.widthM)
  1766. self.Power:Hide()
  1767. self.Name:SetPoint("TOPLEFT", self.Health, 0, cfg.NameFS/2)
  1768. self:Tag(self.Name, '[afkdnd][raidcolor][abbrevname]')
  1769. self.Health.value:SetPoint("TOPRIGHT", self.Health, 0, cfg.NameFS/2)
  1770.  
  1771. -- plugins
  1772. SpellRange(self)
  1773.  
  1774. -- Icons
  1775. createRaidIcon(self)
  1776. self.RaidIcon:SetPoint("CENTER", self.Health, "CENTER", 0, 0)
  1777. end,
  1778.  
  1779. arenaframes = function(self, ...)
  1780. Shared(self, ...)
  1781. self.Health:SetHeight(cfg.heightPA)
  1782. self.Health:SetWidth(cfg.widthPA)
  1783. self.Power:SetWidth(cfg.widthPA)
  1784.  
  1785. --self.Health.value:SetPoint("RIGHT", self.Health, "RIGHT", -4, 0)
  1786. --self.Power.value:SetPoint("RIGHT", self.Health.value, "LEFT", -2, 0)
  1787. self.Status:SetPoint("TOPLEFT", self.Power, "BOTTOMLEFT", 0, -2)
  1788. self.Name:SetPoint("TOPLEFT", self.Status, "TOPRIGHT", 0, 0)
  1789. self.Health.value:SetFont(cfg.NumbFont, cfg.NumbFS, cfg.fontFNum)
  1790.  
  1791. local htext = fs(self.Health, 'OVERLAY', cfg.NameFont, 8, cfg.FontF, 1, 1, 1)
  1792. htext:SetPoint('RIGHT', 2, -19)
  1793. htext.frequentUpdates = .1
  1794. self:Tag(htext, '[player:hp]')
  1795. self.Power.value:SetPoint("TOPRIGHT", htext, "BOTTOMRIGHT", 0, -2)
  1796.  
  1797. local Auras = CreateFrame("Frame", nil, self)
  1798. Auras:SetHeight(cfg.heightPA)
  1799. Auras:SetPoint("TOPRIGHT", self, "TOPLEFT", 300, 30)
  1800. Auras.initialAnchor = "TOPLEFT"
  1801. Auras.size = 24
  1802. Auras:SetWidth(Auras.size * 13)
  1803. Auras.gap = false
  1804. Auras.numBuffs = 8
  1805. Auras.numDebuffs = 4
  1806. Auras.spacing = 2
  1807. Auras["growth-x"] = "RIGHT"
  1808.  
  1809. Auras.PostCreateIcon = PostCreateIcon
  1810. --Auras.PostUpdateIcon = PostUpdateIcon
  1811. self.Auras = Auras
  1812.  
  1813. -- apply aura filter
  1814. if cfg.FilterAuras then
  1815. self.Auras.CustomFilter = CustomFilter
  1816. end
  1817.  
  1818. -- plugins
  1819. CombatFeedback(self)
  1820. SpellRange(self)
  1821.  
  1822. -- Icons
  1823. createRaidIcon(self)
  1824. self.RaidIcon:SetPoint("LEFT", self.Health, "LEFT", 4, 0)
  1825.  
  1826. self:SetSize(cfg.widthPA, cfg.heightPA + cfg.NumbFS + cfg.PPyOffset)
  1827. end,
  1828.  
  1829. arenatargets = function(self, ...)
  1830. Shared(self, ...)
  1831.  
  1832. self.Health.value:ClearAllPoints()
  1833. self.Power.value:ClearAllPoints()
  1834.  
  1835. self.Health:SetHeight(cfg.heightPA)
  1836. self.Health:SetWidth(cfg.widthS)
  1837. self.Power:SetWidth(cfg.widthS)
  1838. self.Name:SetPoint("CENTER", self.Health, 0, 0)
  1839. self:Tag(self.Name, '[raidcolor][shortname]')
  1840.  
  1841. -- Icons
  1842. createRaidIcon(self)
  1843. self.RaidIcon:SetPoint("CENTER", self.Health, "CENTER", 0, 0)
  1844.  
  1845. self:SetSize(cfg.widthS, cfg.heightPA + cfg.NumbFS + cfg.PPyOffset)
  1846. end,
  1847. }
  1848.  
  1849. -- raid, party
  1850. do
  1851. local range = {
  1852. insideAlpha = 1,
  1853. outsideAlpha = cfg.FadeOutAlpha,
  1854. }
  1855.  
  1856. UnitSpecific.party = function(self, ...)
  1857. Shared(self, ...)
  1858.  
  1859. self.unit = 'party'
  1860.  
  1861. self.Health:SetHeight(cfg.heightPA)
  1862. self.Health:SetWidth(cfg.widthPA)
  1863. self.Power:SetWidth(cfg.widthPA)
  1864.  
  1865. self.Health.value:SetFont(cfg.NumbFont, cfg.NumbFS, cfg.fontFNum)
  1866. self.Health.value:SetPoint("TOPRIGHT", self.Power, "BOTTOMRIGHT", 0, -2)
  1867. self.Power.value:SetPoint("RIGHT", self.Health.value, "LEFT", -2, 0)
  1868. self.Status:SetPoint("TOPLEFT", self.Power, "BOTTOMLEFT", 0, -2)
  1869. self.Name:SetPoint("TOPLEFT", self.Status, "TOPRIGHT", 0, 0)
  1870.  
  1871. local Auras = CreateFrame("Frame", nil, self)
  1872. Auras:SetHeight(cfg.heightPA)
  1873. Auras:SetPoint("TOPLEFT", self, "TOPRIGHT", 6, 2)
  1874. Auras.initialAnchor = "TOPLEFT"
  1875. Auras.size = cfg.buSize
  1876. Auras:SetWidth(Auras.size * 13)
  1877. Auras.gap = true
  1878. Auras.numBuffs = 8
  1879. Auras.numDebuffs = 4
  1880. Auras.spacing = 2
  1881.  
  1882. Auras.PostCreateIcon = PostCreateIcon
  1883. Auras.PostUpdateIcon = PostUpdateIcon
  1884. self.Auras = Auras
  1885.  
  1886. -- apply aura filter
  1887. if cfg.FilterAuras then
  1888. self.Auras.CustomFilter = CustomFilter
  1889. end
  1890.  
  1891. -- plugins
  1892. HealComm4(self)
  1893. CombatFeedback(self)
  1894. self.Range = range
  1895.  
  1896. -- Icons
  1897. createRaidIcon(self)
  1898. createPhaseIcon(self)
  1899. self.RaidIcon:SetPoint("RIGHT", self.Health, "RIGHT", -4, 0)
  1900. self.PhaseIcon:SetPoint("RIGHT", self.RaidIcon, "LEFT", -4, 0)
  1901.  
  1902. LfDR = self.Health:CreateTexture(nil, 'OVERLAY')
  1903. LfDR:SetSize(12, 12)
  1904. LfDR:SetPoint("TOPLEFT", self.Health, 4, 6)
  1905. self.LFDRole = LfDR
  1906.  
  1907. LIc = self.Health:CreateTexture(nil, "OVERLAY")
  1908. LIc:SetSize(12, 12)
  1909. LIc:SetPoint("LEFT", LfDR, "RIGHT", 4, 0)
  1910. self.Leader = LIc
  1911.  
  1912. MLIc = self.Health:CreateTexture(nil, 'OVERLAY')
  1913. MLIc:SetSize(12, 12)
  1914. MLIc:SetPoint("LEFT", LIc, "RIGHT", 4, 0)
  1915. self.MasterLooter = MLIc
  1916.  
  1917. rChk = self.Health:CreateTexture(nil, 'OVERLAY')
  1918. rChk:SetSize(18, 18)
  1919. rChk:SetPoint("CENTER", self.Health, 0, 0)
  1920. rChk.fadeTimer = 6
  1921. rChk.finishedTimer = 6
  1922. self.ReadyCheck = rChk
  1923.  
  1924. -- update and debuff highlight
  1925. --self:RegisterEvent("UNIT_AURA", Update)
  1926.  
  1927. -- party pets
  1928. if (self:GetAttribute("unitsuffix") == "pet") then
  1929.  
  1930. -- clear up the inherited mess ...
  1931. self.Auras:ClearAllPoints()
  1932. self.Name:ClearAllPoints()
  1933. self.Health.value:ClearAllPoints()
  1934. self.Power.value:ClearAllPoints()
  1935. self.Status:ClearAllPoints()
  1936. self.PhaseIcon:ClearAllPoints()
  1937.  
  1938. self.Health:SetWidth(cfg.widthS)
  1939. self.Power:SetWidth(cfg.widthS)
  1940. self.Name:SetPoint("TOP", self.Power, "BOTTOM", 0, -2)
  1941. self:Tag(self.Name, '[raidcolor][shortname]')
  1942.  
  1943. -- Icons
  1944. self.RaidIcon:ClearAllPoints()
  1945. self.RaidIcon:SetPoint("CENTER", self.Health, "CENTER", 0, 0)
  1946.  
  1947. self:SetSize(cfg.widthS, cfg.heightPA + cfg.NumbFS + cfg.PPyOffset)
  1948. end
  1949. end
  1950.  
  1951. UnitSpecific.raid = function(self, ...)
  1952. Shared(self, ...)
  1953. --createAuraWatch(self)
  1954. createAuraWatch(self)
  1955.  
  1956. --self.Name:SetPoint("TOPLEFT", self.Health, "BOTTOMLEFT", 1, -2)
  1957. --self:Tag(self.Name, '[afkdnd][raidcolor][raidhpname]')
  1958.  
  1959. self.Health:SetHeight(cfg.heightR)
  1960. self.Health:SetWidth(cfg.widthR)
  1961. self.Power:SetWidth(cfg.widthR*0.7)
  1962. self.Power:SetPoint("TOPLEFT", self.Health, "BOTTOMLEFT", 13, 0)
  1963. self.Power:SetFrameLevel(4)
  1964. self.Power.PostUpdate = PostUpdatePowerRaid
  1965. self.Power.classColor = true
  1966.  
  1967.  
  1968.  
  1969. local name = fs(self.Health, 'OVERLAY', cfg.NameFont, cfg.NameFS, cfg.FontF, 1, 1, 1)
  1970. name:SetPoint('LEFT', 2, 6)
  1971. name:SetJustifyH'LEFT'
  1972. self:Tag(name, '[color][veryshort:name]')
  1973.  
  1974. local htext = fs(self.Health, 'OVERLAY', cfg.NameFont, cfg.NameFS, cfg.FontF, 1, 1, 1)
  1975. htext:SetPoint('RIGHT', -2, -5)
  1976. htext:SetJustifyH'RIGHT'
  1977. htext.frequentUpdates = true
  1978. self:Tag(htext, '[raid:hp]')
  1979.  
  1980.  
  1981.  
  1982. local rDhF = CreateFrame("Frame", nil, self)
  1983. rDhF:SetAllPoints(self.Health)
  1984. rDhF:SetFrameLevel(10)
  1985.  
  1986. --[[ local Debuffs = CreateFrame("Frame", nil, rDhF)
  1987. Debuffs:SetSize(cfg.buSizeRaid*cfg.RaidDebuffNumb, cfg.buSizeRaid)
  1988. Debuffs:SetPoint("CENTER", self.Health, "CENTER", -10, 0)
  1989. Debuffs.initialAnchor = "TOPRIGHT"
  1990. Debuffs.num = 1
  1991. Debuffs.size = (20)
  1992. Debuffs["growth-x"] = "LEFT"
  1993. Debuffs.spacing = 7
  1994. Debuffs.count = fs(Debuffs, 'OVERLAY', cfg.NumbFont, 8, cfg.FontF, 0.8, 0.8, 0.8)
  1995. Debuffs.count:SetPoint('BOTTOMRIGHT', Debuffs, 'BOTTOMRIGHT', 2, 0)
  1996.  
  1997. Debuffs.PostCreateIcon = PostCreateIcon
  1998. Debuffs.PostUpdateIcon = PostUpdateIcon
  1999. self.Debuffs = Debuffs
  2000.  
  2001. if cfg.FilterAuras then
  2002. self.Debuffs.CustomFilter = CustomFilter
  2003. end ]]--
  2004.  
  2005.  
  2006. local d = CreateFrame('Frame', nil, self)
  2007. d:SetSize(20,20)
  2008. d:SetPoint('CENTER', 0, 4)
  2009. d:SetFrameStrata'HIGH'
  2010. d:SetBackdrop(backdrop3)
  2011. -- d:SetBackdrop(backdrop_1px)
  2012. d.icon = d:CreateTexture(nil, 'OVERLAY')
  2013. d.icon:SetTexCoord(.1,.9,.1,.9)
  2014. d.icon:SetAllPoints(d)
  2015. d.time = fs(d, 'OVERLAY', cfg.NumbFont, 8, cfg.FontF, 0.8, 0.8, 0.8)
  2016. d.time:SetPoint('TOPLEFT', d, 'TOPLEFT', 0, 0)
  2017. d.count = fs(d, 'OVERLAY', cfg.NumbFont, 8, cfg.FontF, 0.8, 0.8, 0.8)
  2018. d.count:SetPoint('BOTTOMRIGHT', d, 'BOTTOMRIGHT', 2, 0)
  2019.  
  2020. d.CustomFilter = CustomFilter
  2021. self.RaidDebuffs = d
  2022.  
  2023.  
  2024.  
  2025.  
  2026. -- class specific tags
  2027. --classTags(self)
  2028.  
  2029. -- plugins
  2030. HealComm4(self)
  2031. self.Range = range
  2032. self.Health.Smooth = true
  2033. self.Power.Smooth = true
  2034.  
  2035. -- Icons
  2036. createRaidIcon(self)
  2037. self.RaidIcon:SetSize(14, 14)
  2038. self.RaidIcon:SetPoint('TOP', self.Health, 10, 8)
  2039.  
  2040. rChk = self.Health:CreateTexture(nil, 'OVERLAY')
  2041. rChk:SetSize(18, 18)
  2042. rChk:SetPoint("CENTER", self.Health, 0, 0)
  2043. rChk.fadeTimer = 6
  2044. rChk.finishedTimer = 6
  2045. self.ReadyCheck = rChk
  2046.  
  2047. --self.dHlight:SetPoint("TOPLEFT", self.Health, -3, 3)
  2048. --self.dHlight2:SetPoint("TOPLEFT", self.Health, -3, 3)
  2049.  
  2050. -- update and debuff highlight
  2051. --self:RegisterEvent("UNIT_AURA", Update)
  2052. end
  2053.  
  2054. UnitSpecific.r40 = UnitSpecific.raid
  2055. end
  2056.  
  2057.  
  2058. ---------------------------------------
  2059. -- register style(s) and spawn units --
  2060. ---------------------------------------
  2061. oUF:RegisterStyle("Slim", Shared)
  2062.  
  2063.  
  2064.  
  2065.  
  2066.  
  2067.  
  2068.  
  2069. for unit,layout in next, UnitSpecific do
  2070. oUF:RegisterStyle('Slim - ' .. unit:gsub("^%l", string.upper), layout)
  2071. end
  2072.  
  2073. local spawnHelper = function(self, unit, ...)
  2074. if(UnitSpecific[unit]) then
  2075. self:SetActiveStyle('Slim - ' .. unit:gsub("^%l", string.upper))
  2076. local object = self:Spawn(unit)
  2077. object:SetPoint(...)
  2078. return object
  2079. else
  2080. self:SetActiveStyle'Slim'
  2081. local object = self:Spawn(unit)
  2082. object:SetPoint(...)
  2083. return object
  2084. end
  2085. end
  2086.  
  2087. if cfg.ArenaFrames then
  2088. oUF:RegisterStyle('oUF_Slim_Arena', UnitSpecific.arenaframes)
  2089. oUF:SetActiveStyle('oUF_Slim_Arena')
  2090. local arena = {}
  2091. local arenatarget = {}
  2092. for i = 1, 5 do
  2093. arena[i] = oUF:Spawn("arena"..i, "oUF_Arena"..i)
  2094. if i == 1 then
  2095. arena[i]:SetPoint('LEFT', UIParent, 'LEFT', 250, -200)
  2096. else
  2097. arena[i]:SetPoint("BOTTOMRIGHT", arena[i-1], "TOPRIGHT", 0, 50)
  2098. end
  2099. end
  2100.  
  2101. oUF:RegisterStyle("oUF_Slim_ArenaTarget", UnitSpecific.arenatargets)
  2102. oUF:SetActiveStyle("oUF_Slim_ArenaTarget")
  2103. for i = 1, 5 do
  2104. arenatarget[i] = oUF:Spawn("arena"..i.."target", "oUF_Arena"..i.."target"):SetPoint("TOPLEFT",arena[i], "TOPRIGHT", 8, 0)
  2105. end
  2106. end
  2107.  
  2108.  
  2109.  
  2110.  
  2111. oUF:Factory(function(self)
  2112.  
  2113. --local player = spawnHelper(self, 'player', "CENTER", -180, -230)
  2114. --local player = spawnHelper(self, 'player', "CENTER", 0, -210)
  2115. local player = spawnHelper(self, 'player', "BOTTOM", -338, 233)
  2116. spawnHelper(self, 'pet', "RIGHT", player, "LEFT", -10, 0)
  2117. --local target = spawnHelper(self, 'target', "CENTER", 180, -230)
  2118. --local target = spawnHelper(self, 'target', "LEFT", player, "RIGHT", 100, 0)
  2119. local target = spawnHelper(self, 'target', "BOTTOM", 338, 233)
  2120. --spawnHelper(self, 'targettarget', "LEFT", target, "RIGHT", 10, 0)
  2121. spawnHelper(self, 'targettarget', "BOTTOM", 436, 191)
  2122. --local focus = spawnHelper(self, 'focus', "TOPLEFT", target, "BOTTOMLEFT", 0, -120)
  2123. local focus = spawnHelper(self, 'focus', "CENTER", 360, -164)
  2124. --spawnHelper(self, 'focustarget', "LEFT", focus, "RIGHT", 10, 0)
  2125. spawnHelper(self, 'focustarget', "CENTER", 436, -209)
  2126.  
  2127. local abiRealm=GetRealmName()
  2128. function Frame1_OnLoad()
  2129. print("OnLoad happening")
  2130. print("Got realm", abiRealm)
  2131. end
  2132. function Button1_OnClick()
  2133. FontString1:SetText(abiRealm)
  2134.  
  2135. end
  2136. local spec = GetSpecialization()
  2137.  
  2138.  
  2139. --if cfg.PartyFrames then
  2140. -- self:SetActiveStyle'Slim - Party'
  2141. -- local party = self:SpawnHeader('oUF_Party', nil, 'custom [group:party,nogroup:raid][@raid6,noexists,group:raid] show;hide',
  2142. -- 'showParty', true,
  2143. -- --'showPlayer', true,
  2144. -- 'yOffset', -10,
  2145. -- 'template', 'oUF_SlimRaid', -- party pets
  2146. -- 'oUF-initialConfigFunction', ([[
  2147. -- self:SetWidth(%d)
  2148. -- self:SetHeight(%d)
  2149. -- ]]):format(cfg.widthPA, cfg.heightPA + cfg.NumbFS + cfg.PPyOffset))
  2150. -- --party:SetPoint("BOTTOMLEFT", player, "TOPLEFT", 0, 60)
  2151. -- party:SetPoint("TOPLEFT", player, "BOTTOMLEFT", 0, -40)
  2152. --end
  2153.  
  2154. if cfg.PartyFrames then
  2155. if cfg.ShowAsRaid then
  2156. self:SetActiveStyle'Slim - Raid'
  2157. local party = self:SpawnHeader('oUF_Party', nil, 'custom [@raid6, exists] hide; show',--'custom [@raid6,exists] show; hide',
  2158. 'showPlayer',
  2159. true,'showSolo',false,'showParty',true ,'point','RIGHT','xOffset',-5,
  2160. 'oUF-initialConfigFunction', ([[
  2161. self:SetWidth(%d)
  2162. self:SetHeight(%d)
  2163. ]]):format(cfg.widthR, cfg.heightR + cfg.NumbFS))
  2164. --party:SetPoint("LEFT", player, "RIGHT", 0, 60)
  2165. --party:SetPoint("TOPLEFT", player, "BOTTOMLEFT", 0, -40)
  2166.  
  2167.  
  2168. if UnitName("player") == "Miku" then
  2169. party:SetPoint("CENTER", 0, -299)
  2170. else if UnitName("Player") == "Zetzl" then
  2171. if spec == 1 then
  2172. party:SetPoint("CENTER", 0, -299)
  2173.  
  2174. end
  2175. else if abiRealm == "Kel'Thuzad" then
  2176. if UnitName("player") == "Scrable" then
  2177. party:SetPoint("CENTER", 0, -299)
  2178. end
  2179. else
  2180. party:SetPoint("BOTTOMRIGHT", -216, 9)
  2181. end
  2182. end
  2183. end
  2184.  
  2185. else
  2186. self:SetActiveStyle'Slim - Party'
  2187. local party = self:SpawnHeader('oUF_Party',nil,'custom [@raid6,exists] hide; show',
  2188. 'showPlayer',true,'showSolo',false,'showParty',true ,'yOffset', -23)
  2189. -- party:SetPoint("BOTTOMLEFT", player, "TOPLEFT", 0, 60)
  2190. --party:SetPoint("TOPLEFT", player, "BOTTOMLEFT", 0, -40)
  2191.  
  2192. --if UnitName("player") == "Kaiki" or "Miku" then
  2193. -- party:SetPoint("CENTER", 0, 100)
  2194. --else
  2195. -- party:SetPoint("TOPLEFT", player, "BOTTOMLEFT", 0, -40)
  2196. --end
  2197.  
  2198. --if cfg.uf.party_target then
  2199. -- self:SetActiveStyle'Skaarj - Pet' --'custom [@raid6,exists] hide; show'
  2200. -- local partytargets = self:SpawnHeader('oUF_PartyTargets', nil, 'custom [@raid6,exists] hide; show',
  2201. -- 'showParty', true,'showSolo',false,'yOffset', -27,
  2202. -- 'oUF-initialConfigFunction', ([[self:SetAttribute('unitsuffix', 'target')]]))
  2203. -- partytargets:SetPoint('TOPLEFT', 'oUF_Party', 'TOPRIGHT', 5, 0)
  2204. --end
  2205.  
  2206. end
  2207. end
  2208.  
  2209. local arenaprep = {}
  2210. for i = 1, 5 do
  2211. arenaprep[i] = CreateFrame('Frame', 'oUF_ArenaPrep'..i, UIParent)
  2212. arenaprep[i]:SetAllPoints(_G['oUF_Arena'..i])
  2213. arenaprep[i]:SetFrameStrata('BACKGROUND')
  2214. arenaprep[i].framebd = framebd(arenaprep[i], arenaprep[i])
  2215.  
  2216. arenaprep[i].Health = CreateFrame('StatusBar', nil, arenaprep[i])
  2217. arenaprep[i].Health:SetAllPoints()
  2218. arenaprep[i].Health:SetStatusBarTexture(cfg.blanktexture)
  2219.  
  2220. arenaprep[i].Spec = fs(arenaprep[i].Health, 'OVERLAY', cfg.NumbFont, 8, cfg.FontF, 1, 1, 1)
  2221. arenaprep[i].Spec:SetPoint('CENTER')
  2222. arenaprep[i].Spec:SetJustifyH'CENTER'
  2223.  
  2224. arenaprep[i]:Hide()
  2225. end
  2226.  
  2227. local arenaprepupdate = CreateFrame('Frame')
  2228. arenaprepupdate:RegisterEvent('PLAYER_LOGIN')
  2229. arenaprepupdate:RegisterEvent('PLAYER_ENTERING_WORLD')
  2230. arenaprepupdate:RegisterEvent('ARENA_OPPONENT_UPDATE')
  2231. arenaprepupdate:RegisterEvent('ARENA_PREP_OPPONENT_SPECIALIZATIONS')
  2232. arenaprepupdate:SetScript('OnEvent', function(self, event)
  2233. if event == 'PLAYER_LOGIN' then
  2234. for i = 1, 5 do
  2235. arenaprep[i]:SetAllPoints(_G['oUF_Arena'..i])
  2236. end
  2237. elseif event == 'ARENA_OPPONENT_UPDATE' then
  2238. for i = 1, 5 do
  2239. arenaprep[i]:Hide()
  2240. end
  2241. else
  2242. local numOpps = GetNumArenaOpponentSpecs()
  2243.  
  2244. if numOpps > 0 then
  2245. for i = 1, 5 do
  2246. local f = arenaprep[i]
  2247.  
  2248. if i <= numOpps then
  2249. local s = GetArenaOpponentSpec(i)
  2250. local _, spec, class = nil, 'UNKNOWN', 'UNKNOWN'
  2251.  
  2252. if s and s > 0 then
  2253. _, spec, _, _, _, _, class = GetSpecializationInfoByID(s)
  2254. end
  2255.  
  2256. if class and spec then
  2257. local color = (CUSTOM_CLASS_COLORS or RAID_CLASS_COLORS)[class]
  2258. if cfg.class_colorbars and color then
  2259. f.Health:SetStatusBarColor(color.r, color.g, color.b)
  2260. else
  2261. f.Health:SetStatusBarColor(40/255, 40/255, 40/255)
  2262. end
  2263. f.Spec:SetText(spec..' - '..LOCALIZED_CLASS_NAMES_MALE[class])
  2264. f:Show()
  2265. end
  2266. else
  2267. f:Hide()
  2268. end
  2269. end
  2270. else
  2271. for i = 1, 5 do
  2272. arenaprep[i]:Hide()
  2273. end
  2274. end
  2275. end
  2276. end)
  2277.  
  2278.  
  2279.  
  2280. if cfg.RaidFrames then
  2281. self:SetActiveStyle"Slim - Raid"
  2282. local raid = self:SpawnHeader(nil, nil, 'custom [@raid6,exists] show; hide',
  2283. 'showPlayer', true,
  2284. 'showSolo', true,
  2285. 'showParty', true,
  2286. 'showRaid', true,
  2287. 'xoffset', 4,
  2288. 'yOffset', -10,
  2289. 'point', 'LEFT',
  2290. 'groupFilter', '1,2,3,4,5,6,7,8',
  2291. 'groupingOrder', '1,2,3,4,5,6,7,8',
  2292. 'groupBy', 'GROUP',
  2293. 'maxColumns', 5,
  2294. 'unitsPerColumn', 5,
  2295. 'columnSpacing', -2,
  2296. 'sortMethod', 'INDEX',
  2297. 'columnAnchorPoint', 'TOP',
  2298. 'oUF-initialConfigFunction', ([[
  2299. self:SetWidth(%d)
  2300. self:SetHeight(%d)
  2301. ]]):format(cfg.widthR, cfg.heightR + cfg.NumbFS))
  2302. --raid:SetPoint("BOTTOM", UIParent, "BOTTOM", 0, 150)
  2303. --raid:SetPoint("TOPLEFT", UIParent, "BOTTOMLEFT", 100, 100)
  2304.  
  2305. if UnitName("player") == "Miku" then
  2306. raid:SetPoint("CENTER", 0, -359)
  2307. else if abiRealm == "Kel'Thuzad" then
  2308. if UnitName("player") == "Scrable" then
  2309. raid:SetPoint("CENTER", 0, -359)
  2310. end
  2311. else if UnitName("Player") == "Zetzl" then
  2312. if spec == 1 then
  2313. raid:SetPoint("CENTER", 0, -359)
  2314.  
  2315. end
  2316. else
  2317. raid:SetPoint("BOTTOMRIGHT", -216, 9)
  2318. end
  2319. end
  2320. end
  2321.  
  2322.  
  2323. end
  2324.  
  2325. if cfg.RaidFrames2 then
  2326. self:SetActiveStyle"Slim - R40"
  2327. local r40 = self:SpawnHeader('oUF_R40', nil, 'raid40',
  2328. 'showPlayer', true,
  2329. 'showSolo', true,
  2330. 'showParty', true,
  2331. 'showRaid', true,
  2332. 'xoffset', 4,
  2333. 'yOffset', -5,
  2334. 'point', 'LEFT',
  2335. 'groupFilter', '1,2,3,4,5,6,7,8',
  2336. 'groupingOrder', '1,2,3,4,5,6,7,8',
  2337. 'groupBy', 'GROUP',
  2338. 'maxColumns', 5,
  2339. 'unitsPerColumn', 5,
  2340. 'columnSpacing', 4,
  2341. 'sortMethod', 'INDEX',
  2342. 'columnAnchorPoint', 'TOP',
  2343. 'oUF-initialConfigFunction', ([[
  2344. self:SetWidth(%d)
  2345. self:SetHeight(%d)
  2346. ]]):format(cfg.widthR, cfg.heightR + cfg.NumbFS))
  2347. r40:SetPoint("TOPLEFT", UIParent, "TOPLEFT", 30, -250)
  2348. end
  2349.  
  2350. if cfg.BossFrames then
  2351. self:SetActiveStyle"Slim - Boss"
  2352. local boss = {}
  2353. for i = 1, MAX_BOSS_FRAMES do
  2354. local unit = self:Spawn("boss"..i, "oUF_SlimBoss"..i)
  2355.  
  2356. if i==1 then
  2357. --unit:SetPoint("TOPRIGHT", UIParent, "TOPRIGHT", -80, -420)
  2358. unit:SetPoint("LEFT", 25, -162)
  2359. else
  2360. unit:SetPoint("TOPLEFT", boss[i-1], "BOTTOMLEFT", 0, -10)
  2361. end
  2362. boss[i] = unit
  2363. end
  2364. end
  2365.  
  2366. if cfg.MTFrames then
  2367. self:SetActiveStyle"Slim - MainTank"
  2368. local Main_Tank = self:SpawnHeader("oUF_MainTank", nil, 'raid, party, solo',
  2369. 'showRaid', true,
  2370. "groupFilter", "MAINTANK",
  2371. 'yOffset', -10,
  2372. "template", "oUF_SlimMTartemplate", -- MT Target
  2373. 'oUF-initialConfigFunction', ([[
  2374. self:SetWidth(%d)
  2375. self:SetHeight(%d)
  2376. ]]):format(cfg.widthM, cfg.heightM))
  2377. --Main_Tank:SetPoint("TOPRIGHT", UIParent, "TOPRIGHT", -80, -250)
  2378. Main_Tank:SetPoint("TOPLEFT", 22, -251)
  2379. end
  2380.  
  2381. if cfg.useClassPoints then
  2382. oUF:RegisterStyle("oUF_Slim_pClassPoints", UnitSpecific.pClassPoints)
  2383. oUF:SetActiveStyle("oUF_Slim_pClassPoints")
  2384. oUF:Spawn('player', 'pClassPoints'):SetPoint("BOTTOMRIGHT", player, "TOPRIGHT", 0, 4)
  2385. end
  2386.  
  2387. if IsAddOnLoaded("oUF_WeaponEnchant") then
  2388. oUF:RegisterStyle("oUF_Slim_WpnEnch", UnitSpecific.WpnEnch)
  2389. oUF:SetActiveStyle("oUF_Slim_WpnEnch")
  2390. oUF:Spawn('player', 'WpnEnch'):SetPoint("BOTTOMRIGHT", player, "BOTTOMLEFT", -8, -(cfg.WeapEnchantIconSize+8))
  2391. end
  2392.  
  2393. end)
  2394.  
  2395. -- disable blizzard raidframe manager
  2396. if cfg.disableRaidFrameManager then
  2397. CompactRaidFrameManager:UnregisterAllEvents()
  2398. CompactRaidFrameManager:HookScript('OnShow', function(s) s:Hide() end)
  2399. CompactRaidFrameManager:Hide()
  2400. CompactRaidFrameContainer:UnregisterAllEvents()
  2401. CompactRaidFrameContainer:HookScript('OnShow', function(s) s:Hide() end)
  2402. CompactRaidFrameContainer:Hide()
  2403. end
  2404.  
  2405. -- remove SET_FOCUS & CLEAR_FOCUS from menu, to prevent errors
  2406. do
  2407. for k,v in pairs(UnitPopupMenus) do
  2408. for x,y in pairs(UnitPopupMenus[k]) do
  2409. if y == "SET_FOCUS" then
  2410. table.remove(UnitPopupMenus[k],x)
  2411. elseif y == "CLEAR_FOCUS" then
  2412. table.remove(UnitPopupMenus[k],x)
  2413. end
  2414. end
  2415. end
  2416. end
  2417.  
  2418. -------------
  2419. -- The End --
  2420. -------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement