Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- ################################################################
- #
- # oUF_MosphetRaid by Mosphet @ Bloodfeather EU
- #
- ################################################################
- ]]
- -- Gief addon name space
- local _, oUF_MosphetRaid = ...
- local tags = oUF_MosphetRaid.tags
- -- Create the UI frame to work in
- oUF_MosphetRaid.main = CreateFrame("Frame", nil, UIParent)
- -- xD
- local main = oUF_MosphetRaid.main
- -- Set the Media Path
- local mediapath = [=[Interface\AddOns\oUF_MosphetRaid\media\]=]
- -- Mediaz nom nom nom
- local fontlol = mediapath..[=[fonts\font.ttf]=]
- local texture = mediapath..[=[textures\statusbar]=]
- local bgtexture = mediapath..[=[textures\bgtexture]=]
- local backdrop_edge = mediapath..[=[textures\backdrop_edge]=]
- local raidiconcolor = { -- taken from GridStatusRaidIcons
- [1] = {r = 1.0, g = 0.92, b = 0, hex = "ffeb00"}, -- Yellow 4-point Star
- [2] = {r = 0.98, g = 0.57, b = 0, hex = "fa9100"}, -- Orange Circle
- [3] = {r = 0.83, g = 0.22, b = 0.9, hex = "d438e6"}, -- Purple Diamond
- [4] = {r = 0.04, g = 0.95, b = 0, hex = "0af200"}, -- Green Triangle
- [5] = {r = 0.7, g = 0.82, b = 0.875, hex = "b3d1df"}, -- White Crescent Moon
- [6] = {r = 0, g = 0.71, b = 1, hex = "00b5ff"}, -- Blue Square
- [7] = {r = 1.0, g = 0.24, b = 0.168, hex = "ff3d2b"}, -- Red 'X' Cross
- [8] = {r = 0.98, g = 0.98, b = 0.98, hex = "fafafa"} -- White Skull
- }
- -- Cba writing this same piece over and over so heres a variable with it in.
- local backdrop = {
- bgFile = [=[Interface\ChatFrame\ChatFrameBackground]=],
- insets = {top = 0, left = 0, bottom = 0, right = 0},
- }
- -- Font stuff
- local SetFontString = function(parent, fontName, fontHeight, fontStyle)
- local fs = parent:CreateFontString(nil, "OVERLAY")
- fs:SetFont(fontName, fontHeight, fontStyle)
- fs:SetJustifyH("LEFT")
- fs:SetShadowColor(0, 0, 0)
- fs:SetShadowOffset(0.75, -0.75)
- return fs
- end
- --[[
- ################################################################
- #
- # Functions
- #
- ################################################################
- ]]
- -- Don't think we need this anymore but I'll leave it here anyway.
- --[[local updateRIcon = function(self, event)
- local index = GetRaidTargetIndex(self.unit)
- if(index) then
- self.RIcon:SetText(ICON_LIST[index].."10|t")
- else
- self.RIcon:SetText()
- end
- borderUpdate(self, event)
- end]]
- local updateHealth = function(self, event, unit, bar)
- local r, g, b, t
- --[[
- if(UnitIsPlayer(unit)) then
- local _, class = UnitClass(unit)
- t = oUF.colors.class[class]
- else
- r, g, b = .1, .8, .3
- end
- if(t) then
- r, g, b = t[1], t[2], t[3]
- end
- ]]
- bar:SetStatusBarColor(.08, .08, .08)
- if (UnitIsDead(unit) or UnitIsGhost(unit) or not UnitIsConnected(unit)) then
- bar:SetValue(0)
- end
- end
- local function borderUpdate(self, event)
- if event == "OnEnter" then -- hover over frame
- self.Border:SetBackdropColor(1, 1, 1, 1)
- elseif(UnitInRaid"player" == 1 or UnitInParty"player") and UnitName("target") == UnitName(self.unit) then -- unit is target
- self.Border:SetBackdropColor(.6, .6, .6, 1)
- elseif(GetRaidTargetIndex(self.unit)) then -- color by raid icon
- local index = GetRaidTargetIndex(self.unit)
- self.Border:SetBackdropColor(raidiconcolor[index].r, raidiconcolor[index].g, raidiconcolor[index].b, 1)
- else -- default color
- self.Border:SetBackdropColor(.2, .2, .2, 1)
- end
- end
- local updateRIcon = function(self, event)
- local index = GetRaidTargetIndex(self.unit)
- if(index) then
- self.RIcon:SetText(ICON_LIST[index].."10|t")
- else
- self.RIcon:SetText()
- end
- borderUpdate(self, event)
- end
- local function OnEnter(self)
- UnitFrame_OnEnter(self)
- borderUpdate(self, "OnEnter")
- end
- local function OnLeave(self)
- UnitFrame_OnLeave(self)
- borderUpdate(self, "OnLeave")
- end
- -- Raid Debuffs and other stuff kk.
- local createAuraWatch = function(self, unit)
- local auras = {}
- local spellIDs = {
- -- Paladin
- 53563, -- Beacon Of Light
- --53601, -- Sacred Shield
- -- Shaman
- 61295, -- riptide
- 974, -- earth shield
- -- Any class
- 17, -- Power Word: Shield
- 6788, -- Weakened Soul
- --70809, -- chain heal crit t10 (instead of valanyr)
- --64413, -- Protection of Ancient Kings (valanyr)
- --16237, -- Ancestral Fortitude (overlap with inspiration)
- --15359, -- Inspiration (overlap with ancestral fortitude)
- --48161, -- Fortitude
- }
- auras.presentAlpha = 1
- auras.missingAlpha = .2
- auras.PostCreateIcon = function(self, icon, auraSpellID, auraName, unitFrame)
- -- do stuff
- if icon.icon then
- icon.icon:SetTexCoord(.1,.9,.1,.9)
- end
- end
- -- Set any other AuraWatch settings
- auras.icons = {}
- for i, sid in pairs(spellIDs) do
- local icon = CreateFrame("Frame", nil, self)
- icon:SetFrameStrata'HIGH'
- icon.spellID = sid
- -- set the dimensions and positions
- icon:SetWidth(8)
- icon:SetHeight(8)
- if i == 1 then
- icon:SetPoint("BOTTOMLEFT", self, "BOTTOMLEFT", 4, 2)
- icon.onlyShowPresent = true
- icon:SetWidth(8)
- icon:SetHeight(8)
- elseif i == 2 then
- icon:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", -4, 2)
- icon.onlyShowPresent = true
- icon:SetWidth(8)
- icon:SetHeight(8)
- elseif i == 3 then
- icon:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", -17, 2)
- icon.anyUnit = true
- icon.onlyShowPresent = true
- elseif i == 4 then
- icon:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", -4, 2)
- icon.anyUnit = true
- icon.onlyShowPresent = true
- elseif i == 5 then
- icon:SetPoint("TOPLEFT", self, "TOPLEFT", 2, -2)
- icon.onlyShowPresent = true
- icon.hideCooldown = true
- icon:SetWidth(5)
- icon:SetHeight(5)
- elseif i == 6 then
- icon:SetPoint("TOPRIGHT", self, "TOPRIGHT", -2, -2)
- icon.anyUnit = true
- icon.onlyShowPresent = true
- icon.hideCooldown = true
- icon:SetWidth(5)
- icon:SetHeight(5)
- elseif i == 7 then
- icon:SetPoint("TOPRIGHT", self, "TOPRIGHT", -2, -2)
- icon.anyUnit = true
- icon.onlyShowPresent = true
- icon.hideCooldown = true
- icon:SetWidth(5)
- icon:SetHeight(5)
- elseif i == 8 then
- icon:SetPoint("LEFT", self, 2, 0)
- icon.anyUnit = true
- icon.onlyShowMissing = true
- --icon.hideCooldown = true
- icon:SetWidth(10)
- icon:SetHeight(10)
- else
- icon:SetPoint("BOTTOM", self, "BOTTOM", 12*i, 2)
- end
- auras.icons[sid] = icon
- -- Set any other AuraWatch icon settings
- end
- self.AuraWatch = auras
- end
- --[[
- ################################################################
- #
- # Raid Frames Creation
- #
- ################################################################
- ]]
- local CreateRaidStyle = function(self, u)
- self:SetBackdrop(backdrop)
- self:SetBackdropColor(0, 0, 0)
- self:SetScript("OnEnter", OnEnter)
- self:SetScript("OnLeave", OnLeave)
- self:RegisterForClicks"AnyDown"
- self:SetAttribute("*type2", "menu")
- 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 = 1, right = 1, top = 1, bottom = 1}
- }
- self.FrameBackdrop:SetBackdropColor(0, 0, 0, 0)
- self.FrameBackdrop:SetBackdropBorderColor(0, 0, 0)
- 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 = 0,right = 0,top = 0,bottom = 0}});
- self.FrameIBorderBackdrop:SetBackdropColor(0, 0, 0, 1)
- self.Border = CreateFrame("Frame", nil, self)
- self.Border:SetPoint("TOPLEFT", self, "TOPLEFT", -2, 2)
- self.Border:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", 2, -2)
- self.Border:SetFrameStrata("LOW")
- self.Border:SetFrameLevel(5)
- self.Border:SetBackdrop({bgFile = "Interface\\Buttons\\WHITE8X8",
- insets = {left = 0,right = 0,top = 0,bottom = 0}});
- self.Border:SetBackdropColor(0.2, 0.2, 0.2, 1)
- --[[
- ################################################################
- #
- # Frame Styling
- #
- ################################################################
- ]]
- self.Health = CreateFrame("StatusBar", nil, self)
- self.Health:SetAllPoints(self)
- self.Health:SetStatusBarTexture(texture)
- self.Health:SetStatusBarColor(0.1, 0.1, 0.1, 1)
- self.Health:SetFrameLevel(5)
- self.Health.frequentUpdates = true
- self.Health.bg = CreateFrame("Frame", nil, self)
- self.Health.bg:SetFrameLevel(3)
- self.Health.bg:SetAllPoints(self)
- self.Health.bg.texture = self.Health.bg:CreateTexture(nil, "BACKGROUND")
- self.Health.bg.texture:SetAllPoints(self.Health)
- self.Health.bg.texture:SetTexture(texture)
- self.Health.bg.texture:SetVertexColor(.38,.38,.38)
- self.Health.ForceUpdateHealth = updateHealth
- -- oUF Smooth Support
- if(IsAddOnLoaded("oUF_Smooth")) then
- self.Health.Smooth = true
- end
- -- No Longer need this.
- --[[
- -- 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:SetFrameLevel(4)
- self.HealCommBar:SetStatusBarTexture(texture)
- 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(87)
- self.mhpb:SetFrameLevel(4)
- 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(87)
- self.ohpb:SetFrameLevel(4)
- 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,
- }
- -- oUF Aura Watch Support
- if(IsAddOnLoaded("oUF_AuraWatch")) then
- createAuraWatch(self, unit)
- end
- -- oUF Raid Debuffs Support
- if(IsAddOnLoaded("oUF_RaidDebuffs")) then
- self.RaidDebuffs = CreateFrame('Frame', nil, self)
- self.RaidDebuffs:SetHeight(11)
- self.RaidDebuffs:SetWidth(11)
- self.RaidDebuffs:SetPoint('CENTER', self, 0, -5)
- self.RaidDebuffs:SetFrameStrata'HIGH'
- self.RaidDebuffs:SetFrameLevel(1)
- self.RaidDebuffs:SetBackdrop({
- bgFile = [=[Interface\ChatFrame\ChatFrameBackground]=],
- insets = {top = -1, left = -1, bottom = -1, right = -1},
- })
- self.RaidDebuffs.icon = self.RaidDebuffs:CreateTexture(nil, 'ARTWORK')
- self.RaidDebuffs.icon:SetTexCoord(.1,.9,.1,.9)
- self.RaidDebuffs.icon:SetAllPoints(self.RaidDebuffs)
- self.RaidDebuffs.cd = CreateFrame('Cooldown', nil, self.RaidDebuffs)
- self.RaidDebuffs.cd:SetAllPoints(self.RaidDebuffs)
- -- uncomment this if you are not using omnicc
- self.RaidDebuffs.time = self.RaidDebuffs:CreateFontString(nil, 'OVERLAY')
- self.RaidDebuffs.time:SetFont(fontlol, 8, 'OUTLINE')
- self.RaidDebuffs.time:SetPoint('CENTER', self.RaidDebuffs, 'CENTER', 0, 0)
- self.RaidDebuffs.time:SetTextColor(1, .9, 0)
- self.RaidDebuffs.count = self.RaidDebuffs:CreateFontString(nil, 'OVERLAY')
- self.RaidDebuffs.count:SetFont(fontlol, 8, 'OUTLINE')
- self.RaidDebuffs.count:SetPoint('CENTER', self.RaidDebuffs, 'CENTER', 0, 0)
- self.RaidDebuffs.count:SetTextColor(1, .9, 0)
- end
- -- ResComm Support
- if(IsAddOnLoaded("oUF_ResComm")) then
- --[[self.rcomm = self.Health:CreateTexture(nil, "OVERLAY")
- self.rcomm:SetTexture([=[Interface\Icons\Spell_Holy_Resurrection]=])
- self.rcomm:SetAllPoints(self.Health)
- self.rcomm:SetTexCoord(0.07, 0.93, 0.07, 0.93)
- self.rcomm:SetBlendMode("ADD")
- self.rcomm:SetAlpha(.25)]]
- --[[self.rcomm = CreateFrame("StatusBar", nil, self.Health)
- self.rcomm:SetStatusBarTexture([=[Interface\Icons\Spell_Holy_Resurrection]=])
- self.rcomm:SetAllPoints(self.Health)
- self.rcomm:SetAlpha(.25)
- self.texObject = self.rcomm:GetStatusBarTexture()
- self.texObject:SetTexCoord(0.07, 0.93, 0.07, 0.93)]]
- -- Register with oUF kkthnx.
- --self.ResComm = self.rcomm
- end
- self.healthtxt = self.Health:CreateFontString(nil, "OVERLAY")
- self.healthtxt:SetPoint("TOP", self.Health, 0, -4)
- self.healthtxt:SetFont(fontlol, 8)
- self.healthtxt:SetShadowOffset(1, -1)
- self.healthtxt:SetTextColor(1, 1, 1)
- self:Tag(self.healthtxt, "[MosphetRaidHP]")
- self.infotxt = self.Health:CreateFontString(nil, "OVERLAY")
- self.infotxt:SetPoint("BOTTOM", self.Health, 0, 5)
- self.infotxt:SetFont(fontlol, 8)
- self.infotxt:SetShadowOffset(1, -1)
- self.infotxt:SetTextColor(1, 1, 1)
- self:Tag(self.infotxt, '[MosphetRaidInfo]')
- self.ricon = self.Health:CreateFontString(nil, "OVERLAY")
- self.ricon:SetPoint("TOP", self.Health, "BOTTOM", 0 , 18)
- self.ricon:SetFont("Fonts\\FRIZQT__.ttf", 18)
- self.ricon:SetTextColor(1, 1, 1)
- self.RIcon = self.ricon
- self.Range = {
- insideAlpha = 1,
- outsideAlpha = 0.3,
- }
- -- Version 1.5.2 No Longer needs this
- --[[self:SetAttribute("initial-height", 30)
- self:SetAttribute("initial-width", 87)]]
- self:SetSize(87, 30)
- -- Not sure but apparently this should be broken...?
- self:RegisterEvent("PLAYER_TARGET_CHANGED", borderUpdate)
- self:RegisterEvent("RAID_TARGET_UPDATE", updateRIcon)
- table.insert(self.__elements, updateRIcon)
- end
- oUF:RegisterStyle("oUF_MosphetRaid", CreateRaidStyle)
- oUF:Factory(function(self)
- oUF:SetActiveStyle"oUF_MosphetRaid"
- --[[local party = self:SpawnHeader("oUF_Party", nil, "custom [@raid6,exists] hide; show",
- "showParty", true,
- "showPlayer", true,
- "yOffset", -5,
- "oUF-initialConfigFunction", (self:SetWidth(87) self:SetHeight(30))
- )
- party:SetPoint("BOTTOM", UIParent, -43, 175)
- local raid = {}
- CompactRaidFrameManager:UnregisterAllEvents()
- CompactRaidFrameManager:Hide()
- CompactRaidFrameContainer:UnregisterAllEvents()
- CompactRaidFrameContainer:Hide()
- for i = 1, NUM_RAID_GROUPS do
- local raidgroup = self:SpawnHeader("oUF_Raid"..i, nil, "custom [@raid6,exists] show; hide",
- "groupFilter", tostring(i),
- "showRaid", true,
- "maxColumns", 5,
- "yOffSet", -5,
- "oUF-initialConfigFunction", (self:SetWidth(87) self:SetHeight(30)
- )
- if i == 1 then
- raidgroup:SetPoint("BOTTOM", UIParent, -43, 175)
- else
- raidgroup:SetPoint("TOPLEFT", raid[i-1], "TOPRIGHT", 5, 0)
- end
- insert(raid, raidgroup)
- end]]
- CompactRaidFrameManager:UnregisterAllEvents()
- CompactRaidFrameManager:Hide()
- CompactRaidFrameContainer:UnregisterAllEvents()
- CompactRaidFrameContainer:Hide()
- local raid = self:SpawnHeader("oUF_Raid", nil, "custom [group:party,nogroup:raid25] show; hide",
- "showRaid", true,
- "showParty", true,
- "showPlayer", true,
- "groupFilter", "1,2,3,4,5,6,7,8",
- "groupingOrder", "1,2,3,4,5,6,7,8",
- "groupBy", "GROUP",
- "maxColumns", 5,
- "unitsPerColumn", 5,
- "column", 4,
- "columnAnchorPoint", "LEFT",
- "columnSpacing", 5,
- "yOffset", -5,
- "oUF-initialConfigFunction", ([[self:SetWidth(87) self:SetHeight(30)]])
- )
- raid:SetPoint("BOTTOM", UIParent, 143, 175)
- -- Gonna update this later.
- --[[local boss = {}
- for i = 1, MAX_BOSS_FRAMES do
- boss[i] = self:Spawn("boss"..i, "oUF_Boss"..i)
- if i == 1 then
- boss[i]:SetPoint("TOP", UIParent, 0, -15)
- else
- boss[i]:SetPoint("TOP", boss[i-1], "BOTTOM", 0, -26.5)
- end
- end
- for i, v in ipairs(boss) do v:Show() end]]
- -- Dont need this for now.
- --[[main:RegisterEvent("PLAYER_LOGIN")
- main:RegisterEvent("RAID_ROSTER_UPDATE")
- main:RegisterEvent("PARTY_LEADER_CHANGED")
- main:RegisterEvent("PARTY_MEMBERS_CHANGED")
- main:SetScript("OnEvent", function(self)
- if InCombatLockdown() then
- self:RegisterEvent("PLAYER_REGEN_ENABLED")
- else
- self:UnregisterEvent("PLAYER_REGEN_ENABLED")
- local numraid = GetNumRaidMembers()
- if numraid > 0 and (numraid > 5 or numraid ~= GetNumPartyMembers() + 1) then
- for i, v in ipairs(party) do v:Disable() end
- for i, v in ipairs(raid) do v:Show() end
- else
- for i, v in ipairs(party) do v:Enable() end
- for i, v in ipairs(raid) do v:Hide() end
- end
- end
- end)]]
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement