Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- ################################################################
- #
- # oUF_Mosphet by Mosphet <Vex> @ Bloodfeather EU
- #
- ################################################################
- ]]
- -- Gief addon name space
- local _, oUF_Mosphet = ...
- local tags = oUF_Mosphet.tags
- -- Create the UI frame to work in
- oUF_Mosphet.main = CreateFrame("Frame", nil, UIParent)
- local main = oUF_Mosphet.main
- BuffFrame:Hide()
- -- Set the Media Path
- local mediapath = [=[Interface\AddOns\oUF_Mosphet\media\]=]
- local fontlol = mediapath..[=[fonts\font.ttf]=]
- local texture = mediapath..[=[textures\statusbar]=]
- local backdrop = mediapath..[=[Interface\ChatFrame\ChatFrameBackground]=]
- local bgtexture = mediapath..[=[textures\bgtexture]=]
- local backdrop_edge = mediapath..[=[textures\backdrop_edge]=]
- local bordertex = mediapath..[=[textures\borderTex]=]
- local buttontex = mediapath..[=[textures\buttonborder1]=]
- local backdrop = {
- bgFile = [=[Interface\ChatFrame\ChatFrameBackground]=],
- insets = {top = 0, left = 0, bottom = 0, right = 0},
- }
- -- Colour (Color) shit, GG American spelling.....
- local colors = setmetatable({
- power = setmetatable({
- ["MANA"] = {0.31, 0.45, 0.63},
- ["RAGE"] = {0.69, 0.31, 0.31},
- ["FOCUS"] = {0.71, 0.43, 0.27},
- ["ENERGY"] = {0.65, 0.63, 0.35},
- ["HAPPINESS"] = {0.19, 0.58, 0.58},
- ["RUNES"] = {0.55, 0.57, 0.61},
- ["RUNIC_POWER"] = {0, 0.82, 1},
- ["AMMOSLOT"] = {0.8, 0.6, 0},
- ["FUEL"] = {0, 0.55, 0.5},
- ["POWER_TYPE_STEAM"] = {0.55, 0.57, 0.61},
- ["POWER_TYPE_PYRITE"] = {0.60, 0.09, 0.17},
- }, {__index = oUF.colors.power}),
- happiness = setmetatable({
- [1] = {0.69, 0.31, 0.31},
- [2] = {0.65, 0.63, 0.35},
- [3] = {0.33, 0.59, 0.33},
- }, {__index = oUF.colors.happiness}),
- }, {__index = oUF.colors})
- -- Obvious
- local runeloadcolors = {
- [1] = {0.69, 0.31, 0.31},
- [2] = {0.69, 0.31, 0.31},
- [3] = {0.33, 0.59, 0.33},
- [4] = {0.33, 0.59, 0.33},
- [5] = {0.31, 0.45, 0.63},
- [6] = {0.31, 0.45, 0.63},
- }
- -- Tagging mobs
- oUF.colors.tapped = {0.55, 0.57, 0.61}
- -- Font stuff
- local SetFontString = function(parent, fontName, fontHeight, fontStyle)
- local fs = parent:CreateFontString(nil, "OVERLAY")
- fs:SetFont(fontName, fontHeight, fontStyle)
- fs:SetShadowColor(0, 0, 0)
- fs:SetShadowOffset(0.75, -0.75)
- return fs
- end
- --[[
- ################################################################
- #
- # Functions
- #
- ################################################################
- ]]
- -- Derp Need this for my update hook
- local updateAllElements = function(frame)
- for _, v in ipairs(frame.__elements) do
- v(frame, "UpdateElement", frame.unit)
- end
- end
- -- Menu when right clicking the frames
- local Menu = function(self)
- local unit = self.unit:gsub("(.)", string.upper, 1)
- if _G[unit.."FrameDropDown"] then
- ToggleDropDownMenu(1, nil, _G[unit.."FrameDropDown"], "cursor")
- elseif (self.unit:match("party")) then
- ToggleDropDownMenu(1, nil, _G["PartyMemberFrame"..self.id.."DropDown"], "cursor")
- else
- FriendsDropDown.unit = self.unit
- FriendsDropDown.id = self.id
- FriendsDropDown.initialize = RaidFrameDropDown_Initialize
- ToggleDropDownMenu(1, nil, FriendsDropDown, "cursor")
- end
- end
- -- Short Value
- local ShortValue = function(value)
- if value >= 1e6 then
- return ("%.1fm"):format(value / 1e6):gsub("%.?0+([km])$", "%1")
- elseif value >= 1e3 or value <= -1e3 then
- return ("%.1fk"):format(value / 1e3):gsub("%.?0+([km])$", "%1")
- else
- return value
- end
- end
- local PostUpdateHealth = function(health, unit, min, max)
- if not UnitIsConnected(unit) or UnitIsDead(unit) or UnitIsGhost(unit) then
- local class = select(2, UnitClass(unit))
- local color = UnitIsPlayer(unit) and oUF.colors.class[class] or {0.84, 0.75, 0.65}
- if not UnitIsConnected(unit) then
- health.value:SetText("|cffD7BEA5".."Offline".."|r")
- elseif UnitIsDead(unit) then
- health.value:SetText("|cffD7BEA5".."Dead".."|r")
- elseif UnitIsGhost(unit) then
- health.value:SetText("|cffD7BEA5".."Ghost".."|r")
- end
- else
- local r, g, b
- r, g, b = oUF.ColorGradient(min/max, 0.69, 0.31, 0.31, 0.71, 0.43, 0.27, 0.17, 0.17, 0.24)
- r, g, b = oUF.ColorGradient(min/max, 0.69, 0.31, 0.31, 0.65, 0.63, 0.35, 0.33, 0.59, 0.33)
- if unit == "player" and health:GetAttribute("normalUnit") ~= "pet" then
- health.value:SetFormattedText("|cffAF5050%d|r |cffD7BEA5-|r |cff%02x%02x%02x%d%%|r", min, r * 255, g * 255, b * 255, floor(min / max * 100))
- elseif unit == "target" then
- health.value:SetFormattedText("|cff%02x%02x%02x%d%%|r |cffD7BEA5-|r |cffAF5050%d|r", r * 255, g * 255, b * 255, floor(min / max * 100), min)
- else
- health.value:SetFormattedText("|cff%02x%02x%02x%d%%|r", r * 255, g * 255, b * 255, floor(min / max * 100))
- end
- end
- end
- local PostUpdateName = function(self, power)
- self.info:ClearAllPoints()
- self.info:SetPoint("CENTER", 0, -4)
- end
- local PreUpdatePower = function(power, unit)
- local _, pType = UnitPowerType(unit)
- local color = colors.power[pType]
- if color then
- power:SetStatusBarColor(color[1], color[2], color[3])
- end
- end
- local PostUpdatePower = function(power, unit, min, max)
- local self = power:GetParent()
- local pType, pToken = UnitPowerType(unit)
- local color = colors.power[pToken]
- if color then
- power.value:SetTextColor(color[1], color[2], color[3])
- end
- if not UnitIsConnected(unit) or UnitIsDead(unit) or UnitIsGhost(unit) then
- local class = select(2, UnitClass(unit))
- local color = UnitIsPlayer(unit) and oUF.colors.class[class] or {0.84, 0.75, 0.65}
- power:SetValue(0)
- power.bg:SetVertexColor(color[1] * 0.5, color[2] * 0.5, color[3] * 0.5)
- end
- if unit ~= "player" and unit ~= "pet" and unit ~= "target" then return end
- if min == 0 then
- power.value:SetText()
- elseif not UnitIsPlayer(unit) and not UnitPlayerControlled(unit) or not UnitIsConnected(unit) then
- power.value:SetText()
- elseif UnitIsDead(unit) or UnitIsGhost(unit) then
- power.value:SetText()
- elseif min == max and (pType == 2 or pType == 3 and pToken ~= "POWER_TYPE_PYRITE") then
- power.value:SetText()
- else
- if min ~= max then
- if pType == 0 then
- if unit == "target" then
- power.value:SetFormattedText("%s |cffD7BEA5-|r %d%%", max - (max - min), floor(min / max * 100))
- elseif unit == "player" and power:GetAttribute("normalUnit") == "pet" or unit == "pet" then
- power.value:SetFormattedText("%d%%", floor(min / max * 100))
- else
- power.value:SetFormattedText("%d%% |cffD7BEA5-|r %d", floor(min / max * 100), max - (max - min))
- end
- else
- power.value:SetText(max - (max - min))
- end
- else
- if unit == "pet" or unit == "target" then
- power.value:SetText(min)
- else
- power.value:SetText(min)
- end
- end
- end
- if self.Info then
- if unit == "pet" or unit == "target" then PostUpdateName(self, power) end
- end
- end
- local PostCreateIcon = function(self, button)
- button.cd:SetReverse()
- button.icon:SetTexCoord(0.1, 0.9, 0.1, 0.9)
- button.icon:SetDrawLayer("BACKGROUND")
- --count
- button.count:ClearAllPoints()
- button.count:SetPoint("TOPLEFT", 5, -3)
- button.count:SetTextColor(0.7,0.7,0.7)
- --helper
- local helper = CreateFrame("Frame", nil, button)
- helper:SetFrameLevel(0)
- helper:SetPoint("TOPLEFT",-5,5)
- helper:SetPoint("BOTTOMRIGHT",5,-5)
- helper:SetBackdrop{edgeFile = bgtexture, edgeSize = 3, insets = {left = 0, right = 0, top = 0, bottom = 0}}
- helper:SetBackdropColor(0,0,0,0.7)
- helper:SetBackdropBorderColor(0,0,0,1)
- end
- local PostCastStart = function(Castbar, unit, name, rank, text, castid)
- Castbar.channeling = false
- if unit == "vehicle" then unit = "player" end
- if Castbar.interrupt and UnitCanAttack("player", unit) then
- Castbar:SetStatusBarColor(0.69, 0.31, 0.31)
- else
- Castbar:SetStatusBarColor(0.55, 0.57, 0.61)
- end
- end
- local PostChannelStart = function(Castbar, unit, name, rank, text)
- Castbar.channeling = true
- if unit == "vehicle" then unit = "player" end
- if Castbar.interrupt and UnitCanAttack("player", unit) then
- Castbar:SetStatusBarColor(0.69, 0.31, 0.31)
- else
- Castbar:SetStatusBarColor(0.55, 0.57, 0.61)
- end
- end
- local CustomCastTimeText = function(self, duration)
- self.Time:SetText(("%.1f / %.1f"):format(self.channeling and duration or self.max - duration, self.max))
- end
- local CustomCastDelayText = function(self, duration)
- self.Time:SetText(("%.1f |cffaf5050%s %.1f|r"):format(self.channeling and duration or self.max - duration, self.channeling and "- " or "+", self.delay))
- end
- local FormatTime = function(s)
- local day, hour, minute = 86400, 3600, 60
- if s >= day then
- return format("%dd", floor(s/day + 0.5)), s % day
- elseif s >= hour then
- return format("%dh", floor(s/hour + 0.5)), s % hour
- elseif s >= minute then
- if s <= minute * 5 then
- return format("%d:%02d", floor(s/60), s % minute), s - floor(s)
- end
- return format("%dm", floor(s/minute + 0.5)), s % minute
- elseif s >= minute / 12 then
- return floor(s + 0.5), (s * 100 - floor(s * 100))/100
- end
- return format("%.1f", s), (s * 100 - floor(s * 100))/100
- end
- local CreateAuraTimer = function(self, elapsed)
- if self.timeLeft then
- self.elapsed = (self.elapsed or 0) + elapsed
- if self.elapsed >= 0.1 then
- if not self.first then
- self.timeLeft = self.timeLeft - self.elapsed
- else
- self.timeLeft = self.timeLeft - GetTime()
- self.first = false
- end
- if self.timeLeft > 0 then
- local time = FormatTime(self.timeLeft)
- self.remaining:SetText(time)
- if self.timeLeft < 5 then
- self.remaining:SetTextColor(0.69, 0.31, 0.31)
- else
- self.remaining:SetTextColor(0.84, 0.75, 0.65)
- end
- else
- self.remaining:Hide()
- self:SetScript("OnUpdate", nil)
- end
- self.elapsed = 0
- end
- end
- end
- local CancelAura = function(self, button)
- if button == "RightButton" and not self.debuff then
- CancelUnitBuff("player", self:GetID())
- end
- end
- local PostCreateAura = function(auras, button)
- button.backdrop = CreateFrame("Frame", nil, button)
- button.backdrop:SetPoint("TOPLEFT", button, -3, 3)
- button.backdrop:SetPoint("BOTTOMRIGHT", button, 3, -3)
- button.backdrop:SetFrameStrata("BACKGROUND")
- button.backdrop.border = CreateFrame("Frame", nil, button)
- button.backdrop.border:SetPoint("TOPLEFT", button.backdrop, "TOPLEFT", -1, 1)
- button.backdrop.border:SetPoint("BOTTOMRIGHT", button.backdrop, "BOTTOMRIGHT", 1, -1)
- button.backdrop.border:SetBackdrop{edgeFile = bgtexture, edgeSize = 5, insets = {left = 1, right = 1, top = 1, bottom = 1}}
- button.backdrop.border:SetBackdropBorderColor(0, 0, 0, 1)
- button.backdrop.border:SetFrameStrata("BACKGROUND")
- button.count = SetFontString(button, fontlol, 9, "OUTLINE")
- button.count:SetPoint("TOP", 0, -3)
- button.count:SetTextColor(0.84, 0.75, 0.65)
- button.cd.noOCC = true
- button.cd.noCooldownCount = true
- auras.disableCooldown = true
- button.overlay:SetTexture(buttontex)
- button.overlay:SetPoint("TOPLEFT", button, -2, 2)
- button.overlay:SetPoint("BOTTOMRIGHT", button, 2, -2)
- button.overlay:SetTexCoord(0, 1, 0.02, 1)
- button.overlay.Hide = function(self) end
- button.remaining = SetFontString(button, fontlol, 9, "OUTLINE")
- button.remaining:SetPoint("BOTTOM", 1, 3)
- if unit == "player" then
- button:SetScript("OnMouseUp", CancelAura)
- end
- end
- local PostUpdateIcon = function(icons, unit, icon, index, offset)
- local _, _, _, _, _, duration, expirationTime, unitCaster, _ = UnitAura(unit, index, icon.filter)
- if unitCaster == "player" or unitCaster == "pet" or unitCaster == "vehicle" then
- if icon.debuff then
- icon.overlay:SetVertexColor(0.69, 0.31, 0.31)
- else
- icon.overlay:SetVertexColor(0.33, 0.59, 0.33)
- end
- else
- if UnitIsEnemy("player", unit) then
- if icon.debuff then
- icon.icon:SetDesaturated(true)
- end
- end
- icon.overlay:SetVertexColor(0.84, 0.75, 0.65)
- end
- if duration and duration > 0 then
- icon.remaining:Show()
- icon.timeLeft = expirationTime
- icon:SetScript("OnUpdate", CreateAuraTimer)
- else
- icon.remaining:Hide()
- icon.timeLeft = math.huge
- icon:SetScript("OnUpdate", nil)
- end
- icon.first = true
- end
- local SortAura = function(a, b)
- return (a.timeLeft and a.timeLeft) > (b.timeLeft and b.timeLeft)
- end
- local PreSetPosition = function(auras)
- sort(auras, SortAura)
- end
- --[[
- ################################################################
- #
- # Frame Creation
- #
- ################################################################
- ]]
- local CreateStyle = function(self, unit)
- self.menu = Menu
- self.colors = colors
- self:RegisterForClicks("AnyUp")
- self:SetAttribute("type2", "menu")
- self:SetScript("OnEnter", UnitFrame_OnEnter)
- self:SetScript("OnLeave", UnitFrame_OnLeave)
- self:HookScript("OnShow", updateAllElements)
- self.FrameBackdrop = CreateFrame("Frame", nil, self)
- self.FrameBackdrop:SetPoint("TOPLEFT", self, "TOPLEFT", -5, 5)
- self.FrameBackdrop:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", 5, -5)
- self.FrameBackdrop:SetFrameStrata("LOW")
- self.FrameBackdrop:SetBackdrop {
- edgeFile = bgtexture, edgeSize = 5,
- insets = {left = 0, right = 0, top = 0, bottom = 0}
- }
- self.FrameBackdrop:SetBackdropColor(0, 0, 0, 0)
- self.FrameBackdrop:SetBackdropBorderColor(0, 0, 0, 0.8)
- self.FrameIBorderBackdrop = CreateFrame("Frame", nil, self)
- self.FrameIBorderBackdrop:SetPoint("TOPLEFT", self, "TOPLEFT", -1, 1)
- self.FrameIBorderBackdrop:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", 1, -1)
- self.FrameIBorderBackdrop:SetFrameStrata("LOW")
- self.FrameIBorderBackdrop:SetFrameLevel(6)
- self.FrameIBorderBackdrop:SetBackdrop({
- bgFile = "Interface\\Buttons\\WHITE8X8",
- insets = {left = 1,right = 1,top = 1,bottom = 1}
- });
- self.FrameIBorderBackdrop:SetBackdropColor(0.1, 0.1, 0.1, 1)
- --[[
- ################################################################
- #
- # Player/Target Frames
- #
- ################################################################
- ]]
- if unit == "player" or unit == "target" then
- -- Player/Target Health Size
- self.Health = CreateFrame("StatusBar", nil, self)
- self.Health:SetSize(275, 23)
- self.Health:SetPoint("TOPLEFT", self, "TOPLEFT", 0, 0)
- self.Health:SetPoint("TOPRIGHT", self, "TOPRIGHT", 0, 0)
- self.Health:SetStatusBarTexture(texture)
- -- Options
- self.Health.frequentUpdates = true
- self.Health.colorTapping = true
- self.Health.colorDisconnected = true
- self.Health.colorHappiness = true
- self.Health.colorClass = true
- self.Health.colorReaction = true
- self.Health.colorHealth = true
- -- oUF Smooth Support
- if(IsAddOnLoaded("oUF_Smooth")) then
- self.Health.Smooth = true
- end
- --[[ Healcomm 4 Support
- if(IsAddOnLoaded("oUF_HealComm4")) then
- self.HealCommBar = CreateFrame('StatusBar', nil, self.Health)
- self.HealCommBar:SetHeight(0)
- self.HealCommBar:SetWidth(0)
- self.HealCommBar:SetStatusBarTexture(self.Health:GetStatusBarTexture():GetTexture())
- self.HealCommBar:SetStatusBarColor(0, 0, 0, 0.5)
- self.HealCommBar:SetPoint('LEFT', self.Health, 'LEFT')
- -- optional flag to show overhealing
- self.allowHealCommOverflow = false
- -- limit to the next 3 seconds incoming heals
- self.HealCommTimeframe = 3
- end]]
- -- New Heal Prediction stuff :D
- self.mhpb = CreateFrame("StatusBar", nil, self.Health)
- self.mhpb:SetPoint('TOPLEFT', self.Health:GetStatusBarTexture(), 'TOPRIGHT', 0, 0)
- self.mhpb:SetPoint('BOTTOMLEFT', self.Health:GetStatusBarTexture(), 'BOTTOMRIGHT', 0, 0)
- self.mhpb:SetWidth(275)
- self.mhpb:SetStatusBarTexture(texture)
- self.mhpb:SetStatusBarColor(0, 0, 0, 0.5)
- self.ohpb = CreateFrame("StatusBar", nil, self.Health)
- self.ohpb:SetPoint('TOPLEFT', self.mhpb:GetStatusBarTexture(), 'TOPRIGHT', 0, 0)
- self.ohpb:SetPoint('BOTTOMLEFT', self.mhpb:GetStatusBarTexture(), 'BOTTOMRIGHT', 0, 0)
- self.ohpb:SetWidth(275)
- self.ohpb:SetStatusBarTexture(texture)
- self.ohpb:SetStatusBarColor(0, 0, 0, 0.5)
- -- Register Heal Prediction with oUF. Derp!
- self.HealPrediction = {
- myBar = self.mhpb,
- otherBar = self.ohpb,
- maxOverflow = 1,
- }
- -- Player Power Position and size
- self.Power = CreateFrame("StatusBar", nil, self)
- self.Power:SetHeight(4)
- self.Power:SetPoint("TOPLEFT", self.Health, "BOTTOMLEFT", 0, -1)
- self.Power:SetPoint("TOPRIGHT", self.Health, "BOTTOMRIGHT", 0, -1)
- self.Power:SetStatusBarTexture(texture)
- -- Add a background and border
- self.Power.bg = self.Power:CreateTexture(nil, 'BACKGROUND')
- self.Power.bg:SetAllPoints()
- self.Power.bg:SetTexture(texture)
- self.Power.border = CreateFrame("Frame", nil, self)
- self.Power.border:SetPoint("TOPLEFT", self.Power, "TOPLEFT", 0, 1)
- self.Power.border:SetPoint("BOTTOMRIGHT", self.Power, "BOTTOMRIGHT", 0, -1)
- self.Power.border:SetFrameStrata("LOW")
- self.Power.border:SetFrameLevel(5)
- self.Power.border:SetBackdrop({bgFile = "Interface\\Buttons\\WHITE8X8", insets = {left = 0,right = 0,top = 0,bottom = 0}});
- self.Power.border:SetBackdropColor(0, 0, 0, 1)
- -- Options
- self.Power.frequentUpdates = true
- self.Power.colorTapping = true
- self.Power.colorDisconnected = true
- self.Power.colorHappiness = true
- self.Power.colorPower = true
- self.Power.colorClass = true
- self.Power.colorReaction = true
- self.Power.bg.colorClass = false
- self.Power.bg.colorPower = false
- -- Make the background darker.
- self.Power.bg.multiplier = .5
- -- Info Panel
- self.info = CreateFrame("FRAME", nil, self)
- self.info:SetHeight(10)
- self.info:SetPoint("TOPLEFT", self.Power, "BOTTOMLEFT", 0, 0)
- self.info:SetPoint("TOPRIGHT", self.Power, "BOTTOMRIGHT", 0, 0)
- self.info.border = CreateFrame("Frame", nil, self)
- self.info.border:SetPoint("TOPLEFT", self.info, "TOPLEFT", -1, 0)
- self.info.border:SetPoint("BOTTOMRIGHT", self.info, "BOTTOMRIGHT", 1, -10)
- self.info.border:SetBackdrop{edgeFile = bgtexture, edgeSize = 1, insets = {left = 0, right = 0, top = 0, bottom = 0}}
- self.info.border:SetBackdropBorderColor(0.6, 0.6, 0.6, 1)
- self.info.border:SetFrameLevel(10)
- -- Holy Power
- if class == "PALADIN" then
- if unit == "player" then
- self.hlypwr = CreateFrame('StatusBar', nil, self)
- self.hlypwr:SetPoint('TOPLEFT', self, 'TOPRIGHT', 0, 2)
- self.hlypwr:SetSize(275, 5)
- self.hlypwr:SetBackdrop(texture)
- self.hlypwr:SetBackdropColor(0, 0, 0)
- for id = 1, 3 do
- self.hp = self.hlypwr:CreateTexture(nil, 'OVERLAY')
- self.hp:SetTexture(1, 0.8, 0)
- if id > 1 then
- self.hp:SetSize(91, 5)
- self.hp:SetPoint('BOTTOMLEFT', self.hlypwr[id-1], 'BOTTOMRIGHT', 2, 0)
- else
- self.hp:SetSize(91, 5)
- self.hp:SetPoint('BOTTOMLEFT', self.hlypwr, 'BOTTOMLEFT', 0, 0)
- end
- self.hlypwr[id] = self.hp
- end
- -- Register to oUF
- self.HolyPower = self.hlypwr
- end
- end
- -- Buffs/Debuffs
- self.Buffs = CreateFrame("Frame", nil, self)
- if unit == "player" then
- self.Buffs:SetHeight(60)
- self.Buffs:SetWidth(600)
- self.Buffs.size = 35
- self.Buffs.spacing = 5
- elseif unit == "target" then
- self.Buffs:SetHeight(40)
- self.Buffs:SetWidth(210)
- self.Buffs.size = 26
- self.Buffs.spacing = 3
- end
- self.Buffs.PreSetPosition = PreSetPosition
- self.Buffs.PostCreateIcon = PostCreateAura
- self.Buffs.PostUpdateIcon = PostUpdateIcon
- self.Debuffs = CreateFrame("Frame", nil, self)
- if unit == "player" then
- self.Debuffs:SetHeight(80)
- self.Debuffs:SetWidth(460)
- self.Debuffs.size = 40
- self.Debuffs.spacing = 6
- elseif unit == "target" then
- self.Debuffs:SetHeight(52)
- self.Debuffs:SetWidth(236)
- self.Debuffs.size = 26
- self.Debuffs.spacing = 3
- end
- self.Debuffs.PreSetPosition = PreSetPosition
- self.Debuffs.PostCreateIcon = PostCreateAura
- self.Debuffs.PostUpdateIcon = PostUpdateIcon
- if unit == "player" then
- self.Buffs:SetPoint("TOP", UIParent, "TOP", 485, -18)
- self.Buffs.initialAnchor = "TOPRIGHT"
- self.Buffs["growth-x"] = "LEFT"
- self.Buffs["growth-y"] = "DOWN"
- self.Buffs.num = 30
- self.Debuffs:SetPoint("TOP", UIParent, "TOP", 525, -133)
- self.Debuffs.initialAnchor = "TOPRIGHT"
- self.Debuffs["growth-x"] = "LEFT"
- self.Debuffs["growth-y"] = "DOWN"
- elseif unit == "target" then
- self.Buffs:SetPoint("TOPLEFT", self, "TOPRIGHT", 5, -1)
- self.Buffs.initialAnchor = "TOPLEFT"
- self.Buffs["growth-x"] = "RIGHT"
- self.Buffs["growth-y"] = "UP"
- self.Debuffs:SetPoint("TOPLEFT", self, "TOPRIGHT", 5, -32)
- self.Debuffs.initialAnchor = "TOPLEFT"
- self.Debuffs["growth-x"] = "RIGHT"
- self.Debuffs["growth-y"] = "DOWN"
- self.Debuffs.num = 24
- end
- -- Health/Power/Name Values and Handlers
- self.Health.PostUpdate = PostUpdateHealth
- self.Power.PostUpdate = PostUpdatePower
- -- Health/Power
- self.Health.value = SetFontString(self.info, fontlol, 9, "OUTLINE")
- self.Power.value = SetFontString(self.info, fontlol, 9, "OUTLINE")
- if unit == "player" then
- self.Health.value:SetPoint("LEFT", self.info, "LEFT", 5, -5)
- self.Power.value:SetPoint("RIGHT", self.info, "RIGHT", -5, -5)
- elseif unit == "target" then
- self.Health.value:SetPoint("RIGHT", self.info, "RIGHT", -5, -5)
- self.Power.value:SetPoint("LEFT", self.info, "LEFT", 5, -5)
- self.Name = self.Health:CreateFontString(nil, "OVERLAY")
- self.Name:SetFont(fontlol, 9, "OUTLINE")
- self:Tag(self.Name, "[afkdnd][name]")
- self.Name:SetPoint("LEFT", self.Health, "LEFT", 10, 0)
- end
- --[[
- ################################################################
- #
- # Pet/Focus Frames
- #
- ################################################################
- ]]
- else
- -- Pet/Focus Health Size
- self.Health = CreateFrame("StatusBar", nil, self)
- self.Health:SetHeight(21.5)
- self.Health:SetPoint("TOPLEFT", self, "TOPLEFT", 0, 0)
- self.Health:SetPoint("TOPRIGHT", self, "TOPRIGHT", 0, 0)
- self.Health:SetStatusBarTexture(texture)
- -- Options
- self.Health.frequentUpdates = true
- self.Health.colorTapping = true
- self.Health.colorDisconnected = true
- self.Health.colorHappiness = true
- self.Health.colorClass = true
- self.Health.colorReaction = true
- self.Health.colorHealth = true
- self.Name = self.Health:CreateFontString(nil, "OVERLAY")
- self.Name:SetFont(fontlol, 9, "OUTLINE")
- self:Tag(self.Name, "[afkdnd][abbrevname]")
- self.Name:SetPoint("LEFT", self.Health, "LEFT", 10, 0)
- self.Health.value = SetFontString(self.Health, fontlol, 9, "OUTLINE")
- self.Health.value:SetPoint("RIGHT", self.Health, "RIGHT", -10, 0)
- end
- --[[
- ################################################################
- #
- # Cast Bars
- #
- ################################################################
- ]]
- self.Castbar = CreateFrame("StatusBar", nil, self)
- self.Castbar:SetStatusBarTexture(texture)
- self.Castbar.PostCastStart = PostCastStart
- self.Castbar.PostChannelStart = PostChannelStart
- if unit == "player" then
- self.Castbar:SetPoint("TOPLEFT", self, 25, -53)
- self.Castbar:SetPoint("BOTTOMRIGHT", self, -1, -25)
- elseif unit == "target" then
- self.Castbar:SetPoint("TOPLEFT", self, 1, -53)
- self.Castbar:SetPoint("BOTTOMRIGHT", self, -26, -25)
- elseif unit == "focus" then
- self.Castbar:SetPoint("TOPLEFT", self, 0, -53)
- self.Castbar:SetPoint("BOTTOMRIGHT", self, 0, -51)
- else
- self.Castbar:SetPoint("TOPLEFT", self, 0, -27)
- self.Castbar:SetPoint("BOTTOMRIGHT", self, 0, -25)
- end
- -- Add a background and border
- self.Castbar.bg = self.Castbar:CreateTexture(nil, 'BACKGROUND')
- self.Castbar.bg:SetPoint("TOPLEFT", self.Castbar, "TOPLEFT",-1, 1)
- self.Castbar.bg:SetPoint("BOTTOMRIGHT", self.Castbar, "BOTTOMRIGHT", 1, -1)
- self.Castbar.bg:SetTexture(texture)
- self.Castbar.bg:SetVertexColor(.1,.1,.1)
- self.Castbar.border = CreateFrame("Frame", nil, self)
- self.Castbar.border:SetPoint("TOPLEFT", self, "TOPLEFT", -2, 2)
- self.Castbar.border:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", 2, -2)
- self.Castbar.border:SetBackdrop{edgeFile = bgtexture, edgeSize = 1, insets = {left = 0, right = 0, top = 0, bottom = 0}}
- self.Castbar.border:SetBackdropBorderColor(0.1, 0.1, 0.1, 1)
- self.Castbar.border = CreateFrame("Frame", nil, self)
- self.Castbar.border:SetPoint("TOPLEFT", self.Castbar, "TOPLEFT", -5, 5)
- self.Castbar.border:SetPoint("BOTTOMRIGHT", self.Castbar, "BOTTOMRIGHT", 5, -5)
- self.Castbar.border:SetBackdrop{edgeFile = bgtexture, edgeSize = 5, insets = {left = 5, right = 5, top = 5, bottom = 5}}
- self.Castbar.border:SetBackdropBorderColor(0, 0, 0, 0.7)
- self.Castbar.Time = SetFontString(self.Castbar, fontlol, 9, "OUTLINE")
- self.Castbar.Time:SetPoint("RIGHT", self.Castbar, -5, 0)
- self.Castbar.Time:SetTextColor(1, 1, 1)
- self.Castbar.Text = SetFontString(self.Castbar, fontlol, 9, "OUTLINE")
- self.Castbar.Text:SetPoint("LEFT", 10, 1)
- self.Castbar.Text:SetTextColor(1, 1, 1)
- self.Castbar.Icon = self.Castbar:CreateTexture(nil, "ARTWORK")
- self.Castbar.Icon:SetSize(20,20)
- self.Castbar.Icon:SetTexCoord(0, 1, 0, 1)
- if unit == "player" then
- self.Castbar.Icon:SetPoint("LEFT", -25, 0)
- elseif unit == "target" then
- self.Castbar.Icon:SetPoint("RIGHT", 25, 0)
- end
- if unit == "player" or unit == "target" then
- self.IconOverlay = self.Castbar:CreateTexture(nil, "OVERLAY")
- self.IconOverlay:SetTexture(buttontex)
- self.IconOverlay:SetPoint("TOPLEFT", self.Castbar.Icon, -1, 1)
- self.IconOverlay:SetPoint("BOTTOMRIGHT", self.Castbar.Icon, 1, -1)
- self.IconOverlay:SetVertexColor(0, 0, 0)
- self.IconBackdrop = CreateFrame("Frame", nil, self.Castbar)
- self.IconBackdrop:SetPoint("TOPLEFT", self.Castbar.Icon, -3, 3)
- self.IconBackdrop:SetPoint("BOTTOMRIGHT", self.Castbar.Icon, 3, -3)
- self.IconBackdrop:SetBackdrop{edgeFile = bgtexture, edgeSize = 3, insets = {left = 2, right = 2, top = 2, bottom = 2}}
- self.IconBackdrop:SetBackdropColor(0, 0, 0, 0)
- self.IconBackdrop:SetBackdropBorderColor(0, 0, 0, 0.7)
- end
- self.Castbar:HookScript("OnShow", function() self.Castbar.Text:Show(); self.Castbar.Time:Show(); self.Castbar.bg:Show(); self.Castbar.border:Show(); self.Castbar.Icon:Show() end)
- self.Castbar:HookScript("OnHide", function() self.Castbar.Text:Hide(); self.Castbar.Time:Hide(); self.Castbar.bg:Hide(); self.Castbar.border:Hide(); self.Castbar.Icon:Hide() end)
- self:RegisterEvent("UNIT_SPELLCAST_SENT", function(self, event, caster)
- if caster == "player" or caster == "vehicle" then
- self.Castbar.castSent = GetTime()
- end
- end)
- --[[
- ################################################################
- #
- # Frame Sizing
- #
- ################################################################
- ]]
- if unit == "player" or unit == "target" then
- --[[self:SetAttribute("initial-height", 47)
- self:SetAttribute("initial-width", 275)]]
- self:SetSize(275, 47)
- else
- --[[self:SetAttribute("initial-height", 21.5)
- self:SetAttribute("initial-width", 175)]]
- self:SetSize(175, 21.5)
- end
- end
- --[[
- ################################################################
- #
- # Spawns and Handlers
- #
- ################################################################
- ]]
- oUF:RegisterStyle("oUF_Mosphet", CreateStyle)
- oUF:Factory(function(self)
- oUF:SetActiveStyle"oUF_Mosphet"
- self:Spawn("player", "oUF_Mosphet_player"):SetPoint("BOTTOM", UIParent, -235, 120)
- self:Spawn("target", "oUF_Mosphet_target"):SetPoint("BOTTOM", UIParent, 234.5, 120)
- self:Spawn("pet", "oUF_Mosphet_playerpet"):SetPoint("BOTTOM", UIParent, 0, 145.5)
- self:Spawn("focus", "oUF_Mosphet_focus"):SetPoint("BOTTOM", UIParent, 0, 145.5)
- self:Spawn("targettarget", "oUF_Mosphet_targettarget"):SetPoint("BOTTOM", UIParent, 0, 120)
- main:RegisterEvent("PLAYER_LOGIN")
- main:RegisterEvent("PARTY_LEADER_CHANGED")
- main:RegisterEvent("PARTY_MEMBERS_CHANGED")
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement