--[[ ############################################################################## _____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# ___\///////////___________\///___________\/////////_____\///////////_# ############################################################################## S U P E R - V I L L A I N - U I By: Munglunch # ############################################################################## --]] local SuperVillain, L = unpack(select(2, ...)); local MOD = SuperVillain.Registry:Expose('SVUnit'); local _, ns = ... local oUF_SuperVillain = ns.oUF --[[ MUNGLUNCH's FASTER ASSERT FUNCTION ]]-- local assert = enforce; assert(oUF_SuperVillain, "SVUI was unable to locate oUF.") local ceil,tinsert = math.ceil,table.insert local VisibilityUpdate = function(self, event) local db = MOD.db["party"] if (not db or (db and not db.enable) or not MOD.db.smartRaidFilter or self.isForced) then return end local instance, instanceType = IsInInstance() if(event == "PLAYER_REGEN_ENABLED") then self:UnregisterEvent("PLAYER_REGEN_ENABLED") end if(not InCombatLockdown()) then if(instance and instanceType == "raid") then UnregisterStateDriver(self,"visibility") self:Hide() elseif db.visibility then RegisterStateDriver(self, "visibility", db.visibility) end else self:RegisterEvent("PLAYER_REGEN_ENABLED") end end local UpdateTargetGlow = function(self) if not self.unit then return end local unit = self.unit; if(UnitIsUnit(unit, "target")) then self.TargetGlow:Show() local reaction = UnitReaction(unit, "player") if(UnitIsPlayer(unit)) then local _, class = UnitClass(unit) if class then local colors = SVUI_CLASS_COLORS[class] self.TargetGlow:SetBackdropBorderColor(colors.r, colors.g, colors.b) else self.TargetGlow:SetBackdropBorderColor(1, 1, 1) end elseif(reaction) then local colors = FACTION_BAR_COLORS[reaction] self.TargetGlow:SetBackdropBorderColor(colors.r, colors.g, colors.b) else self.TargetGlow:SetBackdropBorderColor(1, 1, 1) end else self.TargetGlow:Hide() end end local UpdatePartyFrame = function(self) local frame = self local db = MOD.db["party"] frame.colors = oUF_SuperVillain.colors; frame:RegisterForClicks(MOD.db.fastClickTarget and 'AnyDown' or 'AnyUp') if frame.isChild then local altDB = db.petsGroup; if frame == _G[frame.originalParent:GetName()..'Target'] then altDB = db.targetsGroup end if not frame.originalParent.childList then frame.originalParent.childList = {} end frame.originalParent.childList[frame] = true; if not InCombatLockdown()then if altDB.enable then frame:SetParent(frame.originalParent) frame:Size(altDB.width,altDB.height) frame:ClearAllPoints() SuperVillain:ReversePoint(frame, altDB.anchorPoint, frame.originalParent, altDB.xOffset, altDB.yOffset) else frame:SetParent(SuperVillain.Cloaked) end end do local health = frame.Health; health.Smooth = nil; health.frequentUpdates = nil; health.colorSmooth = nil; health.colorHealth = nil; health.colorClass = true; health.colorReaction = true; health:ClearAllPoints() health:Point("TOPRIGHT", frame, "TOPRIGHT", -1, -1) health:Point("BOTTOMLEFT", frame, "BOTTOMLEFT", 1, 1) end do local nametext = frame.InfoPanel.Name frame:Tag(nametext, altDB.tags) end else if not InCombatLockdown() then frame:Size(db.width,db.height) end MOD:RefreshUnitLayout(frame, "party") MOD:UpdateAuraWatch(frame) end frame:EnableElement('ReadyCheck') frame:UpdateAllElements() end --[[ ########################################################## BUILD FUNCTION ########################################################## ]]-- function MOD.Construct:party() local frame = self frame:SetScript("OnEnter", UnitFrame_OnEnter) frame:SetScript("OnLeave", UnitFrame_OnLeave) MOD:SetActionPanel(frame, "party") if frame.isChild then frame.Health = MOD:CreateHealthBar(frame, true) frame.originalParent = frame:GetParent() else frame.Health = MOD:CreateHealthBar(frame, true) frame.Power = MOD:CreatePowerBar(frame, true) frame.Power.frequentUpdates = false MOD:CreatePortrait(frame, true) frame.Buffs = MOD:CreateBuffs(frame, "party") frame.Debuffs = MOD:CreateDebuffs(frame, "party") frame.AuraWatch = MOD:CreateAuraWatch(frame, "party") frame.Afflicted = MOD:CreateAfflicted(frame) frame.ResurrectIcon = MOD:CreateResurectionIcon(frame) frame.LFDRole = MOD:CreateRoleIcon(frame) frame.RaidRoleFramesAnchor = MOD:CreateRaidRoleFrames(frame) frame.RaidIcon = MOD:CreateRaidIcon(frame) frame.ReadyCheck = MOD:CreateReadyCheckIcon(frame) frame.HealPrediction = MOD:CreateHealPrediction(frame) local shadow = CreateFrame("Frame", nil, frame) shadow:SetFrameLevel(1) shadow:SetFrameStrata(frame:GetFrameStrata()) shadow:WrapOuter(frame, 3, 3) shadow:SetBackdrop({ edgeFile = [[Interface\AddOns\SVUI\assets\artwork\Template\GLOW]], edgeSize = SuperVillain:Scale(3), insets = { left = SuperVillain:Scale(5), right = SuperVillain:Scale(5), top = SuperVillain:Scale(5), bottom = SuperVillain:Scale(5) } }) shadow:SetBackdropColor(0, 0, 0, 0) shadow:SetBackdropBorderColor(0, 0, 0, 0.9) shadow:Hide() frame.TargetGlow = shadow tinsert(frame.__elements, UpdateTargetGlow) frame:RegisterEvent("PLAYER_TARGET_CHANGED", UpdateTargetGlow) frame:RegisterEvent("PLAYER_ENTERING_WORLD", UpdateTargetGlow) frame:RegisterEvent("GROUP_ROSTER_UPDATE", UpdateTargetGlow) end frame.Range = { insideAlpha = 1, outsideAlpha = 1 } return frame end --[[ ########################################################## UPDATE ########################################################## ]]-- function MOD.HeaderUpdate:party() local group = self:GetParent() if not group.positioned then group:ClearAllPoints() group:Point("LEFT",SuperVillain.UIParent,"LEFT",40,0) SuperVillain:SetSVMovable(group, group:GetName()..'_MOVE', L['Party Frames'], nil, nil, nil, 'ALL,PARTY,ARENA'); group.positioned = true; group:RegisterEvent("PLAYER_ENTERING_WORLD") group:RegisterEvent("ZONE_CHANGED_NEW_AREA") group:SetScript("OnEvent", VisibilityUpdate) end VisibilityUpdate(group) local index = 1; local childFrame = self:GetAttribute("child"..index) while childFrame do UpdatePartyFrame(childFrame) if(_G[childFrame:GetName().."Pet"]) then UpdatePartyFrame(_G[childFrame:GetName().."Pet"]) end if(_G[childFrame:GetName().."Target"]) then UpdatePartyFrame(_G[childFrame:GetName().."Target"]) end index = index + 1; childFrame = self:GetAttribute("child"..index) end end