Guest User

customizelol

a guest
Jan 28th, 2010
409
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --[[
  2.  
  3. oUF_Lyn
  4.  
  5. Author: Lyn
  6. Mail: post@endlessly.de
  7. URL: http://www.wowinterface.com/list.php?skinnerid=62149
  8.  
  9. Credits: oUF_TsoHG (used as base) / http://www.wowinterface.com/downloads/info8739-oUF_TsoHG.html
  10. Rothar for buff border (and Neal for the edited version)
  11. p3lim for party toggle function
  12.  
  13. --]]
  14.  
  15. -- ------------------------------------------------------------------------
  16. -- local horror
  17. -- ------------------------------------------------------------------------
  18. local select = select
  19. local UnitClass = UnitClass
  20. local UnitIsDead = UnitIsDead
  21. local UnitIsPVP = UnitIsPVP
  22. local UnitIsGhost = UnitIsGhost
  23. local UnitIsPlayer = UnitIsPlayer
  24. local UnitReaction = UnitReaction
  25. local UnitIsConnected = UnitIsConnected
  26. local UnitCreatureType = UnitCreatureType
  27. local UnitClassification = UnitClassification
  28. local UnitReactionColor = UnitReactionColor
  29. local RAID_CLASS_COLORS = RAID_CLASS_COLORS
  30.  
  31. -- ------------------------------------------------------------------------
  32. -- font, fontsize and textures
  33. -- ------------------------------------------------------------------------
  34. local font = "Interface\\AddOns\\oUF_Lyn\\fonts\\font.ttf"
  35. local upperfont = "Interface\\AddOns\\oUF_Lyn\\fonts\\upperfont.ttf"
  36. local fontsize = 15
  37. local bartex = "Interface\\AddOns\\oUF_Lyn\\textures\\statusbar"
  38. local bufftex = "Interface\\AddOns\\oUF_Lyn\\textures\\border"
  39. local playerClass = select(2, UnitClass("player"))
  40.  
  41. -- castbar position
  42. local playerCastBar_x = 0
  43. local playerCastBar_y = -300
  44. local targetCastBar_x = 0
  45. local targetCastBar_y = -200
  46.  
  47. -- ------------------------------------------------------------------------
  48. -- change some colors :)
  49. -- ------------------------------------------------------------------------
  50. oUF.colors.happiness = {
  51. [1] = {182/225, 34/255, 32/255}, -- unhappy
  52. [2] = {220/225, 180/225, 52/225}, -- content
  53. [3] = {143/255, 194/255, 32/255}, -- happy
  54. }
  55.  
  56. -- ------------------------------------------------------------------------
  57. -- right click
  58. -- ------------------------------------------------------------------------
  59. local menu = function(self)
  60. local unit = self.unit:sub(1, -2)
  61. local cunit = self.unit:gsub("(.)", string.upper, 1)
  62.  
  63. if(unit == "party" or unit == "partypet") then
  64. ToggleDropDownMenu(1, nil, _G["PartyMemberFrame"..self.id.."DropDown"], "cursor", 0, 0)
  65. elseif(_G[cunit.."FrameDropDown"]) then
  66. ToggleDropDownMenu(1, nil, _G[cunit.."FrameDropDown"], "cursor", 0, 0)
  67. end
  68. end
  69.  
  70. -- ------------------------------------------------------------------------
  71. -- reformat everything above 9999, i.e. 10000 -> 10k
  72. -- ------------------------------------------------------------------------
  73. local numberize = function(v)
  74. if v <= 9999 then return v end
  75. if v >= 1000000 then
  76. local value = string.format("%.1fm", v/1000000)
  77. return value
  78. elseif v >= 10000 then
  79. local value = string.format("%.1fk", v/1000)
  80. return value
  81. end
  82. end
  83.  
  84. -- ------------------------------------------------------------------------
  85. -- level update
  86. -- ------------------------------------------------------------------------
  87. local updateLevel = function(self, unit, name)
  88. local lvl = UnitLevel(unit)
  89. local typ = UnitClassification(unit)
  90.  
  91. local color = GetQuestDifficultyColor(lvl)
  92.  
  93. if lvl <= 0 then lvl = "??" end
  94.  
  95. if typ=="worldboss" then
  96. self.Level:SetText("|cffff0000"..lvl.."b|r")
  97. elseif typ=="rareelite" then
  98. self.Level:SetText(lvl.."r+")
  99. self.Level:SetTextColor(color.r, color.g, color.b)
  100. elseif typ=="elite" then
  101. self.Level:SetText(lvl.."+")
  102. self.Level:SetTextColor(color.r, color.g, color.b)
  103. elseif typ=="rare" then
  104. self.Level:SetText(lvl.."r")
  105. self.Level:SetTextColor(color.r, color.g, color.b)
  106. else
  107. if UnitIsConnected(unit) == nil then
  108. self.Level:SetText("??")
  109. else
  110. self.Level:SetText(lvl)
  111. end
  112. if(not UnitIsPlayer(unit)) then
  113. self.Level:SetTextColor(color.r, color.g, color.b)
  114. else
  115. local _, class = UnitClass(unit)
  116. color = self.colors.class[class]
  117. self.Level:SetTextColor(color[1], color[2], color[3])
  118. end
  119. end
  120. end
  121.  
  122. -- ------------------------------------------------------------------------
  123. -- name update
  124. -- ------------------------------------------------------------------------
  125. local updateName = function(self, event, unit)
  126. if(self.unit ~= unit) then return end
  127.  
  128. local name = UnitName(unit)
  129. self.Name:SetText(string.lower(name))
  130.  
  131. if unit=="targettarget" then
  132. local totName = UnitName(unit)
  133. local pName = UnitName("player")
  134. if totName==pName then
  135. self.Name:SetTextColor(0.9, 0.5, 0.2)
  136. else
  137. self.Name:SetTextColor(1,1,1)
  138. end
  139. else
  140. self.Name:SetTextColor(1,1,1)
  141. end
  142.  
  143. if unit=="target" then -- Show level value on targets only
  144. updateLevel(self, unit, name)
  145. end
  146. end
  147.  
  148. -- ------------------------------------------------------------------------
  149. -- health update
  150. -- ------------------------------------------------------------------------
  151. local updateHealth = function(self, event, unit, bar, min, max)
  152. local cur, maxhp = min, max
  153.  
  154. local d = floor(cur/maxhp*100)
  155.  
  156. if(UnitIsDead(unit) or UnitIsGhost(unit)) then
  157. bar:SetValue(0)
  158. bar.value:SetText"dead"
  159. elseif(not UnitIsConnected(unit)) then
  160. bar.value:SetText"offline"
  161. elseif(unit == "player") then
  162. if(min ~= max) then
  163. bar.value:SetText("|cff33EE44"..numberize(cur) .."|r.".. d.."%")
  164. else
  165. bar.value:SetText(" ")
  166. end
  167. elseif(unit == "targettarget") then
  168. bar.value:SetText(d.."%")
  169. elseif(unit == "target") then
  170. if(d < 100) then
  171. bar.value:SetText("|cff33EE44"..numberize(cur).."|r."..d.."%")
  172. else
  173. bar.value:SetText(" ")
  174. end
  175.  
  176. elseif(min == max) then
  177. if unit == "pet" then
  178. bar.value:SetText(" ") -- just here if otherwise wanted
  179. else
  180. bar.value:SetText(" ")
  181. end
  182. else
  183. if((max-min) < max) then
  184. if unit == "pet" then
  185. bar.value:SetText("-"..maxhp-cur) -- negative values as for party, just here if otherwise wanted
  186. else
  187. bar.value:SetText("-"..maxhp-cur) -- this makes negative values (easier as a healer)
  188. end
  189. end
  190. end
  191.  
  192. self:UNIT_NAME_UPDATE(event, unit)
  193. end
  194.  
  195.  
  196. -- ------------------------------------------------------------------------
  197. -- power update
  198. -- ------------------------------------------------------------------------
  199. local updatePower = function(self, event, unit, bar, min, max)
  200. if UnitIsPlayer(unit)==nil then
  201. bar.value:SetText()
  202. else
  203. local _, ptype = UnitPowerType(unit)
  204. local color = oUF.colors.power[ptype]
  205. if(min==0) then
  206. bar.value:SetText()
  207. elseif(UnitIsDead(unit) or UnitIsGhost(unit)) then
  208. bar:SetValue(0)
  209. elseif(not UnitIsConnected(unit)) then
  210. bar.value:SetText()
  211. elseif unit=="player" then
  212. if((max-min) > 0) then
  213. bar.value:SetText(min)
  214. if color then
  215. bar.value:SetTextColor(color[1], color[2], color[3])
  216. else
  217. bar.value:SetTextColor(0.2, 0.66, 0.93)
  218. end
  219. elseif(min==max) then
  220. bar.value:SetText("")
  221. else
  222. bar.value:SetText(min)
  223. if color then
  224. bar.value:SetTextColor(color[1], color[2], color[3])
  225. else
  226. bar.value:SetTextColor(0.2, 0.66, 0.93)
  227. end
  228. end
  229. else
  230. if((max-min) > 0) then
  231. bar.value:SetText(min)
  232. if color then
  233. bar.value:SetTextColor(color[1], color[2], color[3])
  234. else
  235. bar.value:SetTextColor(0.2, 0.66, 0.93)
  236. end
  237. else
  238. bar.value:SetText(min)
  239. if color then
  240. bar.value:SetTextColor(color[1], color[2], color[3])
  241. else
  242. bar.value:SetTextColor(0.2, 0.66, 0.93)
  243. end
  244. end
  245. end
  246. end
  247. end
  248.  
  249. -- ------------------------------------------------------------------------
  250. -- aura reskin
  251. -- ------------------------------------------------------------------------
  252. local auraIcon = function(self, button, icons)
  253. icons.showDebuffType = true -- show debuff border type color
  254.  
  255. button.icon:SetTexCoord(.07, .93, .07, .93)
  256. button.icon:SetPoint("TOPLEFT", button, "TOPLEFT", 1, -1)
  257. button.icon:SetPoint("BOTTOMRIGHT", button, "BOTTOMRIGHT", -1, 1)
  258.  
  259. button.overlay:SetTexture(bufftex)
  260. button.overlay:SetTexCoord(0,1,0,1)
  261. button.overlay.Hide = function(self) self:SetVertexColor(0.3, 0.3, 0.3) end
  262.  
  263. button.cd:SetReverse()
  264. button.cd:SetPoint("TOPLEFT", button, "TOPLEFT", 2, -2)
  265. button.cd:SetPoint("BOTTOMRIGHT", button, "BOTTOMRIGHT", -2, 2)
  266. end
  267.  
  268. -- ------------------------------------------------------------------------
  269. -- the layout starts here
  270. -- ------------------------------------------------------------------------
  271. local func = function(self, unit)
  272. self.menu = menu -- Enable the menus
  273.  
  274. self:SetScript("OnEnter", UnitFrame_OnEnter)
  275. self:SetScript("OnLeave", UnitFrame_OnLeave)
  276.  
  277. self:RegisterForClicks"anyup"
  278. self:SetAttribute("*type2", "menu")
  279.  
  280. --
  281. -- background
  282. --
  283. self:SetBackdrop{
  284. bgFile = "Interface\\ChatFrame\\ChatFrameBackground", tile = true, tileSize = 16,
  285. insets = {left = -2, right = -2, top = -2, bottom = -2},
  286. }
  287. self:SetBackdropColor(0,0,0,1) -- and color the backgrounds
  288.  
  289. --
  290. -- healthbar
  291. --
  292. self.Health = CreateFrame"StatusBar"
  293. self.Health:SetHeight(19) -- Custom height
  294. self.Health:SetStatusBarTexture(bartex)
  295. self.Health:SetParent(self)
  296. self.Health:SetPoint"TOP"
  297. self.Health:SetPoint"LEFT"
  298. self.Health:SetPoint"RIGHT"
  299. --
  300. -- healthbar background
  301. --
  302. self.Health.bg = self.Health:CreateTexture(nil, "BORDER")
  303. self.Health.bg:SetAllPoints(self.Health)
  304. self.Health.bg:SetTexture(bartex)
  305. self.Health.bg:SetAlpha(0.30)
  306.  
  307. --
  308. -- healthbar text
  309. --
  310. self.Health.value = self.Health:CreateFontString(nil, "OVERLAY")
  311. self.Health.value:SetPoint("RIGHT", -2, 2)
  312. self.Health.value:SetFont(font, fontsize, "OUTLINE")
  313. self.Health.value:SetTextColor(1,1,1)
  314. self.Health.value:SetShadowOffset(1, -1)
  315.  
  316. --
  317. -- healthbar functions
  318. --
  319. self.Health.colorClass = true
  320. self.Health.colorReaction = true
  321. self.Health.colorDisconnected = true
  322. self.Health.colorTapping = true
  323. self.PostUpdateHealth = updateHealth -- let the colors be
  324.  
  325. --
  326. -- powerbar
  327. --
  328. self.Power = CreateFrame"StatusBar"
  329. self.Power:SetHeight(3)
  330. self.Power:SetStatusBarTexture(bartex)
  331. self.Power:SetParent(self)
  332. self.Power:SetPoint"LEFT"
  333. self.Power:SetPoint"RIGHT"
  334. self.Power:SetPoint("TOP", self.Health, "BOTTOM", 0, -1.45) -- Little offset to make it pretty
  335.  
  336. --
  337. -- powerbar background
  338. --
  339. self.Power.bg = self.Power:CreateTexture(nil, "BORDER")
  340. self.Power.bg:SetAllPoints(self.Power)
  341. self.Power.bg:SetTexture(bartex)
  342. self.Power.bg:SetAlpha(0.30)
  343.  
  344. --
  345. -- powerbar text
  346. --
  347. self.Power.value = self.Power:CreateFontString(nil, "OVERLAY")
  348. self.Power.value:SetPoint("RIGHT", self.Health.value, "BOTTOMRIGHT", 0, -5) -- powerbar text in health box
  349. self.Power.value:SetFont(font, fontsize, "OUTLINE")
  350. self.Power.value:SetTextColor(1,1,1)
  351. self.Power.value:SetShadowOffset(1, -1)
  352. self.Power.value:Hide()
  353.  
  354. --
  355. -- powerbar functions
  356. --
  357. self.Power.colorTapping = true
  358. self.Power.colorDisconnected = true
  359. self.Power.colorClass = true
  360. self.Power.colorPower = true
  361. self.Power.colorHappiness = false
  362. self.PostUpdatePower = updatePower -- let the colors be
  363.  
  364. --
  365. -- names
  366. --
  367. self.Name = self.Health:CreateFontString(nil, "OVERLAY")
  368. self.Name:SetPoint("LEFT", self, 0, 9)
  369. self.Name:SetJustifyH"LEFT"
  370. self.Name:SetFont(font, fontsize, "OUTLINE")
  371. self.Name:SetShadowOffset(1, -1)
  372. self.UNIT_NAME_UPDATE = updateName
  373.  
  374. --
  375. -- level
  376. --
  377. self.Level = self.Health:CreateFontString(nil, "OVERLAY")
  378. self.Level:SetPoint("LEFT", self.Health, 0, 9)
  379. self.Level:SetJustifyH("LEFT")
  380. self.Level:SetFont(font, fontsize, "OUTLINE")
  381. self.Level:SetTextColor(1,1,1)
  382. self.Level:SetShadowOffset(1, -1)
  383. self.UNIT_LEVEL = updateLevel
  384.  
  385. -- ------------------------------------
  386. -- player
  387. -- ------------------------------------
  388. if unit=="player" then
  389. self:SetWidth(250)
  390. self:SetHeight(20)
  391. self.Health:SetHeight(15.5)
  392. self.Name:Hide()
  393. self.Health.value:SetPoint("RIGHT", 0, 9)
  394. self.Power:SetHeight(3)
  395. self.Power.value:Show()
  396. self.Power.value:SetPoint("LEFT", self.Health, 0, 9)
  397. self.Power.value:SetJustifyH"LEFT"
  398. self.Level:Hide()
  399.  
  400. --[[
  401. if(playerClass=="DRUID") then
  402. -- bar
  403. self.DruidMana = CreateFrame('StatusBar', nil, self)
  404. self.DruidMana:SetPoint('TOP', self, 'BOTTOM', 0, -6)
  405. self.DruidMana:SetStatusBarTexture(bartex)
  406. self.DruidMana:SetStatusBarColor(45/255, 113/255, 191/255)
  407. self.DruidMana:SetHeight(10)
  408. self.DruidMana:SetWidth(250)
  409. -- bar bg
  410. self.DruidMana.bg = self.DruidMana:CreateTexture(nil, "BORDER")
  411. self.DruidMana.bg:SetAllPoints(self.DruidMana)
  412. self.DruidMana.bg:SetTexture(bartex)
  413. self.DruidMana.bg:SetAlpha(0.30)
  414. -- black bg
  415. self.DruidMana:SetBackdrop{
  416. bgFile = "Interface\\ChatFrame\\ChatFrameBackground", tile = true, tileSize = 16,
  417. insets = {left = -2, right = -2.5, top = -2.5, bottom = -2},
  418. }
  419. self.DruidMana:SetBackdropColor(0,0,0,1)
  420. -- text
  421. self.DruidManaText = self.DruidMana:CreateFontString(nil, 'OVERLAY')
  422. self.DruidManaText:SetPoint("CENTER", self.DruidMana, "CENTER", 0, 1)
  423. self.DruidManaText:SetFont(font, 12, "OUTLINE")
  424. self.DruidManaText:SetTextColor(1,1,1)
  425. self.DruidManaText:SetShadowOffset(1, -1)
  426. end
  427. --]]
  428.  
  429. --
  430. -- leader icon
  431. --
  432. self.Leader = self.Health:CreateTexture(nil, "OVERLAY")
  433. self.Leader:SetHeight(12)
  434. self.Leader:SetWidth(12)
  435. self.Leader:SetPoint("BOTTOMRIGHT", self, -2, 4)
  436. self.Leader:SetTexture"Interface\\GroupFrame\\UI-Group-LeaderIcon"
  437.  
  438. --
  439. -- raid target icons
  440. --
  441. self.RaidIcon = self.Health:CreateTexture(nil, "OVERLAY")
  442. self.RaidIcon:SetHeight(16)
  443. self.RaidIcon:SetWidth(16)
  444. self.RaidIcon:SetPoint("TOP", self, 0, 9)
  445. self.RaidIcon:SetTexture"Interface\\TargetingFrame\\UI-RaidTargetingIcons"
  446.  
  447. --
  448. -- oUF_PowerSpark support
  449. --
  450. self.Spark = self.Power:CreateTexture(nil, "OVERLAY")
  451. self.Spark:SetTexture("Interface\\CastingBar\\UI-CastingBar-Spark")
  452. self.Spark:SetVertexColor(1, 1, 1, 1)
  453. self.Spark:SetBlendMode("ADD")
  454. self.Spark:SetHeight(self.Power:GetHeight()*2.5)
  455. self.Spark:SetWidth(self.Power:GetHeight()*2)
  456. -- self.Spark.rtl = true -- Make the spark go from Right To Left instead
  457. -- self.Spark.manatick = true -- Show mana regen ticks outside FSR (like the energy ticker)
  458. -- self.Spark.highAlpha = 1 -- What alpha setting to use for the FSR and energy spark
  459. -- self.Spark.lowAlpha = 0.25 -- What alpha setting to use for the mana regen ticker
  460.  
  461. --
  462. -- oUF_BarFader
  463. --
  464. self.BarFade = true
  465. self.BarFadeAlpha = 0.2
  466. end
  467.  
  468. -- ------------------------------------
  469. -- pet
  470. -- ------------------------------------
  471. if unit=="pet" then
  472. self:SetWidth(120)
  473. self:SetHeight(18)
  474. self.Health:SetHeight(18)
  475. self.Power:Hide()
  476. self.Health.value:Hide()
  477. self.Level:Hide()
  478. self.Name:Hide()
  479.  
  480. if playerClass=="HUNTER" then
  481. self.Health.colorReaction = false
  482. self.Health.colorClass = false
  483. self.Health.colorHappiness = true
  484. end
  485.  
  486. --
  487. -- oUF_BarFader
  488. --
  489. self.BarFade = true
  490. self.BarFadeAlpha = 0.2
  491. end
  492.  
  493. -- ------------------------------------
  494. -- target
  495. -- ------------------------------------
  496. if unit=="target" then
  497. self:SetWidth(250)
  498. self:SetHeight(20)
  499. self.Health:SetHeight(15.5)
  500. self.Power:SetHeight(3)
  501. self.Power.value:Hide()
  502. self.Health.value:SetPoint("RIGHT", 0, 9)
  503. self.Name:SetPoint("LEFT", self.Level, "RIGHT", 0, 0)
  504. self.Name:SetHeight(20)
  505. self.Name:SetWidth(150)
  506.  
  507. self.Health.colorClass = true
  508.  
  509. --
  510. -- combo points
  511. --
  512. if(playerClass=="ROGUE" or playerClass=="DRUID") then
  513. self.CPoints = self:CreateFontString(nil, "OVERLAY")
  514. self.CPoints:SetPoint("RIGHT", self, "LEFT", -10, 0)
  515. self.CPoints:SetFont(font, 38, "OUTLINE")
  516. self.CPoints:SetTextColor(0, 0.81, 1)
  517. self.CPoints:SetShadowOffset(1, -1)
  518. self.CPoints:SetJustifyH"RIGHT"
  519. end
  520.  
  521. --
  522. -- raid target icons
  523. --
  524. self.RaidIcon = self.Health:CreateTexture(nil, "OVERLAY")
  525. self.RaidIcon:SetHeight(24)
  526. self.RaidIcon:SetWidth(24)
  527. self.RaidIcon:SetPoint("RIGHT", self, 30, 0)
  528. self.RaidIcon:SetTexture"Interface\\TargetingFrame\\UI-RaidTargetingIcons"
  529.  
  530. --
  531. -- buffs
  532. --
  533. self.Buffs = CreateFrame("Frame", nil, self) -- buffs
  534. self.Buffs.size = 22
  535. self.Buffs:SetHeight(self.Buffs.size)
  536. self.Buffs:SetWidth(self.Buffs.size * 5)
  537. self.Buffs:SetPoint("BOTTOMLEFT", self, "TOPLEFT", -2, 15)
  538. self.Buffs.initialAnchor = "BOTTOMLEFT"
  539. self.Buffs["growth-y"] = "TOP"
  540. self.Buffs.num = 20
  541. self.Buffs.spacing = 2
  542.  
  543. --
  544. -- debuffs
  545. --
  546. self.Debuffs = CreateFrame("Frame", nil, self)
  547. self.Debuffs.size = 30
  548. self.Debuffs:SetHeight(self.Debuffs.size)
  549. self.Debuffs:SetWidth(self.Debuffs.size * 9)
  550. self.Debuffs:SetPoint("TOPLEFT", self, "BOTTOMLEFT", -2, -6)
  551. self.Debuffs.initialAnchor = "TOPLEFT"
  552. self.Debuffs["growth-y"] = "DOWN"
  553. self.Debuffs.filter = false
  554. self.Debuffs.num = 40
  555. self.Debuffs.spacing = 2
  556. end
  557.  
  558. -- ------------------------------------
  559. -- target of target and focus
  560. -- ------------------------------------
  561. if unit=="targettarget" or unit=="focus" then
  562. self:SetWidth(120)
  563. self:SetHeight(18)
  564. self.Health:SetHeight(18)
  565. self.Power:Hide()
  566. self.Power.value:Hide()
  567. self.Health.value:Hide()
  568. self.Name:SetWidth(95)
  569. self.Name:SetHeight(18)
  570.  
  571. --
  572. -- raid target icons
  573. --
  574. self.RaidIcon = self.Health:CreateTexture(nil, "OVERLAY")
  575. self.RaidIcon:SetHeight(16)
  576. self.RaidIcon:SetWidth(16)
  577. self.RaidIcon:SetPoint("RIGHT", self, 0, 9)
  578. self.RaidIcon:SetTexture"Interface\\TargetingFrame\\UI-RaidTargetingIcons"
  579.  
  580. --
  581. -- oUF_BarFader
  582. --
  583. if unit=="focus" then
  584. self.BarFade = true
  585. self.BarFadeAlpha = 0.2
  586. end
  587. end
  588.  
  589. -- ------------------------------------
  590. -- player and target castbar
  591. -- ------------------------------------
  592. if(unit == 'player' or unit == 'target' or unit == 'focus') then
  593. self.Castbar = CreateFrame('StatusBar', nil, self)
  594. self.Castbar:SetStatusBarTexture(bartex)
  595.  
  596. if(unit == "player") then
  597. self.Castbar:SetStatusBarColor(1, 1, 1)
  598. self.Castbar:SetHeight(20)
  599. self.Castbar:SetWidth(188)
  600.  
  601. self.Castbar:SetBackdrop({
  602. bgFile = [[Interface\ChatFrame\ChatFrameBackground]],
  603. insets = {top = -2, left = -2, bottom = -2, right = -2}})
  604.  
  605. self.Castbar.SafeZone = self.Castbar:CreateTexture(nil,"ARTWORK")
  606. self.Castbar.SafeZone:SetTexture(bartex)
  607. self.Castbar.SafeZone:SetVertexColor(.75,.10,.10,.6)
  608. self.Castbar.SafeZone:SetPoint("TOPRIGHT")
  609. self.Castbar.SafeZone:SetPoint("BOTTOMRIGHT")
  610. self.Castbar.SafeZone:SetHeight(20)
  611. self.Castbar.SafeZone:SetWidth(188)
  612.  
  613. self.Castbar:SetPoint('CENTER', UIParent, 'CENTER', playerCastBar_x, playerCastBar_y)
  614. -- self.Castbar.Spark = self.Castbar:CreateTexture(nil, "OVERLAY")
  615. -- self.Castbar.Spark:SetBlendMode("ADD")
  616. -- self.Castbar.Spark:SetHeight(self.Castbar:GetHeight() * 2)
  617. -- self.Castbar.Spark:SetWidth(self.Castbar:GetHeight() / 2)
  618.  
  619. elseif (unit == "target") then
  620. self.Castbar:SetStatusBarColor(0.80, 0.01, 0)
  621. self.Castbar:SetHeight(25)
  622. self.Castbar:SetWidth(250)
  623.  
  624. self.Castbar:SetBackdrop({
  625. bgFile = [[Interface\ChatFrame\ChatFrameBackground]],
  626. insets = {top = -2, left = -2, bottom = -2, right = -2}})
  627.  
  628. self.Castbar:SetPoint('CENTER', UIParent, 'CENTER', targetCastBar_x, targetCastBar_y)
  629.  
  630. else
  631. self.Castbar:SetStatusBarColor(0, 0.80, 0.80)
  632. self.Castbar:SetHeight(18)
  633. self.Castbar:SetWidth(188)
  634. self.Castbar:SetBackdrop({
  635. bgFile = [[Interface\ChatFrame\ChatFrameBackground]],
  636. insets = {top = -2, left = -2, bottom = -2, right = -2}})
  637. self.Castbar:SetPoint('CENTER', UIParent, 'CENTER', focusCastBar_x, focusCastBar_y)
  638. end
  639.  
  640. self.Castbar:SetBackdropColor(0, 0, 0, 1)
  641.  
  642. self.Castbar.bg = self.Castbar:CreateTexture(nil, 'BORDER')
  643. self.Castbar.bg:SetAllPoints(self.Castbar)
  644. self.Castbar.bg:SetTexture(0, 0, 0, 0.6)
  645.  
  646. self.Castbar.Text = self.Castbar:CreateFontString(nil, 'OVERLAY')
  647. -- self.Castbar.Text:SetPoint('LEFT', self.Castbar, 2, 1)
  648. self.Castbar.Text:SetFont(font, 12, "OUTLINE")
  649. self.Castbar.Text:SetShadowOffset(1, -1)
  650. self.Castbar.Text:SetTextColor(1, 1, 1)
  651. self.Castbar.Text:SetJustifyH('LEFT')
  652.  
  653. self.Castbar.Time = self.Castbar:CreateFontString(nil, 'OVERLAY')
  654.  
  655. if(unit == "player") then
  656. self.Castbar.Time:SetPoint('CENTER', self.Castbar, 0, 1)
  657. else
  658. self.Castbar.Time:SetPoint('RIGHT', self.Castbar, -2, 1)
  659. self.Castbar.Text:SetPoint('LEFT', self.Castbar, 2, 1)
  660. end
  661. self.Castbar.Time:SetFont(font, 12, "OUTLINE")
  662. self.Castbar.Time:SetTextColor(1, 1, 1)
  663. self.Castbar.Time:SetJustifyH('RIGHT')
  664. end
  665.  
  666.  
  667.  
  668. -- ------------------------------------
  669. -- party
  670. -- ------------------------------------
  671. if(self:GetParent():GetName():match"oUF_Party") then
  672. self:SetWidth(160)
  673. self:SetHeight(20)
  674. self.Health:SetHeight(15)
  675. self.Power:SetHeight(3)
  676. self.Power.value:Hide()
  677. self.Health.value:SetPoint("RIGHT", 0 , 9)
  678. self.Name:SetPoint("LEFT", 0, 9)
  679.  
  680. --
  681. -- debuffs
  682. --
  683. self.Debuffs = CreateFrame("Frame", nil, self)
  684. self.Debuffs.size = 20 * 1.3
  685. self.Debuffs:SetHeight(self.Debuffs.size)
  686. self.Debuffs:SetWidth(self.Debuffs.size * 5)
  687. self.Debuffs:SetPoint("LEFT", self, "RIGHT", 5, 0)
  688. self.Debuffs.initialAnchor = "TOPLEFT"
  689. self.Debuffs.filter = false
  690. self.Debuffs.showDebuffType = true
  691. self.Debuffs.spacing = 2
  692. self.Debuffs.num = 2 -- max debuffs
  693.  
  694. --
  695. -- raid target icons
  696. --
  697. self.RaidIcon = self.Health:CreateTexture(nil, "OVERLAY")
  698. self.RaidIcon:SetHeight(24)
  699. self.RaidIcon:SetWidth(24)
  700. self.RaidIcon:SetPoint("LEFT", self, -30, 0)
  701. self.RaidIcon:SetTexture"Interface\\TargetingFrame\\UI-RaidTargetingIcons"
  702. end
  703.  
  704. -- ------------------------------------
  705. -- raid
  706. -- ------------------------------------
  707. if(self:GetParent():GetName():match"oUF_Raid") then
  708. self:SetWidth(85)
  709. self:SetHeight(15)
  710. self.Health:SetHeight(15)
  711. self.Power:Hide()
  712. self.Health:SetFrameLevel(2)
  713. self.Power:SetFrameLevel(2)
  714. self.Health.value:Hide()
  715. self.Power.value:Hide()
  716. self.Name:SetFont(font, 12, "OUTLINE")
  717. self.Name:SetWidth(85)
  718. self.Name:SetHeight(15)
  719.  
  720. --
  721. -- oUF_DebuffHighlight support
  722. --
  723. self.DebuffHighlight = self.Health:CreateTexture(nil, "OVERLAY")
  724. self.DebuffHighlight:SetAllPoints(self.Health)
  725. self.DebuffHighlight:SetTexture("Interface\\AddOns\\oUF_Lyn\\textures\\highlight.tga")
  726. self.DebuffHighlight:SetBlendMode("ADD")
  727. self.DebuffHighlight:SetVertexColor(0, 0, 0, 0)
  728. self.DebuffHighlightAlpha = 0.8
  729. self.DebuffHighlightFilter = true
  730. end
  731.  
  732. --
  733. -- fading for party and raid
  734. --
  735. if(not unit) then -- fadeout if units are out of range
  736. self.Range = false -- put true to make party/raid frames fade out if not in your range
  737. self.inRangeAlpha = 1.0 -- what alpha if IN range
  738. self.outsideRangeAlpha = 0.5 -- the alpha it will fade out to if not in range
  739. end
  740.  
  741. --
  742. -- custom aura textures
  743. --
  744. self.PostCreateAuraIcon = auraIcon
  745. self.SetAuraPosition = auraOffset
  746.  
  747. if(self:GetParent():GetName():match"oUF_Party") then
  748. self:SetAttribute('initial-height', 20)
  749. self:SetAttribute('initial-width', 160)
  750. else
  751. self:SetAttribute('initial-height', height)
  752. self:SetAttribute('initial-width', width)
  753. end
  754.  
  755. return self
  756. end
  757.  
  758. -- ------------------------------------------------------------------------
  759. -- spawning the frames
  760. -- ------------------------------------------------------------------------
  761.  
  762. --
  763. -- normal frames
  764. --
  765. oUF:RegisterStyle("Lyn", func)
  766.  
  767. oUF:SetActiveStyle("Lyn")
  768. local player = oUF:Spawn("player", "oUF_Player")
  769. player:SetPoint("CENTER", -335, -106)
  770. local target = oUF:Spawn("target", "oUF_Target")
  771. target:SetPoint("CENTER", 335, -106)
  772. local pet = oUF:Spawn("pet", "oUF_Pet")
  773. pet:SetPoint("BOTTOMLEFT", player, 0, -30)
  774. local tot = oUF:Spawn("targettarget", "oUF_TargetTarget")
  775. tot:SetPoint("TOPRIGHT", target, 0, 35)
  776. local focus = oUF:Spawn("focus", "oUF_Focus")
  777. focus:SetPoint("BOTTOMRIGHT", player, 0, -30)
  778.  
  779. --
  780. -- party
  781. --
  782. local party = oUF:Spawn("header", "oUF_Party")
  783. party:SetManyAttributes("showParty", true, "yOffset", -15)
  784. party:SetPoint("TOPLEFT", 35, -200)
  785. party:Show()
  786. party:SetAttribute("showRaid", false)
  787.  
  788. --
  789. -- raid
  790. --
  791. local Raid = {}
  792. for i = 1, NUM_RAID_GROUPS do
  793. local RaidGroup = oUF:Spawn("header", "oUF_Raid" .. i)
  794. RaidGroup:SetAttribute("groupFilter", tostring(i))
  795. RaidGroup:SetAttribute("showRaid", true)
  796. RaidGroup:SetAttribute("yOffset", -10)
  797. RaidGroup:SetAttribute("point", "TOP")
  798. RaidGroup:SetAttribute("showRaid", true)
  799. table.insert(Raid, RaidGroup)
  800. if i == 1 then
  801. RaidGroup:SetPoint("TOPLEFT", UIParent, 35, -35)
  802. else
  803. RaidGroup:SetPoint("TOPLEFT", Raid[i-1], "TOPRIGHT", 10, 0)
  804. end
  805. RaidGroup:Show()
  806. end
  807.  
  808. --
  809. -- party toggle in raid
  810. --
  811. local partyToggle = CreateFrame('Frame')
  812. partyToggle:RegisterEvent('PLAYER_LOGIN')
  813. partyToggle:RegisterEvent('RAID_ROSTER_UPDATE')
  814. partyToggle:RegisterEvent('PARTY_LEADER_CHANGED')
  815. partyToggle:RegisterEvent('PARTY_MEMBER_CHANGED')
  816. partyToggle:SetScript('OnEvent', function(self)
  817. if(InCombatLockdown()) then
  818. self:RegisterEvent('PLAYER_REGEN_ENABLED')
  819. else
  820. self:UnregisterEvent('PLAYER_REGEN_DISABLED')
  821. if(HIDE_PARTY_INTERFACE == "1" and GetNumRaidMembers() > 0) then
  822. party:Hide()
  823. else
  824. party:Show()
  825. end
  826. end
  827. end)
  828.  
RAW Paste Data