Compare with Previous | Blame | View Log
-- config local settings = oUF_Settings local _, myclass = UnitClass("player") ---------------- local function do_format(v) local string = "" if v > 1000000 then string = (floor((v/1000000)*10)/10).."m" elseif v > 1000 then string = (floor((v/1000)*10)/10).."k" else string = v end return string end local PostIcon = function(self, button, ...) button.icon:SetTexCoord(0, 1, 0, 1) button.overlay:SetTexture(settings.bordertex) button.overlay:SetTexCoord(0, 1, 0, 1) button.overlay.Hide = function(self) self:SetVertexColor(0, 0, 0) end end local function GetDebuffType(unit) if not UnitCanAssist("player", unit) then return nil end local CanDispel = { PRIEST = { Magic = true, Disease = true, }, SHAMAN = { Poison = true, Disease = true, Curse = true, }, PALADIN = { Magic = true, Poison = true, Disease = true, }, MAGE = { Curse = true, }, DRUID = { Curse = true, Poison = true, }, WARLOCK = { Magic = true, }, } local dispellist = CanDispel[myclass] or {} local i=1 while true do local name, rank, icon, count, debuffType, duration, expirationTime, unitCaster, isStealable, shouldConsolidate, spellId = UnitAura(unit, i, "HARMFUL") if icon and dispellist[debuffType] then return debuffType, icon, spellId, count else break end i=i+1 end end local function CheckDebuffs(self, event, unit) if self.unit ~= unit then return end local debuffType, texture, spellId, count = GetDebuffType(unit) if debuffType then local color = DebuffTypeColor[debuffType] or {0,0,1} self.Health:SetBackdropColor(color.r,color.g, color.b,1) self.Icon.Icon:SetTexture(texture) self.Icon.Count:SetText((count~=0) and count) self.Icon:Show() else self.Health:SetBackdropColor(0,0,0) self.Icon:Hide() end end local function createAuraWatch(self, unit) local corners = settings.corners local auras = CreateFrame("Frame", nil, self) auras:SetAllPoints(self.Health) auras.presentAlpha = 1 auras.missingAlpha = 0 auras.icons = {} for i, corner in pairs(corners) do local icon = CreateFrame("Frame", nil, auras) icon.spellID = corner.spellID if corner.action == "HARMFUL" then icon.anyUnit = true icon:SetWidth(20) icon:SetHeight(20) icon:SetPoint("CENTER",0,0) icon.PostCreateAuraIcon = PostIcon else local tex = icon:CreateTexture(nil, "BACKGROUND") tex:SetAllPoints(icon) local cd = CreateFrame("Cooldown", nil, icon) cd:SetAllPoints(icon) cd:SetReverse() icon.cd = cd icon:SetWidth(corner.width) icon:SetHeight(corner.height) icon:SetPoint(corner.point, 0, 0) tex:SetTexture(settings.indicator) tex:SetVertexColor(unpack(corner.color)) if corner.count == true then local count = icon:CreateFontString(nil, "OVERLAY") count:SetFont(settings.font, 10,"THINOUTLINE") count:SetPoint(corner.point, -7, 0) icon.count = count end icon.icon = tex end auras.icons[corner.spellID] = icon auras.icons[corner.spellID]:Hide() end self.AuraWatch = auras end local function check_threat(self,event,unit) if unit then if self.unit ~= unit then return end if self.Aggro then local threat = UnitThreatSituation(unit) if threat == 3 then self.Aggro:SetText("|cffFF0000AGGRO") self.Health:SetBackdropColor(1,0,0) elseif threat == 2 then self.Aggro:SetText("|cffFFAA00THREAT") self.Health:SetBackdropColor(1,0.6,0) else self.Aggro:SetText("") self.Health:SetBackdropColor(0,0,0) end end end end local function updateHealth(self, event, unit, bar, min, max) if (self.unit ~= unit) and unit then return end self.Name:SetText(UnitName(unit):sub(1, 12)) if (UnitIsDead(unit) or UnitIsGhost(unit) or not UnitIsConnected(unit)) then bar.value:SetText((UnitIsDead(unit) and 'Dead') or (UnitIsGhost(unit) and 'Ghost') or (not UnitIsConnected(unit) and 'Offline')) bar.value:SetTextColor(0.5, 0.5, 0.5) self.Health:SetStatusBarColor(0.5, 0.5, 0.5) else bar.value:SetText("") local color = RAID_CLASS_COLORS[select(2, UnitClass(unit))] if (color) then bar:SetStatusBarColor(color.r*0.6, color.g*0.6, color.b*0.6) bar.bg:SetVertexColor(color.r*0.2, color.g*0.2, color.b*0.2) end end end local powerbar = function(self) local pp = CreateFrame("StatusBar") pp:SetStatusBarTexture(settings.texture) pp:SetOrientation("VERTICAL") pp.colorPower = true pp.frequentUpdates = true pp:SetParent(self) pp:SetPoint("TOPLEFT", self.Health,"TOPRIGHT", 0, 0) pp:SetPoint("BOTTOMRIGHT", self.Health,"BOTTOMRIGHT", settings.RaidFrames.ManaBar, 0) self.Health:SetWidth(settings.RaidFrames.Width-settings.RaidFrames.ManaBar-4) self.Health:SetPoint("BOTTOMRIGHT",self,"BOTTOMRIGHT",-(settings.RaidFrames.ManaBar+2),2) local ppbg = pp:CreateTexture(nil, "BORDER") ppbg:SetAllPoints(pp) ppbg:SetTexture(settings.texture) ppbg:SetVertexColor(.1,.1,.1) ppbg.multiplier = .2 pp.bg = ppbg self.Power = pp end local stylefunc = function(self, unit) self:SetScript("OnEnter", UnitFrame_OnEnter) self:SetScript("OnLeave", UnitFrame_OnLeave) self:SetAttribute('initial-height', settings.RaidFrames.Height) self:SetAttribute('initial-width', settings.RaidFrames.Width) self.Health = CreateFrame("StatusBar",nil,self) self.Health:SetPoint("TOPLEFT",self,"TOPLEFT",2,-2) self.Health:SetPoint("BOTTOMRIGHT",self,"BOTTOMRIGHT",-2,2) self.Health:SetStatusBarTexture(settings.texture) self.Health:SetOrientation("VERTICAL") self.Health:SetBackdrop{ bgFile = 'Interface\\Buttons\\WHITE8x8', tile = true, tileSize = 16, insets = { left = -2, right = -2, top = -2, bottom = -2 }, } self.Health:SetBackdropColor(0, 0, 0) self.Health.bg = self.Health:CreateTexture(nil, "BORDER") self.Health.bg:SetAllPoints(self.Health) self.Health.bg:SetTexture(settings.texture) self.Health.value = self.Health:CreateFontString(nil, 'OVERLAY') self.Health.value:SetPoint('BOTTOM', 0, 5) self.Health.value:SetFont(settings.font, 10) self.Health.value:SetShadowOffset(1, -1) self.Name = self.Health:CreateFontString(nil, "ARTWORK") self.Name:SetPoint("LEFT", 2, 0) self.Name:SetPoint("RIGHT", -2, 0) self.Name:SetFont(settings.font, floor((settings.fsize/100)*90), "THINOUTLINE") self.Name:SetShadowColor(0,0,0,0) self.Name:SetTextColor(1, 1, 1) self.Aggro = self.Health:CreateFontString(nil, 'OVERLAY') self.Aggro:SetPoint('CENTER', self, 'TOP') self.Aggro:SetFont(settings.font, 8, 'THINOUTLINE') self.Aggro:SetShadowColor(0, 0, 0, 0) self.Aggro:SetTextColor(1, 1, 1) -- debuff icons self.Icon = CreateFrame('Frame', nil, self.Health) self.Icon:SetAllPoints(self.Health) self.Icon:SetFrameStrata("MEDIUM") self.Icon.Icon = self.Icon:CreateTexture(nil, 'ARTWORK') self.Icon.Icon:SetPoint('CENTER', self.Icon) self.Icon.Icon:SetHeight(20) self.Icon.Icon:SetWidth(20) self.Icon.Icon:SetTexCoord(0.07, 0.93, 0.07, 0.93) self.Icon.Count = self.Icon:CreateFontString(nil, 'OVERLAY') self.Icon.Count:SetPoint('BOTTOMRIGHT', self.Icon.Icon, 1, 0) self.Icon.Count:SetFont(settings.font, 10, 'THINOUTLINE') self.Icon.Count:SetShadowColor(0, 0, 0, 0) self.Icon.Count:SetTextColor(1, 1, 1) self.Icon.Border = self.Icon:CreateTexture(nil, 'BORDER') self.Icon.Border:SetPoint('CENTER', self.Health) self.Icon.Border:SetHeight(20 + 4) self.Icon.Border:SetWidth(20 + 4) self.Icon.Border:SetTexture(settings.buffTex) self.Icon.Border:SetVertexColor(1, 1, 1) self.Icon:Hide() if settings.powerbar == true then powerbar(self) end self:RegisterEvent("UNIT_DEAD", CheckDebuffs) self:RegisterEvent("UNIT_AURA", CheckDebuffs) self:RegisterEvent('PLAYER_TARGET_CHANGED', check_threat) self:RegisterEvent('UNIT_THREAT_LIST_UPDATE', check_threat) self:RegisterEvent('UNIT_THREAT_SITUATION_UPDATE', check_threat) if settings.cornerPoints == true then createAuraWatch(self,unit) end local ricon = self.Health:CreateTexture(nil, "OVERLAY") ricon:SetHeight(10) ricon:SetWidth(10) ricon:SetPoint("BOTTOM", self.Name, "TOP", 0, -1) ricon:SetTexture"Interface\\TargetingFrame\\UI-RaidTargetingIcons" self.RaidIcon = ricon if (not unit) then self.Range = true self.outsideRangeAlpha = 0.4 self.inRangeAlpha = 1 end self.PostUpdateHealth = updateHealth return self end oUF:RegisterStyle("ouf_raid", stylefunc) oUF:SetActiveStyle("ouf_raid") local function make_me_movable(f) f:SetMovable(true) f:SetUserPlaced(true) f:EnableMouse(true) f:RegisterForDrag("LeftButton","RightButton") f:SetScript("OnDragStart", function(self) self:StartMoving() end) f:SetScript("OnDragStop", function(self) self:StopMovingOrSizing() end) end local RaidDragFrame = CreateFrame("Frame","RaidDragFrame",UIParent) RaidDragFrame:SetPoint("TOPLEFT", UIParent, "TOPLEFT", 20, -20) RaidDragFrame:SetBackdrop({bgFile = "Interface/Tooltips/UI-Tooltip-Background", edgeFile = "", tile = true, tileSize = 16, edgeSize = 16, insets = { left = 0, right = 0, top = 0, bottom = 0 }}) RaidDragFrame:SetWidth(settings.RaidFrames.Width/2) RaidDragFrame:SetHeight(10) RaidDragFrame:SetAlpha(0) RaidDragFrame:SetScript("OnEnter", function(self) self:SetAlpha(1) end) RaidDragFrame:SetScript("OnLeave", function(self) self:SetAlpha(0) end) RaidDragFrame:Show() make_me_movable(RaidDragFrame) local raid = oUF:Spawn('header', 'oUF_Raid', nil) raid:SetPoint("TOPLEFT", RaidDragFrame, "BOTTOMLEFT", -2, 0) raid:SetManyAttributes( 'showPlayer', 1, 'showSolo', 1, 'showParty', 1, 'showRaid', 1, 'xoffset', 0, 'yOffset', 0, 'point', 'TOP', 'groupFilter', '1,2,3,4,5,6,7,8', 'groupingOrder', '1,2,3,4,5,6,7,8', 'groupBy', 'GROUP', 'maxColumns', 8, 'unitsPerColumn', 5, 'columnSpacing', 0, 'columnAnchorPoint', 'LEFT' ) raid:Show() local pets = oUF:Spawn('header', 'oUF_Pet', 'SecureGroupPetHeaderTemplate') pets:SetPoint('TOPLEFT', oUF_Raid, 'TOPRIGHT') pets:SetManyAttributes( 'showSolo', 1, 'showParty', 1, 'showRaid', 1, 'xoffset', 0, 'yOffset', 0, 'point', 'BOTTOM', 'maxColumns', 5, 'unitsPerColumn', 5, 'columnSpacing', 0, 'columnAnchorPoint', 'RIGHT' ) pets:Show()