diff --git a/SVUI_!Core/setup/installer.lua b/SVUI_!Core/setup/installer.lua index 1942d7b..fdb2ef9 100644 --- a/SVUI_!Core/setup/installer.lua +++ b/SVUI_!Core/setup/installer.lua @@ -454,7 +454,7 @@ function SV.Setup:UnitframeLayout(style, preserve) if(preset_mediastyle == "default") then SV.db.UnitFrames.healthclass = true; end - + if(not mungs) then if(not preserve) then if preset_barstyle and (preset_barstyle == "twosmall" or preset_barstyle == "twobig") then @@ -470,6 +470,7 @@ function SV.Setup:UnitframeLayout(style, preserve) end SVUILib:RefreshModule('Dock') SVUILib:RefreshModule('ActionBars') + SVUILib:RefreshModule('UnitFrames') if(not preserve) then SV:SavedPopup() end diff --git a/SVUI_!Core/system/dock.lua b/SVUI_!Core/system/dock.lua index 2b2e8b2..87d3bbc 100644 --- a/SVUI_!Core/system/dock.lua +++ b/SVUI_!Core/system/dock.lua @@ -110,7 +110,7 @@ function MOD.SetThemeDockStyle(frame, isBottom) left:SetTexture(1, 1, 1, 1) left:ModPoint("TOPLEFT", 1, -1) left:ModPoint("BOTTOMLEFT", -1, -1) - left:ModWidth(4) + left:ModWidth(2) if(isBottom) then left:SetGradientAlpha("VERTICAL", 0, 0, 0, 1, 0, 0, 0, 0) else @@ -121,7 +121,7 @@ function MOD.SetThemeDockStyle(frame, isBottom) right:SetTexture(1, 1, 1, 1) right:ModPoint("TOPRIGHT", -1, -1) right:ModPoint("BOTTOMRIGHT", -1, -1) - right:ModWidth(4) + right:ModWidth(2) if(isBottom) then right:SetGradientAlpha("VERTICAL", 0, 0, 0, 1, 0, 0, 0, 0) else @@ -133,7 +133,7 @@ function MOD.SetThemeDockStyle(frame, isBottom) bottom:ModPoint("BOTTOMRIGHT", -1, -1) if(isBottom) then bottom:SetTexture(0, 0, 0, 1) - bottom:ModHeight(4) + bottom:ModHeight(2) else bottom:SetTexture(0, 0, 0, 0) bottom:SetAlpha(0) @@ -149,7 +149,7 @@ function MOD.SetThemeDockStyle(frame, isBottom) top:ModHeight(1) else top:SetTexture(0, 0, 0, 1) - top:ModHeight(4) + top:ModHeight(2) end return backdrop diff --git a/SVUI_!Options/UnitFrames.lua b/SVUI_!Options/UnitFrames.lua index 215d7ab..3966e30 100644 --- a/SVUI_!Options/UnitFrames.lua +++ b/SVUI_!Options/UnitFrames.lua @@ -652,21 +652,23 @@ function SVUIOptions:SetHealthConfigGroup(partyRaid, updateFunction, unitName, c } } } - if partyRaid then - healthOptions.args.commonGroup.args.frequentUpdates = { - type = "toggle", - order = 6, - name = L["Frequent Updates"], - desc = L["Rapidly update the health, uses more memory and cpu. Only recommended for healing."] - } + if SV.db.UnitFrames[unitName].health.orientation then healthOptions.args.commonGroup.args.orientation = { type = "select", - order = 7, + order = 6, name = L["Orientation"], desc = L["Direction the health bar moves when gaining/losing health."], values = {["HORIZONTAL"] = L["Horizontal"], ["VERTICAL"] = L["Vertical"]} } end + if partyRaid then + healthOptions.args.commonGroup.args.frequentUpdates = { + type = "toggle", + order = 7, + name = L["Frequent Updates"], + desc = L["Rapidly update the health, uses more memory and cpu. Only recommended for healing."] + } + end return healthOptions end @@ -802,6 +804,16 @@ function SVUIOptions:SetPowerConfigGroup(playerTarget, updateFunction, unitName, } } + if SV.db.UnitFrames[unitName].power.orientation then + powerOptions.args.commonGroup.args.orientation = { + type = "select", + order = 5, + name = L["Orientation"], + desc = L["Direction the power bar moves when gaining/losing power."], + values = {["HORIZONTAL"] = L["Horizontal"], ["VERTICAL"] = L["Vertical"]} + } + end + return powerOptions end diff --git a/SVUI_Chat/SVUI_Chat.lua b/SVUI_Chat/SVUI_Chat.lua index aeda328..4535b42 100644 --- a/SVUI_Chat/SVUI_Chat.lua +++ b/SVUI_Chat/SVUI_Chat.lua @@ -156,6 +156,7 @@ local BNPLAYER_PATTERN = "|HBNplayer:(.-)|h%[(|Kb(%d+).-)%](.*)|h" LOCAL FUNCTIONS ########################################################## ]]-- +local AddModifiedMessage; local ScrollIndicator = CreateFrame("Frame", nil) local HighLight_OnUpdate = function(self) if(self:IsMouseOver(50, -2, 0, 50)) then @@ -302,7 +303,7 @@ do return arg1:gsub("([%%%+%-%.%[%]%*%?])", "%%%1") end - local AddModifiedMessage = function(self, message, ...) + function AddModifiedMessage(self, message, ...) internalTest = false; if type(message) == "string" then if(message:find("%pTInterface%p+") or message:find("%pTINTERFACE%p+") or message:find("%pHshare%p+") or message:find("%pHSHARE%p+")) then diff --git a/SVUI_UnitFrames/Loader.lua b/SVUI_UnitFrames/Loader.lua index 91c9731..2ba5c39 100644 --- a/SVUI_UnitFrames/Loader.lua +++ b/SVUI_UnitFrames/Loader.lua @@ -124,6 +124,7 @@ SV.defaults[Schema] = { ["threatEnabled"] = true, ["playerExpBar"] = false, ["playerRepBar"] = false, + ["reverseLayout"] = false, ["formatting"] = { ["power_colored"] = true, ["power_type"] = "none", @@ -147,6 +148,7 @@ SV.defaults[Schema] = { { ["tags"] = "[health:color][health:current]", ["position"] = "INNERRIGHT", + ["orientation"] = "HORIZONTAL", ["xOffset"] = 0, ["yOffset"] = 0, ["reversed"] = false, @@ -160,7 +162,9 @@ SV.defaults[Schema] = { ["enable"] = true, ["tags"] = "", ["height"] = 7, + ["anchor"] = "BOTTOM", ["position"] = "INNERLEFT", + ["orientation"] = "HORIZONTAL", ["hideonnpc"] = false, ["xOffset"] = 0, ["yOffset"] = 0, @@ -305,6 +309,7 @@ SV.defaults[Schema] = { ["rangeCheck"] = true, ["predict"] = false, ["middleClickFocus"] = true, + ["reverseLayout"] = true, ["formatting"] = { ["power_colored"] = true, ["power_type"] = "none", @@ -328,6 +333,7 @@ SV.defaults[Schema] = { { ["tags"] = "[health:color][health:current]", ["position"] = "INNERLEFT", + ["orientation"] = "HORIZONTAL", ["xOffset"] = 0, ["yOffset"] = 0, ["reversed"] = true, @@ -341,7 +347,9 @@ SV.defaults[Schema] = { ["enable"] = true, ["tags"] = "[power:color][power:current]", ["height"] = 7, + ["anchor"] = "BOTTOM", ["position"] = "INNERRIGHT", + ["orientation"] = "HORIZONTAL", ["hideonnpc"] = true, ["xOffset"] = 0, ["yOffset"] = 0, @@ -506,6 +514,7 @@ SV.defaults[Schema] = { ["threatEnabled"] = false, ["width"] = 110, ["height"] = 40, + ["reverseLayout"] = true, ["formatting"] = { ["power_colored"] = true, ["power_type"] = "none", @@ -529,6 +538,7 @@ SV.defaults[Schema] = { { ["tags"] = "", ["position"] = "INNERRIGHT", + ["orientation"] = "HORIZONTAL", ["xOffset"] = 0, ["yOffset"] = 0, ["reversed"] = false, @@ -542,7 +552,9 @@ SV.defaults[Schema] = { ["enable"] = false, ["tags"] = "", ["height"] = 7, + ["anchor"] = "BOTTOM", ["position"] = "INNERLEFT", + ["orientation"] = "HORIZONTAL", ["hideonnpc"] = false, ["xOffset"] = 0, ["yOffset"] = 0, @@ -670,6 +682,7 @@ SV.defaults[Schema] = { ["width"] = 170, ["height"] = 30, ["predict"] = false, + ["reverseLayout"] = true, ["formatting"] = { ["power_colored"] = true, ["power_type"] = "none", @@ -693,6 +706,7 @@ SV.defaults[Schema] = { { ["tags"] = "", ["position"] = "INNERRIGHT", + ["orientation"] = "HORIZONTAL", ["xOffset"] = 0, ["yOffset"] = 0, ["reversed"] = false, @@ -706,7 +720,9 @@ SV.defaults[Schema] = { ["enable"] = true, ["tags"] = "", ["height"] = 7, + ["anchor"] = "BOTTOM", ["position"] = "INNERLEFT", + ["orientation"] = "HORIZONTAL", ["hideonnpc"] = false, ["xOffset"] = 0, ["yOffset"] = 0, @@ -850,6 +866,7 @@ SV.defaults[Schema] = { ["threatEnabled"] = false, ["width"] = 150, ["height"] = 26, + ["reverseLayout"] = true, ["formatting"] = { ["power_colored"] = true, ["power_type"] = "none", @@ -873,6 +890,7 @@ SV.defaults[Schema] = { { ["tags"] = "", ["position"] = "INNERRIGHT", + ["orientation"] = "HORIZONTAL", ["xOffset"] = 0, ["yOffset"] = 0, ["reversed"] = false, @@ -886,7 +904,9 @@ SV.defaults[Schema] = { ["enable"] = false, ["tags"] = "", ["height"] = 7, + ["anchor"] = "BOTTOM", ["position"] = "INNERLEFT", + ["orientation"] = "HORIZONTAL", ["hideonnpc"] = false, ["xOffset"] = 0, ["yOffset"] = 0, @@ -1005,6 +1025,7 @@ SV.defaults[Schema] = { ["width"] = 110, ["height"] = 40, ["predict"] = false, + ["reverseLayout"] = false, ["formatting"] = { ["power_colored"] = true, ["power_type"] = "none", @@ -1028,6 +1049,7 @@ SV.defaults[Schema] = { { ["tags"] = "", ["position"] = "INNERRIGHT", + ["orientation"] = "HORIZONTAL", ["yOffset"] = 0, ["xOffset"] = 0, ["reversed"] = false, @@ -1041,7 +1063,9 @@ SV.defaults[Schema] = { ["enable"] = true, ["tags"] = "", ["height"] = 7, + ["anchor"] = "BOTTOM", ["position"] = "INNERLEFT", + ["orientation"] = "HORIZONTAL", ["hideonnpc"] = false, ["yOffset"] = 0, ["xOffset"] = 0, @@ -1131,6 +1155,7 @@ SV.defaults[Schema] = { ["threatEnabled"] = false, ["width"] = 130, ["height"] = 26, + ["reverseLayout"] = false, ["formatting"] = { ["power_colored"] = true, ["power_type"] = "none", @@ -1154,6 +1179,7 @@ SV.defaults[Schema] = { { ["tags"] = "", ["position"] = "INNERRIGHT", + ["orientation"] = "HORIZONTAL", ["yOffset"] = 0, ["xOffset"] = 0, ["reversed"] = false, @@ -1165,8 +1191,10 @@ SV.defaults[Schema] = { ["power"] = { ["enable"] = false, + ["orientation"] = "HORIZONTAL", ["tags"] = "", ["height"] = 7, + ["anchor"] = "BOTTOM", ["position"] = "INNERLEFT", ["hideonnpc"] = false, ["yOffset"] = 0, @@ -1274,6 +1302,7 @@ SV.defaults[Schema] = { ["showBy"] = "UP", ["width"] = 200, ["height"] = 45, + ["reverseLayout"] = true, ["formatting"] = { ["power_colored"] = true, ["power_type"] = "none", @@ -1297,6 +1326,7 @@ SV.defaults[Schema] = { { ["tags"] = "[health:color][health:current]", ["position"] = "INNERTOPRIGHT", + ["orientation"] = "HORIZONTAL", ["yOffset"] = 0, ["xOffset"] = 0, ["reversed"] = false, @@ -1310,7 +1340,9 @@ SV.defaults[Schema] = { ["enable"] = true, ["tags"] = "[power:color][power:current]", ["height"] = 7, + ["anchor"] = "BOTTOM", ["position"] = "INNERBOTTOMRIGHT", + ["orientation"] = "HORIZONTAL", ["hideonnpc"] = false, ["yOffset"] = 7, ["xOffset"] = 0, @@ -1407,6 +1439,7 @@ SV.defaults[Schema] = { ["width"] = 215, ["height"] = 45, ["predict"] = false, + ["reverseLayout"] = true, ["formatting"] = { ["power_colored"] = true, ["power_type"] = "none", @@ -1430,6 +1463,7 @@ SV.defaults[Schema] = { { ["tags"] = "[health:color][health:current]", ["position"] = "INNERTOPRIGHT", + ["orientation"] = "HORIZONTAL", ["yOffset"] = 0, ["xOffset"] = 0, ["reversed"] = false, @@ -1443,7 +1477,9 @@ SV.defaults[Schema] = { ["enable"] = true, ["tags"] = "[power:color][power:current]", ["height"] = 7, + ["anchor"] = "BOTTOM", ["position"] = "INNERBOTTOMRIGHT", + ["orientation"] = "HORIZONTAL", ["hideonnpc"] = false, ["yOffset"] = 7, ["xOffset"] = 0, @@ -1553,6 +1589,7 @@ SV.defaults[Schema] = { ["predict"] = false, ["width"] = 115, ["height"] = 30, + ["reverseLayout"] = false, ["grid"] = { ["enable"] = false, ["size"] = 45, @@ -1597,6 +1634,8 @@ SV.defaults[Schema] = { { ["enable"] = false, ["tags"] = "", + ["anchor"] = "BOTTOM", + ["orientation"] = "HORIZONTAL", ["frequentUpdates"] = false, ["height"] = 8, ["position"] = "BOTTOMRIGHT", @@ -1741,6 +1780,7 @@ SV.defaults[Schema] = { ["predict"] = false, ["width"] = 50, ["height"] = 30, + ["reverseLayout"] = false, ["grid"] = { ["enable"] = false, ["size"] = 30, @@ -1787,6 +1827,7 @@ SV.defaults[Schema] = { ["tags"] = "", ["frequentUpdates"] = false, ["height"] = 8, + ["anchor"] = "BOTTOM", ["position"] = "BOTTOMRIGHT", ["hideonnpc"] = false, ["yOffset"] = 0, @@ -1901,6 +1942,7 @@ SV.defaults[Schema] = { ["predict"] = false, ["width"] = 80, ["height"] = 30, + ["reverseLayout"] = false, ["grid"] = { ["enable"] = false, ["size"] = 30, @@ -2021,6 +2063,7 @@ SV.defaults[Schema] = { ["rangeCheck"] = true, ["width"] = 120, ["height"] = 28, + ["reverseLayout"] = false, ["grid"] = { ["enable"] = false, ["size"] = 45, @@ -2088,6 +2131,7 @@ SV.defaults[Schema] = { ["rangeCheck"] = true, ["width"] = 120, ["height"] = 28, + ["reverseLayout"] = false, ["grid"] = { ["enable"] = false, ["size"] = 45, @@ -2152,6 +2196,7 @@ SV.defaults[Schema] = { ["enable"] = true, ["width"] = 120, ["height"] = 28, + ["reverseLayout"] = false, ["health"] = { ["position"] = "INNERRIGHT", diff --git a/SVUI_UnitFrames/SVUI_UnitFrames.lua b/SVUI_UnitFrames/SVUI_UnitFrames.lua index e05a1ee..a133ccb 100644 --- a/SVUI_UnitFrames/SVUI_UnitFrames.lua +++ b/SVUI_UnitFrames/SVUI_UnitFrames.lua @@ -75,14 +75,6 @@ LOCALS ########################################################## ]]-- local LoadedUnitFrames, LoadedGroupHeaders; -local ReversedUnit = { - ["target"] = true, - ["targettarget"] = true, - ["pettarget"] = true, - ["focustarget"] = true, - ["boss"] = true, - ["arena"] = true, -}; local function FindAnchorFrame(frame, anchor, badPoint) if badPoint or anchor == 'FRAME' then @@ -339,13 +331,20 @@ function MOD:RefreshUnitMedia(unitName) end end +local POWER_ANCHORS = { + ["BOTTOM"] = {"BOTTOMLEFT", "BOTTOMLEFT", 1, 1, "BOTTOMRIGHT", "BOTTOMRIGHT", -1, 1}, + ["TOP"] = {"TOPLEFT", "TOPLEFT", 1, -1, "TOPRIGHT", "TOPRIGHT", -1, -1}, + ["LEFT"] = {"TOPLEFT", "TOPLEFT", 1, -1, "BOTTOMLEFT", "BOTTOMLEFT", 1, 1}, + ["RIGHT"] = {"TOPRIGHT", "TOPRIGHT", -1, -1, "BOTTOMRIGHT", "BOTTOMRIGHT", -1, 1}, +} + function MOD:RefreshUnitLayout(frame, template) local db = SV.db.UnitFrames[template] if(not db) then return end local TOP_ANCHOR1, TOP_ANCHOR2, TOP_MODIFIER = "TOPRIGHT", "TOPLEFT", 1; local BOTTOM_ANCHOR1, BOTTOM_ANCHOR2, BOTTOM_MODIFIER = "BOTTOMLEFT", "BOTTOMRIGHT", -1; - if(ReversedUnit[template]) then + if(db.reverseLayout) then TOP_ANCHOR1 = "TOPLEFT" TOP_ANCHOR2 = "TOPRIGHT" TOP_MODIFIER = -1 @@ -354,7 +353,7 @@ function MOD:RefreshUnitLayout(frame, template) BOTTOM_MODIFIER = 1 end - local MASTER_GRIP = frame.MasterGrip; + local MASTER_GRIP = frame.ActionPanel; local TEXT_GRIP = frame.TextGrip; local UNIT_WIDTH, UNIT_HEIGHT, BEST_SIZE = self:GetActiveSize(db); @@ -386,11 +385,20 @@ function MOD:RefreshUnitLayout(frame, template) else PORTRAIT_WIDTH = ((db.portrait.width * TOP_MODIFIER) + (1 * TOP_MODIFIER)); end + frame:ModSize(UNIT_WIDTH + PORTRAIT_WIDTH, UNIT_HEIGHT) end - if(frame.PortraitModel) then + + if(frame.PortraitModel) then frame.PortraitModel:Hide() frame.PortraitModel:ClearAllPoints() end + + if(frame.PortraitTexture) then + local parent2D = frame.PortraitTexture:GetParent(); + parent2D:Hide() + parent2D:ClearAllPoints() + end + if(frame.PortraitTexture and frame.PortraitModel) then if(PORTRAIT_STYLE == '2D') then frame.Portrait = frame.PortraitTexture @@ -412,8 +420,8 @@ function MOD:RefreshUnitLayout(frame, template) local DEBUFF_ENABLED = (db.debuffs and db.debuffs.enable) or false; MASTER_GRIP:ClearAllPoints(); - MASTER_GRIP:ModPoint(TOP_ANCHOR1, frame, TOP_ANCHOR1, (1 * BOTTOM_MODIFIER), -1); - MASTER_GRIP:ModPoint(BOTTOM_ANCHOR1, frame, BOTTOM_ANCHOR1, PORTRAIT_WIDTH, 1); + MASTER_GRIP:ModPoint(TOP_ANCHOR2, frame, TOP_ANCHOR2, PORTRAIT_WIDTH, 0); + MASTER_GRIP:ModPoint(BOTTOM_ANCHOR2, frame, BOTTOM_ANCHOR2, 0, 0); if(frame.StatusPanel) then if(template ~= "player" and template ~= "pet" and template ~= "target" and template ~= "targettarget" and template ~= "focus" and template ~= "focustarget") then @@ -615,12 +623,27 @@ function MOD:RefreshUnitLayout(frame, template) POWER_GRIP:ClearAllPoints() POWER_GRIP:ModHeight(POWER_HEIGHT - 2) - if(not PORTRAIT_OVERLAY) then - POWER_GRIP:ModPoint(BOTTOM_ANCHOR1, frame, BOTTOM_ANCHOR1, PORTRAIT_WIDTH, 1) - POWER_GRIP:ModPoint(BOTTOM_ANCHOR2, frame, BOTTOM_ANCHOR2, (1 * BOTTOM_MODIFIER), 1) + if(db.power and db.power.anchor and POWER_ANCHORS[db.power.anchor]) then + local a1,a2,ax,ay,b1,b2,bx,by = unpack(POWER_ANCHORS[db.power.anchor]) + POWER_GRIP:ModPoint(a1, MASTER_GRIP, a2, ax, ay) + POWER_GRIP:ModPoint(b1, MASTER_GRIP, b2, bx, by) + -- if(frame.InfoPanel) then + -- frame.InfoPanel:ClearAllPoints() + -- if(db.power.anchor == "BOTTOM") then + -- frame.InfoPanel:ModPoint("TOPLEFT", POWER_GRIP, "BOTTOMLEFT", 0, 1) + -- frame.InfoPanel:ModPoint("TOPRIGHT", POWER_GRIP, "BOTTOMRIGHT", 0, 1) + -- else + -- frame.InfoPanel:ModPoint("TOPLEFT", frame.ActionPanel, "BOTTOMLEFT", 0, 1) + -- frame.InfoPanel:ModPoint("TOPRIGHT", frame.ActionPanel, "BOTTOMRIGHT", 0, 1) + -- end + -- end else - POWER_GRIP:ModPoint(BOTTOM_ANCHOR1, frame, BOTTOM_ANCHOR1, (PORTRAIT_WIDTH - (1 * BOTTOM_MODIFIER)), 2) - POWER_GRIP:ModPoint(BOTTOM_ANCHOR2, frame, BOTTOM_ANCHOR2, (2 * BOTTOM_MODIFIER), 2) + POWER_GRIP:ModPoint(BOTTOM_ANCHOR1, MASTER_GRIP, BOTTOM_ANCHOR1, (1 * TOP_MODIFIER), 1) + POWER_GRIP:ModPoint(BOTTOM_ANCHOR2, MASTER_GRIP, BOTTOM_ANCHOR2, (1 * BOTTOM_MODIFIER), 1) + end + + if(db.power and db.power.orientation) then + POWER_GRIP:SetOrientation(db.power.orientation) end elseif(frame:IsElementEnabled('Power')) then frame:DisableElement('Power') @@ -672,10 +695,13 @@ function MOD:RefreshUnitLayout(frame, template) PORTRAIT_GRIP:SetAlpha(1) PORTRAIT_GRIP:ClearAllPoints() if(PORTRAIT_OVERLAY) then - PORTRAIT_GRIP:SetAllPoints(MASTER_GRIP) + PORTRAIT_GRIP:InsetPoints(MASTER_GRIP,2,2) + PORTRAIT_GRIP.Outline:Hide() else - PORTRAIT_GRIP:ModPoint(TOP_ANCHOR2, frame, TOP_ANCHOR2, (1 * TOP_MODIFIER), -1) - PORTRAIT_GRIP:ModPoint(BOTTOM_ANCHOR2, MASTER_GRIP, BOTTOM_ANCHOR1, (1 * BOTTOM_MODIFIER), 1) + PORTRAIT_GRIP:ModPoint(TOP_ANCHOR1, MASTER_GRIP, TOP_ANCHOR2, 0, -2) + PORTRAIT_GRIP:ModPoint(BOTTOM_ANCHOR2, MASTER_GRIP, BOTTOM_ANCHOR1, 0, 2) + PORTRAIT_GRIP:ModWidth(PORTRAIT_WIDTH * TOP_MODIFIER) + PORTRAIT_GRIP.Outline:Show() end if(PORTRAIT.ForceUpdate) then PORTRAIT:ForceUpdate() end @@ -1293,7 +1319,7 @@ function MOD:Load() SV.Events:On("AURA_FILTER_OPTIONS_CHANGED", UpdateUnitFrames, true); - --self:InitializeBodyGuard() + self:InitializeBodyGuard() local rDebuffs = SV.oUF_RaidDebuffs or oUF_RaidDebuffs; if not rDebuffs then return end diff --git a/SVUI_UnitFrames/SVUI_UnitFrames.xml b/SVUI_UnitFrames/SVUI_UnitFrames.xml index c23c28e..7721402 100644 --- a/SVUI_UnitFrames/SVUI_UnitFrames.xml +++ b/SVUI_UnitFrames/SVUI_UnitFrames.xml @@ -10,7 +10,7 @@ <AbsValue val="11"/> </FontHeight> </Font> - + <Font name="SVUI_Font_Unit_Small" font="Fonts\MORPHEUS.ttf" virtual="true"> <Shadow> <Offset> @@ -64,7 +64,7 @@ <Attribute name="panelSkipUpdate" type="boolean" value="false" /> </Attributes> <Backdrop bgFile="Interface\AddOns\SVUI_!Core\assets\textures\EMPTY" edgeFile="Interface\BUTTONS\WHITE8X8" tile="false"> - <EdgeSize val="3" /> + <EdgeSize val="2" /> <TileSize val="0" /> <BackgroundInsets left="0" right="0" top="0" bottom="0" /> <Color r="0" g="0" b="0" a="0" /> @@ -73,7 +73,7 @@ </Frame> <Button name="SVUI_UNITTARGET" inherits="SecureUnitButtonTemplate" hidden="true" virtual="true"> - <Frames> + <Frames> <Button name="$parentTarget" inherits="SecureUnitButtonTemplate"> <Anchors> <Anchor point="TOPLEFT" relativePoint="TOPRIGHT" relativeTo="$parent"> @@ -87,14 +87,14 @@ <Attribute name="useparent-unit" type="boolean" value="true"/> <Attribute name="type1" type="string" value="target"/> <Attribute name="initial-unitWatch" type="boolean" value="true"/> - </Attributes> + </Attributes> </Button> </Frames> </Button> <Button name="SVUI_UNITPET" inherits="SecureUnitButtonTemplate" hidden="true" virtual="true"> <Frames> - <Button name="$parentPet" inherits="SecureUnitButtonTemplate"> + <Button name="$parentPet" inherits="SecureUnitButtonTemplate"> <Anchors> <Anchor point="BOTTOM" relativePoint="TOP" relativeTo="$parent"> <Offset> @@ -107,7 +107,7 @@ <Attribute name="useparent-unit" type="boolean" value="true"/> <Attribute name="type1" type="string" value="target"/> <Attribute name="initial-unitWatch" type="boolean" value="true"/> - </Attributes> + </Attributes> </Button> </Frames> </Button> @@ -134,9 +134,9 @@ <Script file="class_resources\shaman.lua"/> <Script file="class_resources\warlock.lua"/> <Script file="class_resources\warrior.lua"/> - + <Script file="frames.lua"/> <Script file="groups.lua"/> <Script file="view.lua"/> - <!-- <Script file="bodyguard.lua"/> --> -</Ui> \ No newline at end of file + <Script file="bodyguard.lua"/> +</Ui> diff --git a/SVUI_UnitFrames/bodyguard.lua b/SVUI_UnitFrames/bodyguard.lua index 56b7b93..3a28f5b 100644 --- a/SVUI_UnitFrames/bodyguard.lua +++ b/SVUI_UnitFrames/bodyguard.lua @@ -68,7 +68,7 @@ local BodyGuard = { CurrentStatus = 2, Initialized = false, }; - +BodyGuard.UF = CreateFrame("Button", "SVUI_BodyGuard", UIParent, "SecureActionButtonTemplate") local EventListener = CreateFrame("Frame"); local CONTINENT_DRAENOR = 7; local BODYGUARD_NAMES, BARRACKS_LIST, BODYGUARD_BANNED_ZONES = {}, {[27]=true,[28]=true}, {[978]=true,[1009]=true,[1011]=true}; @@ -282,6 +282,7 @@ function BodyGuard:ToggleVisibility(state) end function BodyGuard:UpdateSettings() + if(not self.UF) then return end if(SV.db.UnitFrames.bodyguard.enable) then self.UF:SetParent(SV.Screen) else @@ -309,11 +310,12 @@ function BodyGuard:NameUpdate() if(not InCombatLockdown() and self.CurrentName) then self.UF:SetAttribute("macrotext1", "/targetexact " .. self.CurrentName) end - + if(not self.UF.Name) then return end self.UF.Name:SetText(self.CurrentName) end function BodyGuard:HealthUpdate() + if(not self.UF) then return end local health = self.CurrentHealth; local maxHealth = self.CurrentMaxHealth; @@ -348,13 +350,10 @@ local _hook_GOSSIP_CONFIRM = function(...) end function MOD:InitializeBodyGuard() - BodyGuard:RefreshData() - - local frame = CreateFrame("Button", "SVUI_BodyGuard", SV.Screen, "SecureActionButtonTemplate") - frame:ModPoint("BOTTOMRIGHT", SV.Dock.BottomLeft, "TOPRIGHT", 0, 10) - frame:SetWidth(SV.db.UnitFrames.bodyguard.width) - frame:SetHeight(SV.db.UnitFrames.bodyguard.height) - frame:SetScript("OnEvent", function(self, event) + BodyGuard.UF:ModPoint("BOTTOMRIGHT", SV.Dock.BottomLeft, "TOPRIGHT", 0, 10) + BodyGuard.UF:SetWidth(SV.db.UnitFrames.bodyguard.width) + BodyGuard.UF:SetHeight(SV.db.UnitFrames.bodyguard.height) + BodyGuard.UF:SetScript("OnEvent", function(self, event) if(event == "PLAYER_REGEN_ENABLED") then BodyGuard:ToggleVisibility(self.VisualState) elseif(event == "PLAYER_TARGET_CHANGED") then @@ -365,43 +364,42 @@ function MOD:InitializeBodyGuard() end end end) - frame:SetStyle("Frame", "Icon") + BodyGuard.UF:SetStyle("Frame", "Icon") - frame.TargetGlow = frame.Panel.Shadow - frame.TargetGlow:SetBackdropBorderColor(0, 1, 0, 0.5) - frame.TargetGlow:Hide() + BodyGuard.UF.TargetGlow = BodyGuard.UF.Panel.Shadow + BodyGuard.UF.TargetGlow:SetBackdropBorderColor(0, 1, 0, 0.5) + BodyGuard.UF.TargetGlow:Hide() - frame:RegisterEvent("PLAYER_TARGET_CHANGED") - frame.Health = CreateFrame("StatusBar", nil, frame) - frame.Health:InsetPoints(frame) - frame.Health:SetMinMaxValues(0, 1) - frame.Health:SetValue(1) - frame.Health:SetStatusBarTexture(LSM:Fetch("statusbar", SV.db.UnitFrames.statusbar)) + BodyGuard.UF:RegisterEvent("PLAYER_TARGET_CHANGED") + BodyGuard.UF.Health = CreateFrame("StatusBar", nil, BodyGuard.UF) + BodyGuard.UF.Health:InsetPoints(BodyGuard.UF) + BodyGuard.UF.Health:SetMinMaxValues(0, 1) + BodyGuard.UF.Health:SetValue(1) + BodyGuard.UF.Health:SetStatusBarTexture(LSM:Fetch("statusbar", SV.db.UnitFrames.statusbar)) - frame.Health.bg = frame.Health:CreateTexture(nil, "BORDER") - frame.Health.bg:SetAllPoints() - frame.Health.bg:SetTexture(SV.media.statusbar.gradient) - frame.Health.bg:SetVertexColor(0.1, 0.1, 0.1) + BodyGuard.UF.Health.bg = BodyGuard.UF.Health:CreateTexture(nil, "BORDER") + BodyGuard.UF.Health.bg:SetAllPoints() + BodyGuard.UF.Health.bg:SetTexture(SV.media.statusbar.gradient) + BodyGuard.UF.Health.bg:SetVertexColor(0.1, 0.1, 0.1) - frame.Name = frame.Health:CreateFontString(nil, 'OVERLAY') - SV:FontManager(frame.Name, "unitsecondary") - frame.Name:SetPoint("CENTER", frame, "CENTER") - frame.Name:SetTextColor(unpack(oUF_SVUI.colors.reaction[5])) + BodyGuard.UF.Name = BodyGuard.UF.Health:CreateFontString(nil, 'OVERLAY') + SV:FontManager(BodyGuard.UF.Name, "unitsecondary") + BodyGuard.UF.Name:SetPoint("CENTER", BodyGuard.UF, "CENTER") + BodyGuard.UF.Name:SetTextColor(unpack(oUF_SVUI.colors.reaction[5])) - SV:NewAnchor(frame, L["BodyGuard Frame"]) + SV:NewAnchor(BodyGuard.UF, L["BodyGuard Frame"]) - frame:SetAttribute("type1", "macro") + BodyGuard.UF:SetAttribute("type1", "macro") if BodyGuard.CurrentName then - frame:SetAttribute("macrotext1", "/targetexact " .. BodyGuard.CurrentName) + BodyGuard.UF:SetAttribute("macrotext1", "/targetexact " .. BodyGuard.CurrentName) end + BodyGuard:RefreshData() - BodyGuard.UF = frame - - BodyGuard:ToggleVisibility("Hide") - - if(BodyGuard.IsActive and ZoneTest()) then + if((BodyGuard.CurrentStatus ~= 0) and ZoneTest()) then BodyGuard:ToggleVisibility("Show") BodyGuard:HealthUpdate() + else + BodyGuard:ToggleVisibility("Hide") end EventListener:SetScript("OnEvent", EventListener_OnEvent) @@ -422,3 +420,5 @@ function MOD:InitializeBodyGuard() hooksecurefunc(StaticPopupDialogs.GOSSIP_CONFIRM, "OnAccept", _hook_GOSSIP_CONFIRM) end + +BodyGuard:RefreshData() diff --git a/SVUI_UnitFrames/elements/essentials.lua b/SVUI_UnitFrames/elements/essentials.lua index 5d8baa9..054e71f 100644 --- a/SVUI_UnitFrames/elements/essentials.lua +++ b/SVUI_UnitFrames/elements/essentials.lua @@ -239,7 +239,7 @@ local function ADDInfoBG(frame) frame.InfoPanelBG = bg local left = frame.InfoPanel:CreateTexture(nil, "BACKGROUND") - left:ModPoint("TOPLEFT", frame.ActionPanel, "TOPLEFT", 0, 1) + left:ModPoint("TOPLEFT", frame.ActionPanel, "TOPLEFT", 0, -1) left:ModPoint("BOTTOMLEFT", frame.InfoPanel, "BOTTOMLEFT", 0, 0) left:SetWidth(2) left:SetTexture(1, 1, 1, 1) @@ -247,7 +247,7 @@ local function ADDInfoBG(frame) frame.InfoPanelLeft = left local right = frame.InfoPanel:CreateTexture(nil, "BACKGROUND") - right:ModPoint("TOPRIGHT", frame.ActionPanel, "TOPRIGHT", 0, 1) + right:ModPoint("TOPRIGHT", frame.ActionPanel, "TOPRIGHT", 0, -1) right:ModPoint("BOTTOMRIGHT", frame.InfoPanel, "BOTTOMRIGHT", 0, 0) right:SetWidth(2) right:SetTexture(1, 1, 1, 1) @@ -681,11 +681,15 @@ end function MOD:CreatePowerBar(frame) local power = CreateFrame("StatusBar", nil, frame) power:SetStatusBarTexture(SV.media.statusbar.default) - power:SetStyle("Frame", "Bar") power:SetFrameStrata("LOW") power:SetFrameLevel(6) - power.bg = power.Panel.Skin - power.bg.multiplier = 0.2 + power:SetStyle("Frame", "Bar") + power.bg = power:CreateTexture(nil, "BORDER") + power.bg:SetAllPoints() + power.bg:SetTexture(SV.media.statusbar.gradient) + power.bg:SetVertexColor(0.4, 0.1, 0.1) + power.bg.multiplier = 0.25 + power.colorDisconnected = false; power.colorTapping = false; power.PostUpdate = MOD.PostUpdatePower; @@ -750,6 +754,10 @@ function MOD:CreatePortrait(frame,smallUnit,isPlayer) portrait3D:SetStyle("Frame", "UnitLarge") end + portrait3D.Outline = CreateFrame("Frame", nil, portrait3D) + portrait3D.Outline:SetAllPoints() + portrait3D.Outline:SetStyle("Frame", "ActionPanel") + portrait3D.UserRotation = 0; portrait3D.UserCamDistance = 1.3; @@ -764,8 +772,12 @@ function MOD:CreatePortrait(frame,smallUnit,isPlayer) portrait2Danchor:SetStyle("Frame", "UnitLarge") end + portrait2Danchor.Outline = CreateFrame("Frame", nil, portrait2Danchor) + portrait2Danchor.Outline:SetAllPoints() + portrait2Danchor.Outline:SetStyle("Frame", "ActionPanel") + local portrait2D = portrait2Danchor:CreateTexture(nil,'OVERLAY') - portrait2D:InsetPoints(portrait2Danchor) + portrait2D:SetAllPoints() portrait2D:SetTexCoord(0.15,0.85,0.15,0.85) portrait2D:SetBlendMode("ADD") diff --git a/SVUI_UnitFrames/frames.lua b/SVUI_UnitFrames/frames.lua index 7c4dcfb..df9ef1f 100644 --- a/SVUI_UnitFrames/frames.lua +++ b/SVUI_UnitFrames/frames.lua @@ -43,12 +43,12 @@ local L = SV.L; local LSM = _G.LibStub("LibSharedMedia-3.0") local MOD = SV.UnitFrames -if(not MOD) then return end +if(not MOD) then return end local oUF_SVUI = MOD.oUF assert(oUF_SVUI, "SVUI UnitFrames: unable to locate oUF.") ---[[ -########################################################## +--[[ +########################################################## LOCALIZED GLOBALS ########################################################## ]]-- @@ -79,33 +79,33 @@ local FACTION_BAR_COLORS = _G.FACTION_BAR_COLORS; local RAID_CLASS_COLORS = _G.RAID_CLASS_COLORS; local CUSTOM_CLASS_COLORS = _G.CUSTOM_CLASS_COLORS local LOCALIZED_CLASS_NAMES_MALE = _G.LOCALIZED_CLASS_NAMES_MALE; ---[[ -########################################################## +--[[ +########################################################## LOCAL DATA ########################################################## ]]-- local CONSTRUCTORS = {} local lastArenaFrame, lastBossFrame ---[[ -########################################################## +--[[ +########################################################## ALL UNIT HELPERS ########################################################## ]]-- local UpdateTargetGlow = function(self) - if not self.unit then return end + if not self.unit then return end local unit = self.unit; - if(UnitIsUnit(unit, "target")) then + if(UnitIsUnit(unit, "target")) then self.TargetGlow:Show() local reaction = UnitReaction(unit, "player") - if(reaction) then + if(reaction) then local colors = FACTION_BAR_COLORS[reaction] self.TargetGlow:SetBackdropBorderColor(colors.r, colors.g, colors.b) - else + else self.TargetGlow:SetBackdropBorderColor(0.2, 1, 0.3) - end - else + end + else self.TargetGlow:Hide() - end + end end local AllowElement = function(self) @@ -113,7 +113,7 @@ local AllowElement = function(self) -- print('Allowed') -- print(self.unit) -- print(self.isForced) - if not self.isForced then + if not self.isForced then self.sourceElement = self.unit; self.unit = "player" self.isForced = true; @@ -126,9 +126,9 @@ local AllowElement = function(self) RegisterUnitWatch(self, true) self:Show() - if self:IsVisible() and self.Update then + if self:IsVisible() and self.Update then self:Update() - end + end end local RestrictElement = function(self) @@ -142,19 +142,19 @@ local RestrictElement = function(self) UnregisterUnitWatch(self) RegisterUnitWatch(self) - if self.sourceEvent then + if self.sourceEvent then self:SetScript("OnUpdate", self.sourceEvent) - self.sourceEvent = nil + self.sourceEvent = nil end self.unit = self.sourceElement or self.unit; - if self:IsVisible() and self.Update then + if self:IsVisible() and self.Update then self:Update() - end + end end --[[ -########################################################## +########################################################## PLAYER ########################################################## ]]-- @@ -179,7 +179,7 @@ local UpdatePlayerFrame = function(self) MOD:RefreshUnitLayout(self, "player") - do + do local resting = self.Resting; if resting then if iconDB and iconDB.restIcon and iconDB.restIcon.enable then @@ -187,16 +187,16 @@ local UpdatePlayerFrame = function(self) resting:ClearAllPoints() resting:ModSize(size) SV:SetReversePoint(resting, iconDB.restIcon.attachTo, MASTER_GRIP, iconDB.restIcon.xOffset, iconDB.restIcon.yOffset) - if not self:IsElementEnabled("Resting")then + if not self:IsElementEnabled("Resting")then self:EnableElement("Resting") - end - elseif self:IsElementEnabled("Resting")then + end + elseif self:IsElementEnabled("Resting")then self:DisableElement("Resting") resting:Hide() end end - end - do + end + do local combat = self.Combat; if combat then if iconDB and iconDB.combatIcon and iconDB.combatIcon.enable then @@ -204,52 +204,52 @@ local UpdatePlayerFrame = function(self) combat:ClearAllPoints() combat:ModSize(size) SV:SetReversePoint(combat, iconDB.combatIcon.attachTo, MASTER_GRIP, iconDB.combatIcon.xOffset, iconDB.combatIcon.yOffset) - if not self:IsElementEnabled("Combat")then + if not self:IsElementEnabled("Combat")then self:EnableElement("Combat") - end - elseif self:IsElementEnabled("Combat")then + end + elseif self:IsElementEnabled("Combat")then self:DisableElement("Combat") combat:Hide() end end - end - do + end + do local pvp = self.PvPText; local point = db.pvp.position; pvp:ClearAllPoints() pvp:ModPoint(db.pvp.position, MASTER_GRIP, db.pvp.position) self:Tag(pvp, db.pvp.tags) - end + end do if(self.ClassBar) then - if USE_CLASSBAR and self.RefreshClassBar then + if USE_CLASSBAR and self.RefreshClassBar then self.RefreshClassBar(self) - end + end if(self.ClassBar) then local classBar = self[self.ClassBar]; if USE_CLASSBAR then - if(not self:IsElementEnabled(self.ClassBar)) then + if(not self:IsElementEnabled(self.ClassBar)) then self:EnableElement(self.ClassBar) end classBar:Show() else - if(self:IsElementEnabled(self.ClassBar)) then + if(self:IsElementEnabled(self.ClassBar)) then self:DisableElement(self.ClassBar) end classBar:Hide() end end end - end + end - do - if db.combatfade and not self:IsElementEnabled("CombatFade")then + do + if db.combatfade and not self:IsElementEnabled("CombatFade")then self:EnableElement("CombatFade") - elseif - not db.combatfade and self:IsElementEnabled("CombatFade")then + elseif + not db.combatfade and self:IsElementEnabled("CombatFade")then self:DisableElement("CombatFade") - end - end + end + end self:UpdateAllElements() end @@ -280,16 +280,16 @@ CONSTRUCTORS["player"] = function(self, unit) self.HealPrediction = MOD:CreateHealPrediction(self, true) self.ResolveBar = MOD:CreateResolveBar(self) self.CombatFade = true; - self:ModPoint("BOTTOMLEFT", SV.Screen, "BOTTOM", -413, 182) + self:ModPoint("BOTTOMRIGHT", SV.Screen, "BOTTOM", -80, 182) SV:NewAnchor(self, L["Player Frame"]) self.MediaUpdate = MOD.RefreshUnitMedia self.Update = UpdatePlayerFrame - - return self + + return self end ---[[ -########################################################## +--[[ +########################################################## TARGET ########################################################## ]]-- @@ -305,21 +305,21 @@ local UpdateTargetFrame = function(self) self.colors = oUF_SVUI.colors; self:ModSize(UNIT_WIDTH, UNIT_HEIGHT) _G[self:GetName().."_MOVE"]:ModSize(self:GetSize()) - if not self:IsElementEnabled("ActionPanel")then + if not self:IsElementEnabled("ActionPanel")then self:EnableElement("ActionPanel") end - if not self:IsElementEnabled("Friendship")then + if not self:IsElementEnabled("Friendship")then self:EnableElement("Friendship") end MOD:RefreshUnitLayout(self, "target") - if(not IsAddOnLoaded("Clique")) then - if db.middleClickFocus then + if(not IsAddOnLoaded("Clique")) then + if db.middleClickFocus then self:SetAttribute("type3", "focus") - elseif self:GetAttribute("type3") == "focus"then + elseif self:GetAttribute("type3") == "focus"then self:SetAttribute("type3", nil) - end + end end self:UpdateAllElements() @@ -366,26 +366,26 @@ CONSTRUCTORS["target"] = function(self, unit) xray:SetScript("OnLeave", function(self) GameTooltip:Hide() self.icon:SetAlpha(0) end) xray:SetScript("OnEnter", function(self) self.icon:SetAlpha(1) - local anchor1, anchor2 = SV:GetScreenXY(self) + local anchor1, anchor2 = SV:GetScreenXY(self) GameTooltip:SetOwner(self, "ANCHOR_NONE") GameTooltip:SetPoint(anchor1, self, anchor2) GameTooltip:SetText(FOCUSTARGET) end) - - self.XRay = xray + + self.XRay = xray self.Friendship = MOD:CreateFriendshipBar(self) self.Range = { insideAlpha = 1, outsideAlpha = 1 } - - self:ModPoint("BOTTOMRIGHT", SV.Screen, "BOTTOM", 413, 182) + + self:ModPoint("BOTTOMLEFT", SV.Screen, "BOTTOM", 80, 182) SV:NewAnchor(self, L["Target Frame"]) self.MediaUpdate = MOD.RefreshUnitMedia self.Update = UpdateTargetFrame - return self -end ---[[ -########################################################## + return self +end +--[[ +########################################################## TARGET OF TARGET ########################################################## ]]-- @@ -418,15 +418,15 @@ CONSTRUCTORS["targettarget"] = function(self, unit) MOD:CreateAuraFrames(self, key) self.RaidIcon = MOD:CreateRaidIcon(self) self.Range = { insideAlpha = 1, outsideAlpha = 1 } - self:ModPoint("LEFT", SVUI_Target, "RIGHT", 2, 0) + self:ModPoint("LEFT", SVUI_Target, "RIGHT", 4, 0) SV:NewAnchor(self, L["TargetTarget Frame"]) self.MediaUpdate = MOD.RefreshUnitMedia self.Update = UpdateTargetTargetFrame - return self + return self end ---[[ -########################################################## +--[[ +########################################################## PET ########################################################## ]]-- @@ -440,11 +440,11 @@ local UpdatePetFrame = function(self) self:ModSize(UNIT_WIDTH, UNIT_HEIGHT) _G[self:GetName().."_MOVE"]:ModSize(self:GetSize()) MOD:RefreshUnitLayout(self, "pet") - do - if SVUI_Player and not InCombatLockdown()then + do + if SVUI_Player and not InCombatLockdown()then self:SetParent(SVUI_Player) - end - end + end + end self:UpdateAllElements() end @@ -467,14 +467,14 @@ CONSTRUCTORS["pet"] = function(self, unit) self.AuraWatch = MOD:CreateAuraWatch(self, key) self.RaidIcon = MOD:CreateRaidIcon(self) self.Range = { insideAlpha = 1, outsideAlpha = 1 } - self:ModPoint("RIGHT", SVUI_Player, "LEFT", -2, 0) + self:ModPoint("RIGHT", SVUI_Player, "LEFT", -4, 0) SV:NewAnchor(self, L["Pet Frame"]) self.MediaUpdate = MOD.RefreshUnitMedia self.Update = UpdatePetFrame - return self -end ---[[ -########################################################## + return self +end +--[[ +########################################################## TARGET OF PET ########################################################## ]]-- @@ -488,11 +488,11 @@ local UpdatePetTargetFrame = function(self) self:ModSize(UNIT_WIDTH, UNIT_HEIGHT) _G[self:GetName().."_MOVE"]:ModSize(self:GetSize()) MOD:RefreshUnitLayout(self, "pettarget") - do - if SVUI_Pet and not InCombatLockdown()then + do + if SVUI_Pet and not InCombatLockdown()then self:SetParent(SVUI_Pet) - end - end + end + end self:UpdateAllElements() end @@ -504,7 +504,7 @@ CONSTRUCTORS["pettarget"] = function(self, unit) self:SetScript("OnEnter", UnitFrame_OnEnter) self:SetScript("OnLeave", UnitFrame_OnLeave) self:SetFrameLevel(2) - + MOD:SetActionPanel(self, key) self.Health = MOD:CreateHealthBar(self, true) self.Power = MOD:CreatePowerBar(self) @@ -516,10 +516,10 @@ CONSTRUCTORS["pettarget"] = function(self, unit) self.MediaUpdate = MOD.RefreshUnitMedia self.Update = UpdatePetTargetFrame - return self -end ---[[ -########################################################## + return self +end +--[[ +########################################################## FOCUS ########################################################## ]]-- @@ -545,9 +545,9 @@ CONSTRUCTORS["focus"] = function(self, unit) self:SetScript("OnEnter", UnitFrame_OnEnter) self:SetScript("OnLeave", UnitFrame_OnLeave) self:SetFrameLevel(2) - + MOD:SetActionPanel(self, key) - + self.Health = MOD:CreateHealthBar(self, true) self.Health.frequentUpdates = true @@ -579,7 +579,7 @@ CONSTRUCTORS["focus"] = function(self, unit) xray:SetScript("OnLeave", function(self) GameTooltip:Hide() self.icon:SetAlpha(0) end) xray:SetScript("OnEnter",function(self) self.icon:SetAlpha(1) - local anchor1, anchor2 = SV:GetScreenXY(self) + local anchor1, anchor2 = SV:GetScreenXY(self) GameTooltip:SetOwner(self, "ANCHOR_NONE") GameTooltip:SetPoint(anchor1, self, anchor2) GameTooltip:SetText(CLEAR_FOCUS) @@ -592,10 +592,10 @@ CONSTRUCTORS["focus"] = function(self, unit) self.MediaUpdate = MOD.RefreshUnitMedia self.Update = UpdateFocusFrame - return self + return self end ---[[ -########################################################## +--[[ +########################################################## TARGET OF FOCUS ########################################################## ]]-- @@ -620,7 +620,7 @@ CONSTRUCTORS["focustarget"] = function(self, unit) self:SetScript("OnEnter", UnitFrame_OnEnter) self:SetScript("OnLeave", UnitFrame_OnLeave) self:SetFrameLevel(2) - + MOD:SetActionPanel(self, key) self.Health = MOD:CreateHealthBar(self, true) self.Power = MOD:CreatePowerBar(self) @@ -633,10 +633,10 @@ CONSTRUCTORS["focustarget"] = function(self, unit) self.MediaUpdate = MOD.RefreshUnitMedia self.Update = UpdateFocusTargetFrame - return self -end ---[[ -########################################################## + return self +end +--[[ +########################################################## BOSS ########################################################## ]]-- @@ -656,19 +656,19 @@ local UpdateBossFrame = function(self) if(tonumber(INDEX) == 1) then holder:ModWidth(UNIT_WIDTH) holder:ModHeight(UNIT_HEIGHT + (UNIT_HEIGHT + 12 + db.castbar.height) * 4) - if db.showBy == "UP"then + if db.showBy == "UP"then self:ModPoint("BOTTOMRIGHT", holder, "BOTTOMRIGHT") - else + else self:ModPoint("TOPRIGHT", holder, "TOPRIGHT") - end + end else local yOffset = (UNIT_HEIGHT + 12 + db.castbar.height) * (INDEX - 1) - if db.showBy == "UP"then + if db.showBy == "UP"then self:ModPoint("BOTTOMRIGHT", holder, "BOTTOMRIGHT", 0, yOffset) - else + else self:ModPoint("TOPRIGHT", holder, "TOPRIGHT", 0, -yOffset) - end - end + end + end self:RegisterForClicks(SV.db.UnitFrames.fastClickTarget and "AnyDown" or "AnyUp") MOD:RefreshUnitLayout(self, "boss") @@ -685,7 +685,7 @@ CONSTRUCTORS["boss"] = function(self, unit) self:SetScript("OnEnter", UnitFrame_OnEnter) self:SetScript("OnLeave", UnitFrame_OnLeave) self:SetFrameLevel(2) - + MOD:SetActionPanel(self, key) self.Health = MOD:CreateHealthBar(self, true) self.Health.frequentUpdates = true @@ -713,10 +713,10 @@ CONSTRUCTORS["boss"] = function(self, unit) self.MediaUpdate = MOD.RefreshUnitMedia self.Update = UpdateBossFrame lastBossFrame = self - return self + return self end ---[[ -########################################################## +--[[ +########################################################## ARENA ########################################################## ]]-- @@ -738,18 +738,18 @@ local UpdateArenaFrame = function(self) if(tonumber(INDEX) == 1) then holder:ModWidth(UNIT_WIDTH) holder:ModHeight(UNIT_HEIGHT + (UNIT_HEIGHT + 12 + db.castbar.height) * 4) - if(db.showBy == "UP") then + if(db.showBy == "UP") then self:ModPoint("BOTTOMRIGHT", holder, "BOTTOMRIGHT") - else + else self:ModPoint("TOPRIGHT", holder, "TOPRIGHT") - end + end else local yOffset = (UNIT_HEIGHT + 12 + db.castbar.height) * (INDEX - 1) - if(db.showBy == "UP") then + if(db.showBy == "UP") then self:ModPoint("BOTTOMRIGHT", holder, "BOTTOMRIGHT", 0, yOffset) - else + else self:ModPoint("TOPRIGHT", holder, "TOPRIGHT", 0, -yOffset) - end + end end MOD:RefreshUnitLayout(self, "arena") @@ -764,20 +764,20 @@ local UpdateArenaFrame = function(self) trinket:ModSize(db.pvp.trinketSize) trinket:ClearAllPoints() - if(db.pvp.trinketPosition == "RIGHT") then + if(db.pvp.trinketPosition == "RIGHT") then trinket:ModPoint("LEFT", rightAnchor, "RIGHT", db.pvp.trinketX, db.pvp.trinketY) rightAnchor = trinket - else + else trinket:ModPoint("RIGHT", leftAnchor, "LEFT", db.pvp.trinketX, db.pvp.trinketY) leftAnchor = trinket end badge:ModSize(db.pvp.specSize) badge:ClearAllPoints() - if(db.pvp.specPosition == "RIGHT") then + if(db.pvp.specPosition == "RIGHT") then badge:ModPoint("LEFT", rightAnchor, "RIGHT", db.pvp.specX, db.pvp.specY) rightAnchor = badge - else + else badge:ModPoint("RIGHT", leftAnchor, "LEFT", db.pvp.specX, db.pvp.specY) leftAnchor = badge end @@ -789,7 +789,7 @@ local UpdateArenaFrame = function(self) if(db.pvp.enable and (not self:IsElementEnabled("Gladiator"))) then self:EnableElement("Gladiator") pvp:Show() - elseif((not db.pvp.enable) and self:IsElementEnabled("Gladiator")) then + elseif((not db.pvp.enable) and self:IsElementEnabled("Gladiator")) then self:DisableElement("Gladiator") pvp:Hide() end @@ -808,10 +808,10 @@ CONSTRUCTORS["arena"] = function(self, unit) self:SetScript("OnEnter", UnitFrame_OnEnter) self:SetScript("OnLeave", UnitFrame_OnLeave) self:SetFrameLevel(2) - + local selfName = self:GetName() local prepName = selfName.."PrepFrame"; - + MOD:SetActionPanel(self, key) self.Health = MOD:CreateHealthBar(self, true) @@ -842,15 +842,15 @@ CONSTRUCTORS["arena"] = function(self, unit) icon:SetSize(45,45) icon:SetPoint("LEFT", prep, "RIGHT", 2, 0) icon:SetBackdrop({ - bgFile = [[Interface\BUTTONS\WHITE8X8]], - tile = false, - tileSize = 0, - edgeFile = [[Interface\BUTTONS\WHITE8X8]], - edgeSize = 2, + bgFile = [[Interface\BUTTONS\WHITE8X8]], + tile = false, + tileSize = 0, + edgeFile = [[Interface\BUTTONS\WHITE8X8]], + edgeSize = 2, insets = { - left = 0, - right = 0, - top = 0, + left = 0, + right = 0, + top = 0, bottom = 0 } }) @@ -880,10 +880,10 @@ CONSTRUCTORS["arena"] = function(self, unit) self.MediaUpdate = MOD.RefreshUnitMedia self.Update = UpdateArenaFrame lastArenaFrame = self - return self + return self end ---[[ -########################################################## +--[[ +########################################################## PREP FRAME ########################################################## ]]-- @@ -951,15 +951,15 @@ local ArenaPrepHandler_OnEvent = function(self, event) end end end -end +end ArenaPrepHandler:RegisterEvent("PLAYER_LOGIN") ArenaPrepHandler:RegisterEvent("PLAYER_ENTERING_WORLD") ArenaPrepHandler:RegisterEvent("ARENA_OPPONENT_UPDATE") ArenaPrepHandler:RegisterEvent("ARENA_PREP_OPPONENT_SPECIALIZATIONS") ArenaPrepHandler:SetScript("OnEvent", ArenaPrepHandler_OnEvent) ---[[ -########################################################## +--[[ +########################################################## LOAD/UPDATE METHOD ########################################################## ]]-- @@ -978,10 +978,10 @@ function MOD:SetUnitFrame(key) else frame = self.Units[unit] end - if frame:GetParent() ~= SVUI_UnitFrameParent then + if frame:GetParent() ~= SVUI_UnitFrameParent then frame:SetParent(SVUI_UnitFrameParent) end - if(SV.db.UnitFrames[key].enable) then + if(SV.db.UnitFrames[key].enable) then frame:Enable() frame:Update() else @@ -1005,21 +1005,21 @@ function MOD:SetEnemyFrame(key, maxCount) else frame = self.Units[unit] end - if frame:GetParent() ~= SVUI_UnitFrameParent then + if frame:GetParent() ~= SVUI_UnitFrameParent then frame:SetParent(SVUI_UnitFrameParent) end - if(SV.db.UnitFrames[key].enable) then + if(SV.db.UnitFrames[key].enable) then frame:Enable() - frame:Update() - else + frame:Update() + else frame:Disable() end - if(frame.isForced) then + if(frame.isForced) then frame:Allow() end end end -- tinsert(self.__elements, ELEMENT_FUNCTION) --- self:RegisterEvent(ELEMENT_EVENT, ELEMENT_FUNCTION) \ No newline at end of file +-- self:RegisterEvent(ELEMENT_EVENT, ELEMENT_FUNCTION) diff --git a/SVUI_UnitFrames/libs/oUF/elements/portraits.lua b/SVUI_UnitFrames/libs/oUF/elements/portraits.lua index 2a4c4c5..73e3948 100644 --- a/SVUI_UnitFrames/libs/oUF/elements/portraits.lua +++ b/SVUI_UnitFrames/libs/oUF/elements/portraits.lua @@ -1,5 +1,5 @@ --[[ Element: Portraits - + THIS FILE HEAVILY MODIFIED FOR USE WITH SUPERVILLAIN UI ]] @@ -42,9 +42,9 @@ local Update = function(self, event, unit, forced) portrait:SetModel([[Spells\Monk_travelingmist_missile.m2]]) portrait.guid = nil portrait:SetBackdropColor(0.25,0.25,0.25) - if portrait.UpdateColor then + if portrait.UpdateColor then portrait:UpdateColor(0.25,0.25,0.25) - end + end elseif((forced) or (portrait.guid ~= guid) or (event == 'UNIT_MODEL_CHANGED')) then portrait:ClearModel() portrait:SetUnit(unit) @@ -53,27 +53,28 @@ local Update = function(self, event, unit, forced) portrait:SetPosition(0,0,0) portrait.guid = guid - if(rotate and portrait:GetFacing() ~= rotate / 60) then + if(rotate and portrait:GetFacing() ~= rotate / 60) then portrait:SetFacing(rotate / 60) end local r, g, b, color = 0.25, 0.25, 0.25 - if not UnitIsPlayer(unit)then + if not UnitIsPlayer(unit)then color = self.colors.reaction[UnitReaction(unit,"player")] - if(color ~= nil) then - r,g,b = color[1], color[2], color[3] - end - else + if(color ~= nil) then + r,g,b = color[1], color[2], color[3] + end + else local _,unitClass = UnitClass(unit) if unitClass then color = self.colors.class[unitClass] r,g,b = color[1], color[2], color[3] - end + end end portrait:SetBackdropColor(r,g,b) - if portrait.UpdateColor then + if portrait.UpdateColor then portrait:UpdateColor(r,g,b) - end + end + portrait:RefreshCamera() end else SetPortraitTexture(portrait, unit) @@ -88,6 +89,11 @@ local Path = function(self, ...) return (self.Portrait.Override or Update) (self, ...) end +local ForceTargetUpdate = function(self) + local portrait = self.Portrait + return Path(portrait.__owner, 'ForceUpdate', portrait.__owner.unit) +end + local ForceUpdate = function(element) return Path(element.__owner, 'ForceUpdate', element.__owner.unit) end @@ -97,12 +103,12 @@ local Enable = function(self, unit) if(portrait) then portrait.__owner = self portrait.ForceUpdate = ForceUpdate - + portrait:SetUnit(unit) self:RegisterEvent("UNIT_PORTRAIT_UPDATE", Path) self:RegisterEvent("UNIT_MODEL_CHANGED", Path) self:RegisterEvent('UNIT_CONNECTION', Path) if(unit == 'target' or unit == 'targettarget') then - self:RegisterEvent('PLAYER_TARGET_CHANGED', Path) + self:RegisterEvent('PLAYER_TARGET_CHANGED', ForceTargetUpdate) end -- The quest log uses PARTY_MEMBER_{ENABLE,DISABLE} to handle updating of -- party members overlapping quests. This will probably be enough to handle @@ -125,7 +131,7 @@ local Disable = function(self) self:UnregisterEvent("UNIT_MODEL_CHANGED", Path) self:UnregisterEvent('PARTY_MEMBER_ENABLE', Path) self:UnregisterEvent('UNIT_CONNECTION', Path) - self:UnregisterEvent('PLAYER_TARGET_CHANGED', Path) + self:UnregisterEvent('PLAYER_TARGET_CHANGED', ForceTargetUpdate) end end