Advertisement
Guest User

Untitled

a guest
Jun 28th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 27.51 KB | None | 0 0
  1. --[[
  2. ################################################################
  3. #
  4. # oUF_Mosphet by Mosphet <Vex> @ Bloodfeather EU
  5. #
  6. ################################################################
  7. ]]
  8.  
  9. -- Gief addon name space
  10. local _, oUF_Mosphet = ...
  11.  
  12. local tags = oUF_Mosphet.tags
  13.  
  14. -- Create the UI frame to work in
  15. oUF_Mosphet.main = CreateFrame("Frame", nil, UIParent)
  16.  
  17. local main = oUF_Mosphet.main
  18.  
  19. BuffFrame:Hide()
  20.  
  21. -- Set the Media Path
  22. local mediapath = [=[Interface\AddOns\oUF_Mosphet\media\]=]
  23.  
  24. local fontlol = mediapath..[=[fonts\font.ttf]=]
  25. local texture = mediapath..[=[textures\statusbar]=]
  26. local backdrop = mediapath..[=[Interface\ChatFrame\ChatFrameBackground]=]
  27. local bgtexture = mediapath..[=[textures\bgtexture]=]
  28. local backdrop_edge = mediapath..[=[textures\backdrop_edge]=]
  29. local bordertex = mediapath..[=[textures\borderTex]=]
  30. local buttontex = mediapath..[=[textures\buttonborder1]=]
  31.  
  32. local backdrop = {
  33. bgFile = [=[Interface\ChatFrame\ChatFrameBackground]=],
  34. insets = {top = 0, left = 0, bottom = 0, right = 0},
  35. }
  36.  
  37. -- Colour (Color) shit, GG American spelling.....
  38. local colors = setmetatable({
  39. power = setmetatable({
  40. ["MANA"] = {0.31, 0.45, 0.63},
  41. ["RAGE"] = {0.69, 0.31, 0.31},
  42. ["FOCUS"] = {0.71, 0.43, 0.27},
  43. ["ENERGY"] = {0.65, 0.63, 0.35},
  44. ["HAPPINESS"] = {0.19, 0.58, 0.58},
  45. ["RUNES"] = {0.55, 0.57, 0.61},
  46. ["RUNIC_POWER"] = {0, 0.82, 1},
  47. ["AMMOSLOT"] = {0.8, 0.6, 0},
  48. ["FUEL"] = {0, 0.55, 0.5},
  49. ["POWER_TYPE_STEAM"] = {0.55, 0.57, 0.61},
  50. ["POWER_TYPE_PYRITE"] = {0.60, 0.09, 0.17},
  51. }, {__index = oUF.colors.power}),
  52. happiness = setmetatable({
  53. [1] = {0.69, 0.31, 0.31},
  54. [2] = {0.65, 0.63, 0.35},
  55. [3] = {0.33, 0.59, 0.33},
  56. }, {__index = oUF.colors.happiness}),
  57. }, {__index = oUF.colors})
  58.  
  59. -- Obvious
  60. local runeloadcolors = {
  61. [1] = {0.69, 0.31, 0.31},
  62. [2] = {0.69, 0.31, 0.31},
  63. [3] = {0.33, 0.59, 0.33},
  64. [4] = {0.33, 0.59, 0.33},
  65. [5] = {0.31, 0.45, 0.63},
  66. [6] = {0.31, 0.45, 0.63},
  67. }
  68.  
  69. -- Tagging mobs
  70. oUF.colors.tapped = {0.55, 0.57, 0.61}
  71.  
  72. -- Font stuff
  73. local SetFontString = function(parent, fontName, fontHeight, fontStyle)
  74. local fs = parent:CreateFontString(nil, "OVERLAY")
  75. fs:SetFont(fontName, fontHeight, fontStyle)
  76. fs:SetShadowColor(0, 0, 0)
  77. fs:SetShadowOffset(0.75, -0.75)
  78. return fs
  79. end
  80.  
  81. --[[
  82. ################################################################
  83. #
  84. # Functions
  85. #
  86. ################################################################
  87. ]]
  88.  
  89. -- Derp Need this for my update hook
  90. local updateAllElements = function(frame)
  91. for _, v in ipairs(frame.__elements) do
  92. v(frame, "UpdateElement", frame.unit)
  93. end
  94. end
  95.  
  96. -- Menu when right clicking the frames
  97. local Menu = function(self)
  98. local unit = self.unit:gsub("(.)", string.upper, 1)
  99. if _G[unit.."FrameDropDown"] then
  100. ToggleDropDownMenu(1, nil, _G[unit.."FrameDropDown"], "cursor")
  101. elseif (self.unit:match("party")) then
  102. ToggleDropDownMenu(1, nil, _G["PartyMemberFrame"..self.id.."DropDown"], "cursor")
  103. else
  104. FriendsDropDown.unit = self.unit
  105. FriendsDropDown.id = self.id
  106. FriendsDropDown.initialize = RaidFrameDropDown_Initialize
  107. ToggleDropDownMenu(1, nil, FriendsDropDown, "cursor")
  108. end
  109. end
  110.  
  111. -- Short Value
  112. local ShortValue = function(value)
  113. if value >= 1e6 then
  114. return ("%.1fm"):format(value / 1e6):gsub("%.?0+([km])$", "%1")
  115. elseif value >= 1e3 or value <= -1e3 then
  116. return ("%.1fk"):format(value / 1e3):gsub("%.?0+([km])$", "%1")
  117. else
  118. return value
  119. end
  120. end
  121.  
  122. local PostUpdateHealth = function(health, unit, min, max)
  123. if not UnitIsConnected(unit) or UnitIsDead(unit) or UnitIsGhost(unit) then
  124. local class = select(2, UnitClass(unit))
  125. local color = UnitIsPlayer(unit) and oUF.colors.class[class] or {0.84, 0.75, 0.65}
  126. if not UnitIsConnected(unit) then
  127. health.value:SetText("|cffD7BEA5".."Offline".."|r")
  128. elseif UnitIsDead(unit) then
  129. health.value:SetText("|cffD7BEA5".."Dead".."|r")
  130. elseif UnitIsGhost(unit) then
  131. health.value:SetText("|cffD7BEA5".."Ghost".."|r")
  132. end
  133. else
  134. local r, g, b
  135. r, g, b = oUF.ColorGradient(min/max, 0.69, 0.31, 0.31, 0.71, 0.43, 0.27, 0.17, 0.17, 0.24)
  136. r, g, b = oUF.ColorGradient(min/max, 0.69, 0.31, 0.31, 0.65, 0.63, 0.35, 0.33, 0.59, 0.33)
  137. if unit == "player" and health:GetAttribute("normalUnit") ~= "pet" then
  138. health.value:SetFormattedText("|cffAF5050%d|r |cffD7BEA5-|r |cff%02x%02x%02x%d%%|r", min, r * 255, g * 255, b * 255, floor(min / max * 100))
  139. elseif unit == "target" then
  140. health.value:SetFormattedText("|cff%02x%02x%02x%d%%|r |cffD7BEA5-|r |cffAF5050%d|r", r * 255, g * 255, b * 255, floor(min / max * 100), min)
  141. else
  142. health.value:SetFormattedText("|cff%02x%02x%02x%d%%|r", r * 255, g * 255, b * 255, floor(min / max * 100))
  143. end
  144. end
  145. end
  146.  
  147. local PostUpdateName = function(self, power)
  148. self.info:ClearAllPoints()
  149. self.info:SetPoint("CENTER", 0, -4)
  150. end
  151.  
  152. local PreUpdatePower = function(power, unit)
  153. local _, pType = UnitPowerType(unit)
  154.  
  155. local color = colors.power[pType]
  156. if color then
  157. power:SetStatusBarColor(color[1], color[2], color[3])
  158. end
  159. end
  160.  
  161. local PostUpdatePower = function(power, unit, min, max)
  162.  
  163. local self = power:GetParent()
  164.  
  165. local pType, pToken = UnitPowerType(unit)
  166. local color = colors.power[pToken]
  167.  
  168. if color then
  169. power.value:SetTextColor(color[1], color[2], color[3])
  170. end
  171.  
  172. if not UnitIsConnected(unit) or UnitIsDead(unit) or UnitIsGhost(unit) then
  173. local class = select(2, UnitClass(unit))
  174. local color = UnitIsPlayer(unit) and oUF.colors.class[class] or {0.84, 0.75, 0.65}
  175.  
  176. power:SetValue(0)
  177. power.bg:SetVertexColor(color[1] * 0.5, color[2] * 0.5, color[3] * 0.5)
  178. end
  179.  
  180. if unit ~= "player" and unit ~= "pet" and unit ~= "target" then return end
  181.  
  182. if min == 0 then
  183. power.value:SetText()
  184. elseif not UnitIsPlayer(unit) and not UnitPlayerControlled(unit) or not UnitIsConnected(unit) then
  185. power.value:SetText()
  186. elseif UnitIsDead(unit) or UnitIsGhost(unit) then
  187. power.value:SetText()
  188. elseif min == max and (pType == 2 or pType == 3 and pToken ~= "POWER_TYPE_PYRITE") then
  189. power.value:SetText()
  190. else
  191. if min ~= max then
  192. if pType == 0 then
  193. if unit == "target" then
  194. power.value:SetFormattedText("%s |cffD7BEA5-|r %d%%", max - (max - min), floor(min / max * 100))
  195. elseif unit == "player" and power:GetAttribute("normalUnit") == "pet" or unit == "pet" then
  196. power.value:SetFormattedText("%d%%", floor(min / max * 100))
  197. else
  198. power.value:SetFormattedText("%d%% |cffD7BEA5-|r %d", floor(min / max * 100), max - (max - min))
  199. end
  200. else
  201. power.value:SetText(max - (max - min))
  202. end
  203. else
  204. if unit == "pet" or unit == "target" then
  205. power.value:SetText(min)
  206. else
  207. power.value:SetText(min)
  208. end
  209. end
  210. end
  211. if self.Info then
  212. if unit == "pet" or unit == "target" then PostUpdateName(self, power) end
  213. end
  214. end
  215.  
  216. local PostCreateIcon = function(self, button)
  217. button.cd:SetReverse()
  218. button.icon:SetTexCoord(0.1, 0.9, 0.1, 0.9)
  219. button.icon:SetDrawLayer("BACKGROUND")
  220. --count
  221. button.count:ClearAllPoints()
  222. button.count:SetPoint("TOPLEFT", 5, -3)
  223. button.count:SetTextColor(0.7,0.7,0.7)
  224. --helper
  225. local helper = CreateFrame("Frame", nil, button)
  226. helper:SetFrameLevel(0)
  227. helper:SetPoint("TOPLEFT",-5,5)
  228. helper:SetPoint("BOTTOMRIGHT",5,-5)
  229. helper:SetBackdrop{edgeFile = bgtexture, edgeSize = 3, insets = {left = 0, right = 0, top = 0, bottom = 0}}
  230. helper:SetBackdropColor(0,0,0,0.7)
  231. helper:SetBackdropBorderColor(0,0,0,1)
  232. end
  233.  
  234. local PostCastStart = function(Castbar, unit, name, rank, text, castid)
  235. Castbar.channeling = false
  236. if unit == "vehicle" then unit = "player" end
  237.  
  238. if Castbar.interrupt and UnitCanAttack("player", unit) then
  239. Castbar:SetStatusBarColor(0.69, 0.31, 0.31)
  240. else
  241. Castbar:SetStatusBarColor(0.55, 0.57, 0.61)
  242. end
  243. end
  244.  
  245. local PostChannelStart = function(Castbar, unit, name, rank, text)
  246. Castbar.channeling = true
  247. if unit == "vehicle" then unit = "player" end
  248.  
  249. if Castbar.interrupt and UnitCanAttack("player", unit) then
  250. Castbar:SetStatusBarColor(0.69, 0.31, 0.31)
  251. else
  252. Castbar:SetStatusBarColor(0.55, 0.57, 0.61)
  253. end
  254. end
  255.  
  256. local CustomCastTimeText = function(self, duration)
  257. self.Time:SetText(("%.1f / %.1f"):format(self.channeling and duration or self.max - duration, self.max))
  258. end
  259.  
  260. local CustomCastDelayText = function(self, duration)
  261. self.Time:SetText(("%.1f |cffaf5050%s %.1f|r"):format(self.channeling and duration or self.max - duration, self.channeling and "- " or "+", self.delay))
  262. end
  263.  
  264. local FormatTime = function(s)
  265. local day, hour, minute = 86400, 3600, 60
  266. if s >= day then
  267. return format("%dd", floor(s/day + 0.5)), s % day
  268. elseif s >= hour then
  269. return format("%dh", floor(s/hour + 0.5)), s % hour
  270. elseif s >= minute then
  271. if s <= minute * 5 then
  272. return format("%d:%02d", floor(s/60), s % minute), s - floor(s)
  273. end
  274. return format("%dm", floor(s/minute + 0.5)), s % minute
  275. elseif s >= minute / 12 then
  276. return floor(s + 0.5), (s * 100 - floor(s * 100))/100
  277. end
  278. return format("%.1f", s), (s * 100 - floor(s * 100))/100
  279. end
  280.  
  281. local CreateAuraTimer = function(self, elapsed)
  282. if self.timeLeft then
  283. self.elapsed = (self.elapsed or 0) + elapsed
  284. if self.elapsed >= 0.1 then
  285. if not self.first then
  286. self.timeLeft = self.timeLeft - self.elapsed
  287. else
  288. self.timeLeft = self.timeLeft - GetTime()
  289. self.first = false
  290. end
  291. if self.timeLeft > 0 then
  292. local time = FormatTime(self.timeLeft)
  293. self.remaining:SetText(time)
  294. if self.timeLeft < 5 then
  295. self.remaining:SetTextColor(0.69, 0.31, 0.31)
  296. else
  297. self.remaining:SetTextColor(0.84, 0.75, 0.65)
  298. end
  299. else
  300. self.remaining:Hide()
  301. self:SetScript("OnUpdate", nil)
  302. end
  303. self.elapsed = 0
  304. end
  305. end
  306. end
  307.  
  308. local CancelAura = function(self, button)
  309. if button == "RightButton" and not self.debuff then
  310. CancelUnitBuff("player", self:GetID())
  311. end
  312. end
  313.  
  314. local PostCreateAura = function(auras, button)
  315. button.backdrop = CreateFrame("Frame", nil, button)
  316. button.backdrop:SetPoint("TOPLEFT", button, -3, 3)
  317. button.backdrop:SetPoint("BOTTOMRIGHT", button, 3, -3)
  318. button.backdrop:SetFrameStrata("BACKGROUND")
  319.  
  320. button.backdrop.border = CreateFrame("Frame", nil, button)
  321. button.backdrop.border:SetPoint("TOPLEFT", button.backdrop, "TOPLEFT", -1, 1)
  322. button.backdrop.border:SetPoint("BOTTOMRIGHT", button.backdrop, "BOTTOMRIGHT", 1, -1)
  323. button.backdrop.border:SetBackdrop{edgeFile = bgtexture, edgeSize = 5, insets = {left = 1, right = 1, top = 1, bottom = 1}}
  324. button.backdrop.border:SetBackdropBorderColor(0, 0, 0, 1)
  325. button.backdrop.border:SetFrameStrata("BACKGROUND")
  326.  
  327. button.count = SetFontString(button, fontlol, 9, "OUTLINE")
  328. button.count:SetPoint("TOP", 0, -3)
  329. button.count:SetTextColor(0.84, 0.75, 0.65)
  330.  
  331. button.cd.noOCC = true
  332. button.cd.noCooldownCount = true
  333. auras.disableCooldown = true
  334.  
  335. button.overlay:SetTexture(buttontex)
  336. button.overlay:SetPoint("TOPLEFT", button, -2, 2)
  337. button.overlay:SetPoint("BOTTOMRIGHT", button, 2, -2)
  338. button.overlay:SetTexCoord(0, 1, 0.02, 1)
  339. button.overlay.Hide = function(self) end
  340.  
  341. button.remaining = SetFontString(button, fontlol, 9, "OUTLINE")
  342. button.remaining:SetPoint("BOTTOM", 1, 3)
  343.  
  344. if unit == "player" then
  345. button:SetScript("OnMouseUp", CancelAura)
  346. end
  347. end
  348.  
  349. local PostUpdateIcon = function(icons, unit, icon, index, offset)
  350. local _, _, _, _, _, duration, expirationTime, unitCaster, _ = UnitAura(unit, index, icon.filter)
  351. if unitCaster == "player" or unitCaster == "pet" or unitCaster == "vehicle" then
  352. if icon.debuff then
  353. icon.overlay:SetVertexColor(0.69, 0.31, 0.31)
  354. else
  355. icon.overlay:SetVertexColor(0.33, 0.59, 0.33)
  356. end
  357. else
  358. if UnitIsEnemy("player", unit) then
  359. if icon.debuff then
  360. icon.icon:SetDesaturated(true)
  361. end
  362. end
  363. icon.overlay:SetVertexColor(0.84, 0.75, 0.65)
  364. end
  365.  
  366. if duration and duration > 0 then
  367. icon.remaining:Show()
  368. icon.timeLeft = expirationTime
  369. icon:SetScript("OnUpdate", CreateAuraTimer)
  370. else
  371. icon.remaining:Hide()
  372. icon.timeLeft = math.huge
  373. icon:SetScript("OnUpdate", nil)
  374. end
  375.  
  376. icon.first = true
  377.  
  378. end
  379.  
  380. local SortAura = function(a, b)
  381. return (a.timeLeft and a.timeLeft) > (b.timeLeft and b.timeLeft)
  382. end
  383.  
  384. local PreSetPosition = function(auras)
  385. sort(auras, SortAura)
  386. end
  387.  
  388.  
  389. --[[
  390. ################################################################
  391. #
  392. # Frame Creation
  393. #
  394. ################################################################
  395. ]]
  396.  
  397. local CreateStyle = function(self, unit)
  398.  
  399. self.menu = Menu
  400. self.colors = colors
  401.  
  402. self:RegisterForClicks("AnyUp")
  403. self:SetAttribute("type2", "menu")
  404.  
  405. self:SetScript("OnEnter", UnitFrame_OnEnter)
  406. self:SetScript("OnLeave", UnitFrame_OnLeave)
  407. self:HookScript("OnShow", updateAllElements)
  408.  
  409. self.FrameBackdrop = CreateFrame("Frame", nil, self)
  410. self.FrameBackdrop:SetPoint("TOPLEFT", self, "TOPLEFT", -5, 5)
  411. self.FrameBackdrop:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", 5, -5)
  412. self.FrameBackdrop:SetFrameStrata("LOW")
  413. self.FrameBackdrop:SetBackdrop {
  414. edgeFile = bgtexture, edgeSize = 5,
  415. insets = {left = 0, right = 0, top = 0, bottom = 0}
  416. }
  417. self.FrameBackdrop:SetBackdropColor(0, 0, 0, 0)
  418. self.FrameBackdrop:SetBackdropBorderColor(0, 0, 0, 0.8)
  419.  
  420. self.FrameIBorderBackdrop = CreateFrame("Frame", nil, self)
  421. self.FrameIBorderBackdrop:SetPoint("TOPLEFT", self, "TOPLEFT", -1, 1)
  422. self.FrameIBorderBackdrop:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", 1, -1)
  423. self.FrameIBorderBackdrop:SetFrameStrata("LOW")
  424. self.FrameIBorderBackdrop:SetFrameLevel(6)
  425. self.FrameIBorderBackdrop:SetBackdrop({
  426. bgFile = "Interface\\Buttons\\WHITE8X8",
  427. insets = {left = 1,right = 1,top = 1,bottom = 1}
  428. });
  429. self.FrameIBorderBackdrop:SetBackdropColor(0.1, 0.1, 0.1, 1)
  430.  
  431. --[[
  432. ################################################################
  433. #
  434. # Player/Target Frames
  435. #
  436. ################################################################
  437. ]]
  438.  
  439. if unit == "player" or unit == "target" then
  440.  
  441. -- Player/Target Health Size
  442. self.Health = CreateFrame("StatusBar", nil, self)
  443. self.Health:SetSize(275, 23)
  444. self.Health:SetPoint("TOPLEFT", self, "TOPLEFT", 0, 0)
  445. self.Health:SetPoint("TOPRIGHT", self, "TOPRIGHT", 0, 0)
  446. self.Health:SetStatusBarTexture(texture)
  447.  
  448. -- Options
  449. self.Health.frequentUpdates = true
  450. self.Health.colorTapping = true
  451. self.Health.colorDisconnected = true
  452. self.Health.colorHappiness = true
  453. self.Health.colorClass = true
  454. self.Health.colorReaction = true
  455. self.Health.colorHealth = true
  456.  
  457. -- oUF Smooth Support
  458. if(IsAddOnLoaded("oUF_Smooth")) then
  459. self.Health.Smooth = true
  460. end
  461.  
  462. --[[ Healcomm 4 Support
  463. if(IsAddOnLoaded("oUF_HealComm4")) then
  464. self.HealCommBar = CreateFrame('StatusBar', nil, self.Health)
  465. self.HealCommBar:SetHeight(0)
  466. self.HealCommBar:SetWidth(0)
  467. self.HealCommBar:SetStatusBarTexture(self.Health:GetStatusBarTexture():GetTexture())
  468. self.HealCommBar:SetStatusBarColor(0, 0, 0, 0.5)
  469. self.HealCommBar:SetPoint('LEFT', self.Health, 'LEFT')
  470.  
  471. -- optional flag to show overhealing
  472. self.allowHealCommOverflow = false
  473.  
  474. -- limit to the next 3 seconds incoming heals
  475. self.HealCommTimeframe = 3
  476. end]]
  477.  
  478. -- New Heal Prediction stuff :D
  479. self.mhpb = CreateFrame("StatusBar", nil, self.Health)
  480. self.mhpb:SetPoint('TOPLEFT', self.Health:GetStatusBarTexture(), 'TOPRIGHT', 0, 0)
  481. self.mhpb:SetPoint('BOTTOMLEFT', self.Health:GetStatusBarTexture(), 'BOTTOMRIGHT', 0, 0)
  482. self.mhpb:SetWidth(275)
  483. self.mhpb:SetStatusBarTexture(texture)
  484. self.mhpb:SetStatusBarColor(0, 0, 0, 0.5)
  485.  
  486. self.ohpb = CreateFrame("StatusBar", nil, self.Health)
  487. self.ohpb:SetPoint('TOPLEFT', self.mhpb:GetStatusBarTexture(), 'TOPRIGHT', 0, 0)
  488. self.ohpb:SetPoint('BOTTOMLEFT', self.mhpb:GetStatusBarTexture(), 'BOTTOMRIGHT', 0, 0)
  489. self.ohpb:SetWidth(275)
  490. self.ohpb:SetStatusBarTexture(texture)
  491. self.ohpb:SetStatusBarColor(0, 0, 0, 0.5)
  492.  
  493. -- Register Heal Prediction with oUF. Derp!
  494. self.HealPrediction = {
  495. myBar = self.mhpb,
  496. otherBar = self.ohpb,
  497. maxOverflow = 1,
  498. }
  499.  
  500. -- Player Power Position and size
  501. self.Power = CreateFrame("StatusBar", nil, self)
  502. self.Power:SetHeight(4)
  503. self.Power:SetPoint("TOPLEFT", self.Health, "BOTTOMLEFT", 0, -1)
  504. self.Power:SetPoint("TOPRIGHT", self.Health, "BOTTOMRIGHT", 0, -1)
  505. self.Power:SetStatusBarTexture(texture)
  506.  
  507. -- Add a background and border
  508. self.Power.bg = self.Power:CreateTexture(nil, 'BACKGROUND')
  509. self.Power.bg:SetAllPoints()
  510. self.Power.bg:SetTexture(texture)
  511. self.Power.border = CreateFrame("Frame", nil, self)
  512. self.Power.border:SetPoint("TOPLEFT", self.Power, "TOPLEFT", 0, 1)
  513. self.Power.border:SetPoint("BOTTOMRIGHT", self.Power, "BOTTOMRIGHT", 0, -1)
  514. self.Power.border:SetFrameStrata("LOW")
  515. self.Power.border:SetFrameLevel(5)
  516. self.Power.border:SetBackdrop({bgFile = "Interface\\Buttons\\WHITE8X8", insets = {left = 0,right = 0,top = 0,bottom = 0}});
  517. self.Power.border:SetBackdropColor(0, 0, 0, 1)
  518.  
  519. -- Options
  520. self.Power.frequentUpdates = true
  521. self.Power.colorTapping = true
  522. self.Power.colorDisconnected = true
  523. self.Power.colorHappiness = true
  524. self.Power.colorPower = true
  525. self.Power.colorClass = true
  526. self.Power.colorReaction = true
  527. self.Power.bg.colorClass = false
  528. self.Power.bg.colorPower = false
  529.  
  530. -- Make the background darker.
  531. self.Power.bg.multiplier = .5
  532.  
  533. -- Info Panel
  534. self.info = CreateFrame("FRAME", nil, self)
  535. self.info:SetHeight(10)
  536. self.info:SetPoint("TOPLEFT", self.Power, "BOTTOMLEFT", 0, 0)
  537. self.info:SetPoint("TOPRIGHT", self.Power, "BOTTOMRIGHT", 0, 0)
  538.  
  539. self.info.border = CreateFrame("Frame", nil, self)
  540. self.info.border:SetPoint("TOPLEFT", self.info, "TOPLEFT", -1, 0)
  541. self.info.border:SetPoint("BOTTOMRIGHT", self.info, "BOTTOMRIGHT", 1, -10)
  542. self.info.border:SetBackdrop{edgeFile = bgtexture, edgeSize = 1, insets = {left = 0, right = 0, top = 0, bottom = 0}}
  543. self.info.border:SetBackdropBorderColor(0.6, 0.6, 0.6, 1)
  544. self.info.border:SetFrameLevel(10)
  545.  
  546. -- Holy Power
  547. if class == "PALADIN" then
  548. if unit == "player" then
  549. self.hlypwr = CreateFrame('StatusBar', nil, self)
  550. self.hlypwr:SetPoint('TOPLEFT', self, 'TOPRIGHT', 0, 2)
  551. self.hlypwr:SetSize(275, 5)
  552. self.hlypwr:SetBackdrop(texture)
  553. self.hlypwr:SetBackdropColor(0, 0, 0)
  554.  
  555. for id = 1, 3 do
  556. self.hp = self.hlypwr:CreateTexture(nil, 'OVERLAY')
  557. self.hp:SetTexture(1, 0.8, 0)
  558. if id > 1 then
  559. self.hp:SetSize(91, 5)
  560. self.hp:SetPoint('BOTTOMLEFT', self.hlypwr[id-1], 'BOTTOMRIGHT', 2, 0)
  561. else
  562. self.hp:SetSize(91, 5)
  563. self.hp:SetPoint('BOTTOMLEFT', self.hlypwr, 'BOTTOMLEFT', 0, 0)
  564. end
  565. self.hlypwr[id] = self.hp
  566. end
  567.  
  568. -- Register to oUF
  569. self.HolyPower = self.hlypwr
  570. end
  571. end
  572.  
  573. -- Buffs/Debuffs
  574. self.Buffs = CreateFrame("Frame", nil, self)
  575.  
  576. if unit == "player" then
  577. self.Buffs:SetHeight(60)
  578. self.Buffs:SetWidth(600)
  579. self.Buffs.size = 35
  580. self.Buffs.spacing = 5
  581. elseif unit == "target" then
  582. self.Buffs:SetHeight(40)
  583. self.Buffs:SetWidth(210)
  584. self.Buffs.size = 26
  585. self.Buffs.spacing = 3
  586. end
  587.  
  588. self.Buffs.PreSetPosition = PreSetPosition
  589. self.Buffs.PostCreateIcon = PostCreateAura
  590. self.Buffs.PostUpdateIcon = PostUpdateIcon
  591.  
  592. self.Debuffs = CreateFrame("Frame", nil, self)
  593. if unit == "player" then
  594. self.Debuffs:SetHeight(80)
  595. self.Debuffs:SetWidth(460)
  596. self.Debuffs.size = 40
  597. self.Debuffs.spacing = 6
  598. elseif unit == "target" then
  599. self.Debuffs:SetHeight(52)
  600. self.Debuffs:SetWidth(236)
  601. self.Debuffs.size = 26
  602. self.Debuffs.spacing = 3
  603. end
  604.  
  605. self.Debuffs.PreSetPosition = PreSetPosition
  606. self.Debuffs.PostCreateIcon = PostCreateAura
  607. self.Debuffs.PostUpdateIcon = PostUpdateIcon
  608.  
  609. if unit == "player" then
  610. self.Buffs:SetPoint("TOP", UIParent, "TOP", 485, -18)
  611. self.Buffs.initialAnchor = "TOPRIGHT"
  612. self.Buffs["growth-x"] = "LEFT"
  613. self.Buffs["growth-y"] = "DOWN"
  614. self.Buffs.num = 30
  615. self.Debuffs:SetPoint("TOP", UIParent, "TOP", 525, -133)
  616. self.Debuffs.initialAnchor = "TOPRIGHT"
  617. self.Debuffs["growth-x"] = "LEFT"
  618. self.Debuffs["growth-y"] = "DOWN"
  619. elseif unit == "target" then
  620. self.Buffs:SetPoint("TOPLEFT", self, "TOPRIGHT", 5, -1)
  621. self.Buffs.initialAnchor = "TOPLEFT"
  622. self.Buffs["growth-x"] = "RIGHT"
  623. self.Buffs["growth-y"] = "UP"
  624. self.Debuffs:SetPoint("TOPLEFT", self, "TOPRIGHT", 5, -32)
  625. self.Debuffs.initialAnchor = "TOPLEFT"
  626. self.Debuffs["growth-x"] = "RIGHT"
  627. self.Debuffs["growth-y"] = "DOWN"
  628. self.Debuffs.num = 24
  629. end
  630.  
  631. -- Health/Power/Name Values and Handlers
  632. self.Health.PostUpdate = PostUpdateHealth
  633. self.Power.PostUpdate = PostUpdatePower
  634.  
  635. -- Health/Power
  636. self.Health.value = SetFontString(self.info, fontlol, 9, "OUTLINE")
  637. self.Power.value = SetFontString(self.info, fontlol, 9, "OUTLINE")
  638.  
  639. if unit == "player" then
  640. self.Health.value:SetPoint("LEFT", self.info, "LEFT", 5, -5)
  641. self.Power.value:SetPoint("RIGHT", self.info, "RIGHT", -5, -5)
  642. elseif unit == "target" then
  643. self.Health.value:SetPoint("RIGHT", self.info, "RIGHT", -5, -5)
  644. self.Power.value:SetPoint("LEFT", self.info, "LEFT", 5, -5)
  645. self.Name = self.Health:CreateFontString(nil, "OVERLAY")
  646. self.Name:SetFont(fontlol, 9, "OUTLINE")
  647. self:Tag(self.Name, "[afkdnd][name]")
  648. self.Name:SetPoint("LEFT", self.Health, "LEFT", 10, 0)
  649. end
  650.  
  651.  
  652. --[[
  653. ################################################################
  654. #
  655. # Pet/Focus Frames
  656. #
  657. ################################################################
  658. ]]
  659.  
  660. else
  661.  
  662. -- Pet/Focus Health Size
  663. self.Health = CreateFrame("StatusBar", nil, self)
  664. self.Health:SetHeight(21.5)
  665. self.Health:SetPoint("TOPLEFT", self, "TOPLEFT", 0, 0)
  666. self.Health:SetPoint("TOPRIGHT", self, "TOPRIGHT", 0, 0)
  667. self.Health:SetStatusBarTexture(texture)
  668.  
  669. -- Options
  670. self.Health.frequentUpdates = true
  671. self.Health.colorTapping = true
  672. self.Health.colorDisconnected = true
  673. self.Health.colorHappiness = true
  674. self.Health.colorClass = true
  675. self.Health.colorReaction = true
  676. self.Health.colorHealth = true
  677.  
  678. self.Name = self.Health:CreateFontString(nil, "OVERLAY")
  679. self.Name:SetFont(fontlol, 9, "OUTLINE")
  680. self:Tag(self.Name, "[afkdnd][abbrevname]")
  681. self.Name:SetPoint("LEFT", self.Health, "LEFT", 10, 0)
  682. self.Health.value = SetFontString(self.Health, fontlol, 9, "OUTLINE")
  683. self.Health.value:SetPoint("RIGHT", self.Health, "RIGHT", -10, 0)
  684.  
  685. end
  686.  
  687.  
  688. --[[
  689. ################################################################
  690. #
  691. # Cast Bars
  692. #
  693. ################################################################
  694. ]]
  695.  
  696. self.Castbar = CreateFrame("StatusBar", nil, self)
  697. self.Castbar:SetStatusBarTexture(texture)
  698.  
  699. self.Castbar.PostCastStart = PostCastStart
  700. self.Castbar.PostChannelStart = PostChannelStart
  701.  
  702. if unit == "player" then
  703. self.Castbar:SetPoint("TOPLEFT", self, 25, -53)
  704. self.Castbar:SetPoint("BOTTOMRIGHT", self, -1, -25)
  705. elseif unit == "target" then
  706. self.Castbar:SetPoint("TOPLEFT", self, 1, -53)
  707. self.Castbar:SetPoint("BOTTOMRIGHT", self, -26, -25)
  708. elseif unit == "focus" then
  709. self.Castbar:SetPoint("TOPLEFT", self, 0, -53)
  710. self.Castbar:SetPoint("BOTTOMRIGHT", self, 0, -51)
  711. else
  712. self.Castbar:SetPoint("TOPLEFT", self, 0, -27)
  713. self.Castbar:SetPoint("BOTTOMRIGHT", self, 0, -25)
  714. end
  715.  
  716. -- Add a background and border
  717. self.Castbar.bg = self.Castbar:CreateTexture(nil, 'BACKGROUND')
  718. self.Castbar.bg:SetPoint("TOPLEFT", self.Castbar, "TOPLEFT",-1, 1)
  719. self.Castbar.bg:SetPoint("BOTTOMRIGHT", self.Castbar, "BOTTOMRIGHT", 1, -1)
  720. self.Castbar.bg:SetTexture(texture)
  721. self.Castbar.bg:SetVertexColor(.1,.1,.1)
  722. self.Castbar.border = CreateFrame("Frame", nil, self)
  723. self.Castbar.border:SetPoint("TOPLEFT", self, "TOPLEFT", -2, 2)
  724. self.Castbar.border:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", 2, -2)
  725. self.Castbar.border:SetBackdrop{edgeFile = bgtexture, edgeSize = 1, insets = {left = 0, right = 0, top = 0, bottom = 0}}
  726. self.Castbar.border:SetBackdropBorderColor(0.1, 0.1, 0.1, 1)
  727. self.Castbar.border = CreateFrame("Frame", nil, self)
  728. self.Castbar.border:SetPoint("TOPLEFT", self.Castbar, "TOPLEFT", -5, 5)
  729. self.Castbar.border:SetPoint("BOTTOMRIGHT", self.Castbar, "BOTTOMRIGHT", 5, -5)
  730. self.Castbar.border:SetBackdrop{edgeFile = bgtexture, edgeSize = 5, insets = {left = 5, right = 5, top = 5, bottom = 5}}
  731. self.Castbar.border:SetBackdropBorderColor(0, 0, 0, 0.7)
  732.  
  733. self.Castbar.Time = SetFontString(self.Castbar, fontlol, 9, "OUTLINE")
  734. self.Castbar.Time:SetPoint("RIGHT", self.Castbar, -5, 0)
  735. self.Castbar.Time:SetTextColor(1, 1, 1)
  736.  
  737. self.Castbar.Text = SetFontString(self.Castbar, fontlol, 9, "OUTLINE")
  738. self.Castbar.Text:SetPoint("LEFT", 10, 1)
  739. self.Castbar.Text:SetTextColor(1, 1, 1)
  740.  
  741. self.Castbar.Icon = self.Castbar:CreateTexture(nil, "ARTWORK")
  742. self.Castbar.Icon:SetSize(20,20)
  743. self.Castbar.Icon:SetTexCoord(0, 1, 0, 1)
  744. if unit == "player" then
  745. self.Castbar.Icon:SetPoint("LEFT", -25, 0)
  746. elseif unit == "target" then
  747. self.Castbar.Icon:SetPoint("RIGHT", 25, 0)
  748. end
  749.  
  750. if unit == "player" or unit == "target" then
  751. self.IconOverlay = self.Castbar:CreateTexture(nil, "OVERLAY")
  752. self.IconOverlay:SetTexture(buttontex)
  753. self.IconOverlay:SetPoint("TOPLEFT", self.Castbar.Icon, -1, 1)
  754. self.IconOverlay:SetPoint("BOTTOMRIGHT", self.Castbar.Icon, 1, -1)
  755. self.IconOverlay:SetVertexColor(0, 0, 0)
  756.  
  757. self.IconBackdrop = CreateFrame("Frame", nil, self.Castbar)
  758. self.IconBackdrop:SetPoint("TOPLEFT", self.Castbar.Icon, -3, 3)
  759. self.IconBackdrop:SetPoint("BOTTOMRIGHT", self.Castbar.Icon, 3, -3)
  760. self.IconBackdrop:SetBackdrop{edgeFile = bgtexture, edgeSize = 3, insets = {left = 2, right = 2, top = 2, bottom = 2}}
  761. self.IconBackdrop:SetBackdropColor(0, 0, 0, 0)
  762. self.IconBackdrop:SetBackdropBorderColor(0, 0, 0, 0.7)
  763. end
  764.  
  765. self.Castbar:HookScript("OnShow", function() self.Castbar.Text:Show(); self.Castbar.Time:Show(); self.Castbar.bg:Show(); self.Castbar.border:Show(); self.Castbar.Icon:Show() end)
  766. self.Castbar:HookScript("OnHide", function() self.Castbar.Text:Hide(); self.Castbar.Time:Hide(); self.Castbar.bg:Hide(); self.Castbar.border:Hide(); self.Castbar.Icon:Hide() end)
  767.  
  768. self:RegisterEvent("UNIT_SPELLCAST_SENT", function(self, event, caster)
  769. if caster == "player" or caster == "vehicle" then
  770. self.Castbar.castSent = GetTime()
  771. end
  772. end)
  773.  
  774.  
  775. --[[
  776. ################################################################
  777. #
  778. # Frame Sizing
  779. #
  780. ################################################################
  781. ]]
  782.  
  783. if unit == "player" or unit == "target" then
  784. --[[self:SetAttribute("initial-height", 47)
  785. self:SetAttribute("initial-width", 275)]]
  786. self:SetSize(275, 47)
  787. else
  788. --[[self:SetAttribute("initial-height", 21.5)
  789. self:SetAttribute("initial-width", 175)]]
  790. self:SetSize(175, 21.5)
  791. end
  792.  
  793. end
  794.  
  795. --[[
  796. ################################################################
  797. #
  798. # Spawns and Handlers
  799. #
  800. ################################################################
  801. ]]
  802.  
  803. oUF:RegisterStyle("oUF_Mosphet", CreateStyle)
  804.  
  805. oUF:Factory(function(self)
  806.  
  807. oUF:SetActiveStyle"oUF_Mosphet"
  808.  
  809. self:Spawn("player", "oUF_Mosphet_player"):SetPoint("BOTTOM", UIParent, -235, 120)
  810. self:Spawn("target", "oUF_Mosphet_target"):SetPoint("BOTTOM", UIParent, 234.5, 120)
  811. self:Spawn("pet", "oUF_Mosphet_playerpet"):SetPoint("BOTTOM", UIParent, 0, 145.5)
  812. self:Spawn("focus", "oUF_Mosphet_focus"):SetPoint("BOTTOM", UIParent, 0, 145.5)
  813. self:Spawn("targettarget", "oUF_Mosphet_targettarget"):SetPoint("BOTTOM", UIParent, 0, 120)
  814.  
  815. main:RegisterEvent("PLAYER_LOGIN")
  816. main:RegisterEvent("PARTY_LEADER_CHANGED")
  817. main:RegisterEvent("PARTY_MEMBERS_CHANGED")
  818.  
  819. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement