Advertisement
Guest User

oUF_Haori

a guest
Sep 4th, 2010
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 21.18 KB | None | 0 0
  1. --[[
  2.    
  3.     You are free to use this as you wish, but please give credits if you use it as a base for your layout.
  4.     I've tried to make it as easy to understand as possible, hopefully it's gonna be a good base for everyone to use.
  5.    
  6.     Huge credits to p3lim, as the base code is his. Also big credits to Led and Carebear, as they both inspired in some way.
  7.    
  8. --]]
  9.  
  10. -- Some local variables, it can also be seen as a config. Simply change the values of the variables to get some effect!
  11. local FONT = 'Interface\\AddOns\\oUF_Haori\\semplice.ttf'
  12. local BARTEXTURE = 'Interface\\AddOns\\oUF_Haori\\WaB.tga'
  13.  
  14. local TEXTURE = 'Interface\\ChatFrame\\ChatFrameBackground'
  15. local BACKDROP = {
  16.     bgFile = TEXTURE, insets = {top = -1, bottom = -1, left = -1, right = -1}
  17. }
  18.  
  19. -- Set this to false if you want to use another buff addon such as Satrina's Buff Frames.
  20. local HIDE_DEFAULT_BUFFS = true
  21. local STYLE_TEMP_ENCHANTS = true        -- Weapon enchants such as Windfury Weapon.
  22.  
  23. -- Healthbars
  24. local HEALTH_USE_CLASS_COLOR = false            -- Classcolored healthbars.
  25. local HEALTH_CUSTOM_COLOR = { r=0.18, b=0.18, g=0.18}   -- What color to use if not the above setting is true.
  26.  
  27. -- Powerbars
  28. local POWER_USE_CLASS_COLOR = true              -- Classcolored powerbars.
  29. local POWER_CUSTOM_COLOR = { r=1, b=1, g=1} -- What color to use if not the above setting is true.
  30. -- Alright, we're done with those for now.
  31.  
  32. -- Here we create a function to shorten health values from stuff like 2360003 to 2.36m, or 236000 to 236k. Wonderful!
  33. -- To be quite honest, this isn't mine. It's p3lims, credit where credit is due!
  34. local function ShortenValue(value)
  35.     if(value >= 1e6) then
  36.         return ('%.2fm'):format(value / 1e6):gsub('%.?0+([km])$', '%1')
  37.     elseif(value >= 1e4) then
  38.         return ('%.1fk'):format(value / 1e3):gsub('%.?0+([km])$', '%1')
  39.     else
  40.         return value
  41.     end
  42. end
  43.  
  44. -- Tags start here, edit these to modify hp displays, mana displays, etc etc. I'll try to comment as good as possible on them.
  45. --[[
  46.     YES, THE HEALTH TAG, THE MOST FUN ONE. Kind of, no. Usually the most complex one, complex isn't fun. Well, sometimes it is, it's most often not.
  47.     Well, what this does, is simply putting the health text in this format:
  48.         If target is Disconnected, Dead, or a Ghost, it will say so.
  49.         If they're not any of the above, it will show
  50.             Enemy Target: His current HP, in white.
  51.             Player: Nothing if you're on full health, if you lose health however it will display your current missing HP. SCARY HUH.
  52.             Any other shit with not full health, it'd show health in this format: Health / MaxHealth.
  53.             Else, it'll just show MaxHealth.
  54. --]]
  55. oUF.Tags['WimpfaceHP'] = function(unit)
  56.     local min, max = UnitHealth(unit), UnitHealthMax(unit)
  57.     local status = not UnitIsConnected(unit) and 'DC' or UnitIsGhost(unit) and 'Ghost' or UnitIsDead(unit) and 'Dead'
  58.  
  59.     if(status) then
  60.         return status
  61.     elseif(unit == 'target' and UnitCanAttack('player', unit)) then
  62.         return ('%s'):format(ShortenValue(min))
  63.     elseif(unit == 'player' and min ~= max) then
  64.         return ('|cffff0000%d|r'):format(min - max)
  65.     elseif(min ~= max) then
  66.         return ('%s |cff0090ff/|r %s'):format(ShortenValue(min), ShortenValue(max))
  67.     else
  68.         return max
  69.     end
  70. end
  71.  
  72. --[[
  73.     Right, extremely simple tag to display mana, rage etc.
  74.     Basically, it shows your power, holy shit so complex.
  75. --]]
  76. oUF.Tags['WimpfacePOWAH'] = function(unit)
  77.     local power = UnitPower(unit)
  78.     if(power > 0 and not UnitIsDeadOrGhost(unit)) then
  79.         local _, type = UnitPowerType(unit)
  80.         local colors = _COLORS.power
  81.         return ('%s%d|r'):format(Hex(colors[type] or colors['RUNES']), power)
  82.     end
  83. end
  84.  
  85. --[[
  86.     Name tag, if it's tapped or DC'd it's grey. GREY I TELL YOU. OR is it gray? I don't know. l2englosh much
  87.     If it isn't, it's just normal white. Shit that's not any fun or special at all. Well no, but it's awesome.
  88. --]]
  89. oUF.TagEvents['WimpfaceNAMEZ'] = 'UNIT_NAME_UPDATE UNIT_REACTION UNIT_FACTION'
  90. oUF.Tags['WimpfaceNAMEZ'] = function(unit)
  91.     local reaction = UnitReaction(unit, 'player')
  92.  
  93.     local r, g, b = 1, 1, 1
  94.     if((UnitIsTapped(unit) and not UnitIsTappedByPlayer(unit)) or not UnitIsConnected(unit)) then
  95.         r, g, b = 3/5, 3/5, 3/5
  96.     end
  97.  
  98.     return ('%s%s|r'):format(Hex(r, g, b), UnitName(unit))
  99. end
  100.  
  101. --[[
  102.     We use this tag for raid and party frames only.
  103.     Shows name if full health, dead/ghost/dc if any of those apply, and otherwise missing HP.
  104. --]]
  105. oUF.TagEvents['WimpfaceRAIDZ'] = 'UNIT_NAME_UPDATE'
  106. oUF.Tags['WimpfaceRAIDZ'] = function(unit)
  107.     local name = UnitName(unit)
  108.     local min, max = UnitHealth(unit), UnitHealthMax(unit)
  109.     local status = not UnitIsConnected(unit) and 'DC' or UnitIsGhost(unit) and 'Ghost' or UnitIsDead(unit) and 'Dead'
  110.    
  111.     if(status) then
  112.         return status
  113.     elseif(min ~= max) then
  114.         return ('|cffff0000%d|r'):format(min - max)
  115.     else
  116.         return name
  117.     end
  118. end
  119. -- We're done with tags now.
  120.  
  121. -- Now, we feel like creating a function to... well, spawn the menu that shows up when right clicking.
  122. local function SpawnMenu(self)
  123.     ToggleDropDownMenu(1, nil, _G[string.gsub(self.unit, '^.', string.upper)..'FrameDropDown'], 'cursor')
  124. end
  125.  
  126. -- Style buffs, because we want to. Basically just a 1px black border around it.
  127. local function PostCreateAura(element, button)
  128.     button:SetBackdrop(BACKDROP)
  129.     button:SetBackdropColor(0, 0, 0)
  130.     button.cd:SetReverse()
  131.     button.icon:SetTexCoord(0.08, 0.92, 0.08, 0.92)
  132.     button.icon:SetDrawLayer('ARTWORK')
  133. end
  134.  
  135. -- Ripped from p3lim, like a lot of shit in here. It's because it's all brilliant though.
  136. local function PostUpdateDebuff(element, unit, button, index)
  137.     if(UnitIsFriend('player', unit) or button.isPlayer) then
  138.         local _, _, _, _, type = UnitAura(unit, index, button.filter)
  139.         local color = DebuffTypeColor[type] or DebuffTypeColor.none
  140.  
  141.         button:SetBackdropColor(color.r * 3/5, color.g * 3/5, color.b * 3/5)
  142.         button.icon:SetDesaturated(false)
  143.     else
  144.         button:SetBackdropColor(0, 0, 0)
  145.         button.icon:SetDesaturated(true)
  146.     end
  147. end
  148.  
  149. local function CustomCastText(element, duration)
  150.     element.Time:SetFormattedText('%.1f', element.channeling and duration or (element.max - duration))
  151. end    
  152.  
  153. local function PostCastStart(element)
  154.     local text = element.Text
  155.    
  156.     if(element.interrupt) then
  157.         text:SetTextColor(1, 0, 0)
  158.     else
  159.         text:SetTextColor(1, 1, 1)
  160.     end
  161. end
  162.  
  163. if HIDE_DEFAULT_BUFFS == true then
  164.     _G["BuffFrame"]:Hide()
  165.     _G["BuffFrame"]:UnregisterAllEvents()
  166.     _G["BuffFrame"]:SetScript("OnUpdate", nil)
  167. end
  168.  
  169. MakeFS = function(parent, justify)
  170.     local f = parent:CreateFontString(nil, "OVERLAY")
  171.     f:SetFont(FONT, 8, "OUTLINE")
  172.     f:SetShadowColor(0, 0, 0, 0)
  173.     f:SetShadowOffset(0,0)
  174.     if(justify) then f:SetJustifyH(justify) end
  175.     return f
  176. end
  177.  
  178. if(STYLE_TEMP_ENCHANTS) then
  179.     for i = 1, 2 do
  180.         _G["TempEnchant"..i.."Icon"]:Hide()
  181.         _G["TempEnchant"..i.."Count"]:Hide()
  182.         _G["TempEnchant"..i.."Border"]:Hide()
  183.         _G["TempEnchant"..i.."Duration"] = MakeFS(UIParent)
  184.         _G["TempEnchant"..i]:ClearAllPoints()
  185.         _G["TempEnchant"..i]:SetAllPoints(_G["TempEnchant"..i.."Duration"])
  186.     end
  187. elseif(not HIDE_DEFAULT_BUFFS) then
  188.     _G["TemporaryEnchantFrame"]:Hide()
  189.     _G["TemporaryEnchantFrame"]:SetScript("OnUpdate", nil)
  190.     _G["TempEnchant1"]:SetScript("OnUpdate", nil)
  191.     _G["TempEnchant2"]:SetScript("OnUpdate", nil)
  192. end
  193.  
  194. -- Right, here we make changes to different units based on different shit. Mostly because we want to and... it's hot and quite easy to change.
  195. local UnitSpecific = {
  196.     player = function(self)
  197.         -- Spawn the leader icon, terrific!
  198.         local leader = self.Health:CreateTexture(nil, 'OVERLAY')
  199.         leader:SetPoint('TOPLEFT', self, 0, 8)
  200.         leader:SetSize(16, 16)
  201.         self.Leader = leader
  202.        
  203.         -- Spawn the assistant icon, terrific again!
  204.         local assistant = self.Health:CreateTexture(nil, 'OVERLAY')
  205.         assistant:SetPoint('TOPLEFT', self, 0, 8)
  206.         assistant:SetSize(16, 16)
  207.         self.Assistant = assistant
  208.        
  209.         -- Set the width of the frame. HURR DURR
  210.         self:SetAttribute('initial-width', 220)
  211.        
  212.         local buffs = CreateFrame("Frame", nill, self)
  213.         buffs:SetPoint("TOPRIGHT", UIParent, "TOPRIGHT", -55, -55)
  214.         buffs.initialAnchor = "TOPRIGHT"
  215.         buffs["growth-y"] = "DOWN"
  216.         buffs["growth-x"] = "LEFT"
  217.         buffs:SetHeight(500)
  218.         buffs:SetWidth((21.7 + 3) * 20)
  219.         buffs.spacing = 6
  220.         buffs.size = 21.7
  221.         buffs.PostCreateIcon = PostCreateAura
  222.         self.Buffs = buffs
  223.  
  224.         local debuffs = CreateFrame("Frame", nill, self)
  225.         debuffs:SetPoint("BOTTOMRIGHT", self, "TOPRIGHT", 0, -475)
  226.         debuffs.initialAnchor = "TOPRIGHT"
  227.         debuffs["growth-x"] = "LEFT"
  228.         debuffs["growth-y"] = "DOWN"
  229.         debuffs:SetHeight(500)
  230.         debuffs:SetWidth((21.7 + 3) * 20)
  231.         debuffs.spacing = 6
  232.         debuffs.size = 21.7
  233.         debuffs.PostCreateIcon = PostCreateAura
  234.         self.Debuffs = debuffs
  235.     end,
  236.     target = function(self)
  237.         local buffs = CreateFrame('Frame', nil, self)
  238.         buffs:SetPoint('TOPLEFT', self, 'TOPLEFT', 0, 24)
  239.         buffs:SetSize(236, 44)
  240.         buffs.num = 20
  241.         buffs.size = 20
  242.         buffs.spacing = 4
  243.         buffs.initialAnchor = 'TOPLEFT'
  244.         buffs['growth-y'] = 'UP'
  245.         buffs.PostCreateIcon = PostCreateAura
  246.         self.Buffs = buffs
  247.  
  248.         local cpoints = self:CreateFontString(nil, 'OVERLAY', 'SubZoneTextFont')
  249.         cpoints:SetPoint('RIGHT', self, 'LEFT', -9, 0)
  250.         cpoints:SetJustifyH('RIGHT')
  251.         self:Tag(cpoints, '|cffffffff[cpoints]|r')
  252.  
  253.         self:SetAttribute('initial-width', 220)
  254.     end,
  255.     pet = function(self)
  256.         local auras = CreateFrame('Frame', nil, self)
  257.         auras:SetPoint('TOPRIGHT', self, 'TOPLEFT', -4, 0)
  258.         auras:SetSize(236, 44)
  259.         auras.size = 20
  260.         auras.spacing = 4
  261.         auras.initialAnchor = 'TOPRIGHT'
  262.         auras['growth-x'] = 'LEFT'
  263.         auras.PostCreateIcon = PostCreateAura
  264.         self.Auras = auras
  265.  
  266.         self:SetAttribute('initial-width', 121)
  267.     end,
  268.     raid = function(self, unit)
  269.         self:SetAttribute('initial-height', 30)
  270.         self:SetAttribute('initial-width', 30)
  271.        
  272.         local health = self.Health
  273.         health:ClearAllPoints()
  274.         health:SetAllPoints(self)
  275.         health.Smooth = nil
  276.         health:SetOrientation("VERTICAL")
  277.        
  278.         if (IsAddOnLoaded("oUF_HealComm4")) then
  279.             local heal = CreateFrame('StatusBar', nil, health)
  280.             heal:SetHeight(0)
  281.             heal:SetWidth(0)
  282.             heal:SetStatusBarTexture(BARTEXTURE)
  283.             heal:SetStatusBarColor(0, 1, 0, 0.4)
  284.             heal:SetPoint("BOTTOM", health, "BOTTOM")
  285.            
  286.             self.HealCommBar = heal
  287.             self.HealCommOthersOnly = true
  288.             self.HealCommTimeframe = 2
  289.         end
  290.    
  291.         if (IsAddOnLoaded("oUF_ResComm")) then
  292.             local rescomm = CreateFrame("StatusBar", nil, self)
  293.             rescomm:SetStatusBarTexture([=[Interface\Icons\Spell_Holy_Resurrection]=])
  294.             rescomm:SetAllPoints(self)
  295.             rescomm:SetAlpha(.25)
  296.            
  297.             local texObject = rescomm:GetStatusBarTexture()
  298.             texObject:SetTexCoord(0.07, 0.93, 0.07, 0.93)
  299.             texObject:SetVertTile(false)
  300.             texObject:SetHorizTile(false)
  301.            
  302.             rescomm.OthersOnly = true
  303.             self.ResComm = rescomm
  304.         end
  305.        
  306.         local icon = CreateFrame("Frame", nil, self)
  307.         icon:SetPoint("CENTER")
  308.         icon:SetHeight(22)
  309.         icon:SetWidth(22)
  310.         icon:Hide()
  311.        
  312.         local iconTex = icon:CreateTexture(nil, "ARTWORK")
  313.         iconTex:SetAllPoints(icon)
  314.         iconTex:SetTexCoord(0.07, 0.93, 0.07, 0.93)
  315.        
  316.         local overlay = icon:CreateTexture(nil, "OVERLAY")
  317.         overlay:SetTexture(gxMedia.buttonOverlay)
  318.         overlay:SetPoint("TOPLEFT", icon, -1, 1)
  319.         overlay:SetPoint("BOTTOMRIGHT", icon, 1, -1)
  320.        
  321.         local cooldown = CreateFrame("Cooldown", nil, icon)
  322.         cooldown:SetPoint("TOPLEFT", icon, 2, -2)
  323.         cooldown:SetPoint("BOTTOMRIGHT", icon, -1, 1)
  324.        
  325.         local count = cooldown:CreateFontString(nil, "OVERLAY")
  326.         count:SetPoint("BOTTOMRIGHT", 0, 0)
  327.         count:SetJustifyH("RIGHT")
  328.         count:SetFont(gxMedia.font, 10, "OUTLINE")
  329.         count:SetTextColor(0.84, 0.75, 0.65)
  330.        
  331.         local backdrop = CreateFrame("Frame", nil, icon)
  332.         backdrop:SetPoint("TOPLEFT", icon, "TOPLEFT", -3.5, 3)
  333.         backdrop:SetPoint("BOTTOMRIGHT", icon, "BOTTOMRIGHT", 4, -3.5)
  334.         backdrop:SetFrameStrata("LOW")
  335.         backdrop:SetBackdrop(BACKDROP)
  336.         backdrop:SetBackdropColor(0, 0, 0, 1)
  337.         backdrop:SetBackdropBorderColor(0, 0, 0)
  338.        
  339.         icon.Texture = iconTex
  340.         icon.Overlay = overlay
  341.         icon.Count = count
  342.         icon.Cooldown = cooldown
  343.         icon.Backdrop = backdrop
  344.        
  345.         self.DebuffIcon = icon
  346.        
  347.         local raidInfo = self:CreateFontString(nil, "OVERLAY")
  348.         raidInfo:SetFont(gxMedia.font, 14)
  349.         raidInfo:SetShadowColor(0, 0, 0)
  350.         raidInfo:SetShadowOffset(1.25, -1.25)
  351.         raidInfo:SetPoint("CENTER", self)
  352.         raidInfo:SetTextColor(0.84, 0.75, 0.65)
  353.         self:Tag(raidInfo, "[raidcolor][WimpfaceRAIDZ]")
  354.        
  355.         self.RaidInfo = raidInfo
  356.        
  357.         local leader = self.Leader
  358.         leader:SetHeight(8)
  359.         leader:SetWidth(8)
  360.         leader:SetPoint("CENTER", self, "TOPLEFT")
  361.        
  362.         local masterLooter = self.MasterLooter
  363.         masterLooter:SetHeight(8)
  364.         masterLooter:SetWidth(8)
  365.         masterLooter:SetPoint("CENTER", self, "TOPLEFT", 8, 0)
  366.        
  367.         if (oUF.Indicators) then
  368.             local auraStatus
  369.            
  370.             auraStatus = self:CreateFontString(nil, "ARTWORK")
  371.             auraStatus:SetPoint("TOPLEFT", -2, 1)
  372.             auraStatus:SetFont(FONT, 8, "OUTLINE|MONOCHROME")
  373.             self:Tag(auraStatus, oUF.Indicators["TL"])
  374.            
  375.             self.AuraStatusTopLeft = auraStatus
  376.            
  377.             auraStatus = self:CreateFontString(nil, "ARTWORK")
  378.             auraStatus:SetPoint("TOPRIGHT", 3, 1)
  379.             auraStatus:SetFont(FONT, 8, "OUTLINE|MONOCHROME")
  380.             self:Tag(auraStatus, oUF.Indicators["TR"])
  381.            
  382.             self.AuraStatusTopRight = auraStatus
  383.  
  384.             auraStatus = self:CreateFontString(nil, "ARTWORK")
  385.             auraStatus:ClearAllPoints()
  386.             auraStatus:SetPoint("BOTTOMLEFT", -2, 1)
  387.             auraStatus:SetFont(FONT, 8, "OUTLINE|MONOCHROME")
  388.             self:Tag(auraStatus, oUF.Indicators["BL"])
  389.            
  390.             self.AuraStatusBottomLeft = auraStatus
  391.  
  392.             auraStatus = self:CreateFontString(nil, "ARTWORK")
  393.             auraStatus:SetPoint("CENTER", self, "BOTTOMRIGHT", 1, 1)
  394.             auraStatus:SetFont(FONT, 8, "OUTLINE|MONOCHROME")
  395.             self:Tag(auraStatus, oUF.Indicators["BR"])
  396.            
  397.             self.AuraStatusBottomRight = auraStatus
  398.         end
  399.        
  400.         local role = self:CreateTexture(nil, "OVERLAY")
  401.         role:SetHeight(12)
  402.         role:SetWidth(12)
  403.         role:SetPoint("CENTER", self, "TOPRIGHT")
  404.        
  405.         self.LFDRole = role
  406.     end,
  407. }
  408.  
  409. local function Shared(self, unit)
  410.     self.colors.power.MANA = {0, 144/255, 1}
  411.  
  412.     self:RegisterForClicks('AnyUp')
  413.     self:SetScript('OnEnter', UnitFrame_OnEnter)
  414.     self:SetScript('OnLeave', UnitFrame_OnLeave)
  415.    
  416.     local health = CreateFrame('StatusBar', nil, self)
  417.     health:SetStatusBarTexture(BARTEXTURE)
  418.     if HEALTH_USE_CLASS_COLOR then
  419.         health.colorClass = true
  420.         health.colorTapping = true
  421.         health.colorDisconnected = true
  422.         health.colorReaction = true
  423.     else
  424.         health:SetStatusBarColor(HEALTH_CUSTOM_COLOR.r, HEALTH_CUSTOM_COLOR.g, HEALTH_CUSTOM_COLOR.b)
  425.     end
  426.     health.frequentUpdates = true  
  427.     self.Health = health
  428.  
  429.     local healthBG = health:CreateTexture(nil, 'BORDER')
  430.     healthBG:SetAllPoints()
  431.     healthBG:SetTexture(1/3, 1/3, 1/3)
  432.  
  433.     local healthValue = health:CreateFontString(nil, 'OVERLAY')
  434.     healthValue:SetPoint('RIGHT', health, -2, -20)
  435.     healthValue:SetFont(FONT, 8, 'OUTLINE|MONOCHROME')
  436.     healthValue:SetJustifyH('RIGHT')
  437.     healthValue.frequentUpdates = 1/4
  438.     self:Tag(healthValue, '[WimpfaceHP]')
  439.    
  440.     self:SetBackdrop(BACKDROP)
  441.     self:SetBackdropColor(0, 0, 0)
  442.    
  443.     -- health:SetBackdrop(BACKDROP)
  444.     -- health:SetBackdropColor(0, 0, 0)
  445.  
  446.     if(unit == 'player' or unit == 'target' or unit == 'pet' or unit == 'targettarget') then
  447.         local power = CreateFrame('StatusBar', nil, self)
  448.         power:SetPoint('TOPRIGHT', 1)
  449.         power:SetPoint('TOPLEFT', 1)
  450.         power:SetStatusBarTexture(BARTEXTURE)
  451.         power.frequentUpdates = true
  452.         power:SetHeight(1)
  453.         self.Power = power
  454.  
  455.         if POWER_USE_CLASS_COLOR then
  456.             power.colorClass = true
  457.             power.colorReaction = unit ~= 'pet'
  458.             power.colorTapping = true
  459.             power.colorDisconnected = true
  460.         else
  461.             power:SetStatusBarColor(POWER_CUSTOM_COLOR.r, POWER_CUSTOM_COLOR.g, POWER_CUSTOM_COLOR.b)
  462.         end
  463.         power.colorHappiness = unit == 'pet'
  464.         power.colorPower = unit == 'pet'
  465.  
  466.         local powerBG = power:CreateTexture(nil, 'BORDER')
  467.         powerBG:SetAllPoints()
  468.         powerBG:SetTexture(TEXTURE)
  469.         powerBG.multiplier = 1/3
  470.         power.bg = powerBG
  471.        
  472.         -- power:SetBackdrop(BACKDROP)
  473.         -- power:SetBackdropColor(0, 0, 0)
  474.  
  475.         if not(unit == 'target' or unit == 'targettarget') then
  476.             local powerValue = health:CreateFontString(nil, 'OVERLAY')
  477.             powerValue:SetPoint('LEFT', health, 2, -20)
  478.             powerValue:SetFont(FONT, 8, 'OUTLINE|MONOCHROME')
  479.             powerValue:SetJustifyH('LEFT')
  480.             powerValue.frequentUpdates = 0.1
  481.             self:Tag(powerValue, '[WimpfacePOWAH]')
  482.         end
  483.  
  484.         local raidicon = health:CreateTexture(nil, 'OVERLAY')
  485.         raidicon:SetPoint('TOP', self, 0, 8)
  486.         raidicon:SetSize(16, 16)
  487.         self.RaidIcon = raidicon
  488.        
  489.         health:SetHeight(18)
  490.         health:SetPoint('BOTTOMRIGHT')
  491.         health:SetPoint('BOTTOMLEFT')
  492.  
  493.         self.menu = SpawnMenu
  494.         self:SetAttribute('type2', 'menu')
  495.         self:SetAttribute('initial-height', 20)
  496.     end
  497.  
  498.     if(unit == 'focus' or unit:find('target')) then
  499.         local name = health:CreateFontString(nil, 'OVERLAY')
  500.         name:SetPoint('LEFT', health, 2, -20)
  501.         name:SetPoint('RIGHT', healthValue, 'LEFT')
  502.         name:SetFont(FONT, 8, 'OUTLINE|MONOCHROME')
  503.         name:SetJustifyH('LEFT')
  504.         self:Tag(name, '[WimpfaceNAMEZ< ][|cff0090ff>rare<|r]')
  505.  
  506.         local debuffs = CreateFrame('Frame', nil, self)
  507.         debuffs.spacing = 4
  508.         debuffs.initialAnchor = 'TOPLEFT'
  509.         debuffs.PostCreateIcon = PostCreateAura
  510.         self.Debuffs = debuffs
  511.  
  512.         if(unit == 'target') then
  513.             debuffs.num = 20
  514.             debuffs.size = 21.7
  515.             debuffs['growth-y'] = 'DOWN'
  516.             debuffs.PostUpdateIcon = PostUpdateDebuff
  517.             debuffs:SetPoint('TOPLEFT', self, 'BOTTOMLEFT', 0, -20)
  518.         else
  519.             health:SetHeight(18)
  520.             self:SetAttribute('initial-height', 20)
  521.             self:SetAttribute('initial-width', 121)
  522.         end
  523.  
  524.         if(unit == 'focus') then
  525.             debuffs:SetPoint('TOPLEFT', self, 'TOPRIGHT')
  526.             debuffs.onlyShowPlayer = true
  527.         elseif(unit ~= 'target') then
  528.             debuffs:SetPoint('TOPLEFT', self, 'TOPRIGHT', 4, 0)
  529.             debuffs.initialAnchor = 'TOPLEFT'
  530.             debuffs['growth-x'] = 'RIGHT'
  531.         end
  532.  
  533.         debuffs:SetSize(230, 21.7)
  534.     end
  535.    
  536.     if(unit == 'player' or unit == 'target') then
  537.         local castbar = CreateFrame('StatusBar', nil, self)
  538.         castbar:SetSize(205, 16)
  539.        
  540.         castbar:SetStatusBarTexture(BARTEXTURE)
  541.         castbar:SetStatusBarColor(0.18, 0.18, 0.18)
  542.        
  543.         castbar:SetBackdrop(BACKDROP)
  544.         castbar:SetBackdropColor(0, 0, 0)
  545.        
  546.         castbar.CustomTimeText = CustomCastText
  547.         self.Castbar = castbar
  548.        
  549.         local castbarBG = castbar:CreateTexture(nil, 'BORDER')
  550.         castbarBG:SetAllPoints()
  551.         castbarBG:SetTexture(1/3, 1/3, 1/3)
  552.        
  553.         local castbarTime = castbar:CreateFontString(nil, 'OVERLAY')
  554.         castbarTime:SetPoint('RIGHT', -2, 0)
  555.         castbarTime:SetFont(FONT, 8, 'OUTLINE|MONOCHROME')
  556.         castbarTime:SetJustifyH('RIGHT')
  557.         castbar.Time = castbarTime
  558.        
  559.         local castbarText = castbar:CreateFontString(nil, 'OVERLAY')
  560.         castbarText:SetPoint('LEFT', 2, 0)
  561.         castbarText:SetPoint('RIGHT', castbarTime)
  562.         castbarText:SetFont(FONT, 8, 'OUTLINE|MONOCHROME')
  563.         castbarText:SetJustifyH('LEFT')
  564.         castbar.Text = castbarText
  565.        
  566.         local castbarDummy = CreateFrame('Frame', nil, castbar)
  567.         castbarDummy:SetSize(21, 21)
  568.         castbarDummy:SetBackdrop(BACKDROP)
  569.         castbarDummy:SetBackdropColor(0, 0, 0)
  570.        
  571.         local castbarIcon = castbarDummy:CreateTexture(nil, 'ARTWORK')
  572.         castbarIcon:SetAllPoints()
  573.         castbarIcon:SetTexCoord(0.08, 0.92, 0.08, 0.92)
  574.         castbar.Icon = castbarIcon
  575.        
  576.         if(unit == 'target') then
  577.             castbar.PostCastStart = PostCastStart
  578.             castbar.PostChannelStart = PostCastStart
  579.             castbar:SetPoint('TOPLEFT', self, 'BOTTOMLEFT', 0, -60)
  580.             castbarDummy:SetPoint('BOTTOMLEFT', castbar, 'BOTTOMRIGHT', 4, 0)
  581.         else
  582.             castbar:SetPoint('TOPRIGHT', self, 'BOTTOMRIGHT', 0, -60)
  583.             castbarDummy:SetPoint('BOTTOMRIGHT', castbar, 'BOTTOMLEFT', -4, 0)
  584.         end
  585.     end
  586.  
  587.     if(UnitSpecific[unit]) then
  588.         return UnitSpecific[unit](self)
  589.     end
  590.  
  591. end
  592.  
  593. oUF.colors.power.MANA = {0, 144/255, 1}
  594.  
  595. oUF:RegisterStyle('Haori', Shared)
  596.  
  597. for unit, layoutFunc in next, UnitSpecific do
  598.     oUF:RegisterStyle('Haori - ' .. unit:gsub("^%l", string.upper), layoutFunc)
  599. end
  600.  
  601. oUF:Factory(function(self)
  602.     self:SetActiveStyle('Haori')
  603.     self:Spawn('player'):SetPoint('CENTER', UIParent, 'CENTER', -175, -230)
  604.     self:Spawn('pet'):SetPoint('CENTER', UIParent, 'CENTER', -250, -230)
  605.     self:Spawn('focus'):SetPoint('CENTER', UIParent, 'CENTER', -250, -80)
  606.     self:Spawn('target'):SetPoint('CENTER', UIParent, 'CENTER', 175, -230)
  607.     self:Spawn('targettarget'):SetPoint('CENTER', UIParent, 'CENTER', 349, -230)
  608.    
  609.     self:SetActiveStyle("Haori - Raid")
  610.     local group = self:SpawnHeader(nil, nil, "raid,party",
  611.         "showPlayer", true,
  612.         "showRaid", true,
  613.         "ShowParty", true,
  614.         "yOffset", 5,
  615.         "xOffset", 5,
  616.         "maxColumns", 8,
  617.         "point", "BOTTOM",
  618.         "unitsPerColumn", 5,
  619.         "columnSpacing", 5,
  620.         "columnAnchorPoint", "LEFT",
  621.         "groupingOrder", "1,2,3,4,5,6,7,8",
  622.         "groupBy", "GROUP"
  623.     )
  624.     group:SetPoint("CENTER", UIParent, "CENTER", 0, -275)
  625. end)
  626.  
  627. local testui = TestUI or function() end
  628.     TestUI = function()
  629.     testui()
  630.     UnitAura = function()
  631.     -- name, rank, texture, count, dtype, duration, timeLeft, caster
  632.     return 'penancelol', 'Rank 2', 'Interface\\Icons\\Spell_Holy_Penance', random(5), 'Magic', 0, 0, "player"
  633.     end
  634.         if(oUF) then
  635.         for i, v in pairs(oUF.units) do
  636.             if(v.UNIT_AURA) then
  637.             v:UNIT_AURA("UNIT_AURA", v.unit)
  638.             end
  639.         end
  640.     end
  641. end
  642. SlashCmdList.TestUI = TestUI
  643. SLASH_TestUI1 = "/testui"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement