Advertisement
Guest User

Untitled

a guest
Nov 18th, 2011
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 22.91 KB | None | 0 0
  1. BuffFrame:UnregisterAllEvents()
  2. BuffFrame:Hide()
  3. TemporaryEnchantFrame:Hide()
  4. CompactRaidFrameManager:UnregisterAllEvents()
  5. CompactRaidFrameManager:Hide()
  6. CompactRaidFrameContainer:UnregisterAllEvents()
  7. CompactRaidFrameContainer:Hide()
  8. ConsolidatedBuffs:Hide()
  9. ConsolidatedBuffs:UnregisterAllEvents()
  10. SpellActivationOverlayFrame:Hide()
  11. SpellActivationOverlayFrame:UnregisterAllEvents()
  12. RuneFrame:Hide()
  13. RuneFrame.Show = RuneFrame.Hide
  14.  
  15. local backdrop = { bgFile = 'Interface\\ChatFrame\\ChatFrameBackground', insets = {top = -1, left = -1, bottom = -1, right = -1}, }
  16. local btex = 'Interface\\AddOns\\oUF_y\\Flat.tga'
  17. --local fonttw = 'Interface\\AddOns\\oUF_y\\twcenmt.ttf'
  18. local font2 = 'Interface\\AddOns\\oUF_y\\visitor2.ttf'
  19. local fonttw = font2
  20. local cpoint = 'Interface\\AddOns\\oUF_y\\square.tga'
  21. local _, playerClass = UnitClass("player")
  22.  
  23. classcolor = function(unit)
  24.     if unit then
  25.         local class = select(2, UnitClass(unit))
  26.         if RAID_CLASS_COLORS[class] then
  27.             return RAID_CLASS_COLORS[class].r, RAID_CLASS_COLORS[class].g, RAID_CLASS_COLORS[class].b
  28.         end
  29.     end
  30. end
  31.  
  32. oUF.colors.runes = {
  33.     {1, .1, .4};
  34.     {.3, .5, .3};
  35.     {.3, 1, 1};
  36.     {.9, .3, 1};
  37. }
  38.  
  39. local dropdown = CreateFrame("Frame", "MyAddOnUnitDropDownMenu", UIParent, "UIDropDownMenuTemplate") -- thanks to Phanx for this
  40. UIDropDownMenu_Initialize(dropdown, function(self)
  41.     local unit = self:GetParent().unit
  42.     if not unit then return end
  43.  
  44.     local menu, name, id
  45.     if UnitIsUnit(unit, "player") then
  46.         menu = "SELF"
  47.     elseif UnitIsUnit(unit, "vehicle") then
  48.         menu = "VEHICLE"
  49.     elseif UnitIsUnit(unit, "pet") then
  50.         menu = "PET"
  51.     elseif UnitIsPlayer(unit) then
  52.         id = UnitInRaid(unit)
  53.         if id then
  54.             menu = "RAID_PLAYER"
  55.             name = GetRaidRosterInfo(id)
  56.         elseif UnitInParty(unit) then
  57.             menu = "PARTY"
  58.         else
  59.             menu = "PLAYER"
  60.         end
  61.     else
  62.         menu = "TARGET"
  63.         name = RAID_TARGET_ICON
  64.     end
  65.     if menu then
  66.         UnitPopup_ShowMenu(self, menu, unit, name, id)
  67.     end
  68. end, "MENU")
  69.  
  70. local menu = function(self)
  71.     dropdown:SetParent(self)
  72.     ToggleDropDownMenu(1, nil, dropdown, "cursor", 0, 0)
  73. end
  74.  
  75. local FormatTime = function(s) -- stole this from ouf_cael I think
  76.     local day, hour, minute = 86400, 3600, 60
  77.     if s >= day then
  78.         return format("%dd", floor(s/day + 0.5)), s % day
  79.     elseif s >= hour then
  80.         return format("%dh", floor(s/hour + 0.5)), s % hour
  81.     elseif s >= minute then
  82.         return format("%dm", floor(s/minute + 0.5)), s % minute
  83.     elseif s >= minute / 12 then
  84.         return floor(s + 0.5), (s * 100 - floor(s * 100))/100
  85.     end
  86.     return format("%.1d", s), (s * 100 - floor(s * 100))/100
  87. end
  88.  
  89. local CreateAuraTimer = function(self,elapsed)
  90.     if self.timeLeft then
  91.         self.elapsed = (self.elapsed or 0) + elapsed
  92.         if self.elapsed >= 0.1 then
  93.             if not self.first then
  94.                 self.timeLeft = self.timeLeft - self.elapsed
  95.             else
  96.                 self.timeLeft = self.timeLeft - GetTime()
  97.                 self.first = false
  98.             end
  99.             if self.timeLeft > 0 then
  100.                 local time = FormatTime(self.timeLeft)
  101.                     self.remaining:SetText(time)
  102.                     self.remaining:SetTextColor(0.84, 0.75, 0.65)
  103.             else
  104.                 self.remaining:Hide()
  105.                 self:SetScript("OnUpdate", nil)
  106.             end
  107.             self.elapsed = 0
  108.         end
  109.     end
  110. end
  111.  
  112. local UpdateAura = function(icons, unit, icon, index, offset, filter, isDebuff)--(self, icons, unit, icon, index)
  113.     local _, _, _, _, _, duration, expirationTime, unitCaster, _ = UnitAura(unit, index, icon.filter)
  114.  
  115.     if unitCaster ~= 'player' then
  116.         if icon.debuff or unit == 'player' then
  117.             icon.icon:SetDesaturated(true)
  118.         end
  119.     end
  120.  
  121.     if duration and duration > 0 then
  122.         icon.remaining:Show()
  123.     else
  124.         icon.remaining:Hide()
  125.     end
  126.    
  127.     icon.duration = duration
  128.     icon.timeLeft = expirationTime
  129.     icon.first = true
  130.     icon:SetScript("OnUpdate", CreateAuraTimer)
  131. end
  132.  
  133. local CreateAura = function(aura, button)  
  134.     button.count:SetPoint("TOPLEFT", -8, 18)
  135.     button.count:SetFont(font2, 12, "MONOCHROMETHINOUTLINE")
  136.     button.count:SetTextColor(1, 1, 1)
  137.  
  138.     button.overlay:SetTexture(nil)
  139.     button.overlay:SetPoint("TOPLEFT", button, "TOPLEFT")
  140.     button.overlay:SetPoint("BOTTOMRIGHT", button, "BOTTOMRIGHT")
  141.     button.overlay:SetTexCoord(0, 1, 0, 1)
  142.     button.overlay.Hide = function(self) end
  143.    
  144.     button.icon:SetTexCoord(0.07, 0.93, 0.07, 0.93)
  145.    
  146.     local f = CreateFrame("Frame", nil, button)
  147.     f:SetBackdrop(backdrop)
  148.     f:SetBackdropColor(0,0,0)
  149.     f:SetPoint("TOPLEFT", button, "TOPLEFT", 0, 0)
  150.     f:SetPoint("BOTTOMRIGHT", button, "BOTTOMRIGHT")
  151.     f:SetFrameStrata("LOW")
  152.  
  153.     button.remaining = button:CreateFontString(nil, "OVERLAY")
  154.     button.remaining:SetPoint("BOTTOMRIGHT", 2, -1)
  155.     button.remaining:SetFont(font2, 12, "MONOCHROMETHINOUTLINE")
  156.     button.remaining:SetTextColor(1, 1, 1)
  157. end
  158.  
  159. oUF.Tags["text:hp"] = function(u)
  160.     local hp = tostring(UnitHealth(u)) -- string.len doesn't work with numbers :(
  161.     if string.len(hp) > 6 then
  162.         hp = select(3, hp:find("^(...)")):gsub("%d", "%1%.", 1).." m" -- more graceful solution wanted
  163.     elseif string.len(hp) > 5 then
  164.         hp = select(3, hp:find("^(...)")).." k"
  165.     end
  166.    
  167.     if(not UnitIsConnected(u)) then
  168.         return "D/C"
  169.     elseif UnitIsDead(u) then
  170.         return "DEAD"
  171.     elseif UnitIsGhost(u) then
  172.         return "GHOST"
  173.     else
  174.         return hp
  175.     end
  176. end
  177. oUF.TagEvents["text:hp"] = oUF.TagEvents.missinghp
  178.  
  179. oUF.Tags["text:pp"] = function(u)
  180.     local pp, pmax = tostring(UnitPower(u)), UnitPowerMax(u)
  181.     if string.len(pp) > 6 then
  182.         pp = select(3, pp:find("^(...)")):gsub("%d", "%1.", 1).." m"
  183.     elseif string.len(pp) > 5 then
  184.         pp = select(3, pp:find("^(...)")).." k"
  185.     end
  186.    
  187.     if(not UnitIsConnected(u)) then
  188.         return "D/C"
  189.     elseif UnitIsDead(u) then
  190.         return "DEAD"
  191.     elseif UnitIsGhost(u) then
  192.         return "GHOST"
  193.     elseif(cur == 0 or pmax == 0) then
  194.         return "NONE"
  195.     else
  196.         return pp
  197.     end
  198. end
  199. oUF.TagEvents["text:pp"] = oUF.TagEvents.missingpp
  200.  
  201. oUF.Tags["text:pres"] = function(u)
  202.     if u then
  203.         return UnitIsAFK(u) and "|cFFFFFFFF<AFK>|r" or UnitIsDND(u) and "|cFFFFFFFF<DND>|r" -- stolen from ouf_nivea
  204.     end
  205. end
  206. oUF.TagEvents["text:pres"] = "PLAYER_FLAGS_CHANGED"
  207.    
  208. oUF.Tags["text:combo"] = function(u)
  209.     local cp
  210.     if(UnitHasVehicleUI'player') then -- fuck yeah p3lim
  211.         cp = GetComboPoints('vehicle', 'target')
  212.     else
  213.         cp = GetComboPoints('player', 'target')
  214.     end
  215.    
  216.     local cpstring = string.rep("*", cp)
  217.    
  218.     return (cp == 5) and "|cFFFF0000"..cpstring or "|cFFFFF569"..cpstring
  219. end
  220. oUF.TagEvents["text:combo"] = "UNIT_COMBO_POINTS PLAYER_TARGET_CHANGED"
  221.    
  222. local function healthstringupdate(s,u,...)
  223.     if u then
  224.         local barlength = math.floor(s:GetParent():GetWidth()/5.8)
  225.         local curhp,maxhp = UnitHealth(u),UnitHealthMax(u)
  226.         local dashes = string.rep("-", barlength)
  227.         local replacenumhp = math.floor((curhp/maxhp)*#dashes)
  228.        
  229.         local classred, classgreen, classblue = classcolor(u)
  230.         local hexcolor = string.format("|cFF%02x%02x%02x", classred * 255, classgreen * 255, classblue * 255)
  231.        
  232.         dashes = dashes:gsub("%-", hexcolor.."\124||cFF595972", replacenumhp)
  233.         dashes = dashes:gsub(hexcolor.."\124||cFF595972", "%-", replacenumhp-1) -- WTB better solution, pst
  234.        
  235.         s.string:SetText("|cFF595972["..dashes.."]|r")
  236.     end
  237. end
  238.  
  239. local function powerstringupdate(s,u,...)
  240.     if u then
  241.         if (UnitPowerMax(u) == 0) then
  242.             s.string:SetText(nil)
  243.             return
  244.         end
  245.        
  246.         local barlength = math.floor((s:GetParent():GetWidth()/5.8) - 6) -- 5 chars for health or power number plus 1 space
  247.         local curpp,maxpp = UnitPower(u),UnitPowerMax(u)
  248.         local dashes = string.rep("-", barlength)
  249.         local replacenumpp = math.floor((curpp/maxpp)*#dashes)
  250.        
  251.         local classred, classgreen, classblue = classcolor(u)
  252.         local hexcolor = string.format("|cFF%02x%02x%02x", classred * 255, classgreen * 255, classblue * 255)
  253.        
  254.         dashes = dashes:gsub("%-", "|cFF595972\124|"..hexcolor, replacenumpp)
  255.         dashes = dashes:gsub("|cFF595972\124|"..hexcolor, "%-", replacenumpp-1)
  256.        
  257.         local endcap = replacenumpp == barlength and "|r|cFF595972]|r" or "|r|cFF595972]|r" -- loads of escape problems because I'm using a pipe :D
  258.         s.string:SetText("|cFF595972["..hexcolor..dashes..endcap)
  259.     end
  260. end
  261.  
  262. local function caststringonupdate(s,e,...)
  263.     if s.casting then
  264.         local totalTime = s.endTime - s.startTime
  265.         local curTime = GetTime() - s.startTime
  266.        
  267.         local dashes = string.rep("-", 26)
  268.         local replacecastpos = math.floor((curTime/totalTime)*#dashes)
  269.         dashes = dashes:gsub("%-", "|cFFFFFFFF\124||cFF595972", replacecastpos)
  270.         dashes = dashes:gsub("|cFFFFFFFF\124||cFF595972", "%-", replacecastpos-1)
  271.        
  272.         s.string:SetText("|cFF595972["..dashes.."]|r")
  273.     end
  274. end
  275.  
  276. local function caststringstart(s, u, ...)
  277.     local startTime
  278.    
  279.     if u then
  280.         if UnitCastingInfo(u) then
  281.             _,_,_,_, startTime, endTime = UnitCastingInfo(u)
  282.             s.startTime = startTime / 1e3 -- stole this from ouf's castbar.lua
  283.             s.endTime = endTime / 1e3
  284.         elseif UnitChannelInfo(u) then
  285.             _,_,_,_, startTime, endTime = UnitChannelInfo(u)
  286.             s.startTime = startTime / 1e3
  287.             s.endTime = endTime / 1e3
  288.         end
  289.        
  290.         s:SetScript("OnUpdate", caststringonupdate)
  291.     end
  292. end
  293.  
  294. local function caststringstop(s,u,...)
  295.     s.startTime = nil
  296.     s.endTime = nil
  297.     s:SetScript("OnUpdate", nil)
  298. end
  299.  
  300. local function runeonupdate(s,e)
  301.     local minrune,maxrune = s:GetMinMaxValues()
  302.     if(maxrune == 1) then
  303.         s:SetScript("OnUpdate", nil)
  304.     end
  305.    
  306.     local current = s:GetValue()
  307.     local r,g,b = s:GetStatusBarColor()
  308.     local color = string.format("|cFF%02x%02x%02x", r * 255, g * 255, b * 255)
  309.     local multi = 0.3
  310.     local bgcolor = string.format("|cFF%02x%02x%02x", (r * 255)/multi, (g * 255)/multi, (b * 255)/multi)
  311.    
  312.     local rcurrent = math.floor(((current/maxrune)*4)+0.5)
  313.     local reverse = 4 - rcurrent
  314.    
  315.     local runestring = color.."["..string.rep("-", rcurrent).."|r"..string.rep("-",reverse)..color.."]"
  316.    
  317.     s.string:SetText(runestring)
  318.    
  319.     --print("min: "..minrune.." max: "..maxrune.." current: "..s:GetValue())
  320. end
  321.  
  322. local function runetextupdate(s,rune,...)
  323.     for i=1,6 do
  324.         local currentrune = s.Runes[i]
  325.         local r,g,b = currentrune:GetStatusBarColor()
  326.         local runecolor = string.format("|cFF%02x%02x%02x", r * 255, g * 255, b * 255)
  327.    
  328.         local minrune,maxrune = currentrune:GetMinMaxValues()
  329.         --print("min: "..minrune.." Max: "..maxrune)
  330.         if(maxrune == 1) then
  331.             currentrune.string:SetText(runecolor.."[----]")
  332.         else
  333.             currentrune:HookScript("OnUpdate", runeonupdate)
  334.         end
  335.     end
  336. end
  337.  
  338. local function layout(self, unit)
  339.     self.menu = menu
  340.     self:RegisterForClicks("anyup")
  341.     self:SetAttribute("*type2", "menu")
  342.    
  343.     self:SetBackdrop(backdrop)
  344.     self:SetBackdropColor(0,0,0,0)
  345.     self:SetHeight(28)
  346.     self:SetWidth(207)
  347.    
  348.     local healthcontainer = CreateFrame("Statusbar", nil, self) -- ouf expects self.Health (and most other elements) to be a statusbar no matter what
  349.    
  350.     local healthstring = healthcontainer:CreateFontString(nil, 'OVERLAY')
  351.     healthstring:SetFont(font2, 12, 'MONOCHROMETHINOUTLINE')
  352.     healthstring:SetShadowColor(0,0,0,0)
  353.     healthstring:SetJustifyH("CENTER")
  354.     healthstring:SetPoint("CENTER", self, 0, 0)
  355.  
  356.     self.Health = healthcontainer
  357.     self.Health.string = healthstring
  358.     self.Health.PostUpdate = healthstringupdate
  359.        
  360.     local powercontainer = CreateFrame("Statusbar", nil, self)
  361.    
  362.     local powerstring = powercontainer:CreateFontString(nil, 'OVERLAY')
  363.     powerstring:SetFont(font2, 12, 'MONOCHROMEOUTLINE')
  364.     powerstring:SetShadowColor(0,0,0,0)
  365.     powerstring:SetJustifyH("LEFT")
  366.     --powerstring:SetPoint("TOP", healthstring, "BOTTOM", 0, 4) -- centered
  367.     powerstring:SetPoint("TOPLEFT", healthstring, "BOTTOMLEFT", -.5, 4) -- to the left
  368.    
  369.     self.Power = powercontainer
  370.     self.Power.string = powerstring
  371.     self.Power.PostUpdate = powerstringupdate
  372.  
  373.    
  374.     local healthval = self:CreateFontString(nil, 'OVERLAY')
  375.     healthval:SetFont(font2, 12, 'MONOCHROMEOUTLINE')
  376.     healthval:SetShadowColor(0,0,0,0)
  377.     healthval:SetJustifyH("RIGHT")
  378.     healthval:SetPoint("TOPRIGHT", healthstring, "BOTTOMRIGHT", -.5, 4)
  379.     self:Tag(healthval,'[raidcolor][text:hp]')
  380.     self.Health.value = healthval
  381.  
  382.     local powerval = self:CreateFontString(nil, 'OVERLAY')
  383.     powerval:SetFont(font2, 12, 'MONOCHROMEOUTLINE')
  384.     powerval:SetShadowColor(0,0,0,0)
  385.     powerval:SetJustifyH("RIGHT")
  386.     powerval:SetPoint("TOPRIGHT", healthstring, "BOTTOMRIGHT", -.5, 4)
  387.     powerval:SetAlpha(0)
  388.     self:Tag(powerval,'[raidcolor][text:pp]')
  389.     self.Power.value = powerval
  390.    
  391.     self:SetScript("OnEnter", function(self) -- Toggle visibility of health/power when mousing over the frame
  392.         powerval:SetAlpha(1)
  393.         healthval:SetAlpha(0)
  394.         UnitFrame_OnEnter(self)
  395.     end)
  396.     self:SetScript("OnLeave", function(self)
  397.         powerval:SetAlpha(0)
  398.         healthval:SetAlpha(1)
  399.         UnitFrame_OnLeave(self)
  400.     end)
  401.  
  402.     local unitnames = self:CreateFontString(nil, 'ARTWORK')
  403.     unitnames:SetFont(fonttw, 12, 'MONOCHROMETHINOUTLINE')
  404.     unitnames:SetShadowColor(0,0,0,0)
  405.     unitnames:SetPoint('BOTTOM', healthstring, "TOP", 0, 0)
  406.     unitnames:SetJustifyH("CENTER")
  407.     self:Tag(unitnames,'[text:pres][raidcolor][name]')
  408.     self.Name = unitnames
  409.    
  410.    
  411.     local castcontainer = CreateFrame("Statusbar", nil, self)
  412.    
  413.     local caststring = castcontainer:CreateFontString(nil, 'OVERLAY')
  414.     caststring:SetFont(font2, 12, 'MONOCHROMETHINOUTLINE')
  415.     caststring:SetShadowColor(0,0,0,0)
  416.     caststring:SetJustifyH("CENTER")
  417.     caststring:SetPoint("BOTTOM", self, 0, -80)
  418.  
  419.     self.Castbar = castcontainer
  420.     self.Castbar.string = caststring
  421.     self.Castbar.PostCastStart = caststringstart
  422.     self.Castbar.PostChannelStart = caststringstart
  423.     self.Castbar.PostCastStop = caststringstop
  424.     self.Castbar.PostChannelStop = caststringstop
  425.    
  426.     local casttext = castcontainer:CreateFontString(nil, 'OVERLAY')
  427.     casttext:SetFont(font2, 12, 'MONOCHROMETHINOUTLINE')
  428.     casttext:SetShadowColor(0,0,0,0)
  429.     casttext:SetJustifyH("CENTER")
  430.     casttext:SetPoint("BOTTOM", caststring, "TOP", 0, 0)
  431.    
  432.     self.Castbar.Text = casttext
  433.    
  434.     self.RaidIcon = self:CreateTexture(nil, "OVERLAY")
  435.     self.RaidIcon:SetHeight(10)
  436.     self.RaidIcon:SetWidth(10)
  437.     self.RaidIcon:SetPoint("RIGHT", self.Name, 'LEFT', -6, -1)
  438.     self.RaidIcon:SetTexture"Interface\\TargetingFrame\\UI-RaidTargetingIcons"
  439.    
  440.     --[[local threat = self.Health:CreateTexture(nil, "OVERLAY")
  441.     threat:SetSize(3,3)
  442.     threat:SetPoint("TOPRIGHT", self.Health, "TOPRIGHT")
  443.     threat:SetTexture(cpoint)
  444.     threat:SetVertexColor(1,0,0)
  445.     self.Threat = threat
  446.    
  447.     local threatbg = self.Health:CreateTexture(nil, "ARTWORK") -- 1 px border around the tiny red square
  448.     threatbg:SetPoint("TOPRIGHT", self.Health, "TOPRIGHT")
  449.     threatbg:SetSize(self.Threat:GetHeight()+1,self.Threat:GetWidth()+1)
  450.     threatbg:SetTexture(cpoint)
  451.     threatbg:SetVertexColor(0,0,0)
  452.     threatbg:Hide()
  453.     self.Threatbg = threatbg
  454.     self.Threat.PostUpdate = function(self, unit, status)
  455.         if(status and status > 0) then
  456.             threatbg:Show()
  457.         else
  458.             threatbg:Hide()
  459.         end
  460.     end]]
  461.    
  462.     local leader = self:CreateTexture(nil, "OVERLAY")
  463.     leader:SetSize(15,15)
  464.     leader:SetTexture("Interface\\GroupFrame\\UI-Group-LeaderIcon")
  465.     leader:SetAlpha(.7)
  466.     leader:SetPoint("BOTTOM", self.Name, "LEFT", -1, -4)
  467.     leader:SetTexCoord(0.2,-0.4,-0.4,0.8,1.4,0.2,0.8,1.4) -- Rotate so it looks slated on top of the unit name
  468.     self.Leader = leader
  469.  
  470.     local buffs = CreateFrame("Frame", nil, self)
  471.     buffs:SetHeight(40)
  472.     buffs:SetWidth(self:GetWidth())
  473.     buffs.spacing = 3
  474.     buffs.size = 16
  475.     buffs.disableCooldown = true
  476.     self.Buffs = buffs
  477.     self.Buffs.PostCreateIcon = CreateAura
  478.     self.Buffs.PostUpdateIcon = UpdateAura
  479.    
  480.     local debuffs = CreateFrame("Frame", nil, self)
  481.     debuffs:SetHeight(40)
  482.     debuffs:SetWidth(self:GetWidth())
  483.     debuffs.spacing = 3
  484.     debuffs.size = 16
  485.     debuffs.disableCooldown = true
  486.     self.Debuffs = debuffs
  487.     self.Debuffs.PostCreateIcon = CreateAura
  488.     self.Debuffs.PostUpdateIcon = UpdateAura
  489. end
  490.  
  491. --[[ /////////////////////////////////////////////////////////////////////////////////// ]]--
  492. --[[ /////////////////////////////////////////////////////////////////////////////////// ]]--
  493. --[[ I keep scrolling past this while looking for it, so heres a big comment as a marker ]]--
  494. --[[ /////////////////////////////////////////////////////////////////////////////////// ]]--
  495. --[[ /////////////////////////////////////////////////////////////////////////////////// ]]--
  496.  
  497. local UnitSpecific = {
  498.     target = function(self)
  499.         layout(self)
  500.        
  501.         self.Buffs.initialAnchor = "TOPRIGHT"
  502.         self.Buffs["growth-x"] = "LEFT"
  503.         self.Buffs["growth-y"] = "DOWN"
  504.         self.Buffs:SetPoint("TOPRIGHT", self, "BOTTOMRIGHT", -5, -5)
  505.        
  506.         self.Debuffs["growth-x"] = "RIGHT"
  507.         self.Debuffs["growth-y"] = "UP"
  508.         self.Debuffs:SetPoint("BOTTOMLEFT", self, "TOPLEFT", 2, 3)
  509.        
  510.         local combopoints = self:CreateFontString(nil, 'OVERLAY')
  511.         combopoints:SetFont(font2, 12, 'MONOCHROMETHINOUTLINE')
  512.         combopoints:SetShadowColor(0,0,0,0)
  513.         combopoints:SetPoint("BOTTOMLEFT", self.Health.string, "LEFT")
  514.         combopoints:SetJustifyH("LEFT")
  515.         self:Tag(combopoints,'[text:combo]')
  516.     end,
  517.    
  518.     targettarget = function(self)
  519.         layout(self)
  520.         self:SetSize(80,10)
  521.         self.Health:Hide()
  522.         self.Power:Hide()
  523.         self.Castbar:Hide()
  524.         self.Castbar.Text:Hide()
  525.         self.Health.value:Hide()
  526.         self.Power.value:Hide()
  527.        
  528.         self.Name:SetWidth(self:GetWidth())
  529.         self.Name:SetHeight(10)
  530.         self.Name:SetJustifyH("LEFT")
  531.         self.Name:ClearAllPoints()
  532.         self.Name:SetPoint("CENTER", self)
  533.     end,
  534.    
  535.     focus = function(self)
  536.         layout(self)
  537.        
  538.         self.Buffs:ClearAllPoints()
  539.         self.Debuffs:ClearAllPoints()
  540.    
  541.         self.Buffs.initialAnchor = "BOTTOMLEFT"
  542.         self.Buffs["growth-x"] = "RIGHT"
  543.         self.Buffs["growth-y"] = "UP"
  544.         self.Buffs:SetPoint("BOTTOMLEFT", self, "TOPLEFT", 0, 3)
  545.        
  546.         self.Debuffs["growth-x"] = "RIGHT"
  547.         self.Debuffs["growth-y"] = "DOWN"
  548.         self.Debuffs:SetPoint("TOPLEFT", self, "TOPLEFT", 0, -9)
  549.        
  550.         local combopoints = self:CreateFontString(nil, 'OVERLAY')
  551.         combopoints:SetFont(font2, 12, 'MONOCHROMETHINOUTLINE')
  552.         combopoints:SetShadowColor(0,0,0,0)
  553.         combopoints:SetPoint("BOTTOMLEFT", self.Health.string, "LEFT")
  554.         combopoints:SetJustifyH("LEFT")
  555.         self:Tag(combopoints,'[text:combo]')
  556.     end,
  557.    
  558.     pet = function(self)
  559.         layout(self)
  560.         self:SetSize(80,10)
  561.         self.Health:Hide()
  562.         self.Power:Hide()
  563.         self.Castbar:Hide()
  564.         self.Health.value:Hide()
  565.         self.Power.value:Hide()
  566.        
  567.         self.Name:SetWidth(self:GetWidth())
  568.         self.Name:SetHeight(10)
  569.         self.Name:SetJustifyH("RIGHT")
  570.         self.Name:ClearAllPoints()
  571.         self.Name:SetPoint("CENTER", self)
  572.     end,
  573.    
  574.     party = function(self)
  575.         layout(self)
  576.         self:SetSize(100,20) --207,28
  577.        
  578.         self.Castbar:Hide()
  579.         self.Castbar.Text:Hide()
  580.         self.Castbar.PostCastStart = nil
  581.         self.Castbar.PostChannelStart = nil
  582.        
  583.         self.LFDRole = self.Health:CreateTexture(nil, "OVERLAY")
  584.         self.LFDRole:SetHeight(14)
  585.         self.LFDRole:SetWidth(14)
  586.         self.LFDRole:SetPoint("TOPRIGHT", self, 0, 8)
  587.         self.LFDRole:SetTexture("Interface\LFGFrame\UI-LFG-ICON-PORTRAITROLES")
  588.         self.LFDRole:SetTexCoord(0, 0.5, 0, 0.4)
  589.        
  590.         self.Range = { insideAlpha = 1, outsideAlpha = 0.3 }
  591.         self.Name.frequentUpdates = 0.5
  592.     end,
  593.    
  594.     --[[raid = function(self)
  595.         layout(self)
  596.         self:SetSize(40,20)
  597.        
  598.         self.Health:SetWidth(self:GetWidth())
  599.         self.Health:SetHeight(self:GetHeight()-3)
  600.        
  601.         self.Power:SetHeight(2)
  602.         self.Power:SetWidth(self:GetWidth())
  603.        
  604.         self.Name:ClearAllPoints()
  605.         self.Name:SetPoint("TOP", self)
  606.         self.Name:SetWidth(self:GetWidth())
  607.         self.Name:SetHeight(10)
  608.        
  609.         self.Castbar:Hide()
  610.        
  611.         self.Castbar = CreateFrame("StatusBar", self:GetName().."_Castbar", self.Power)
  612.         self.Castbar:SetStatusBarTexture(btex)
  613.         self.Castbar:SetStatusBarColor(.35, .35, .45, 1)
  614.         self.Castbar:SetAllPoints(self.Power)
  615.        
  616.         self.Leader:SetPoint("LEFT", self, "TOPLEFT", 0, 0)
  617.        
  618.         self.Range = { insideAlpha = 1, outsideAlpha = 0.3 }
  619.        
  620.         self.Name.frequentUpdates = 0.5
  621.     end,]]
  622.    
  623.     player = function(self)
  624.         layout(self)
  625.         --self.Name:Hide()
  626.        
  627.         self.Buffs["growth-y"] = "DOWN"
  628.         self.Buffs["growth-x"] = "RIGHT"
  629.         self.Buffs.initialAnchor = "TOPLEFT"
  630.         self.Buffs:SetPoint("TOPLEFT", self, "BOTTOMLEFT", 1, -5)
  631.        
  632.         self.Debuffs["growth-y"] = "UP"
  633.         self.Debuffs["growth-x"] = "LEFT"
  634.         self.Debuffs:SetPoint("BOTTOMLEFT", self, "TOPRIGHT", -20, 3)
  635.        
  636.         if playerClass == "DEATHKNIGHT" then
  637.             self.Runes = CreateFrame("Frame", nil, self)
  638.             self.Runes:SetPoint("TOPLEFT", self, "BOTTOMLEFT", 1, -.5)
  639.             self.Runes:SetHeight(7)
  640.             self.Runes:SetWidth(self:GetWidth())
  641.             self.Runes:SetBackdrop(backdrop)
  642.             self.Runes:SetBackdropColor(0,0,0,0)
  643.            
  644.             for i = 1, 6 do
  645.                 self.Runes[i] = CreateFrame("StatusBar", self:GetName().."_Runes"..i, self.Runes)
  646.                 self.Runes[i]:SetStatusBarTexture(btex) -- Need to keep this so I can grab the color from it later
  647.                
  648.                 local runestring = self.Runes[i]:CreateFontString(nil, 'ARTWORK')
  649.                 runestring:SetFont(font2, 12, 'MONOCHROMETHINOUTLINE')
  650.                 runestring:SetShadowColor(0,0,0,0)
  651.                 runestring:SetTextColor(.35,.35,.45)
  652.                 runestring:SetJustifyH("CENTER")
  653.                 runestring:SetText("[----]")
  654.                
  655.                 self.Runes[i].string = runestring
  656.                 if (i == 1) then
  657.                     self.Runes[i].string:SetPoint("LEFT", self.Runes, "LEFT")
  658.                 else
  659.                     self.Runes[i].string:SetPoint("LEFT", self.Runes[i-1].string, "RIGHT", 3.1, 0)
  660.                 end
  661.        
  662.             end
  663.            
  664.             self.Runes.PostUpdate = runetextupdate
  665.             self.Runes.UpdateType = runetextupdate
  666.            
  667.             self.Buffs:SetPoint("TOPLEFT", self.Runes, "BOTTOMLEFT", 0, -4)
  668.         end
  669.     end
  670.     }
  671.    
  672. oUF:RegisterStyle("ouf_text", layout) -- Stolen, without shame, from ouf_lily
  673. for unit,layout in next, UnitSpecific do
  674.     -- Capitalize the unit name, so it looks better.
  675.     oUF:RegisterStyle('ouf_text - ' .. unit:gsub("^%l", string.upper), layout)
  676. end
  677.  
  678. local spawnHelper = function(self, unit, ...)
  679.     if(UnitSpecific[unit]) then
  680.         self:SetActiveStyle('ouf_text - ' .. unit:gsub("^%l", string.upper))
  681.         local object = self:Spawn(unit)
  682.         object:SetPoint(...)
  683.         return object
  684.     else
  685.         self:SetActiveStyle'ouf_text'
  686.         local object = self:Spawn(unit)
  687.         object:SetPoint(...)
  688.         return object
  689.     end
  690. end
  691.  
  692. local namelist = UnitName("player")
  693. for i = 1,39 do
  694.     namelist = namelist..","..UnitName("player")
  695. end
  696.  
  697. oUF:Factory(function(self)
  698.     spawnHelper(self, 'focus', "CENTER", 502, 0)
  699.     spawnHelper(self, 'player', 'RIGHT', UIParent, 'CENTER', -1, -250)
  700.     spawnHelper(self, 'pet', 'TOPRIGHT', oUF_ouf_textPlayer, 'TOPLEFT', -3, 0)
  701.     spawnHelper(self, 'target', 'TOPLEFT', oUF_ouf_textPlayer, 'TOPRIGHT', 3, 0)
  702.     spawnHelper(self, 'targettarget', 'TOPLEFT', oUF_ouf_textTarget, 'TOPRIGHT', 3, 0)
  703.    
  704.  
  705.     self:SetActiveStyle'ouf_text - Party'
  706.     local party = self:SpawnHeader(nil, nil, 'raid,party', 'showParty', true, 'showRaid', false, 'showPlayer', false, 'yOffset', -15)
  707.     party:SetPoint("TOPLEFT", 6, -8)
  708.    
  709.     --[[self:SetActiveStyle'ouf_text - Raid'
  710.     local raid = {}
  711.     for i = 1, 8 do -- thanks ouf_mono
  712.         local raidgroup = self:SpawnHeader(nil, nil, 'raid',
  713.             'showParty', true,
  714.             'showPlayer', true,
  715.             'showRaid', true,
  716.             'yOffset', -5,
  717.             'xOffset', -5,
  718.             'maxColumns', 8,
  719.             'unitsPerColumn', 5,
  720.             'groupFilter', tostring(i),
  721.             'groupingOrder', '1,2,3,4,5,6,7,8',
  722.             'groupBy', 'GROUP',
  723.             'columnSpacing', 5,
  724.             'columnAnchorPoint', 'BOTTOM',
  725.             'point', "RIGHT")
  726.             if i == 1 then
  727.                 raidgroup:SetPoint("BOTTOMRIGHT", -5.1, 5)
  728.             else
  729.                 raidgroup:SetPoint("BOTTOMRIGHT", raid[i-1], "TOPRIGHT", 0, 5)
  730.             end
  731.         raid[i] = raidgroup
  732.     end]]
  733. end)
  734.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement