diff --git a/oUF_P3lim/oUF_P3lim.lua b/oUF_P3lim/oUF_P3lim.lua index 979112d..9a31a1f 100644 --- a/oUF_P3lim/oUF_P3lim.lua +++ b/oUF_P3lim/oUF_P3lim.lua @@ -1,13 +1,6 @@ local wotlk = select(4, GetBuildInfo()) >= 3e4 - -local classification = { - worldboss = 'Boss', - rareelite = '+!', - elite = '+', - rare = '!', - normal = '', - trivial = '', -} +local _, class = UnitClass('player') +local texture = [=[Interface\AddOns\oUF_P3lim\minimalist]=] local colors = setmetatable({ power = setmetatable({ @@ -16,19 +9,17 @@ local colors = setmetatable({ }, {__index = oUF.colors}) colors.power[0] = colors.power.MANA -local function menu(self) - local unit = self.unit:sub(1, -2) - local cunit = self.unit:gsub('(.)', string.upper, 1) +oUF.Tags['[smartlevel]'] = function(u) return UnitClassification(u) == "worldboss" and "Boss" or oUF.Tags['[level]'](u) .. oUF.Tags["[plus]"](u) end - if(unit == 'party' or unit == 'partypet') then - ToggleDropDownMenu(1, nil, _G['PartyMemberFrame'..self.id..'DropDown'], 'cursor', 0, 0) - elseif(_G[cunit..'FrameDropDown']) then - ToggleDropDownMenu(1, nil, _G[cunit..'FrameDropDown'], 'cursor', 0, 0) +local function menu(self) + local unit = self.unit:gsub('(.)', string.upper, 1) + if(_G[unit..'FrameDropDown']) then + ToggleDropDownMenu(1, nil, _G[unit..'FrameDropDown'], 'cursor') end end -local function OverrideUpdateName(self, event, unit) - if(self.unit == unit) then +local function UpdateInfoColor(self, unit) + if(self.Info) then local color = {1, 1, 1} if(UnitIsTapped(unit) and not UnitIsTappedByPlayer(unit)) then color = self.colors.tapped @@ -43,33 +34,24 @@ local function OverrideUpdateName(self, event, unit) end end - self.Name:SetTextColor(unpack(color)) - - if(unit == 'player' or unit == 'pet') then - self.Name:Hide() - elseif(unit == 'target') then - local level = UnitLevel(unit) < 1 and '??' or UnitLevel(unit) - self.Name:SetFormattedText('%s |cff0090ff%s%s|r', UnitName(unit), level, classification[UnitClassification(unit)]) - else - self.Name:SetText(UnitName(unit)) - end + self.Info:SetTextColor(unpack(color)) end end local function PostUpdateHealth(self, event, unit, bar, min, max) - if(UnitIsDead(unit)) then + if(not UnitIsConnected(unit)) then + bar.text:SetText('Offline') + elseif(UnitIsDead(unit)) then bar.text:SetText('Dead') elseif(UnitIsGhost(unit)) then bar.text:SetText('Ghost') - elseif(not UnitIsConnected(unit)) then - bar.text:SetText('Offline') else if(unit == 'target' and UnitClassification('target') == 'worldboss') then - bar.text:SetFormattedText('%d (%d|cff0090ff%%|r)', min, floor(min/max*100)) -- show percentages on raid bosses + bar.text:SetFormattedText('%d (%d|cff0090ff%%|r)', min, floor(min/max*100)) else if(min ~= max) then - if(unit == 'player' or unit:match('^party')) then - bar.text:SetFormattedText('|cffff8080%d|r |cff0090ff/|r %d|cff0090ff%%|r', min-max, floor(min/max*100)) + if(unit == 'player') then + bar.text:SetFormattedText('|cffff8080%d|r %d|cff0090ff%%|r', min-max, floor(min/max*100)) else bar.text:SetFormattedText('%d |cff0090ff/|r %d', min, max) end @@ -80,32 +62,29 @@ local function PostUpdateHealth(self, event, unit, bar, min, max) end bar:SetStatusBarColor(0.25, 0.25, 0.35) - self:UNIT_NAME_UPDATE(event, unit) + UpdateInfoColor(self, unit) end local function PostUpdatePower(self, event, unit, bar, min, max) - if(unit ~= 'player' and unit ~= 'pet') then - bar.text:Hide() - else + if(bar.text) then if(min == 0) then bar.text:SetText() - elseif(not UnitIsConnected(unit)) then - bar.text:SetText() - elseif(not UnitIsPlayer(unit)) then + elseif(not UnitIsPlayer(unit) or not UnitIsConnected(unit)) then bar.text:SetText() else - local num, str = UnitPowerType(unit) - local color = self.colors.power[wotlk and str or num] - bar.text:SetTextColor(color[1], color[2], color[3]) if(min ~= max) then bar.text:SetText(max-(max-min)) else bar.text:SetText(min) end end + + local num, str = UnitPowerType(unit) + local color = self.colors.power[wotlk and str or num] + bar.text:SetTextColor(color[1], color[2], color[3]) end - self:UNIT_NAME_UPDATE(event, unit) + UpdateInfoColor(self, unit) end local function PostCreateAuraIcon(self, button, icons, index, debuff) @@ -129,8 +108,8 @@ local function CreateStyle(self, unit) self.Health = CreateFrame('StatusBar', nil, self) self.Health:SetPoint('TOPRIGHT', self) self.Health:SetPoint('TOPLEFT', self) - self.Health:SetStatusBarTexture([=[Interface\AddOns\oUF_P3lim\minimalist]=]) - self.Health:SetHeight(unit and 22 or 18) + self.Health:SetStatusBarTexture(texture) + self.Health:SetHeight(22) self.Health.bg = self.Health:CreateTexture(nil, 'BORDER') self.Health.bg:SetAllPoints(self.Health) @@ -143,8 +122,8 @@ local function CreateStyle(self, unit) self.Power = CreateFrame('StatusBar', nil, self) self.Power:SetPoint('TOPRIGHT', self.Health, 'BOTTOMRIGHT', 0, -1) self.Power:SetPoint('TOPLEFT', self.Health, 'BOTTOMLEFT', 0, -1) - self.Power:SetStatusBarTexture([=[Interface\AddOns\oUF_P3lim\minimalist]=]) - self.Power:SetHeight(unit and 4 or 2) + self.Power:SetStatusBarTexture(texture) + self.Power:SetHeight(4) self.Power.colorTapping = true self.Power.colorDisconnected = true @@ -154,10 +133,7 @@ local function CreateStyle(self, unit) self.Power.bg = self.Power:CreateTexture(nil, 'BORDER') self.Power.bg:SetAllPoints(self.Power) self.Power.bg:SetTexture([=[Interface\ChatFrame\ChatFrameBackground]=]) - self.Power.bg:SetAlpha(0.3) - - self.Power.text = self.Power:CreateFontString(nil, 'OVERLAY', 'GameFontHighlightSmall') - self.Power.text:SetPoint('LEFT', self.Health, 2, -1) + self.Power.bg.multiplier = 0.3 self.Leader = self.Health:CreateTexture(nil, 'OVERLAY') self.Leader:SetPoint('TOPLEFT', self, 0, 8) @@ -169,100 +145,92 @@ local function CreateStyle(self, unit) self.RaidIcon:SetHeight(16) self.RaidIcon:SetWidth(16) - self.Name = self.Health:CreateFontString(nil, 'OVERLAY', 'GameFontHighlightSmall') - self.Name:SetPoint('LEFT', self.Health, 2, -1) - self.Name:SetPoint('RIGHT', self.Health.text, 'LEFT') - self.Name:SetJustifyH('LEFT') - - if(unit == 'player') then - self.Spark = self.Power:CreateTexture(nil, 'OVERLAY') - self.Spark:SetTexture([=[Interface\CastingBar\UI-CastingBar-Spark]=]) - self.Spark:SetBlendMode('ADD') - self.Spark:SetHeight(8) - self.Spark:SetWidth(8) - self.Spark.manatick = true - - self.BarFade = true - - self.Experience = CreateFrame('StatusBar', nil, self) - self.Experience:SetPoint('TOP', self, 'BOTTOM', 0, -10) - self.Experience:SetStatusBarTexture([=[Interface\AddOns\oUF_P3lim\minimalist]=]) - self.Experience:SetStatusBarColor(unpack(self.colors.health)) - self.Experience:SetHeight(11) - self.Experience:SetWidth(230) - self.Experience.tooltip = true - - self.Experience.text = self.Experience:CreateFontString(nil, 'OVERLAY', 'GameFontNormalSmall') - self.Experience.text:SetPoint('CENTER', self.Experience) - self.Experience.text:SetTextColor(1, 1, 1) - self.Experience.text:SetJustifyH('LEFT') - - self.Experience.rested = CreateFrame('StatusBar', nil, self) - self.Experience.rested:SetAllPoints(self.Experience) - self.Experience.rested:SetStatusBarTexture([=[Interface\AddOns\oUF_P3lim\minimalist]=]) - self.Experience.rested:SetStatusBarColor(0, 0.39, 0.88, 0.5) - self.Experience.rested:SetBackdrop({bgFile = [=[Interface\ChatFrame\ChatFrameBackground]=], insets = {top = -1, left = -1, bottom = -1, right = -1}}) - self.Experience.rested:SetBackdropColor(0, 0, 0) - - self.Experience.bg = self.Experience.rested:CreateTexture(nil, 'BORDER') - self.Experience.bg:SetAllPoints(self.Experience) - self.Experience.bg:SetTexture(0.3, 0.3, 0.3) - - if(not IsAddOnLoaded('oUF_Experience')) then - self.Experience:Hide() - self.Experience.rested:Hide() - end - - local l, class = UnitClass('player') - if(class == 'DRUID') then - self.DruidMana = CreateFrame('StatusBar', nil, self) - self.DruidMana:SetPoint('BOTTOM', self.Power, 'TOP') - self.DruidMana:SetStatusBarTexture([=[Interface\AddOns\oUF_P3lim\minimalist]=]) - self.DruidMana:SetStatusBarColor(unpack(self.colors.power[0])) - self.DruidMana:SetHeight(1) - self.DruidMana:SetWidth(230) - - self.DruidManaText = self.DruidMana:CreateFontString(nil, 'OVERLAY', 'GameFontNormalSmall') - self.DruidManaText:SetPoint('CENTER', self.DruidMana) - self.DruidManaText:SetTextColor(unpack(self.colors.power[0])) - end - end - - if(unit == 'target') then - self.CPoints = self:CreateFontString(nil, 'OVERLAY', 'SubZoneTextFont') - self.CPoints:SetPoint('RIGHT', self, 'LEFT', -9, 0) - self.CPoints:SetTextColor(1, 1, 1) - self.CPoints:SetJustifyH('RIGHT') - - self.Buffs = CreateFrame('Frame', nil, self) - self.Buffs:SetPoint('TOPLEFT', self, 'TOPRIGHT', 2, 1) - self.Buffs:SetHeight(24 * 2) - self.Buffs:SetWidth(270) - self.Buffs.num = 20 - self.Buffs.size = 24 - self.Buffs.spacing = 2 - self.Buffs.initialAnchor = 'TOPLEFT' - self.Buffs['growth-y'] = 'DOWN' - - self.Debuffs = CreateFrame('Frame', nil, self) - self.Debuffs:SetPoint('TOPLEFT', self, 'BOTTOMLEFT', -1, -2) - self.Debuffs:SetHeight(22 * 0.97) - self.Debuffs:SetWidth(230) - self.Debuffs.size = 22 * 0.97 - self.Debuffs.spacing = 2 - self.Debuffs.initialAnchor = 'TOPLEFT' - self.Debuffs.showDebuffType = true - self.Debuffs['growth-y'] = 'DOWN' + if(unit ~= 'focus' and wotlk) then + self.Threat = self:CreateTexture(nil, 'OVERLAY') + self.Threat:SetPoint('TOPRIGHT', self, 0, -8) + self.Threat:SetHeight(20) + self.Threat:SetWidth(20) + self.Threat:SetTexture([=[Interface\Minimap\ObjectIcons]=]) + self.Threat:SetTexCoord(6/8, 7/8, 1/2, 1) end - if(unit == 'pet') then - self.Power.colorPower = true - self.Power.colorHappiness = true - self.Power.colorReaction = false - self.BarFade = true + if(unit == 'player' or unit == 'pet') then + self.Power.text = self.Power:CreateFontString(nil, 'OVERLAY', 'GameFontHighlightSmall') + self.Power.text:SetPoint('LEFT', self.Health, 2, -1) + + if(unit == 'player') then + self.Spark = self.Power:CreateTexture(nil, 'OVERLAY') + self.Spark:SetTexture([=[Interface\CastingBar\UI-CastingBar-Spark]=]) + self.Spark:SetBlendMode('ADD') + self.Spark:SetHeight(8) + self.Spark:SetWidth(8) + self.Spark.manatick = true + + self.BarFade = true + + if(IsAddOnLoaded('oUF_Experience')) then + self.Experience = CreateFrame('StatusBar', nil, self) + self.Experience:SetPoint('TOP', self, 'BOTTOM', 0, -10) + self.Experience:SetStatusBarTexture(texture) + self.Experience:SetStatusBarColor(unpack(self.colors.health)) + self.Experience:SetHeight(11) + self.Experience:SetWidth(230) + self.Experience.tooltip = true + + self.Experience.text = self.Experience:CreateFontString(nil, 'OVERLAY', 'GameFontNormalSmall') + self.Experience.text:SetPoint('CENTER', self.Experience) + self.Experience.text:SetTextColor(1, 1, 1) + self.Experience.text:SetJustifyH('LEFT') + + self.Experience.rested = CreateFrame('StatusBar', nil, self) + self.Experience.rested:SetAllPoints(self.Experience) + self.Experience.rested:SetStatusBarTexture(texture) + self.Experience.rested:SetStatusBarColor(0, 0.39, 0.88, 0.5) + self.Experience.rested:SetBackdrop({bgFile = [=[Interface\ChatFrame\ChatFrameBackground]=], insets = {top = -1, left = -1, bottom = -1, right = -1}}) + self.Experience.rested:SetBackdropColor(0, 0, 0) + + self.Experience.bg = self.Experience.rested:CreateTexture(nil, 'BORDER') + self.Experience.bg:SetAllPoints(self.Experience) + self.Experience.bg:SetTexture(0.3, 0.3, 0.3) + end - self:SetAttribute('initial-height', 27) - self:SetAttribute('initial-width', 130) + if(IsAddOnLoaded('oUF_DruidMana') and class == 'DRUID') then + self.DruidMana = CreateFrame('StatusBar', nil, self) + self.DruidMana:SetPoint('BOTTOM', self.Power, 'TOP') + self.DruidMana:SetStatusBarTexture(texture) + self.DruidMana:SetStatusBarColor(unpack(self.colors.power[0])) + self.DruidMana:SetHeight(1) + self.DruidMana:SetWidth(230) + + self.DruidManaText = self.DruidMana:CreateFontString(nil, 'OVERLAY', 'GameFontNormalSmall') + self.DruidManaText:SetPoint('CENTER', self.DruidMana) + self.DruidManaText:SetTextColor(unpack(self.colors.power[0])) + end + elseif(unit == 'pet') then + self.Power.colorPower = true + self.Power.colorHappiness = true + self.Power.colorReaction = false + self.BarFade = true + + self.Buffs = CreateFrame('Frame', nil, self) + self.Buffs:SetPoint('TOPRIGHT', self, 'TOPLEFT', -2, 1) + self.Buffs:SetHeight(24 * 2) + self.Buffs:SetWidth(270) + self.Buffs.size = 24 + self.Buffs.spacing = 2 + self.Buffs.initialAnchor = 'TOPRIGHT' + self.Buffs['growth-x'] = 'LEFT' + + self:SetAttribute('initial-height', 27) + self:SetAttribute('initial-width', 130) + end + else + self.Info = self.Health:CreateFontString(nil, 'OVERLAY', 'GameFontHighlightSmall') + self.Info:SetPoint('LEFT', self.Health, 2, -1) + self.Info:SetPoint('RIGHT', self.Health.text, 'LEFT') + self.Info:SetJustifyH('LEFT') + self.Info:SetText(unit == 'target' and '[name] |cff0090ff[smartlevel] [rare]|r' or '[name]') + self.TaggedStrings = {self.Info} end if(unit == 'focus' or unit == 'targettarget') then @@ -298,7 +266,7 @@ local function CreateStyle(self, unit) self.Castbar = CreateFrame('StatusBar', nil, self) self.Castbar:SetPoint('TOPRIGHT', self, 'BOTTOMRIGHT', 0, -100) self.Castbar:SetPoint('TOPLEFT', self, 'BOTTOMLEFT', 0, -100) - self.Castbar:SetStatusBarTexture([=[Interface\AddOns\oUF_P3lim\minimalist]=]) + self.Castbar:SetStatusBarTexture(texture) self.Castbar:SetStatusBarColor(0.25, 0.25, 0.35) self.Castbar:SetBackdrop({bgFile = [=[Interface\ChatFrame\ChatFrameBackground]=], insets = {top = -1, left = -1, bottom = -1, right = -1}}) self.Castbar:SetBackdropColor(0, 0, 0) @@ -318,37 +286,38 @@ local function CreateStyle(self, unit) self:SetAttribute('initial-height', 27) self:SetAttribute('initial-width', 230) - end - if(not unit) then - self.outsideRangeAlpha = 0.4 - self.inRangeAlpha = 1.0 - self.Range = true - - self.ReadyCheck = self.Health:CreateTexture(nil, 'OVERLAY') - self.ReadyCheck:SetPoint('TOPRIGHT', self, 0, 8) - self.ReadyCheck:SetHeight(16) - self.ReadyCheck:SetWidth(16) - - self.Debuffs = CreateFrame('Frame', nil, self) - self.Debuffs:SetPoint('TOPLEFT', self, 'TOPRIGHT', 2, 1) - self.Debuffs:SetHeight(23) - self.Debuffs:SetWidth(230) - self.Debuffs.num = 5 - self.Debuffs.size = 23 - self.Debuffs.spacing = 2 - self.Debuffs.initialAnchor = 'TOPLEFT' - self.Debuffs.showDebuffType = true - self.Debuffs.filter = true - - self:SetAttribute('initial-height', 21) - self:SetAttribute('initial-width', 181) + if(unit == 'target') then + self.CPoints = self:CreateFontString(nil, 'OVERLAY', 'SubZoneTextFont') + self.CPoints:SetPoint('RIGHT', self, 'LEFT', -9, 0) + self.CPoints:SetTextColor(1, 1, 1) + self.CPoints:SetJustifyH('RIGHT') + + self.Buffs = CreateFrame('Frame', nil, self) + self.Buffs:SetPoint('TOPLEFT', self, 'TOPRIGHT', 2, 1) + self.Buffs:SetHeight(24 * 2) + self.Buffs:SetWidth(270) + self.Buffs.num = 20 + self.Buffs.size = 24 + self.Buffs.spacing = 2 + self.Buffs.initialAnchor = 'TOPLEFT' + self.Buffs['growth-y'] = 'DOWN' + + self.Debuffs = CreateFrame('Frame', nil, self) + self.Debuffs:SetPoint('TOPLEFT', self, 'BOTTOMLEFT', -1, -2) + self.Debuffs:SetHeight(22 * 0.97) + self.Debuffs:SetWidth(230) + self.Debuffs.size = 22 * 0.97 + self.Debuffs.spacing = 2 + self.Debuffs.initialAnchor = 'TOPLEFT' + self.Debuffs.showDebuffType = true + self.Debuffs['growth-y'] = 'DOWN' + end end self.DebuffHighlightBackdrop = true self.DebuffHighlightFilter = true - self.UNIT_NAME_UPDATE = OverrideUpdateName self.PostCreateAuraIcon = PostCreateAuraIcon self.PostUpdateHealth = PostUpdateHealth self.PostUpdatePower = PostUpdatePower @@ -356,7 +325,6 @@ local function CreateStyle(self, unit) return self end -oUF:RegisterSubTypeMapping('UNIT_LEVEL') oUF:RegisterStyle('P3lim', CreateStyle) oUF:SetActiveStyle('P3lim') @@ -364,26 +332,4 @@ oUF:Spawn('player'):SetPoint('CENTER', UIParent, -220, -250) oUF:Spawn('target'):SetPoint('CENTER', UIParent, 220, -250) oUF:Spawn('targettarget'):SetPoint('BOTTOMRIGHT', oUF.units.target, 'TOPRIGHT', 0, 5) oUF:Spawn('focus'):SetPoint('BOTTOMLEFT', oUF.units.player, 'TOPLEFT', 0, 5) -oUF:Spawn('pet'):SetPoint('RIGHT', oUF.units.player, 'LEFT', -25, 0) - -local party = oUF:Spawn('header', 'oUF_Party') -party:SetPoint('TOPLEFT', UIParent, 15, -15) -party:SetManyAttributes('yOffset', -5, 'showParty', true) - -local partyToggle = CreateFrame('Frame') -partyToggle:RegisterEvent('PLAYER_LOGIN') -partyToggle:RegisterEvent('RAID_ROSTER_UPDATE') -partyToggle:RegisterEvent('PARTY_LEADER_CHANGED') -partyToggle:RegisterEvent('PARTY_MEMBER_CHANGED') -partyToggle:SetScript('OnEvent', function(self) - if(InCombatLockdown()) then - self:RegisterEvent('PLAYER_REGEN_ENABLED') - else - self:UnregisterEvent('PLAYER_REGEN_ENABLED') - if(GetNumRaidMembers() > 0) then - party:Hide() - else - party:Show() - end - end -end) \ No newline at end of file +oUF:Spawn('pet'):SetPoint('RIGHT', oUF.units.player, 'LEFT', -25, 0) \ No newline at end of file diff --git a/oUF_P3lim/oUF_P3lim.toc b/oUF_P3lim/oUF_P3lim.toc index b96ecda..574e428 100644 --- a/oUF_P3lim/oUF_P3lim.toc +++ b/oUF_P3lim/oUF_P3lim.toc @@ -1,9 +1,9 @@ ## Interface: 20400 ## Author: p3lim -## Version: wowi:revision +## Version: 20400.wowi:revision ## Title: oUF P3lim -## Notes: Custom oUF Layout +## Notes: Just another oUF layout ## RequiredDeps: oUF -## OptionalDeps: oUF_Banzai, oUF_CombatFeedback, oUF_DebuffHighlight, oUF_DruidMana, oUF_Experience, oUF_PowerSpark, oUF_ReadyCheck +## OptionalDeps: oUF_CombatFeedback, oUF_DebuffHighlight, oUF_DruidMana, oUF_Experience, oUF_PowerSpark, oUF_ReadyCheck oUF_P3lim.lua \ No newline at end of file