Advertisement
Guest User

oUF_Haori

a guest
Sep 4th, 2010
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 21.21 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.         shared(self, unit)
  273.        
  274.         local health = self.Health
  275.         health:ClearAllPoints()
  276.         health:SetAllPoints(self)
  277.         health.Smooth = nil
  278.         health:SetOrientation("VERTICAL")
  279.        
  280.         if (IsAddOnLoaded("oUF_HealComm4")) then
  281.             local heal = CreateFrame('StatusBar', nil, health)
  282.             heal:SetHeight(0)
  283.             heal:SetWidth(0)
  284.             heal:SetStatusBarTexture(BARTEXTURE)
  285.             heal:SetStatusBarColor(0, 1, 0, 0.4)
  286.             heal:SetPoint("BOTTOM", health, "BOTTOM")
  287.            
  288.             self.HealCommBar = heal
  289.             self.HealCommOthersOnly = true
  290.             self.HealCommTimeframe = 2
  291.         end
  292.    
  293.         if (IsAddOnLoaded("oUF_ResComm")) then
  294.             local rescomm = CreateFrame("StatusBar", nil, self)
  295.             rescomm:SetStatusBarTexture([=[Interface\Icons\Spell_Holy_Resurrection]=])
  296.             rescomm:SetAllPoints(self)
  297.             rescomm:SetAlpha(.25)
  298.            
  299.             local texObject = rescomm:GetStatusBarTexture()
  300.             texObject:SetTexCoord(0.07, 0.93, 0.07, 0.93)
  301.             texObject:SetVertTile(false)
  302.             texObject:SetHorizTile(false)
  303.            
  304.             rescomm.OthersOnly = true
  305.             self.ResComm = rescomm
  306.         end
  307.        
  308.         local icon = CreateFrame("Frame", nil, self)
  309.         icon:SetPoint("CENTER")
  310.         icon:SetHeight(22)
  311.         icon:SetWidth(22)
  312.         icon:Hide()
  313.        
  314.         local iconTex = icon:CreateTexture(nil, "ARTWORK")
  315.         iconTex:SetAllPoints(icon)
  316.         iconTex:SetTexCoord(0.07, 0.93, 0.07, 0.93)
  317.        
  318.         local overlay = icon:CreateTexture(nil, "OVERLAY")
  319.         overlay:SetTexture(gxMedia.buttonOverlay)
  320.         overlay:SetPoint("TOPLEFT", icon, -1, 1)
  321.         overlay:SetPoint("BOTTOMRIGHT", icon, 1, -1)
  322.        
  323.         local cooldown = CreateFrame("Cooldown", nil, icon)
  324.         cooldown:SetPoint("TOPLEFT", icon, 2, -2)
  325.         cooldown:SetPoint("BOTTOMRIGHT", icon, -1, 1)
  326.        
  327.         local count = cooldown:CreateFontString(nil, "OVERLAY")
  328.         count:SetPoint("BOTTOMRIGHT", 0, 0)
  329.         count:SetJustifyH("RIGHT")
  330.         count:SetFont(gxMedia.font, 10, "OUTLINE")
  331.         count:SetTextColor(0.84, 0.75, 0.65)
  332.        
  333.         local backdrop = CreateFrame("Frame", nil, icon)
  334.         backdrop:SetPoint("TOPLEFT", icon, "TOPLEFT", -3.5, 3)
  335.         backdrop:SetPoint("BOTTOMRIGHT", icon, "BOTTOMRIGHT", 4, -3.5)
  336.         backdrop:SetFrameStrata("LOW")
  337.         backdrop:SetBackdrop(BACKDROP)
  338.         backdrop:SetBackdropColor(0, 0, 0, 1)
  339.         backdrop:SetBackdropBorderColor(0, 0, 0)
  340.        
  341.         icon.Texture = iconTex
  342.         icon.Overlay = overlay
  343.         icon.Count = count
  344.         icon.Cooldown = cooldown
  345.         icon.Backdrop = backdrop
  346.        
  347.         self.DebuffIcon = icon
  348.        
  349.         local raidInfo = self:CreateFontString(nil, "OVERLAY")
  350.         raidInfo:SetFont(gxMedia.font, 14)
  351.         raidInfo:SetShadowColor(0, 0, 0)
  352.         raidInfo:SetShadowOffset(1.25, -1.25)
  353.         raidInfo:SetPoint("CENTER", self)
  354.         raidInfo:SetTextColor(0.84, 0.75, 0.65)
  355.         self:Tag(raidInfo, "[raidcolor][WimpfaceRAIDZ]")
  356.        
  357.         self.RaidInfo = raidInfo
  358.        
  359.         local leader = self.Leader
  360.         leader:SetHeight(8)
  361.         leader:SetWidth(8)
  362.         leader:SetPoint("CENTER", self, "TOPLEFT")
  363.        
  364.         local masterLooter = self.MasterLooter
  365.         masterLooter:SetHeight(8)
  366.         masterLooter:SetWidth(8)
  367.         masterLooter:SetPoint("CENTER", self, "TOPLEFT", 8, 0)
  368.        
  369.         if (oUF.Indicators) then
  370.             local auraStatus
  371.            
  372.             auraStatus = self:CreateFontString(nil, "ARTWORK")
  373.             auraStatus:SetPoint("TOPLEFT", -2, 1)
  374.             auraStatus:SetFont(FONT, 8, "OUTLINE|MONOCHROME")
  375.             self:Tag(auraStatus, oUF.Indicators["TL"])
  376.            
  377.             self.AuraStatusTopLeft = auraStatus
  378.            
  379.             auraStatus = self:CreateFontString(nil, "ARTWORK")
  380.             auraStatus:SetPoint("TOPRIGHT", 3, 1)
  381.             auraStatus:SetFont(FONT, 8, "OUTLINE|MONOCHROME")
  382.             self:Tag(auraStatus, oUF.Indicators["TR"])
  383.            
  384.             self.AuraStatusTopRight = auraStatus
  385.  
  386.             auraStatus = self:CreateFontString(nil, "ARTWORK")
  387.             auraStatus:ClearAllPoints()
  388.             auraStatus:SetPoint("BOTTOMLEFT", -2, 1)
  389.             auraStatus:SetFont(FONT, 8, "OUTLINE|MONOCHROME")
  390.             self:Tag(auraStatus, oUF.Indicators["BL"])
  391.            
  392.             self.AuraStatusBottomLeft = auraStatus
  393.  
  394.             auraStatus = self:CreateFontString(nil, "ARTWORK")
  395.             auraStatus:SetPoint("CENTER", self, "BOTTOMRIGHT", 1, 1)
  396.             auraStatus:SetFont(FONT, 8, "OUTLINE|MONOCHROME")
  397.             self:Tag(auraStatus, oUF.Indicators["BR"])
  398.            
  399.             self.AuraStatusBottomRight = auraStatus
  400.         end
  401.        
  402.         local role = self:CreateTexture(nil, "OVERLAY")
  403.         role:SetHeight(12)
  404.         role:SetWidth(12)
  405.         role:SetPoint("CENTER", self, "TOPRIGHT")
  406.        
  407.         self.LFDRole = role
  408.     end,
  409. }
  410.  
  411. local function Shared(self, unit)
  412.     self.colors.power.MANA = {0, 144/255, 1}
  413.  
  414.     self:RegisterForClicks('AnyUp')
  415.     self:SetScript('OnEnter', UnitFrame_OnEnter)
  416.     self:SetScript('OnLeave', UnitFrame_OnLeave)
  417.    
  418.     local health = CreateFrame('StatusBar', nil, self)
  419.     health:SetStatusBarTexture(BARTEXTURE)
  420.     if HEALTH_USE_CLASS_COLOR then
  421.         health.colorClass = true
  422.         health.colorTapping = true
  423.         health.colorDisconnected = true
  424.         health.colorReaction = true
  425.     else
  426.         health:SetStatusBarColor(HEALTH_CUSTOM_COLOR.r, HEALTH_CUSTOM_COLOR.g, HEALTH_CUSTOM_COLOR.b)
  427.     end
  428.     health.frequentUpdates = true  
  429.     self.Health = health
  430.  
  431.     local healthBG = health:CreateTexture(nil, 'BORDER')
  432.     healthBG:SetAllPoints()
  433.     healthBG:SetTexture(1/3, 1/3, 1/3)
  434.  
  435.     local healthValue = health:CreateFontString(nil, 'OVERLAY')
  436.     healthValue:SetPoint('RIGHT', health, -2, -20)
  437.     healthValue:SetFont(FONT, 8, 'OUTLINE|MONOCHROME')
  438.     healthValue:SetJustifyH('RIGHT')
  439.     healthValue.frequentUpdates = 1/4
  440.     self:Tag(healthValue, '[WimpfaceHP]')
  441.    
  442.     self:SetBackdrop(BACKDROP)
  443.     self:SetBackdropColor(0, 0, 0)
  444.    
  445.     -- health:SetBackdrop(BACKDROP)
  446.     -- health:SetBackdropColor(0, 0, 0)
  447.  
  448.     if(unit == 'player' or unit == 'target' or unit == 'pet' or unit == 'targettarget') then
  449.         local power = CreateFrame('StatusBar', nil, self)
  450.         power:SetPoint('TOPRIGHT', 1)
  451.         power:SetPoint('TOPLEFT', 1)
  452.         power:SetStatusBarTexture(BARTEXTURE)
  453.         power.frequentUpdates = true
  454.         power:SetHeight(1)
  455.         self.Power = power
  456.  
  457.         if POWER_USE_CLASS_COLOR then
  458.             power.colorClass = true
  459.             power.colorReaction = unit ~= 'pet'
  460.             power.colorTapping = true
  461.             power.colorDisconnected = true
  462.         else
  463.             power:SetStatusBarColor(POWER_CUSTOM_COLOR.r, POWER_CUSTOM_COLOR.g, POWER_CUSTOM_COLOR.b)
  464.         end
  465.         power.colorHappiness = unit == 'pet'
  466.         power.colorPower = unit == 'pet'
  467.  
  468.         local powerBG = power:CreateTexture(nil, 'BORDER')
  469.         powerBG:SetAllPoints()
  470.         powerBG:SetTexture(TEXTURE)
  471.         powerBG.multiplier = 1/3
  472.         power.bg = powerBG
  473.        
  474.         -- power:SetBackdrop(BACKDROP)
  475.         -- power:SetBackdropColor(0, 0, 0)
  476.  
  477.         if not(unit == 'target' or unit == 'targettarget') then
  478.             local powerValue = health:CreateFontString(nil, 'OVERLAY')
  479.             powerValue:SetPoint('LEFT', health, 2, -20)
  480.             powerValue:SetFont(FONT, 8, 'OUTLINE|MONOCHROME')
  481.             powerValue:SetJustifyH('LEFT')
  482.             powerValue.frequentUpdates = 0.1
  483.             self:Tag(powerValue, '[WimpfacePOWAH]')
  484.         end
  485.  
  486.         local raidicon = health:CreateTexture(nil, 'OVERLAY')
  487.         raidicon:SetPoint('TOP', self, 0, 8)
  488.         raidicon:SetSize(16, 16)
  489.         self.RaidIcon = raidicon
  490.        
  491.         health:SetHeight(18)
  492.         health:SetPoint('BOTTOMRIGHT')
  493.         health:SetPoint('BOTTOMLEFT')
  494.  
  495.         self.menu = SpawnMenu
  496.         self:SetAttribute('type2', 'menu')
  497.         self:SetAttribute('initial-height', 20)
  498.     end
  499.  
  500.     if(unit == 'focus' or unit:find('target')) then
  501.         local name = health:CreateFontString(nil, 'OVERLAY')
  502.         name:SetPoint('LEFT', health, 2, -20)
  503.         name:SetPoint('RIGHT', healthValue, 'LEFT')
  504.         name:SetFont(FONT, 8, 'OUTLINE|MONOCHROME')
  505.         name:SetJustifyH('LEFT')
  506.         self:Tag(name, '[WimpfaceNAMEZ< ][|cff0090ff>rare<|r]')
  507.  
  508.         local debuffs = CreateFrame('Frame', nil, self)
  509.         debuffs.spacing = 4
  510.         debuffs.initialAnchor = 'TOPLEFT'
  511.         debuffs.PostCreateIcon = PostCreateAura
  512.         self.Debuffs = debuffs
  513.  
  514.         if(unit == 'target') then
  515.             debuffs.num = 20
  516.             debuffs.size = 21.7
  517.             debuffs['growth-y'] = 'DOWN'
  518.             debuffs.PostUpdateIcon = PostUpdateDebuff
  519.             debuffs:SetPoint('TOPLEFT', self, 'BOTTOMLEFT', 0, -20)
  520.         else
  521.             health:SetHeight(18)
  522.             self:SetAttribute('initial-height', 20)
  523.             self:SetAttribute('initial-width', 121)
  524.         end
  525.  
  526.         if(unit == 'focus') then
  527.             debuffs:SetPoint('TOPLEFT', self, 'TOPRIGHT')
  528.             debuffs.onlyShowPlayer = true
  529.         elseif(unit ~= 'target') then
  530.             debuffs:SetPoint('TOPLEFT', self, 'TOPRIGHT', 4, 0)
  531.             debuffs.initialAnchor = 'TOPLEFT'
  532.             debuffs['growth-x'] = 'RIGHT'
  533.         end
  534.  
  535.         debuffs:SetSize(230, 21.7)
  536.     end
  537.    
  538.     if(unit == 'player' or unit == 'target') then
  539.         local castbar = CreateFrame('StatusBar', nil, self)
  540.         castbar:SetSize(205, 16)
  541.        
  542.         castbar:SetStatusBarTexture(BARTEXTURE)
  543.         castbar:SetStatusBarColor(0.18, 0.18, 0.18)
  544.        
  545.         castbar:SetBackdrop(BACKDROP)
  546.         castbar:SetBackdropColor(0, 0, 0)
  547.        
  548.         castbar.CustomTimeText = CustomCastText
  549.         self.Castbar = castbar
  550.        
  551.         local castbarBG = castbar:CreateTexture(nil, 'BORDER')
  552.         castbarBG:SetAllPoints()
  553.         castbarBG:SetTexture(1/3, 1/3, 1/3)
  554.        
  555.         local castbarTime = castbar:CreateFontString(nil, 'OVERLAY')
  556.         castbarTime:SetPoint('RIGHT', -2, 0)
  557.         castbarTime:SetFont(FONT, 8, 'OUTLINE|MONOCHROME')
  558.         castbarTime:SetJustifyH('RIGHT')
  559.         castbar.Time = castbarTime
  560.        
  561.         local castbarText = castbar:CreateFontString(nil, 'OVERLAY')
  562.         castbarText:SetPoint('LEFT', 2, 0)
  563.         castbarText:SetPoint('RIGHT', castbarTime)
  564.         castbarText:SetFont(FONT, 8, 'OUTLINE|MONOCHROME')
  565.         castbarText:SetJustifyH('LEFT')
  566.         castbar.Text = castbarText
  567.        
  568.         local castbarDummy = CreateFrame('Frame', nil, castbar)
  569.         castbarDummy:SetSize(21, 21)
  570.         castbarDummy:SetBackdrop(BACKDROP)
  571.         castbarDummy:SetBackdropColor(0, 0, 0)
  572.        
  573.         local castbarIcon = castbarDummy:CreateTexture(nil, 'ARTWORK')
  574.         castbarIcon:SetAllPoints()
  575.         castbarIcon:SetTexCoord(0.08, 0.92, 0.08, 0.92)
  576.         castbar.Icon = castbarIcon
  577.        
  578.         if(unit == 'target') then
  579.             castbar.PostCastStart = PostCastStart
  580.             castbar.PostChannelStart = PostCastStart
  581.             castbar:SetPoint('TOPLEFT', self, 'BOTTOMLEFT', 0, -60)
  582.             castbarDummy:SetPoint('BOTTOMLEFT', castbar, 'BOTTOMRIGHT', 4, 0)
  583.         else
  584.             castbar:SetPoint('TOPRIGHT', self, 'BOTTOMRIGHT', 0, -60)
  585.             castbarDummy:SetPoint('BOTTOMRIGHT', castbar, 'BOTTOMLEFT', -4, 0)
  586.         end
  587.     end
  588.  
  589.     if(UnitSpecific[unit]) then
  590.         return UnitSpecific[unit](self)
  591.     end
  592.  
  593. end
  594.  
  595. oUF.colors.power.MANA = {0, 144/255, 1}
  596.  
  597. oUF:RegisterStyle('Haori', Shared)
  598.  
  599. for unit, layoutFunc in next, unitSpecific do
  600.     oUF:RegisterStyle('Haori - ' .. unit:gsub("^%l", string.upper), layoutFunc)
  601. end
  602.  
  603. oUF:Factory(function(self)
  604.     self:SetActiveStyle('Haori')
  605.     self:Spawn('player'):SetPoint('CENTER', UIParent, 'CENTER', -175, -230)
  606.     self:Spawn('pet'):SetPoint('CENTER', UIParent, 'CENTER', -250, -230)
  607.     self:Spawn('focus'):SetPoint('CENTER', UIParent, 'CENTER', -250, -80)
  608.     self:Spawn('target'):SetPoint('CENTER', UIParent, 'CENTER', 175, -230)
  609.     self:Spawn('targettarget'):SetPoint('CENTER', UIParent, 'CENTER', 349, -230)
  610.    
  611.     self:SetActiveStyle("Haori - Raid")
  612.     local group = self:SpawnHeader(nil, nil, "raid,party",
  613.         "showPlayer", true,
  614.         "showRaid", true,
  615.         "ShowParty", true,
  616.         "yOffset", 5,
  617.         "xOffset", 5,
  618.         "maxColumns", 8,
  619.         "point", "BOTTOM",
  620.         "unitsPerColumn", 5,
  621.         "columnSpacing", 5,
  622.         "columnAnchorPoint", "LEFT",
  623.         "groupingOrder", "1,2,3,4,5,6,7,8",
  624.         "groupBy", "GROUP"
  625.     )
  626.     group:SetPoint("CENTER", UIParent, "CENTER", 0, -275)
  627. end)
  628.  
  629. local testui = TestUI or function() end
  630.     TestUI = function()
  631.     testui()
  632.     UnitAura = function()
  633.     -- name, rank, texture, count, dtype, duration, timeLeft, caster
  634.     return 'penancelol', 'Rank 2', 'Interface\\Icons\\Spell_Holy_Penance', random(5), 'Magic', 0, 0, "player"
  635.     end
  636.         if(oUF) then
  637.         for i, v in pairs(oUF.units) do
  638.             if(v.UNIT_AURA) then
  639.             v:UNIT_AURA("UNIT_AURA", v.unit)
  640.             end
  641.         end
  642.     end
  643. end
  644. SlashCmdList.TestUI = TestUI
  645. SLASH_TestUI1 = "/testui"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement