Advertisement
Woopza

Elvui Player.lua - No Rest Icon

Sep 18th, 2015
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 38.57 KB | None | 0 0
  1. local E, L, V, P, G = unpack(select(2, ...)); --Inport: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
  2. local UF = E:GetModule('UnitFrames');
  3.  
  4. local _, ns = ...
  5. local ElvUF = ns.oUF
  6. assert(ElvUF, "ElvUI was unable to locate oUF.")
  7.  
  8. local CAN_HAVE_CLASSBAR = (E.myclass == "PALADIN" or E.myclass == "DRUID" or E.myclass == "DEATHKNIGHT" or E.myclass == "WARLOCK" or E.myclass == "PRIEST" or E.myclass == "MONK" or E.myclass == 'MAGE' or E.myclass == 'ROGUE')
  9.  
  10. function UF:Construct_PlayerFrame(frame)
  11. frame.Threat = self:Construct_Threat(frame, true)
  12.  
  13. frame.Health = self:Construct_HealthBar(frame, true, true, 'RIGHT')
  14. frame.Health.frequentUpdates = true;
  15.  
  16. frame.Power = self:Construct_PowerBar(frame, true, true, 'LEFT')
  17. frame.Power.frequentUpdates = true;
  18.  
  19. frame.Name = self:Construct_NameText(frame)
  20.  
  21. frame.Portrait3D = self:Construct_Portrait(frame, 'model')
  22. frame.Portrait2D = self:Construct_Portrait(frame, 'texture')
  23.  
  24. frame.Buffs = self:Construct_Buffs(frame)
  25.  
  26. frame.Debuffs = self:Construct_Debuffs(frame)
  27.  
  28. frame.Castbar = self:Construct_Castbar(frame, 'LEFT', L["Player Castbar"])
  29.  
  30. if E.myclass == "PALADIN" then
  31. frame.HolyPower = self:Construct_PaladinResourceBar(frame)
  32. frame.ClassBar = 'HolyPower'
  33. elseif E.myclass == "WARLOCK" then
  34. frame.ShardBar = self:Construct_WarlockResourceBar(frame)
  35. frame.ClassBar = 'ShardBar'
  36. elseif E.myclass == "DEATHKNIGHT" then
  37. frame.Runes = self:Construct_DeathKnightResourceBar(frame)
  38. frame.ClassBar = 'Runes'
  39. elseif E.myclass == "DRUID" then
  40. frame.EclipseBar = self:Construct_DruidResourceBar(frame)
  41. frame.DruidAltMana = self:Construct_DruidAltManaBar(frame)
  42. frame.ClassBar = 'EclipseBar'
  43. elseif E.myclass == "MONK" then
  44. frame.Harmony = self:Construct_MonkResourceBar(frame)
  45. frame.Stagger = self:Construct_Stagger(frame)
  46. frame.ClassBar = 'Harmony'
  47. elseif E.myclass == "PRIEST" then
  48. frame.ShadowOrbs = self:Construct_PriestResourceBar(frame)
  49. frame.ClassBar = 'ShadowOrbs'
  50. elseif E.myclass == 'MAGE' then
  51. frame.ArcaneChargeBar = self:Construct_MageResourceBar(frame)
  52. frame.ClassBar = 'ArcaneChargeBar'
  53. elseif E.myclass == 'ROGUE' then
  54. frame.Anticipation = self:Construct_RogueResourceBar(frame)
  55. frame.ClassBar = 'Anticipation'
  56. end
  57.  
  58. frame.RaidIcon = UF:Construct_RaidIcon(frame)
  59. frame.Resting = self:Construct_RestingIndicator(frame)
  60. frame.Combat = self:Construct_CombatIndicator(frame)
  61. frame.PvPText = self:Construct_PvPIndicator(frame)
  62. frame.DebuffHighlight = self:Construct_DebuffHighlight(frame)
  63. frame.HealPrediction = self:Construct_HealComm(frame)
  64.  
  65. frame.AuraBars = self:Construct_AuraBarHeader(frame)
  66.  
  67. frame.CombatFade = true
  68.  
  69. frame.customTexts = {}
  70.  
  71. frame:Point('BOTTOMLEFT', E.UIParent, 'BOTTOM', -413, 68) --Set to default position
  72. E:CreateMover(frame, frame:GetName()..'Mover', L["Player Frame"], nil, nil, nil, 'ALL,SOLO')
  73. end
  74.  
  75. function UF:UpdatePlayerFrameAnchors(frame, isShown)
  76. local db = E.db['unitframe']['units'].player
  77. local health = frame.Health
  78. local threat = frame.Threat
  79. local power = frame.Power
  80. local stagger = frame.Stagger
  81. local PORTRAIT_WIDTH = db.portrait.width
  82. local USE_PORTRAIT = db.portrait.enable
  83. local USE_PORTRAIT_OVERLAY = db.portrait.overlay and USE_PORTRAIT
  84. local CLASSBAR_HEIGHT = db.classbar.height
  85. local USE_CLASSBAR = db.classbar.enable
  86. local USE_MINI_CLASSBAR = db.classbar.fill == "spaced" and USE_CLASSBAR
  87. local USE_POWERBAR = db.power.enable
  88. local USE_INSET_POWERBAR = db.power.width == 'inset' and USE_POWERBAR
  89. local USE_MINI_POWERBAR = db.power.width == 'spaced' and USE_POWERBAR
  90. local POWERBAR_DETACHED = db.power.detachFromFrame
  91. local USE_POWERBAR_OFFSET = db.power.offset ~= 0 and USE_POWERBAR and not POWERBAR_DETACHED
  92. local POWERBAR_OFFSET = db.power.offset
  93. local POWERBAR_HEIGHT = db.power.height
  94. local SPACING = E.Spacing;
  95. local BORDER = E.Border;
  96. local SHADOW_SPACING = E.PixelMode and 3 or 4
  97. local USE_STAGGER = stagger and stagger:IsShown();
  98. local STAGGER_WIDTH = USE_STAGGER and (db.stagger.width + (BORDER*2)) or 0;
  99.  
  100. if not USE_POWERBAR then
  101. POWERBAR_HEIGHT = 0
  102. end
  103.  
  104. if USE_PORTRAIT_OVERLAY or not USE_PORTRAIT then
  105. PORTRAIT_WIDTH = 0
  106. end
  107.  
  108. if USE_MINI_CLASSBAR then
  109. CLASSBAR_HEIGHT = CLASSBAR_HEIGHT / 2
  110. end
  111.  
  112. if db.classbar.detachFromFrame then
  113. CLASSBAR_HEIGHT = E.PixelMode and 0 or -1 --Easiest way to counter the 1px difference SPACING introduces
  114. end
  115.  
  116. if USE_STAGGER then
  117. if not USE_MINI_POWERBAR and not USE_INSET_POWERBAR and not POWERBAR_DETACHED then
  118. stagger:Point('BOTTOMLEFT', power, 'BOTTOMRIGHT', BORDER*2 + (E.PixelMode and -1 or SPACING), 0)
  119. else
  120. stagger:Point('BOTTOMLEFT', health, 'BOTTOMRIGHT', BORDER*2 + (E.PixelMode and -1 or SPACING), 0)
  121. end
  122. stagger:Point('TOPRIGHT', health, 'TOPRIGHT', STAGGER_WIDTH, 0)
  123.  
  124.  
  125. if not USE_POWERBAR_OFFSET and not USE_MINI_POWERBAR and not USE_INSET_POWERBAR and not POWERBAR_DETACHED then
  126. power:Point("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -BORDER - STAGGER_WIDTH, BORDER)
  127. end
  128. elseif not USE_POWERBAR_OFFSET and not USE_MINI_POWERBAR and not USE_INSET_POWERBAR and not POWERBAR_DETACHED then
  129. power:Point("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -BORDER, BORDER)
  130. end
  131.  
  132. if isShown then
  133. if db.power.offset ~= 0 then
  134. health:Point("TOPRIGHT", frame, "TOPRIGHT", -(BORDER+db.power.offset) - STAGGER_WIDTH, -(BORDER + CLASSBAR_HEIGHT + SPACING))
  135. else
  136. health:Point("TOPRIGHT", frame, "TOPRIGHT", -BORDER - STAGGER_WIDTH, -(BORDER + CLASSBAR_HEIGHT + SPACING))
  137. end
  138. health:Point("TOPLEFT", frame, "TOPLEFT", PORTRAIT_WIDTH + BORDER, -(BORDER + CLASSBAR_HEIGHT + SPACING))
  139.  
  140. local mini_classbarY = 0
  141. if USE_MINI_CLASSBAR then
  142. mini_classbarY = -(SPACING+(CLASSBAR_HEIGHT))
  143. end
  144.  
  145. if db.threatStyle == "GLOW" then
  146. threat.glow:Point("TOPLEFT", -SHADOW_SPACING, SHADOW_SPACING+mini_classbarY)
  147. threat.glow:Point("TOPRIGHT", SHADOW_SPACING, SHADOW_SPACING+mini_classbarY)
  148.  
  149. if USE_MINI_POWERBAR then
  150. threat.glow:Point("BOTTOMLEFT", -SHADOW_SPACING, -SHADOW_SPACING + (POWERBAR_HEIGHT/2))
  151. threat.glow:Point("BOTTOMRIGHT", SHADOW_SPACING, -SHADOW_SPACING + (POWERBAR_HEIGHT/2))
  152. else
  153. threat.glow:Point("BOTTOMLEFT", -SHADOW_SPACING, -SHADOW_SPACING)
  154. threat.glow:Point("BOTTOMRIGHT", SHADOW_SPACING, -SHADOW_SPACING)
  155. end
  156.  
  157. if USE_POWERBAR_OFFSET then
  158. threat.glow:Point("TOPRIGHT", SHADOW_SPACING-POWERBAR_OFFSET, SHADOW_SPACING+mini_classbarY)
  159. threat.glow:Point("BOTTOMRIGHT", SHADOW_SPACING-POWERBAR_OFFSET, -SHADOW_SPACING)
  160. end
  161. end
  162.  
  163.  
  164. if db.portrait.enable and not USE_PORTRAIT_OVERLAY and frame.Portrait then
  165. local portrait = frame.Portrait
  166. portrait.backdrop:ClearAllPoints()
  167. if USE_MINI_CLASSBAR and USE_CLASSBAR then
  168. portrait.backdrop:Point("TOPLEFT", frame, "TOPLEFT", 0, -(CLASSBAR_HEIGHT + SPACING))
  169. else
  170. portrait.backdrop:SetPoint("TOPLEFT", frame, "TOPLEFT")
  171. end
  172.  
  173. if USE_MINI_POWERBAR or USE_POWERBAR_OFFSET or USE_INSET_POWERBAR or not USE_POWERBAR or USE_INSET_POWERBAR or POWERBAR_DETACHED then
  174. portrait.backdrop:Point("BOTTOMRIGHT", frame.Health.backdrop, "BOTTOMLEFT", E.PixelMode and 1 or -SPACING, 0)
  175. else
  176. portrait.backdrop:Point("BOTTOMRIGHT", frame.Power.backdrop, "BOTTOMLEFT", E.PixelMode and 1 or -SPACING, 0)
  177. end
  178. end
  179. else
  180. if db.power.offset ~= 0 then
  181. health:Point("TOPRIGHT", frame, "TOPRIGHT", -(BORDER + db.power.offset) - STAGGER_WIDTH, -BORDER)
  182. else
  183. health:Point("TOPRIGHT", frame, "TOPRIGHT", -BORDER - STAGGER_WIDTH, -BORDER)
  184. end
  185. health:Point("TOPLEFT", frame, "TOPLEFT", PORTRAIT_WIDTH + BORDER, -BORDER)
  186.  
  187. if db.threatStyle == "GLOW" then
  188. threat.glow:Point("TOPLEFT", -SHADOW_SPACING, SHADOW_SPACING)
  189. threat.glow:Point("TOPRIGHT", SHADOW_SPACING, SHADOW_SPACING)
  190.  
  191. if USE_MINI_POWERBAR then
  192. threat.glow:Point("BOTTOMLEFT", -SHADOW_SPACING, -SHADOW_SPACING + (POWERBAR_HEIGHT/2))
  193. threat.glow:Point("BOTTOMRIGHT", SHADOW_SPACING, -SHADOW_SPACING + (POWERBAR_HEIGHT/2))
  194. else
  195. threat.glow:Point("BOTTOMLEFT", -SHADOW_SPACING, -SHADOW_SPACING)
  196. threat.glow:Point("BOTTOMRIGHT", SHADOW_SPACING, -SHADOW_SPACING)
  197. end
  198.  
  199. if USE_POWERBAR_OFFSET then
  200. threat.glow:Point("TOPRIGHT", SHADOW_SPACING-POWERBAR_OFFSET, SHADOW_SPACING)
  201. threat.glow:Point("BOTTOMRIGHT", SHADOW_SPACING-POWERBAR_OFFSET, -SHADOW_SPACING)
  202. end
  203. end
  204.  
  205. if db.portrait.enable and not USE_PORTRAIT_OVERLAY and frame.Portrait then
  206. local portrait = frame.Portrait
  207. portrait.backdrop:ClearAllPoints()
  208. portrait.backdrop:Point("TOPLEFT", frame, "TOPLEFT")
  209.  
  210. if USE_MINI_POWERBAR or USE_POWERBAR_OFFSET or not USE_POWERBAR or USE_INSET_POWERBAR or POWERBAR_DETACHED then
  211. portrait.backdrop:Point("BOTTOMRIGHT", frame.Health.backdrop, "BOTTOMLEFT", E.PixelMode and 1 or -SPACING, 0)
  212. else
  213. portrait.backdrop:Point("BOTTOMRIGHT", frame.Power.backdrop, "BOTTOMLEFT", E.PixelMode and 1 or -SPACING, 0)
  214. end
  215. end
  216. end
  217. end
  218.  
  219. function UF:Update_PlayerFrame(frame, db)
  220. frame.db = db
  221.  
  222. if frame.Portrait then
  223. frame.Portrait:Hide()
  224. frame.Portrait:ClearAllPoints()
  225. frame.Portrait.backdrop:Hide()
  226. end
  227. frame.Portrait = db.portrait.style == '2D' and frame.Portrait2D or frame.Portrait3D
  228. frame:RegisterForClicks(self.db.targetOnMouseDown and 'AnyDown' or 'AnyUp')
  229. local BORDER = E.Border
  230. local SPACING = E.Spacing
  231. local SHADOW_SPACING = E.PixelMode and 3 or 4
  232. local UNIT_WIDTH = db.width
  233. local UNIT_HEIGHT = db.height
  234.  
  235. local USE_POWERBAR = db.power.enable
  236. local USE_INSET_POWERBAR = db.power.width == 'inset' and USE_POWERBAR
  237. local USE_MINI_POWERBAR = db.power.width == 'spaced' and USE_POWERBAR
  238. local POWERBAR_DETACHED = db.power.detachFromFrame
  239. local USE_POWERBAR_OFFSET = db.power.offset ~= 0 and USE_POWERBAR and not POWERBAR_DETACHED
  240. local POWERBAR_OFFSET = db.power.offset
  241. local POWERBAR_HEIGHT = db.power.height
  242. local POWERBAR_WIDTH = POWERBAR_DETACHED and db.power.detachedWidth or (db.width - (BORDER*2))
  243.  
  244. local USE_CLASSBAR = db.classbar.enable and CAN_HAVE_CLASSBAR
  245. local USE_MINI_CLASSBAR = db.classbar.fill == "spaced" and USE_CLASSBAR and db.classbar.detachFromFrame ~= true
  246. local CLASSBAR_HEIGHT = db.classbar.height
  247. local CLASSBAR_WIDTH = db.width - (BORDER*2)
  248.  
  249. local USE_PORTRAIT = db.portrait.enable
  250. local USE_PORTRAIT_OVERLAY = db.portrait.overlay and USE_PORTRAIT
  251. local PORTRAIT_WIDTH = db.portrait.width
  252.  
  253. local unit = self.unit
  254.  
  255. frame.colors = ElvUF.colors
  256. frame:Size(UNIT_WIDTH, UNIT_HEIGHT)
  257. _G[frame:GetName()..'Mover']:Size(frame:GetSize())
  258.  
  259. --Adjust some variables
  260. do
  261. if not USE_POWERBAR then
  262. POWERBAR_HEIGHT = 0
  263. end
  264.  
  265. if USE_PORTRAIT_OVERLAY or not USE_PORTRAIT then
  266. PORTRAIT_WIDTH = 0
  267. end
  268.  
  269. if USE_PORTRAIT then
  270. CLASSBAR_WIDTH = (UNIT_WIDTH - (BORDER*2)) - PORTRAIT_WIDTH
  271. end
  272.  
  273. if USE_POWERBAR_OFFSET then
  274. CLASSBAR_WIDTH = CLASSBAR_WIDTH - POWERBAR_OFFSET
  275. end
  276.  
  277. if USE_MINI_POWERBAR and not POWERBAR_DETACHED then
  278. POWERBAR_WIDTH = POWERBAR_WIDTH / 2
  279. end
  280. end
  281.  
  282. local mini_classbarY = 0
  283. if USE_MINI_CLASSBAR then
  284. mini_classbarY = -(SPACING+(CLASSBAR_HEIGHT/2))
  285. end
  286.  
  287. --Threat
  288. do
  289. local threat = frame.Threat
  290.  
  291. if db.threatStyle ~= 'NONE' and db.threatStyle ~= nil then
  292. if not frame:IsElementEnabled('Threat') then
  293. frame:EnableElement('Threat')
  294. end
  295.  
  296. if db.threatStyle == "GLOW" then
  297. threat:SetFrameStrata('BACKGROUND')
  298. threat.glow:ClearAllPoints()
  299. threat.glow:SetBackdropBorderColor(0, 0, 0, 0)
  300. threat.glow:Point("TOPLEFT", -SHADOW_SPACING, SHADOW_SPACING+mini_classbarY)
  301. threat.glow:Point("TOPRIGHT", SHADOW_SPACING, SHADOW_SPACING+mini_classbarY)
  302.  
  303. if USE_MINI_POWERBAR then
  304. threat.glow:Point("BOTTOMLEFT", -SHADOW_SPACING, -SHADOW_SPACING + (POWERBAR_HEIGHT/2))
  305. threat.glow:Point("BOTTOMRIGHT", SHADOW_SPACING, -SHADOW_SPACING + (POWERBAR_HEIGHT/2))
  306. else
  307. threat.glow:Point("BOTTOMLEFT", -SHADOW_SPACING, -SHADOW_SPACING)
  308. threat.glow:Point("BOTTOMRIGHT", SHADOW_SPACING, -SHADOW_SPACING)
  309. end
  310.  
  311. if USE_POWERBAR_OFFSET then
  312. threat.glow:Point("TOPRIGHT", SHADOW_SPACING-POWERBAR_OFFSET, SHADOW_SPACING+mini_classbarY)
  313. threat.glow:Point("BOTTOMRIGHT", SHADOW_SPACING-POWERBAR_OFFSET, -SHADOW_SPACING)
  314.  
  315. if USE_PORTRAIT == true and not USE_PORTRAIT_OVERLAY then
  316. threat.glow:Point("BOTTOMLEFT", frame.Portrait.backdrop, "BOTTOMLEFT", -4, -4)
  317. else
  318. threat.glow:Point("BOTTOMLEFT", frame.Health, "BOTTOMLEFT", -5, -5)
  319. end
  320. threat.glow:Point("BOTTOMRIGHT", frame.Health, "BOTTOMRIGHT", 5, -5)
  321. end
  322. elseif db.threatStyle == "ICONTOPLEFT" or db.threatStyle == "ICONTOPRIGHT" or db.threatStyle == "ICONBOTTOMLEFT" or db.threatStyle == "ICONBOTTOMRIGHT" or db.threatStyle == "ICONTOP" or db.threatStyle == "ICONBOTTOM" or db.threatStyle == "ICONLEFT" or db.threatStyle == "ICONRIGHT" then
  323. threat:SetFrameStrata('HIGH')
  324. local point = db.threatStyle
  325. point = point:gsub("ICON", "")
  326.  
  327. threat.texIcon:ClearAllPoints()
  328. threat.texIcon:SetPoint(point, frame.Health, point)
  329. end
  330. elseif frame:IsElementEnabled('Threat') then
  331. frame:DisableElement('Threat')
  332. end
  333. end
  334.  
  335. --Rest Icon
  336.  
  337.  
  338. --Combat Icon
  339. do
  340. local cIcon = frame.Combat
  341. if db.combatIcon and not frame:IsElementEnabled('Combat') then
  342. frame:EnableElement('Combat')
  343. elseif not db.combatIcon and frame:IsElementEnabled('Combat') then
  344. frame:DisableElement('Combat')
  345. cIcon:Hide()
  346. end
  347. end
  348.  
  349. --Health
  350. do
  351. local health = frame.Health
  352. health.Smooth = self.db.smoothbars
  353.  
  354. --Text
  355. local x, y = self:GetPositionOffset(db.health.position)
  356. health.value:ClearAllPoints()
  357. health.value:Point(db.health.position, health, db.health.position, x + db.health.xOffset, y + db.health.yOffset)
  358. frame:Tag(health.value, db.health.text_format)
  359.  
  360. --Colors
  361. health.colorSmooth = nil
  362. health.colorHealth = nil
  363. health.colorClass = nil
  364. health.colorReaction = nil
  365. if self.db['colors'].healthclass ~= true then
  366. if self.db['colors'].colorhealthbyvalue == true then
  367. health.colorSmooth = true
  368. else
  369. health.colorHealth = true
  370. end
  371. else
  372. health.colorClass = true
  373. health.colorReaction = true
  374. end
  375. if self.db['colors'].forcehealthreaction == true then
  376. health.colorClass = false
  377. health.colorReaction = true
  378. end
  379.  
  380. --Position
  381. health:ClearAllPoints()
  382. health:Point("TOPRIGHT", frame, "TOPRIGHT", -BORDER, -BORDER)
  383.  
  384. if POWERBAR_DETACHED then
  385. health:Point("BOTTOMLEFT", frame, "BOTTOMLEFT", BORDER, BORDER)
  386. elseif USE_POWERBAR_OFFSET then
  387. health:Point("TOPRIGHT", frame, "TOPRIGHT", -(BORDER+POWERBAR_OFFSET), -BORDER)
  388. health:Point("BOTTOMLEFT", frame, "BOTTOMLEFT", BORDER, BORDER+POWERBAR_OFFSET)
  389. elseif USE_INSET_POWERBAR then
  390. health:Point("BOTTOMLEFT", frame, "BOTTOMLEFT", BORDER, BORDER)
  391. elseif USE_MINI_POWERBAR then
  392. health:Point("BOTTOMLEFT", frame, "BOTTOMLEFT", BORDER, BORDER + (POWERBAR_HEIGHT/2))
  393. else
  394. health:Point("BOTTOMLEFT", frame, "BOTTOMLEFT", BORDER, (USE_POWERBAR and ((BORDER + SPACING)*2) or BORDER) + POWERBAR_HEIGHT)
  395. end
  396.  
  397. health.bg:ClearAllPoints()
  398. if not USE_PORTRAIT_OVERLAY then
  399. health:Point("TOPLEFT", PORTRAIT_WIDTH+BORDER, -BORDER)
  400. health.bg:SetParent(health)
  401. health.bg:SetAllPoints()
  402. else
  403. health.bg:Point('BOTTOMLEFT', health:GetStatusBarTexture(), 'BOTTOMRIGHT')
  404. health.bg:Point('TOPRIGHT', health)
  405. health.bg:SetParent(frame.Portrait.overlay)
  406. end
  407.  
  408. if USE_CLASSBAR and not db.classbar.detachFromFrame then
  409. local DEPTH
  410. if USE_MINI_CLASSBAR then
  411. DEPTH = -(BORDER+(CLASSBAR_HEIGHT/2))
  412. else
  413. DEPTH = -(BORDER+CLASSBAR_HEIGHT+SPACING)
  414. end
  415.  
  416. if USE_POWERBAR_OFFSET then
  417. health:Point("TOPRIGHT", frame, "TOPRIGHT", -(BORDER+POWERBAR_OFFSET), DEPTH)
  418. else
  419. health:Point("TOPRIGHT", frame, "TOPRIGHT", -BORDER, DEPTH)
  420. end
  421.  
  422. health:Point("TOPLEFT", frame, "TOPLEFT", PORTRAIT_WIDTH+BORDER, DEPTH)
  423. end
  424. end
  425.  
  426. --Name
  427. UF:UpdateNameSettings(frame)
  428.  
  429. --PvP
  430. do
  431. local pvp = frame.PvPText
  432. local x, y = self:GetPositionOffset(db.pvp.position)
  433. pvp:ClearAllPoints()
  434. pvp:Point(db.pvp.position, frame.Health, db.pvp.position, x, y)
  435.  
  436. frame:Tag(pvp, db.pvp.text_format)
  437. end
  438.  
  439. --Power
  440. do
  441. local power = frame.Power
  442. if USE_POWERBAR then
  443. if not frame:IsElementEnabled('Power') then
  444. frame:EnableElement('Power')
  445.  
  446. power:Show()
  447. end
  448.  
  449. power.Smooth = self.db.smoothbars
  450.  
  451. --Text
  452. local x, y = self:GetPositionOffset(db.power.position)
  453. power.value:ClearAllPoints()
  454. power.value:Point(db.power.position, db.power.attachTextToPower and power or frame.Health, db.power.position, x + db.power.xOffset, y + db.power.yOffset)
  455. frame:Tag(power.value, db.power.text_format)
  456.  
  457.  
  458. if db.power.attachTextToPower then
  459. power.value:SetParent(power)
  460. else
  461. power.value:SetParent(frame.RaisedElementParent)
  462. end
  463.  
  464. --Colors
  465. power.colorClass = nil
  466. power.colorReaction = nil
  467. power.colorPower = nil
  468. if self.db['colors'].powerclass then
  469. power.colorClass = true
  470. power.colorReaction = true
  471. else
  472. power.colorPower = true
  473. end
  474.  
  475. --Position
  476. power:ClearAllPoints()
  477. if POWERBAR_DETACHED then
  478. power:Width(POWERBAR_WIDTH)
  479. power:Height(POWERBAR_HEIGHT)
  480. if not power.mover then
  481. power:ClearAllPoints()
  482. power:Point("BOTTOM", frame, "BOTTOM", 0, -20)
  483. E:CreateMover(power, 'PlayerPowerBarMover', L["Player Powerbar"], nil, nil, nil, 'ALL,SOLO')
  484. else
  485. power:ClearAllPoints()
  486. power:SetPoint("BOTTOMLEFT", power.mover, "BOTTOMLEFT")
  487. power.mover:SetScale(1)
  488. power.mover:SetAlpha(1)
  489. end
  490.  
  491. power:SetFrameStrata("MEDIUM")
  492. power:SetFrameLevel(frame:GetFrameLevel() + 3)
  493. elseif USE_POWERBAR_OFFSET then
  494. power:Point("TOPRIGHT", frame.Health, "TOPRIGHT", POWERBAR_OFFSET, -POWERBAR_OFFSET)
  495. power:Point("BOTTOMLEFT", frame.Health, "BOTTOMLEFT", POWERBAR_OFFSET, -POWERBAR_OFFSET)
  496. power:SetFrameStrata("LOW")
  497. power:SetFrameLevel(2)
  498. elseif USE_INSET_POWERBAR then
  499. power:Height(POWERBAR_HEIGHT)
  500. power:Point("BOTTOMLEFT", frame.Health, "BOTTOMLEFT", BORDER + (BORDER*2), BORDER + (BORDER*2))
  501. power:Point("BOTTOMRIGHT", frame.Health, "BOTTOMRIGHT", -(BORDER + (BORDER*2)), BORDER + (BORDER*2))
  502. power:SetFrameStrata("MEDIUM")
  503. power:SetFrameLevel(frame:GetFrameLevel() + 3)
  504. elseif USE_MINI_POWERBAR then
  505. power:Width(POWERBAR_WIDTH - BORDER*2)
  506. power:Height(POWERBAR_HEIGHT)
  507. power:Point("RIGHT", frame, "BOTTOMRIGHT", -(BORDER*2 + 4), BORDER + (POWERBAR_HEIGHT/2))
  508. power:SetFrameStrata("MEDIUM")
  509. power:SetFrameLevel(frame:GetFrameLevel() + 3)
  510. else
  511. power:Point("TOPLEFT", frame.Health.backdrop, "BOTTOMLEFT", BORDER, -(E.PixelMode and 0 or (BORDER + SPACING)))
  512. power:Point("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -BORDER, BORDER)
  513. end
  514.  
  515. if db.power.strataAndLevel.useCustomStrata then
  516. power:SetFrameStrata(db.power.strataAndLevel.frameStrata)
  517. end
  518. if db.power.strataAndLevel.useCustomLevel then
  519. power:SetFrameLevel(db.power.strataAndLevel.frameLevel)
  520. end
  521.  
  522. elseif frame:IsElementEnabled('Power') then
  523. frame:DisableElement('Power')
  524. power:Hide()
  525. end
  526.  
  527. if frame.DruidAltMana then
  528. if db.power.druidMana then
  529. frame:EnableElement('DruidAltMana')
  530. else
  531. frame:DisableElement('DruidAltMana')
  532. frame.DruidAltMana:Hide()
  533. end
  534. end
  535. end
  536.  
  537. --Portrait
  538. do
  539. local portrait = frame.Portrait
  540.  
  541. --Set Points
  542. if USE_PORTRAIT then
  543. if not frame:IsElementEnabled('Portrait') then
  544. frame:EnableElement('Portrait')
  545. end
  546.  
  547. portrait:ClearAllPoints()
  548.  
  549. if USE_PORTRAIT_OVERLAY then
  550. if db.portrait.style == '3D' then
  551. portrait:SetFrameLevel(frame.Health:GetFrameLevel() + 1)
  552. end
  553. portrait:SetAllPoints(frame.Health)
  554. portrait:SetAlpha(0.3)
  555. portrait:Show()
  556. portrait.backdrop:Hide()
  557. else
  558. portrait:SetAlpha(1)
  559. portrait:Show()
  560. portrait.backdrop:Show()
  561. if db.portrait.style == '3D' then
  562. portrait:SetFrameLevel(frame:GetFrameLevel() + 5)
  563. end
  564. if USE_MINI_CLASSBAR and USE_CLASSBAR and not db.classbar.detachFromFrame then
  565. portrait.backdrop:Point("TOPLEFT", frame, "TOPLEFT", 0, -((CLASSBAR_HEIGHT/2)))
  566. else
  567. portrait.backdrop:SetPoint("TOPLEFT", frame, "TOPLEFT")
  568. end
  569.  
  570. if USE_MINI_POWERBAR or USE_POWERBAR_OFFSET or not USE_POWERBAR or USE_INSET_POWERBAR or POWERBAR_DETACHED then
  571. portrait.backdrop:Point("BOTTOMRIGHT", frame.Health.backdrop, "BOTTOMLEFT", E.PixelMode and 1 or -SPACING, 0)
  572. else
  573. portrait.backdrop:Point("BOTTOMRIGHT", frame.Power.backdrop, "BOTTOMLEFT", E.PixelMode and 1 or -SPACING, 0)
  574. end
  575.  
  576. portrait:Point('BOTTOMLEFT', portrait.backdrop, 'BOTTOMLEFT', BORDER, BORDER)
  577. portrait:Point('TOPRIGHT', portrait.backdrop, 'TOPRIGHT', -BORDER, -BORDER)
  578. end
  579. else
  580. if frame:IsElementEnabled('Portrait') then
  581. frame:DisableElement('Portrait')
  582. portrait:Hide()
  583. portrait.backdrop:Hide()
  584. end
  585. end
  586. end
  587.  
  588. --Auras Disable/Enable
  589. --Only do if both debuffs and buffs aren't being used.
  590. do
  591. if db.debuffs.enable or db.buffs.enable then
  592. if not frame:IsElementEnabled('Aura') then
  593. frame:EnableElement('Aura')
  594. end
  595. else
  596. if frame:IsElementEnabled('Aura') then
  597. frame:DisableElement('Aura')
  598. end
  599. end
  600.  
  601. frame.Buffs:ClearAllPoints()
  602. frame.Debuffs:ClearAllPoints()
  603. end
  604.  
  605. --Buffs
  606. do
  607. local buffs = frame.Buffs
  608. local rows = db.buffs.numrows
  609.  
  610. if USE_POWERBAR_OFFSET then
  611. buffs:SetWidth(UNIT_WIDTH - POWERBAR_OFFSET)
  612. else
  613. buffs:SetWidth(UNIT_WIDTH)
  614. end
  615.  
  616. buffs.forceShow = frame.forceShowAuras
  617. buffs.num = db.buffs.perrow * rows
  618. buffs.size = db.buffs.sizeOverride ~= 0 and db.buffs.sizeOverride or ((((buffs:GetWidth() - (buffs.spacing*(buffs.num/rows - 1))) / buffs.num)) * rows)
  619.  
  620. if db.buffs.sizeOverride and db.buffs.sizeOverride > 0 then
  621. buffs:SetWidth(db.buffs.perrow * db.buffs.sizeOverride)
  622. end
  623.  
  624. local x, y = E:GetXYOffset(db.buffs.anchorPoint)
  625. local attachTo = self:GetAuraAnchorFrame(frame, db.buffs.attachTo)
  626.  
  627. buffs:Point(E.InversePoints[db.buffs.anchorPoint], attachTo, db.buffs.anchorPoint, x + db.buffs.xOffset, y + db.buffs.yOffset + (E.PixelMode and (db.buffs.anchorPoint:find('TOP') and -1 or 1) or 0))
  628. buffs:Height(buffs.size * rows)
  629. buffs["growth-y"] = db.buffs.anchorPoint:find('TOP') and 'UP' or 'DOWN'
  630. buffs["growth-x"] = db.buffs.anchorPoint == 'LEFT' and 'LEFT' or db.buffs.anchorPoint == 'RIGHT' and 'RIGHT' or (db.buffs.anchorPoint:find('LEFT') and 'RIGHT' or 'LEFT')
  631. buffs.initialAnchor = E.InversePoints[db.buffs.anchorPoint]
  632.  
  633. buffs.attachTo = attachTo
  634. buffs.point = E.InversePoints[db.buffs.anchorPoint]
  635. buffs.anchorPoint = db.buffs.anchorPoint
  636. buffs.xOffset = x + db.buffs.xOffset
  637. buffs.yOffset = y + db.buffs.yOffset + (E.PixelMode and (db.buffs.anchorPoint:find('TOP') and -1 or 1) or 0)
  638.  
  639. if db.buffs.enable then
  640. buffs:Show()
  641. UF:UpdateAuraIconSettings(buffs)
  642. else
  643. buffs:Hide()
  644. end
  645. end
  646.  
  647. --Debuffs
  648. do
  649. local debuffs = frame.Debuffs
  650. local rows = db.debuffs.numrows
  651.  
  652. if USE_POWERBAR_OFFSET then
  653. debuffs:SetWidth(UNIT_WIDTH - POWERBAR_OFFSET)
  654. else
  655. debuffs:SetWidth(UNIT_WIDTH)
  656. end
  657.  
  658. debuffs.forceShow = frame.forceShowAuras
  659. debuffs.num = db.debuffs.perrow * rows
  660. debuffs.size = db.debuffs.sizeOverride ~= 0 and db.debuffs.sizeOverride or ((((debuffs:GetWidth() - (debuffs.spacing*(debuffs.num/rows - 1))) / debuffs.num)) * rows)
  661.  
  662. if db.debuffs.sizeOverride and db.debuffs.sizeOverride > 0 then
  663. debuffs:SetWidth(db.debuffs.perrow * db.debuffs.sizeOverride)
  664. end
  665.  
  666. local x, y = E:GetXYOffset(db.debuffs.anchorPoint)
  667. local attachTo = self:GetAuraAnchorFrame(frame, db.debuffs.attachTo, db.debuffs.attachTo == 'BUFFS' and db.buffs.attachTo == 'DEBUFFS')
  668.  
  669. debuffs:Point(E.InversePoints[db.debuffs.anchorPoint], attachTo, db.debuffs.anchorPoint, x + db.debuffs.xOffset, y + db.debuffs.yOffset)
  670. debuffs:Height(debuffs.size * rows)
  671. debuffs["growth-y"] = db.debuffs.anchorPoint:find('TOP') and 'UP' or 'DOWN'
  672. debuffs["growth-x"] = db.debuffs.anchorPoint == 'LEFT' and 'LEFT' or db.debuffs.anchorPoint == 'RIGHT' and 'RIGHT' or (db.debuffs.anchorPoint:find('LEFT') and 'RIGHT' or 'LEFT')
  673. debuffs.initialAnchor = E.InversePoints[db.debuffs.anchorPoint]
  674.  
  675. debuffs.attachTo = attachTo
  676. debuffs.point = E.InversePoints[db.debuffs.anchorPoint]
  677. debuffs.anchorPoint = db.debuffs.anchorPoint
  678. debuffs.xOffset = x + db.debuffs.xOffset
  679. debuffs.yOffset = y + db.debuffs.yOffset
  680.  
  681. if db.debuffs.enable then
  682. debuffs:Show()
  683. UF:UpdateAuraIconSettings(debuffs)
  684. else
  685. debuffs:Hide()
  686. end
  687. end
  688.  
  689. --Smart Aura Position
  690. do
  691. local position = db.smartAuraPosition
  692.  
  693. if position == "BUFFS_ON_DEBUFFS" then
  694. if db.debuffs.attachTo == "BUFFS" then
  695. E:Print(format(L["This setting caused a conflicting anchor point, where '%s' would be attached to itself. Please check your anchor points. Setting '%s' to be attached to '%s'."], L["Buffs"], L["Debuffs"], L["Frame"]))
  696. db.debuffs.attachTo = "FRAME"
  697. frame.Debuffs.attachTo = frame
  698. end
  699. frame.Buffs.PostUpdate = nil
  700. frame.Debuffs.PostUpdate = UF.UpdateBuffsHeaderPosition
  701. elseif position == "DEBUFFS_ON_BUFFS" then
  702. if db.buffs.attachTo == "DEBUFFS" then
  703. E:Print(format(L["This setting caused a conflicting anchor point, where '%s' would be attached to itself. Please check your anchor points. Setting '%s' to be attached to '%s'."], L["Debuffs"], L["Buffs"], L["Frame"]))
  704. db.buffs.attachTo = "FRAME"
  705. frame.Buffs.attachTo = frame
  706. end
  707. frame.Buffs.PostUpdate = UF.UpdateDebuffsHeaderPosition
  708. frame.Debuffs.PostUpdate = nil
  709. else
  710. frame.Buffs.PostUpdate = nil
  711. frame.Debuffs.PostUpdate = nil
  712. end
  713. end
  714.  
  715. --Castbar
  716. do
  717. local castbar = frame.Castbar
  718. castbar:Width(db.castbar.width - (BORDER * 2))
  719. castbar:Height(db.castbar.height)
  720. castbar.Holder:Width(db.castbar.width)
  721. castbar.Holder:Height(db.castbar.height + (E.PixelMode and 2 or (BORDER * 2)))
  722. castbar.Holder:GetScript('OnSizeChanged')(castbar.Holder)
  723.  
  724. --Latency
  725. if db.castbar.latency then
  726. castbar.SafeZone = castbar.LatencyTexture
  727. castbar.LatencyTexture:Show()
  728. else
  729. castbar.SafeZone = nil
  730. castbar.LatencyTexture:Hide()
  731. end
  732.  
  733. --Icon
  734. if db.castbar.icon then
  735. castbar.Icon = castbar.ButtonIcon
  736. castbar.Icon.bg:Width(db.castbar.height + (E.Border * 2))
  737. castbar.Icon.bg:Height(db.castbar.height + (E.Border * 2))
  738.  
  739. castbar:Width(db.castbar.width - castbar.Icon.bg:GetWidth() - (E.PixelMode and 1 or 5))
  740. castbar.Icon.bg:Show()
  741. else
  742. castbar.ButtonIcon.bg:Hide()
  743. castbar.Icon = nil
  744. end
  745.  
  746. if db.castbar.spark then
  747. castbar.Spark:Show()
  748. else
  749. castbar.Spark:Hide()
  750. end
  751.  
  752. if db.castbar.enable and not frame:IsElementEnabled('Castbar') then
  753. frame:EnableElement('Castbar')
  754. elseif not db.castbar.enable and frame:IsElementEnabled('Castbar') then
  755. frame:DisableElement('Castbar')
  756. end
  757. end
  758.  
  759. --Resource Bars
  760. do
  761. local bars = frame[frame.ClassBar]
  762. if bars then
  763. if bars.UpdateAllRuneTypes then
  764. bars.UpdateAllRuneTypes(frame)
  765. end
  766. local c = UF.db.colors.classResources.bgColor
  767. bars.backdrop.ignoreUpdates = true
  768. bars.backdrop.backdropTexture:SetVertexColor(c.r, c.g, c.b)
  769. if(not E.PixelMode) then
  770. c = E.db.general.bordercolor
  771. bars.backdrop:SetBackdropBorderColor(c.r, c.g, c.b)
  772. end
  773. local MAX_CLASS_BAR = UF.classMaxResourceBar[E.myclass]
  774. if USE_MINI_CLASSBAR and not db.classbar.detachFromFrame then
  775. bars:ClearAllPoints()
  776. bars:Point("CENTER", frame.Health.backdrop, "TOP", 0, 0)
  777. if E.myclass == 'DRUID' then
  778. CLASSBAR_WIDTH = CLASSBAR_WIDTH * 2/3
  779. else
  780. CLASSBAR_WIDTH = CLASSBAR_WIDTH * (MAX_CLASS_BAR - 1) / MAX_CLASS_BAR
  781. end
  782. bars:SetFrameStrata("MEDIUM")
  783.  
  784. if bars.mover then
  785. bars.mover:SetScale(0.000001)
  786. bars.mover:SetAlpha(0)
  787. end
  788. elseif not db.classbar.detachFromFrame then
  789. bars:ClearAllPoints()
  790. bars:Point("BOTTOMLEFT", frame.Health.backdrop, "TOPLEFT", BORDER, (E.PixelMode and 0 or (BORDER + SPACING)))
  791. bars:SetFrameStrata("LOW")
  792.  
  793. if bars.mover then
  794. bars.mover:SetScale(0.000001)
  795. bars.mover:SetAlpha(0)
  796. end
  797. else
  798. CLASSBAR_WIDTH = db.classbar.detachedWidth - (BORDER*2)
  799.  
  800. if not bars.mover then
  801. bars:Width(CLASSBAR_WIDTH)
  802. bars:Height(CLASSBAR_HEIGHT - (E.PixelMode and 1 or 4))
  803. bars:ClearAllPoints()
  804. bars:Point("BOTTOM", E.UIParent, "BOTTOM", 0, 150)
  805. E:CreateMover(bars, 'ClassBarMover', L["Classbar"], nil, nil, nil, 'ALL,SOLO')
  806. else
  807. bars:ClearAllPoints()
  808. bars:SetPoint("BOTTOMLEFT", bars.mover, "BOTTOMLEFT")
  809. bars.mover:SetScale(1)
  810. bars.mover:SetAlpha(1)
  811. end
  812.  
  813. bars:SetFrameStrata("LOW")
  814. end
  815.  
  816. bars:Width(CLASSBAR_WIDTH)
  817. bars:Height(CLASSBAR_HEIGHT - (E.PixelMode and 1 or 4))
  818.  
  819. if E.myclass ~= 'MONK' and E.myclass ~= 'WARLOCK' and E.myclass ~= 'DRUID' then
  820. for i = 1, MAX_CLASS_BAR do
  821. bars[i].backdrop.ignoreUpdates = true
  822. bars[i].backdrop.backdropTexture:SetVertexColor(c.r, c.g, c.b)
  823. if(not E.PixelMode) then
  824. c = E.db.general.bordercolor
  825. bars[i].backdrop:SetBackdropBorderColor(c.r, c.g, c.b)
  826. end
  827. bars[i]:SetHeight(bars:GetHeight())
  828. if db.classbar.fill == "spaced" then
  829. bars[i]:SetWidth(E:Scale(bars:GetWidth() - ((SPACING+(BORDER*2)+2)*(MAX_CLASS_BAR - 1)))/MAX_CLASS_BAR)
  830. else
  831. bars[i]:SetWidth(E:Scale(bars:GetWidth() - (MAX_CLASS_BAR - 1))/MAX_CLASS_BAR)
  832. end
  833.  
  834. bars[i]:GetStatusBarTexture():SetHorizTile(false)
  835. bars[i]:ClearAllPoints()
  836. if i == 1 then
  837. bars[i]:SetPoint("LEFT", bars)
  838. else
  839. if db.classbar.fill == "spaced" then
  840. bars[i]:Point("LEFT", bars[i-1], "RIGHT", SPACING+(BORDER*2)+2, 0)
  841. else
  842. bars[i]:Point("LEFT", bars[i-1], "RIGHT", 1, 0)
  843. end
  844. end
  845.  
  846. if db.classbar.fill ~= "spaced" then
  847. bars[i].backdrop:Hide()
  848. else
  849. bars[i].backdrop:Show()
  850. end
  851.  
  852. if E.myclass == 'ROGUE' then
  853. bars[i]:SetStatusBarColor(unpack(ElvUF.colors[frame.ClassBar][i]))
  854.  
  855. if bars[i].bg then
  856. bars[i].bg:SetTexture(unpack(ElvUF.colors[frame.ClassBar][i]))
  857. end
  858. elseif E.myclass ~= 'DEATHKNIGHT' then
  859. bars[i]:SetStatusBarColor(unpack(ElvUF.colors[frame.ClassBar]))
  860.  
  861. if bars[i].bg then
  862. bars[i].bg:SetTexture(unpack(ElvUF.colors[frame.ClassBar]))
  863. end
  864. end
  865. end
  866. elseif E.myclass == 'DRUID' then
  867. --?? Apparent bug fix for the width after in-game settings change
  868. bars.LunarBar:SetMinMaxValues(0, 0)
  869. bars.SolarBar:SetMinMaxValues(0, 0)
  870. bars.LunarBar:SetStatusBarColor(unpack(ElvUF.colors.EclipseBar[1]))
  871. bars.SolarBar:SetStatusBarColor(unpack(ElvUF.colors.EclipseBar[2]))
  872. bars.LunarBar:Size(CLASSBAR_WIDTH, CLASSBAR_HEIGHT - (E.PixelMode and 1 or 4))
  873. bars.SolarBar:Size(CLASSBAR_WIDTH, CLASSBAR_HEIGHT - (E.PixelMode and 1 or 4))
  874. end
  875.  
  876. if E.myclass ~= 'DRUID' then
  877. if db.classbar.fill ~= "spaced" then
  878. bars.backdrop:Show()
  879. else
  880. bars.backdrop:Hide()
  881. end
  882. end
  883.  
  884. if USE_CLASSBAR and not frame:IsElementEnabled(frame.ClassBar) then
  885. frame:EnableElement(frame.ClassBar)
  886. bars:Show()
  887. elseif not USE_CLASSBAR and frame:IsElementEnabled(frame.ClassBar) then
  888. frame:DisableElement(frame.ClassBar)
  889. bars:Hide()
  890. end
  891. end
  892. end
  893.  
  894. --Stagger
  895. do
  896. if E.myclass == "MONK" then
  897. local stagger = frame.Stagger
  898. if db.stagger.enable then
  899. if not frame:IsElementEnabled('Stagger') then
  900. frame:EnableElement('Stagger')
  901. end
  902. else
  903. if frame:IsElementEnabled('Stagger') then
  904. frame:DisableElement('Stagger')
  905. end
  906. end
  907. end
  908. end
  909.  
  910. --Combat Fade
  911. do
  912. if db.combatfade and not frame:IsElementEnabled('CombatFade') then
  913. frame:EnableElement('CombatFade')
  914. elseif not db.combatfade and frame:IsElementEnabled('CombatFade') then
  915. frame:DisableElement('CombatFade')
  916. end
  917. end
  918.  
  919. --Debuff Highlight
  920. do
  921. local dbh = frame.DebuffHighlight
  922. if E.db.unitframe.debuffHighlighting then
  923. frame:EnableElement('DebuffHighlight')
  924. else
  925. frame:DisableElement('DebuffHighlight')
  926. end
  927. end
  928.  
  929. --Raid Icon
  930. do
  931. local RI = frame.RaidIcon
  932. if db.raidicon.enable then
  933. frame:EnableElement('RaidIcon')
  934. RI:Show()
  935. RI:Size(db.raidicon.size)
  936.  
  937. local x, y = self:GetPositionOffset(db.raidicon.attachTo)
  938. RI:ClearAllPoints()
  939. RI:Point(db.raidicon.attachTo, frame, db.raidicon.attachTo, x + db.raidicon.xOffset, y + db.raidicon.yOffset)
  940. else
  941. frame:DisableElement('RaidIcon')
  942. RI:Hide()
  943. end
  944. end
  945.  
  946. --OverHealing
  947. do
  948. local healPrediction = frame.HealPrediction
  949. local c = UF.db.colors.healPrediction
  950. if db.healPrediction then
  951. if not frame:IsElementEnabled('HealPrediction') then
  952. frame:EnableElement('HealPrediction')
  953. end
  954.  
  955. if not USE_PORTRAIT_OVERLAY then
  956. healPrediction.myBar:SetParent(frame)
  957. healPrediction.otherBar:SetParent(frame)
  958. healPrediction.absorbBar:SetParent(frame)
  959. else
  960. healPrediction.myBar:SetParent(frame.Portrait.overlay)
  961. healPrediction.otherBar:SetParent(frame.Portrait.overlay)
  962. healPrediction.absorbBar:SetParent(frame.Portrait.overlay)
  963. end
  964. healPrediction.myBar:SetStatusBarColor(c.personal.r, c.personal.g, c.personal.b, c.personal.a)
  965. healPrediction.otherBar:SetStatusBarColor(c.others.r, c.others.g, c.others.b, c.others.a)
  966. healPrediction.absorbBar:SetStatusBarColor(c.absorbs.r, c.absorbs.g, c.absorbs.b, c.absorbs.a)
  967. else
  968. if frame:IsElementEnabled('HealPrediction') then
  969. frame:DisableElement('HealPrediction')
  970. end
  971. end
  972. end
  973.  
  974. --AuraBars
  975. do
  976. local auraBars = frame.AuraBars
  977.  
  978. if db.aurabar.enable then
  979. if not frame:IsElementEnabled('AuraBars') then
  980. frame:EnableElement('AuraBars')
  981. end
  982. auraBars:Show()
  983. auraBars.friendlyAuraType = db.aurabar.friendlyAuraType
  984. auraBars.enemyAuraType = db.aurabar.enemyAuraType
  985. auraBars.scaleTime = db.aurabar.uniformThreshold
  986.  
  987. local buffColor = UF.db.colors.auraBarBuff
  988. local debuffColor = UF.db.colors.auraBarDebuff
  989. local attachTo = frame
  990.  
  991. if(E:CheckClassColor(buffColor.r, buffColor.g, buffColor.b)) then
  992. buffColor = E.myclass == 'PRIEST' and E.PriestColors or RAID_CLASS_COLORS[E.myclass]
  993. end
  994.  
  995. if(E:CheckClassColor(debuffColor.r, debuffColor.g, debuffColor.b)) then
  996. debuffColor = E.myclass == 'PRIEST' and E.PriestColors or RAID_CLASS_COLORS[E.myclass]
  997. end
  998.  
  999. if db.aurabar.attachTo == 'BUFFS' then
  1000. attachTo = frame.Buffs
  1001. elseif db.aurabar.attachTo == 'DEBUFFS' then
  1002. attachTo = frame.Debuffs
  1003. end
  1004.  
  1005. local anchorPoint, anchorTo = 'BOTTOM', 'TOP'
  1006. if db.aurabar.anchorPoint == 'BELOW' then
  1007. anchorPoint, anchorTo = 'TOP', 'BOTTOM'
  1008. end
  1009.  
  1010. local yOffset = 0;
  1011. if E.PixelMode then
  1012. if db.aurabar.anchorPoint == 'BELOW' then
  1013. yOffset = 1;
  1014. else
  1015. yOffset = -1;
  1016. end
  1017. end
  1018.  
  1019. auraBars.auraBarHeight = db.aurabar.height
  1020. auraBars:ClearAllPoints()
  1021. auraBars:SetPoint(anchorPoint..'LEFT', attachTo, anchorTo..'LEFT', (attachTo == frame and anchorTo == 'BOTTOM') and POWERBAR_OFFSET or 0, E.PixelMode and anchorPoint == -1 or yOffset)
  1022. auraBars:SetPoint(anchorPoint..'RIGHT', attachTo, anchorTo..'RIGHT', attachTo == frame and POWERBAR_OFFSET * (anchorTo == 'BOTTOM' and 0 or -1) or 0, E.PixelMode and -1 or yOffset)
  1023. auraBars.buffColor = {buffColor.r, buffColor.g, buffColor.b}
  1024. if UF.db.colors.auraBarByType then
  1025. auraBars.debuffColor = nil;
  1026. auraBars.defaultDebuffColor = {debuffColor.r, debuffColor.g, debuffColor.b}
  1027. else
  1028. auraBars.debuffColor = {debuffColor.r, debuffColor.g, debuffColor.b}
  1029. auraBars.defaultDebuffColor = nil;
  1030. end
  1031. auraBars.down = db.aurabar.anchorPoint == 'BELOW'
  1032.  
  1033. if db.aurabar.sort == 'TIME_REMAINING' then
  1034. auraBars.sort = true --default function
  1035. elseif db.aurabar.sort == 'TIME_REMAINING_REVERSE' then
  1036. auraBars.sort = UF.SortAuraBarReverse
  1037. elseif db.aurabar.sort == 'TIME_DURATION' then
  1038. auraBars.sort = UF.SortAuraBarDuration
  1039. elseif db.aurabar.sort == 'TIME_DURATION_REVERSE' then
  1040. auraBars.sort = UF.SortAuraBarDurationReverse
  1041. elseif db.aurabar.sort == 'NAME' then
  1042. auraBars.sort = UF.SortAuraBarName
  1043. else
  1044. auraBars.sort = nil
  1045. end
  1046.  
  1047. auraBars.maxBars = db.aurabar.maxBars
  1048. auraBars.forceShow = frame.forceShowAuras
  1049. auraBars:SetAnchors()
  1050. else
  1051. if frame:IsElementEnabled('AuraBars') then
  1052. frame:DisableElement('AuraBars')
  1053. auraBars:Hide()
  1054. end
  1055. end
  1056. end
  1057.  
  1058. for objectName, object in pairs(frame.customTexts) do
  1059. if (not db.customTexts) or (db.customTexts and not db.customTexts[objectName]) then
  1060. object:Hide()
  1061. frame.customTexts[objectName] = nil
  1062. end
  1063. end
  1064.  
  1065. if db.customTexts then
  1066. local customFont = UF.LSM:Fetch("font", UF.db.font)
  1067. for objectName, _ in pairs(db.customTexts) do
  1068. if not frame.customTexts[objectName] then
  1069. frame.customTexts[objectName] = frame.RaisedElementParent:CreateFontString(nil, 'OVERLAY')
  1070. end
  1071.  
  1072. local objectDB = db.customTexts[objectName]
  1073.  
  1074. if objectDB.font then
  1075. customFont = UF.LSM:Fetch("font", objectDB.font)
  1076. end
  1077.  
  1078. frame.customTexts[objectName]:FontTemplate(customFont, objectDB.size or UF.db.fontSize, objectDB.fontOutline or UF.db.fontOutline)
  1079. frame:Tag(frame.customTexts[objectName], objectDB.text_format or '')
  1080. frame.customTexts[objectName]:SetJustifyH(objectDB.justifyH or 'CENTER')
  1081. frame.customTexts[objectName]:ClearAllPoints()
  1082. frame.customTexts[objectName]:SetPoint(objectDB.justifyH or 'CENTER', frame, objectDB.justifyH or 'CENTER', objectDB.xOffset, objectDB.yOffset)
  1083. end
  1084. end
  1085.  
  1086. if UF.db.colors.transparentHealth then
  1087. UF:ToggleTransparentStatusBar(true, frame.Health, frame.Health.bg)
  1088. else
  1089. UF:ToggleTransparentStatusBar(false, frame.Health, frame.Health.bg, (USE_PORTRAIT and USE_PORTRAIT_OVERLAY) ~= true)
  1090. end
  1091.  
  1092. UF:ToggleTransparentStatusBar(UF.db.colors.transparentPower, frame.Power, frame.Power.bg)
  1093.  
  1094. E:SetMoverSnapOffset(frame:GetName()..'Mover', -(12 + db.castbar.height))
  1095. frame:UpdateAllElements()
  1096. end
  1097.  
  1098. tinsert(UF['unitstoload'], 'player')
  1099.  
  1100. --Bugfix: Death Runes show as Blood Runes on first login ( http://git.tukui.org/Elv/elvui/issues/411 )
  1101. --For some reason the registered "PLAYER_ENTERING_WORLD" in runebar.lua doesn't trigger on first login.
  1102. local function UpdateAllRunes()
  1103. local frame = _G["ElvUF_Player"]
  1104. if frame and frame.Runes and frame.Runes.UpdateAllRuneTypes then
  1105. frame.Runes.UpdateAllRuneTypes(frame)
  1106. end
  1107. end
  1108. local f = CreateFrame("Frame")
  1109. f:RegisterEvent("PLAYER_ENTERING_WORLD")
  1110. f:SetScript("OnEvent", function(self, event)
  1111. self:UnregisterEvent(event)
  1112.  
  1113. C_Timer.After(5, UpdateAllRunes) --Delay it, since the WoW client updates Death Runes after PEW
  1114. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement