12-03-10, 11:27 AM | #1 |
Missing Left-click menu
Hi,
In most unitframes, if you click on yourself, then it sets your target to yourself. Or maybe if you click on ToT, then it will set your target to ToT, right? I tried very much to copy everyone else's menu implementation, but it just wouldn't work in my file... so mine is like this... And I need a left-click action that will make the target be what I clicked. The right-click and middle-click work as-is. What to put in the empty left-click code? Code:
local PreUpdateHealth = function(Health, unit, min, max) if (UnitIsDead("Player-target-target")) then oUF_tot.Container:SetAlpha(.75) else oUF_tot.Container:SetAlpha(1) end if(UnitIsDead("Player-target")) then oUF_target.Container:SetAlpha(.75) else oUF_target.Container:SetAlpha(1) end Health:SetScript("OnMouseUp", function(self, btn) if btn == "LeftButton" then -- Make this my target (How?) end if btn == "MiddleButton" then -- Long section omitted. end if btn == "RightButton" then local cunit = unit:gsub("^%l", string.upper) if(cunit == "Vehicle") then cunit = "Pet" end if(unit == "party") then ToggleDropDownMenu(1, nil, _G["PartyMemberFrame"..self.id.."DropDown"], "cursor", 0, 0) elseif(_G[cunit.."FrameDropDown"]) then ToggleDropDownMenu(1, nil, _G[cunit.."FrameDropDown"], "cursor", 0, 0) elseif unit == "raid" then FriendsDropDown.unit = self.unit FriendsDropDown.id = self.id FriendsDropDown.initialize = RaidFrameDropDown_Initialize ToggleDropDownMenu(1,nil,FriendsDropDown,"cursor") end end end) end |
|
![]() |
12-21-10, 12:49 AM | #2 |
1. You can't target yourself through Lua. It's a protected function and the reason why we have to use the secure API to build unit frames.
2. You shouldn't be setting a OnMouseUp handler in the health bars pre-update. You only need to do it once in the style base. 3. Spawning the menu from the base frame is a lot easier as it can be done slightly through the secure API.
__________________
「貴方は1人じゃないよ」 |
|
![]() |
12-21-10, 07:03 AM | #3 |
It wouldn't work when placed there; I really tried to make it do that in the first place. I tried to copy the basic way other files were written, but many things just didn't work, because I'm using Ace with profiles, and because I had so many layers of graphics. So I have too many long workarounds... if someone could help straighten this out, so I could get more organized in the right direction?
Thanks ![]() _____ Here's the file, for testing (with all the other lua files etc): http://www.wowinterface.com/download...-oUFHenna.html And the core lua: Code:
Henna = LibStub("AceAddon-3.0"):NewAddon("Henna", "AceConsole-3.0", "AceEvent-3.0") local addonName, addon = ... local bufftexture = "Interface\\AddOns\\oUF_Henna\\texture\\BuffBackground" local blankTex = "Interface\\Buttons\\WHITE8x8" local portraitbg = "Interface\\AddOns\\oUF_Henna\\texture\\PortraitbgQuartz" local PortraitOrbTexture = "Interface\\AddOns\\oUF_Henna\\texture\\PortraitOrbTexture" local ttbg = "Interface\\AddOns\\oUF_Henna\\texture\\Tooltip" local dragonsilver = "Interface\\AddOns\\oUF_Henna\\icons\\DragonSilver" local dragongold = "Interface\\AddOns\\oUF_Henna\\icons\\DragonGold" local bgalpha = .2 oUF.colors.power["RUNIC_POWER"] = {.5, .1, .7} oUF.colors.power["MANA"] = {.48, .9, 1} oUF.colors.power["ENERGY"] = {1, 1, .5} oUF.colors.power["FOCUS"] = {.92, .92, 1} if not (IsAddOnLoaded"!ClassColors") then oUF.colors.class["DRUID"] = {1, .3, .2} oUF.colors.class["HUNTER"] = {.33, .44, 0} oUF.colors.class["MAGE"] = {0, .52, .65} oUF.colors.class["PALADIN"] = {.92, .5, .5} oUF.colors.class["ROGUE"] = {.52, .52, 0} oUF.colors.class["SHAMAN"] = {0, .3, .53} end local myclasscolors = oUF.colors local myreactioncolors = { [1] = {r = 1, g = 0.22, b = 0.22}, [2] = {r = 0.85, g = 0.22, b = 0.22}, [3] = {r = 0.75, g = 0.27, b = 0}, [4] = {r = 0.9, g = 0.9, b = .2}, [5] = {r = .5, g = 0.8, b = .3}, [6] = {r = 0, g = 0.6, b = 0.1}, [7] = {r = 0, g = 0.6, b = 0.1}, [8] = {r = 0, g = 0.6, b = 0.1}, } local _, class = UnitClass("player") function Henna:OnInitialize() self.db = LibStub("AceDB-3.0"):New("HennaDB", defaults, "Default") self.db.RegisterCallback(self, "OnProfileChanged", "UpdateDisplay") self.db.RegisterCallback(self, "OnProfileCopied", "UpdateDisplay") self.db.RegisterCallback(self, "OnProfileReset", "UpdateDisplay") --Options LibStub("AceConfig-3.0"):RegisterOptionsTable("Henna-Options", Henna_Options) --LibStub("AceConfig-3.0"):RegisterOptionsTable("Henna-Themes", Henna_Themes) self.optionsFrame = LibStub("AceConfigDialog-3.0"):AddToBlizOptions("Henna-Options", "Henna") --self.optionsFrame = LibStub("AceConfigDialog-3.0"):AddToBlizOptions("Henna-Themes", "Themes", "Henna") -- Profiles LibStub("AceConfig-3.0"):RegisterOptionsTable("Henna-Profiles", LibStub("AceDBOptions-3.0"):GetOptionsTable(self.db)) self.profilesFrame = LibStub("AceConfigDialog-3.0"):AddToBlizOptions("Henna-Profiles", "Profiles", "Henna") end function Henna:OnEnable() self:SpawnCore() self:HideBlizzRaid() end function Henna:UpdateDisplay() -- called on profile switch self:HideBlizzRaid(self,unit) self:ResizePlayer(self,unit) self:ResizePet(self,unit) self:ResizeFocus(self,unit) self:ResizeToT(self,unit) self:Recolor(self,unit) self:Retexture(self,unit) self:UpdateContainerPos(self,unit) end ------------------------------------------------------- -- Number and Text formats local function round(num, idp) if idp and idp > 0 then local mult = 10^idp return math.floor(num * mult + 0.5) / mult end return math.floor(num + 0.5) end local function numformat(number) if not number or number <= 0 then return 0 elseif number > 0 and number < 1000000 then local t = {} thousands = ',' decimal = '.' local int = math.floor(number) local rest = number % 1 if int == 0 then t[#t+1] = 0 else local digits = math.log10(int) local segments = math.floor(digits / 3) t[#t+1] = math.floor(int / 1000^segments) for i = segments-1, 0, -1 do t[#t+1] = thousands t[#t+1] = ("%03d"):format(math.floor(int / 1000^i) % 1000) end end if rest ~= 0 then t[#t+1] = decimal rest = math.floor(rest * 10^6) while rest % 10 == 0 do rest = rest / 10 end t[#t+1] = rest end local s = table.concat(t) wipe(t) return s elseif number >= 1000000 and number < 1000000000 then return format("%.1f|cff93E74F%s|r", number * 0.000001, "m") elseif number >= 1000000000 then return format("%.1f|cff93E74F%s|r", number * 0.000000001, "bil") else return number end end oUF.Tags["abbrev"] = function(unit) local len = 14 if(unit == "target") or (unit == "targettarget") or (unit == "focus") then len = 10 else len = 14 end local name = UnitName(unit) return string.len(name) > len and string.gsub(name, "%s?(.)%S+%s", "%1. ") or name end oUF.TagEvents["abbrev"] = "UNIT_NAME_UPDATE" oUF.Tags["pettarget"] = function(unit) local len = 14 if(unit == "pet") then len = 10 else len = 14 end local name = UnitName("Pet-target") if name then return string.len(name) > len and string.gsub(name, "%s?(.)%S+%s", "%1. ") or name end end oUF.TagEvents["pettarget"] = "UNIT_TARGET" ----------------------------------------------------------- -- Invisible listener frame to see if Player has a target. If yes, then show target Container (which holds everything); if not then hide. local a = CreateFrame("Frame") a:SetScript("OnEvent", function(_,event) -- Check if target needs elite borders local c = UnitClassification("target") if (c == 'elite') then oUF_target.EliteBorderGold:Show() if oUF_target.EliteBorderSilver then oUF_target.EliteBorderSilver:Hide() end if UnitIsPVP("target") then oUF_target.PvP:SetPoint("TOPLEFT", oUF_target.PortraitBorder, "BOTTOMRIGHT", -60, 37) end elseif (c == 'rareelite' or c =='worldboss') then oUF_target.EliteBorderSilver:Show() if oUF_target.EliteBorderGold then oUF_target.EliteBorderGold:Hide() end if UnitIsPVP("target") then oUF_target.PvP:SetPoint("TOPLEFT", oUF_target.PortraitBorder, "BOTTOMRIGHT", -60, 37) end else if oUF_target.EliteBorderGold then oUF_target.EliteBorderGold:Hide() end if oUF_target.EliteBorderSilver then oUF_target.EliteBorderSilver:Hide() end if oUF_target.PvP then oUF_target.PvP:SetPoint("TOPLEFT", oUF_target.PortraitBorder, "BOTTOMRIGHT", -20, 37) end end -- Added statements here to fix crash on /reload while dead. local pguid = UnitGUID("player") or nil if pguid then oUF_player.Container:Show() else if oUF_player.Container then oUF_player.Container:Hide() end if oUF_target.Container then oUF_target.Container:Hide() end end -- Check if we have a target and show or hide graphics accordingly. local guid = UnitGUID("target") or nil if guid then oUF_target.Container:Show() if guid == pguid then local _, ctype = UnitClass("target") if(myclasscolors.class[ctype]) then local r, g, b = unpack(myclasscolors.class[ctype]) oUF_target.PortraitBGimg:SetVertexColor(r,g,b) oUF_target.PortraitOrb:SetVertexColor(r*1.1,g*1.1,b*1.1) end if UnitIsPVP("player") then oUF_target.PvP:Show() else oUF_target.PvP:Hide() end else local reaction = UnitReaction("player", "target"); if (reaction) and (myreactioncolors[reaction]) then local r = myreactioncolors[reaction].r local g = myreactioncolors[reaction].g local b = myreactioncolors[reaction].b oUF_target.PortraitBGimg:SetVertexColor(r,g,b) oUF_target.PortraitOrb:SetVertexColor(r*1.1,g*1.1,b*1.1) end if UnitIsPVP("target") then oUF_target.PvP:Show() else oUF_target.PvP:Hide() end end else oUF_target.Health.OverlayText:SetText("") oUF_target.Power.OverlayText:SetText("") oUF_target.Health.value:SetText("") oUF_target.Container:Hide() oUF_target.PvP:Hide() end end) a:RegisterEvent("PLAYER_ENTERING_WORLD") a:RegisterEvent("PLAYER_TARGET_CHANGED") -- Invisible frame that listens for combat, to hide portrait and replace with combat graphic. local b = CreateFrame("Frame") b:SetScript("OnEvent", function(_,event) if event == "PLAYER_REGEN_DISABLED" then if oUF_player.Portrait then oUF_player.Portrait:Hide() oUF_player.glow:Show() end elseif event == "PLAYER_REGEN_ENABLED" then if oUF_player then oUF_player.glow:Hide() oUF_player.Portrait:Show() oUF_player.Portrait:SetCamera(0) end end end) b:RegisterEvent("PLAYER_REGEN_DISABLED") b:RegisterEvent("PLAYER_REGEN_ENABLED") -- Invisible frame that listens for change in pvp status of player and target. local c = CreateFrame("Frame") c:SetScript("OnEvent", function(_,event) if UnitIsPVP("target") then if oUF_target then oUF_target.PvP:Show() end else if oUF_target then oUF_target.PvP:Hide() end end if UnitIsPVP("player") then if oUF_player then oUF_player.PvP:Show() end else if oUF_player then oUF_player.PvP:Hide() end end end) c:RegisterEvent("UNIT_FACTION") -- Added some colors for player pet, since it defaulted to white and seemed confusing. local d = CreateFrame("Frame") d:SetScript("OnEvent", function(_,event) local petguid = UnitGUID("pet") or nil local c = UnitCreatureType("pet") if petguid and Henna.db.profile.showmypet then if oUF_pet then oUF_pet.Container:Show() oUF_pet.Health:Show() oUF_pet.Power:Show() if c == "Demon" then if oUF_pet then oUF_pet.Health:SetStatusBarColor(Henna.db.profile.demoncolor.r, Henna.db.profile.demoncolor.g, Henna.db.profile.demoncolor.b ) end elseif c == "Beast" then if oUF_pet then oUF_pet.Health:SetStatusBarColor(Henna.db.profile.beastcolor.r, Henna.db.profile.beastcolor.g, Henna.db.profile.beastcolor.b ) end elseif c == "Elemental" then if oUF_pet then oUF_pet.Health:SetStatusBarColor(Henna.db.profile.elemcolor.r, Henna.db.profile.elemcolor.g, Henna.db.profile.elemcolor.b ) end end end else if oUF_pet then oUF_pet.Container:Hide() oUF_pet.Health:Hide() oUF_pet.Power:Hide() end end end) d:RegisterEvent("UNIT_PET") d:RegisterEvent("PLAYER_ENTERING_WORLD") -- Hide level while in vehicle; it's both irrelevant and confusing. local e = CreateFrame("Frame") e:SetScript("OnEvent", function(_,event) if event == "UNIT_ENTERED_VEHICLE" then oUF_player.UnitLevel:Hide() elseif event == "UNIT_EXITED_VEHICLE" then oUF_player.UnitLevel:Show() end end) e:RegisterEvent("UNIT_ENTERED_VEHICLE") e:RegisterEvent("UNIT_EXITED_VEHICLE") -- Check if we have a focus and show or hide Container accordingly. local f = CreateFrame("Frame") f:SetScript("OnEvent", function(_,event) local fguid = UnitGUID("focus") or nil if fguid and Henna.db.profile.showmyfocus then oUF_focus.Container:Show() oUF_focus.Health:Show() oUF_focus.Power:Show() else if oUF_focus.Container then oUF_focus.Container:Hide() oUF_focus.Health:Hide() oUF_focus.Power:Hide() end end end) f:RegisterEvent("PLAYER_FOCUS_CHANGED") f:RegisterEvent("PLAYER_ENTERING_WORLD") -- Check if we have a ToT and show or hide Container accordingly. local g = CreateFrame("Frame") g:SetScript("OnEvent", function(_,event) local pguid = UnitGUID("Player") or nil local tguid = UnitGUID("Player-target") or nil local totguid = UnitGUID("Player-target-target") or nil if (pguid == tguid) then oUF_tot.Container:Hide() -- if ToT is player then hide (we don't need 3 frames to show when we selected ourselves) oUF_tot.Health:Hide() oUF_tot.Power:Hide() elseif totguid and Henna.db.profile.showmytot then oUF_tot.Container:Show() -- otherwise show ToT if it exists oUF_tot.Health:Show() oUF_tot.Power:Show() end if not UnitExists("Player-target-target") then oUF_tot.Container:Hide() end end) g:RegisterEvent("PLAYER_TARGET_CHANGED") g:RegisterEvent("UNIT_TARGET") g:RegisterEvent("UNIT_TARGETABLE_CHANGED") g:RegisterEvent("PLAYER_ENTERING_WORLD") -------------------------------- -- Although this section must be at the beginning of the file, it's really the last thing, just fixes little issues. Pretend it was at the end. -- PreUpdate is called far less often than PostUpdate, so everything that can go in here, should. local PreUpdateHealth = function(Health, unit, min, max) if (UnitIsDead("Player-target-target")) then oUF_tot.Container:SetAlpha(.75) else oUF_tot.Container:SetAlpha(1) end if(UnitIsDead("Player-target")) then oUF_target.Container:SetAlpha(.75) else oUF_target.Container:SetAlpha(1) end Health:SetScript("OnMouseUp", function(self, btn) if btn == "MiddleButton" then if unit == "player" or unit == "vehicle" then if not Henna.db.profile.showplayerhealth then Henna.db.profile.showplayerhealth = true Health.OverlayFrame:Show() elseif Henna.db.profile.showplayerhealth then Henna.db.profile.showplayerhealth = false Health.OverlayFrame:Hide() end elseif unit == "target" then if not Henna.db.profile.showtargethealth then Henna.db.profile.showtargethealth = true Health.OverlayFrame:Show() elseif Henna.db.profile.showtargethealth then Henna.db.profile.showtargethealth = false Health.OverlayFrame:Hide() end elseif unit == "pet" then if not Henna.db.profile.showpethealth then Henna.db.profile.showpethealth = true Health.OverlayFrame:Show() elseif Henna.db.profile.showpethealth then Henna.db.profile.showpethealth = false Health.OverlayFrame:Hide() end elseif unit == "focus" then if not Henna.db.profile.showfocushealth then Henna.db.profile.showfocushealth = true Health.OverlayFrame:Show() elseif Henna.db.profile.showfocushealth then Henna.db.profile.showfocushealth = false Health.OverlayFrame:Hide() end elseif unit == "targettarget" then if not Henna.db.profile.showtothealth then Henna.db.profile.showtothealth = true Health.OverlayFrame:Show() elseif Henna.db.profile.showtothealth then Henna.db.profile.showtothealth = false Health.OverlayFrame:Hide() end end end if btn == "RightButton" then local cunit = unit:gsub("^%l", string.upper) if(cunit == "Vehicle") then cunit = "Pet" end if(unit == "party") then ToggleDropDownMenu(1, nil, _G["PartyMemberFrame"..self.id.."DropDown"], "cursor", 0, 0) elseif(_G[cunit.."FrameDropDown"]) then ToggleDropDownMenu(1, nil, _G[cunit.."FrameDropDown"], "cursor", 0, 0) elseif unit == "raid" then FriendsDropDown.unit = self.unit FriendsDropDown.id = self.id FriendsDropDown.initialize = RaidFrameDropDown_Initialize ToggleDropDownMenu(1,nil,FriendsDropDown,"cursor") end end end) end local PostUpdateHealth = function(Health, unit, min, max) -- If you don't use PostUpdate, then dead creatures get stuck displaying with 10% mana, things like that. -- Have to set class colors in here, or using the Update will overwrite them. if(not UnitExists(unit)) then return end Health.frequentUpdates = true Health.value:SetText( (round(min/max, 2)*100).."%" ) local num1 = numformat(min) local num2 = numformat(max) Health.OverlayText:SetText(num1.."/"..num2) Health.OverlayFrameTex:SetSize(Health.OverlayText:GetWidth() *1.8, Health.OverlayText:GetHeight() + 8) if(UnitIsDead(unit)) then Health:SetValue(0) Health.value:SetText("Dead") if Health.offline then Health.offline:Hide() end elseif(UnitIsGhost(unit)) then Health:SetValue(0) Health.value:SetText("Ghost") if Health.offline then Health.offline:Hide() end elseif(not UnitIsConnected(unit) and not unit=="pet") then Health:SetValue(0) Health.value:SetText("Offline") Health.offline:Show() elseif (UnitIsTapped(unit) and not UnitIsTappedByPlayer(unit)) then Health:SetStatusBarColor(.2,.2,.2) if Health.offline then Health.offline:Hide() end Health.value:SetText("Tapped") else if UnitIsPlayer(unit) then local _, ctype = UnitClass(unit) if(myclasscolors.class[ctype]) then local r, g, b = unpack(myclasscolors.class[ctype]) Health:SetStatusBarColor(r,g,b) end if Health.offline then Health.offline:Hide() end elseif unit == "pet" and UnitCreatureType("pet") == "Demon" then Health:SetStatusBarColor(Henna.db.profile.demoncolor.r, Henna.db.profile.demoncolor.g, Henna.db.profile.demoncolor.b ) elseif unit == "pet" and UnitCreatureType("pet") == "Beast" then Health:SetStatusBarColor(Henna.db.profile.beastcolor.r, Henna.db.profile.beastcolor.g, Henna.db.profile.beastcolor.b ) elseif unit == "pet" and UnitCreatureType("pet") == "Elemental" then Health:SetStatusBarColor(Henna.db.profile.elemcolor.r, Henna.db.profile.elemcolor.g, Henna.db.profile.elemcolor.b ) else local reaction = UnitReaction("player", "target"); if (reaction) and (myreactioncolors[reaction]) then local r = myreactioncolors[reaction].r local g = myreactioncolors[reaction].g local b = myreactioncolors[reaction].b Health:SetStatusBarColor(r, g, b, 1) Health:SetAlpha(1) if Health.offline then Health.offline:Hide() end end end end end local PreUpdatePower = function(Power, unit, min, max) Power:SetScript("OnMouseUp", function(self, btn) if btn == "MiddleButton" then if unit == "player" or unit == "vehicle" then if not Henna.db.profile.showplayermana then Henna.db.profile.showplayermana = true Power.OverlayFrame:Show() elseif Henna.db.profile.showplayermana then Henna.db.profile.showplayermana = false Power.OverlayFrame:Hide() end elseif unit == "target" then if not Henna.db.profile.showtargetmana then Henna.db.profile.showtargetmana = true Power.OverlayFrame:Show() elseif Henna.db.profile.showtargetmana then Henna.db.profile.showtargetmana = false Power.OverlayFrame:Hide() end elseif unit == "pet" then if not Henna.db.profile.showpetmana then Henna.db.profile.showpetmana = true Power.OverlayFrame:Show() elseif Henna.db.profile.showpetmana then Henna.db.profile.showpetmana = false Power.OverlayFrame:Hide() end elseif unit == "targettarget" then if not Henna.db.profile.showtotmana then Henna.db.profile.showtotmana = true Power.OverlayFrame:Show() elseif Henna.db.profile.showtotmana then Henna.db.profile.showtotmana = false Power.OverlayFrame:Hide() end elseif unit == "focus" then if not Henna.db.profile.showfocusmana then Henna.db.profile.showfocusmana = true Power.OverlayFrame:Show() elseif Henna.db.profile.showfocusmana then Henna.db.profile.showfocusmana = false Power.OverlayFrame:Hide() end end end if btn == "RightButton" then local cunit = unit:gsub("^%l", string.upper) if(cunit == "Vehicle") then cunit = "Pet" end if(unit == "party") then ToggleDropDownMenu(1, nil, _G["PartyMemberFrame"..self.id.."DropDown"], "cursor", 0, 0) elseif(_G[cunit.."FrameDropDown"]) then ToggleDropDownMenu(1, nil, _G[cunit.."FrameDropDown"], "cursor", 0, 0) elseif unit == "raid" then FriendsDropDown.unit = self.unit FriendsDropDown.id = self.id FriendsDropDown.initialize = RaidFrameDropDown_Initialize ToggleDropDownMenu(1,nil,FriendsDropDown,"cursor") end end end) end local PostUpdatePower = function(Power, unit, min, max) if(not UnitExists(unit)) then return end Power.frequentUpdates = true local num1 = numformat(min) local num2 = numformat(max) if Power.OverlayText then Power.OverlayText:SetText(num1.."/"..num2) end local _, ptype = UnitPowerType(unit) if(myclasscolors.power[ptype]) then local r, g, b = unpack(myclasscolors.power[ptype]) Power.OverlayText:SetTextColor(r,g,b) end Power.OverlayFrameTex:SetSize(Power.OverlayText:GetWidth() *1.8, Power.OverlayText:GetHeight() + 8) if(UnitIsDead(unit)) then Power:SetValue(0) local num1 = 0 if Power.OverlayText then Power.OverlayText:SetText(num1.."/"..num2) end elseif(UnitIsGhost(unit)) then Power:SetValue(0) elseif(not UnitIsConnected(unit)) then Power:SetValue(0) elseif (UnitIsTapped(unit) and not UnitIsTappedByPlayer(unit)) then Power:SetStatusBarColor(.1,.2,.3) else local _, ptype = UnitPowerType(unit) if(myclasscolors.power[ptype]) then r, g, b = unpack(myclasscolors.power[ptype]) end Power:SetStatusBarColor(r,g,b) end end local PostOverridePVP = function(self, event, unit) if(self.PvP) then local factionGroup = UnitFactionGroup(unit) if(UnitIsPVPFreeForAll(unit)) then self.PvP:SetTexture[[Interface\TargetingFrame\UI-PVP-FFA]] elseif(factionGroup and UnitIsPVP(unit)) then self.PvP:SetTexture([[Interface\Addons\oUF_Henna\icons\]]..factionGroup) end end end -------------------------------- -- This section draws a lot of frames, but doesn't fill them until LayoutPlayer etc. function Henna:AddContainer(self, unit) -- Create a container frame, to provide a reference point for anchoring all the textures self.Container = CreateFrame("Frame", "Container", UIParent) self.Container:SetWidth(Henna.db.profile.containerwidth) self.Container:SetHeight(Henna.db.profile.containerheight) self.Container:SetFrameStrata("BACKGROUND") self.Container:SetFrameLevel(1) end function Henna:AddBgGraphics(self) self.Barsborder = self.Container:CreateTexture(nil, "BACKGROUND") self.Barsborder:SetSize(Henna.db.profile.containerwidth, Henna.db.profile.containerheight) self.Barsborder:SetAllPoints(self.Container) self.Barsborder:SetVertexColor(Henna.db.profile.maincolor.r, Henna.db.profile.maincolor.g, Henna.db.profile.maincolor.b) self.PortraitBGimgFrame = CreateFrame("Frame", nil, self.Container) self.PortraitBGimg = self.PortraitBGimgFrame:CreateTexture(nil, "BACKGROUND") self.PortraitBGimg:SetSize(Henna.db.profile.portraitbgsize, Henna.db.profile.portraitbgsize) self.PortraitBGimgFrame:SetFrameLevel(3) self.Portrait = CreateFrame("PlayerModel", nil, self.Container) self.Portrait:SetSize(Henna.db.profile.portraitsize, Henna.db.profile.portraitsize) self.Portrait:SetFrameLevel(4) self.PortraitFrame = CreateFrame("Frame", nil, self.Container) self.PortraitBorder = self.PortraitFrame:CreateTexture(nil, "BACKGROUND") self.PortraitBorder:SetSize(Henna.db.profile.portraitbordersize,Henna.db.profile.portraitbordersize) self.PortraitBorder:SetVertexColor(Henna.db.profile.maincolor.r, Henna.db.profile.maincolor.g, Henna.db.profile.maincolor.b) self.PortraitFrame:SetFrameLevel(5) self.PortraitOrbFrame = CreateFrame("Frame", nil, self.PortraitFrame) self.PortraitOrb = self.PortraitOrbFrame:CreateTexture(nil, "BACKGROUND") self.PortraitOrb:SetAllPoints(self.PortraitOrbFrame) self.PortraitOrb:SetTexture(PortraitOrbTexture) self.PortraitOrbFrame:SetFrameLevel(7) -- see dragging.lua for the rest. texture placed here for keeping track of frame levels. self.DragFrame = CreateFrame("Frame", nil, self.Container) self.DragFrame:SetSize(Henna.db.profile.portraitbgsize-18, Henna.db.profile.portraitbgsize-18) self.DragTex = self.DragFrame:CreateTexture(nil, "BACKGROUND") self.DragTex:SetTexture(blankTex) self.DragTex:SetAlpha(0) --Set alpha to 1 if you want to see the drag region. self.DragTex:SetAllPoints(self.DragFrame) self.DragFrame:SetFrameLevel(11) end function Henna:AddEliteBorder(self,unit) -- Graphics for elites. self.EliteBorderGold = CreateFrame("Frame", nil, self.Container) self.EliteGold = self.EliteBorderGold:CreateTexture(nil, "BACKGROUND") self.EliteGold:SetSize(88,88) self.EliteGold:SetPoint("BOTTOM", self.PortraitBorder, "BOTTOM", 8, 2) self.EliteGold:SetTexture(dragongold) self.EliteGold:SetVertexColor(Henna.db.profile.maincolor.r, Henna.db.profile.maincolor.g, Henna.db.profile.maincolor.b) self.EliteBorderGold:SetFrameLevel(8) self.EliteBorderSilver = CreateFrame("Frame", nil, self.Container) self.EliteSilver = self.EliteBorderSilver:CreateTexture(nil, "BACKGROUND") self.EliteSilver:SetSize(88,88) self.EliteSilver:SetPoint("BOTTOM", self.PortraitBorder, "BOTTOM", 8, 2) self.EliteSilver:SetTexture(dragonsilver) self.EliteSilver:SetVertexColor(Henna.db.profile.maincolor.r, Henna.db.profile.maincolor.g, Henna.db.profile.maincolor.b) self.EliteBorderSilver:SetFrameLevel(8) self.EliteBorderGold:Hide() self.EliteBorderSilver:Hide() -- Set visibility in frame a. end function Henna:AddAnimation(self, unit) -- This animates when combat is entered. self.glow = CreateFrame("Frame", nil, self.Container) self.glow:SetFrameLevel(6) self.glow:SetPoint("RIGHT", self.Container, "LEFT", 0, 0) self.glow:SetSize(Henna.db.profile.portraitbgsize, Henna.db.profile.portraitbgsize) self.glowtex = self.glow:CreateTexture() self.glowtex:SetPoint("CENTER", self.PortraitBorder, "CENTER", 0, 0) self.glowtex:SetSize(Henna.db.profile.portraitbgsize-8, Henna.db.profile.portraitbgsize-8) self.glowtex:SetTexture("Interface\\AddOns\\oUF_Henna\\texture\\Animtex") self.glowtex:SetBlendMode("ADD") self.glowtex:SetVertexColor(1,1,1) self.animgroup = self.glow:CreateAnimationGroup() self.rotate = self.animgroup:CreateAnimation("Rotation") self.rotate:SetDegrees(360) self.rotate:SetDuration(45) self.animgroup:SetLooping("REPEAT") self.animgroup:Play() return self.glow end function Henna:AddHealthBar(self) -- Create a health statusbar. Must not change name "Health", which works with oUF. -- Parent must be self, which is to say, the value will be oUF_player, oUF_target, etc. self.Health = CreateFrame("StatusBar", nil, self) self.Health:SetFrameStrata("BACKGROUND") self.Health:SetFrameLevel(2) -- Create background graphic for all health bars, in case our other background is transparent. self.Health.bg = self.Health:CreateTexture(nil, "BACKGROUND") self.Health.bg:SetAllPoints(self.Health) -- see https://github.com/haste/oUF/wiki for meaning of these -- Do any of these work placed here? self.Health.Smooth = true self.Health.frequentUpdates = true self.Health.colorDisconnected = true self.Health.colorClass = true local BarTextureID = Henna.db.profile.bartexture local bartex = Henna:GetBarTex(BarTextureID) self.Health:SetStatusBarTexture(bartex) self.Health.bg:SetTexture(bartex) self.Health.bg:SetAlpha(bgalpha) self.Health.bg:SetBlendMode("ADD") self.Health.OverlayFrame = CreateFrame("Frame", nil, self.Health) self.Health.OverlayFrame:SetFrameLevel(10) self.Health.OverlayFrameTex = self.Health.OverlayFrame:CreateTexture(nil, "BACKGROUND") self.Health.OverlayText = self.Health.OverlayFrame:CreateFontString(nil, "OVERLAY") self.Health.OverlayText:SetFont(Henna.db.profile.fontFace, Henna.db.profile.fontSize-1) self.Health.OverlayFrameTex:SetPoint("CENTER",self.Health.OverlayText,"CENTER") self.Health.OverlayFrameTex:SetTexture(ttbg) self.Health.OverlayFrame:Hide() end function Henna:AddPowerBar(self) -- Create a power statusbar. Must not change name "Power", which works with oUF. self.Power = CreateFrame("StatusBar", nil, self) self.Power:SetFrameStrata("BACKGROUND") self.Power:SetFrameLevel(2) self.Power:SetParent(self) self.Power.colorPower = true self.Power.Smooth = true self.Power.frequentUpdates = true self.Power.bg = self.Power:CreateTexture(nil, "BACKGROUND") self.Power.bg:SetAllPoints(self.Power) self.Power.bg:SetBlendMode("ADD") local BarTextureID = Henna.db.profile.bartexture local bartex = Henna:GetBarTex(BarTextureID) self.Power:SetStatusBarTexture(bartex) self.Power.bg:SetTexture(bartex) self.Power.bg:SetAlpha(bgalpha) self.Power.OverlayFrame = CreateFrame("Frame", nil, self.Power) self.Power.OverlayFrame:SetFrameLevel(10) self.Power.OverlayFrameTex = self.Power.OverlayFrame:CreateTexture(nil, "BACKGROUND") self.Power.OverlayText = self.Power.OverlayFrame:CreateFontString(nil, "OVERLAY") self.Power.OverlayText:SetFont(Henna.db.profile.fontFace, Henna.db.profile.fontSize-1) self.Power.OverlayFrameTex:SetPoint("CENTER",self.Power.OverlayText,"CENTER") self.Power.OverlayFrameTex:SetTexture(ttbg) self.Power.OverlayFrame:Hide() end function Henna:CreateBuffs(self) self.Buffs = CreateFrame("Frame", nil, self) self.Buffs:ClearAllPoints() self.Buffs.initialAnchor = Henna.db.profile.initanchor self.Buffs["growth-x"] = Henna.db.profile.growthx self.Buffs["growth-y"] = Henna.db.profile.growthy self.Buffs.size = Henna.db.profile.buffsize self.Buffs:SetWidth(Henna.db.profile.containerwidth) self.Buffs:SetHeight(self.Buffs.size) self.Buffs.spacing = Henna.db.profile.buffspacing self.Buffs.num = 40 self.Buffs.onlyShowPlayer = Henna.db.profile.mybuffsonly if Henna.db.profile.buffanchor == "BuffBottom" then self.Buffs:SetPoint("TOPLEFT", self.Container, "BOTTOMLEFT", 9, -2) elseif Henna.db.profile.buffanchor == "BuffTop" then self.Buffs:SetPoint("BOTTOMRIGHT", self.Container, "TOPRIGHT", -1, 5) end self.Buffs:SetScript("OnMouseUp", function(self, btn) local frame = self:GetParent() if btn == "LeftButton" then frame.Buffs.onlyShowPlayer = not frame.Buffs.onlyShowPlayer Henna.db.profile.mybuffsonly = frame.Buffs.onlyShowPlayer frame.Buffs:ForceUpdate() end if btn == "RightButton" then print ("You must type /cancel <buff name> to cancel a buff.") end end) end function Henna:CreateDebuffs(self) self.Debuffs = CreateFrame("Frame", nil, self) self.Debuffs:ClearAllPoints() self.Debuffs.initialAnchor = Henna.db.profile.initanchor self.Debuffs["growth-x"] = Henna.db.profile.growthx self.Debuffs["growth-y"] = Henna.db.profile.growthy self.Debuffs.size = Henna.db.profile.buffsize self.Debuffs:SetWidth(Henna.db.profile.containerwidth) self.Debuffs:SetHeight(self.Debuffs.size) self.Debuffs.spacing = Henna.db.profile.buffspacing self.Debuffs.num = 40 self.Debuffs.onlyShowPlayer = Henna.db.profile.mybuffsonly if Henna.db.profile.buffanchor == "BuffBottom" then self.Debuffs:SetPoint("TOPLEFT", self.Container, "BOTTOMLEFT", 9, -2) elseif Henna.db.profile.buffanchor == "BuffTop" then self.Debuffs:SetPoint("BOTTOMRIGHT", self.Container, "TOPRIGHT", -1, 5) end self.Debuffs:SetScript("OnMouseUp", function(self, btn) local frame = self:GetParent() if btn == "LeftButton" then frame.Debuffs.onlyShowPlayer = not frame.Debuffs.onlyShowPlayer Henna.db.profile.mybuffsonly = frame.Debuffs.onlyShowPlayer end if btn == "RightButton" then print ("You must type /cancel <buff name> to cancel a buff.") end end) end function Henna:AddText(self) -- Create a textframe to anchor texts to correct framelevel. self.Textframe = CreateFrame("Frame", nil, self.Container) self.Textframe:SetFrameLevel(3) self.Health.value = self.Textframe:CreateFontString(nil, "OVERLAY") self.Health.value:SetFont(Henna.db.profile.fontFace, Henna.db.profile.fontSize) self.Name = self.Textframe:CreateFontString(nil, "OVERLAY") self.Name:SetFont(Henna.db.profile.fontFace, Henna.db.profile.fontSize) self.UnitLevel = self.Textframe:CreateFontString(nil, "OVERLAY") self.UnitLevel:SetFont(Henna.db.profile.fontFace, Henna.db.profile.fontSize) -- These tags are from oUF/elements/tags.lua. self:Tag(self.Name, "[abbrev]") self:Tag(self.UnitLevel, "[difficulty][smartlevel]") end ----------------------------------------------------------- -- The meat of the file, decide what goes in oUF.player object here. local function LayoutPlayer(self, unit) local SkinID = Henna.db.profile.containerborder local pborder, cborder = Henna:GetSkin(SkinID) local padding = (Henna.db.profile.containerheight/2) * (1-Henna.db.profile.heightadjust) -- Add frames Henna:AddContainer(self) self.Container:SetScript("OnEvent", function() Henna:UpdateContainerPos(self,unit) end) self.Container:RegisterEvent("DISPLAY_SIZE_CHANGED") Henna:AddBgGraphics(self) self.Barsborder:SetTexture(cborder) self.PortraitBGimg:SetTexture(portraitbg) self.Portrait:SetPoint("RIGHT", self.Container, "LEFT", 9, 0) self.PortraitBorder:SetTexture(pborder) self.PortraitBorder:SetPoint("RIGHT", self.Container, "LEFT", 25, 0) self.PortraitOrb:SetPoint("CENTER", self.PortraitBorder, "CENTER", 0, 0) self.PortraitBGimg:SetPoint("RIGHT", self.Container, "LEFT", 24, 0) local _, ctype = UnitClass(unit) if not (IsAddOnLoaded"!ClassColors") then if(myclasscolors.class[ctype]) then local r, g, b = unpack(myclasscolors.class[ctype]) self.PortraitBGimg:SetVertexColor(r,g,b) self.PortraitOrb:SetVertexColor(r*1.1,g*1.1,b*1.1) end else local r, g, b = unpack(oUF.colors.class[ctype]) self.PortraitBGimg:SetVertexColor(r,g,b) self.PortraitOrb:SetVertexColor(r*1.1,g*1.1,b*1.1) end self.DragFrame:SetPoint("RIGHT", self.Container, "LEFT", 12, 0) Henna:AddHealthBar(self) self.Health:SetHeight(Henna.db.profile.containerheight * Henna.db.profile.heightadjust * Henna.db.profile.pmratio/100) self.Health:SetWidth(Henna.db.profile.containerwidth * Henna.db.profile.widthadjust) self.Health:SetPoint("TOP", self.Container,"TOP", 0, -padding) self.Health.OverlayText:SetPoint("TOPLEFT", self.Container, "TOPLEFT", 10, 6) -- overlay full text if Henna.db.profile.showplayerhealth then self.Health.OverlayFrame:Show() else self.Health.OverlayFrame:Hide() end Henna:AddPowerBar(self) self.Power:SetHeight( Henna.db.profile.containerheight * Henna.db.profile.heightadjust * (100-Henna.db.profile.pmratio)/100 ) self.Power:SetWidth( Henna.db.profile.containerwidth * Henna.db.profile.widthadjust ) self.Power:SetPoint("BOTTOM", self.Container, "BOTTOM", 0, padding) self.Power.OverlayText:SetPoint("BOTTOMLEFT", self.Container, "BOTTOMLEFT", 10, -3) -- overlay full text if Henna.db.profile.showplayermana then self.Power.OverlayFrame:Show() else self.Power.OverlayFrame:Hide() end Henna:AddText(self) self.Name:SetPoint("LEFT", self.Health, "LEFT", 13, 0) self.UnitLevel:SetPoint("RIGHT", self.Power, "RIGHT", -7, 0) self.Health.value:SetPoint("RIGHT", self.Health, "RIGHT", -6, 0) -- percent text Henna:AddIcons(self, unit) self.PvP:SetPoint("TOPLEFT", self.PortraitBorder, "BOTTOMLEFT", -3, 37) self.PvP:SetVertexColor(Henna.db.profile.maincolor.r, Henna.db.profile.maincolor.g, Henna.db.profile.maincolor.b) self.Resting:SetPoint("TOPLEFT", self.PortraitBorder, "BOTTOMLEFT", 11, 22) self.Combat:SetPoint("CENTER", self.PortraitBorder, "CENTER", 5, -8) Henna:AddAnimation(self, unit) self.glow:Hide() Henna:UpdateContainerPos(self,unit) -- see dragging.lua Henna:SetMovable(self, unit) self.Health.PreUpdate = PreUpdateHealth self.Health.PostUpdate = PostUpdateHealth self.Power.PreUpdate = PreUpdatePower self.Power.PostUpdate = PostUpdatePower self.PvP.Override = PostOverridePVP end local function LayoutTarget(self, unit) local SkinID = Henna.db.profile.containerborder local pborder, cborder = Henna:GetSkin(SkinID) local paddingy = (Henna.db.profile.containerheight/2) * (1-Henna.db.profile.heightadjust) Henna:AddContainer(self) Henna:AddBgGraphics(self) self.Barsborder:SetTexture(cborder) self.PortraitBGimg:SetTexture(portraitbg) self.PortraitBGimg:SetPoint("LEFT", self.Container, "RIGHT", -24, 0) self.Portrait:SetPoint("LEFT", self.Container, "RIGHT", -9, 0) self.PortraitBorder:SetTexture(pborder) self.PortraitBorder:SetPoint("LEFT", self.Container, "RIGHT", -25, 0) self.PortraitOrb:SetPoint("CENTER", self.PortraitBorder, "CENTER", 0, 0) self.DragFrame:SetPoint("LEFT", self.Container, "RIGHT", -12, 0) Henna:AddHealthBar(self) self.Health:SetHeight(Henna.db.profile.containerheight * Henna.db.profile.heightadjust * Henna.db.profile.pmratio/100) self.Health:SetWidth(Henna.db.profile.containerwidth * Henna.db.profile.widthadjust) self.Health:SetPoint("TOP", self.Container,"TOP", 0, -paddingy) self.Health.OverlayText:SetPoint("TOPRIGHT", self.Container, "TOPRIGHT", -10, 6) if Henna.db.profile.showtargethealth then self.Health.OverlayFrame:Show() else self.Health.OverlayFrame:Hide() end Henna:AddPowerBar(self) self.Power:SetHeight( Henna.db.profile.containerheight * Henna.db.profile.heightadjust * (100-Henna.db.profile.pmratio)/100 ) self.Power:SetWidth( Henna.db.profile.containerwidth * Henna.db.profile.widthadjust ) self.Power:SetPoint("BOTTOM", self.Container, "BOTTOM", 0, paddingy) self.Power.OverlayText:SetPoint("BOTTOMRIGHT", self.Container, "BOTTOMRIGHT", -10, -3) -- overlay full text if Henna.db.profile.showtargetmana then self.Power.OverlayFrame:Show() else self.Power.OverlayFrame:Hide() end Henna:AddText(self) self.Name:SetPoint("RIGHT", self.Health, "RIGHT", -13, 0) self.UnitLevel:SetPoint("LEFT", self.Power, "LEFT", 7, 0) self.Health.value:SetPoint("LEFT", self.Health, "LEFT", 6, 0) -- percent text Henna:AddIcons(self, unit) self.PvP:SetPoint("TOPLEFT", self.PortraitBorder, "BOTTOMRIGHT", -20, 37) self.PvP:SetVertexColor(Henna.db.profile.maincolor.r, Henna.db.profile.maincolor.g, Henna.db.profile.maincolor.b) Henna:AddEliteBorder(self,unit) Henna:CreateBuffs(self) Henna:CreateDebuffs(self) --Add lightning bolt graphic for offline, but hide til they are. local offlinetex = "Interface\\AddOns\\oUF_Henna\\icons\\Offline" self.offlineframe = CreateFrame("Frame", nil, self.Container) self.offlineframe:SetFrameLevel(6) self.Health.offline = self.offlineframe:CreateTexture(nil, "BACKGROUND") self.Health.offline:SetSize(Henna.db.profile.portraitbgsize, Henna.db.profile.portraitbgsize) self.Health.offline:SetTexture(offlinetex) self.Health.offline:SetPoint("RIGHT", self.PortraitBorder, "RIGHT", -4, 0) self.Health.offline:Hide() -- Add raid target icons self.RaidIconframe = CreateFrame("Frame", nil, self.PortraitOrbFrame) self.RaidIconframe:SetFrameLevel(9) self.RaidIcon = self.RaidIconframe:CreateTexture(nil, "BACKGROUND") self.RaidIcon:SetSize(18, 18) self.RaidIcon:SetPoint("BOTTOMLEFT", self.PortraitBorder, "BOTTOMLEFT", 2, 2) --self.RaidIcon:SetPoint("RIGHT", self.Container, "LEFT", 6,0) Henna:SetMovable(self, unit) Henna:UpdateContainerPos(self,unit) self.Health.PreUpdate = PreUpdateHealth self.Health.PostUpdate = PostUpdateHealth self.Power.PreUpdate = PreUpdatePower self.Power.PostUpdate = PostUpdatePower self.PvP.Override = PostOverridePVP end local function LayoutPet(self, unit) local SkinID = Henna.db.profile.containerborder local pborder, cborder = Henna:GetSkin(SkinID) local petwidth = (Henna.db.profile.containerwidth) * (Henna.db.profile.pcontainerwidth/100) local petheight = (Henna.db.profile.containerheight) * (Henna.db.profile.pcontainerheight/100) local padding = (Henna.db.profile.containerheight/2) * (1-Henna.db.profile.heightadjust) * (Henna.db.profile.pcontainerheight/100) local petfontsize = max (8, math.ceil(Henna.db.profile.fontSize * Henna.db.profile.pcontainerheight/100)) -- get the larger of (minfontsize or mainfontsize*percent) -- Add frames Henna:AddContainer(self) self.Container:SetWidth(petwidth) self.Container:SetHeight(petheight) Henna:AddBgGraphics(self) self.Barsborder:SetTexture(cborder) self.DragFrame:SetPoint("RIGHT", self.Container, "LEFT", 10, 0) Henna:AddHealthBar(self) self.Health:SetHeight( petheight * Henna.db.profile.heightadjust * Henna.db.profile.petpmratio/100) self.Health:SetWidth( petwidth * Henna.db.profile.widthadjust) self.Health:SetPoint("TOP", self.Container,"TOP", 0, -padding) self.Health.OverlayText:SetPoint("TOPLEFT", self.Container, "TOPLEFT", 10, 2) if Henna.db.profile.showpethealth then self.Health.OverlayFrame:Show() else self.Health.OverlayFrame:Hide() end Henna:AddPowerBar(self) self.Power:SetHeight( petheight * Henna.db.profile.heightadjust * (100-Henna.db.profile.petpmratio)/100) self.Power:SetWidth( petwidth * Henna.db.profile.widthadjust) self.Power:SetPoint("BOTTOM", self.Container, "BOTTOM", 0, padding) self.Power.OverlayText:SetPoint("BOTTOMLEFT", self.Container, "BOTTOMLEFT", 10, -3) if Henna.db.profile.showpetmana then self.Power.OverlayFrame:Show() else self.Power.OverlayFrame:Hide() end Henna:AddText(self) self.Health.value:SetFont(Henna.db.profile.fontFace, petfontsize) self.Health.value:SetPoint("RIGHT", self.Health, "RIGHT", -2, 0) self.Name:SetFont(Henna.db.profile.fontFace, petfontsize) self.Name:SetPoint("LEFT", self.Health, "LEFT", 4, 0) self.UnitLevel:SetFont(Henna.db.profile.fontFace, petfontsize) self.UnitLevel:SetPoint("RIGHT", self.Power, "RIGHT", -3, 0) self.PetTargetName = self.Textframe:CreateFontString(nil, "OVERLAY") self.PetTargetName:SetFont(Henna.db.profile.fontFace, petfontsize) self.PetTargetName:SetPoint("LEFT", self.Power, "LEFT", 4, 0) self:Tag(self.PetTargetName, "[pettarget]") Henna:SetMovable(self, unit) Henna:UpdateContainerPos(self,unit) self.Health.PreUpdate = PreUpdateHealth self.Health.PostUpdate = PostUpdateHealth self.Power.PreUpdate = PreUpdatePower self.Power.PostUpdate = PostUpdatePower end local function LayoutFocus(self, unit) local SkinID = Henna.db.profile.containerborder local pborder, cborder = Henna:GetSkin(SkinID) local focuswidth = (Henna.db.profile.containerwidth) * (Henna.db.profile.fcontainerwidth/100) local focusheight = (Henna.db.profile.containerheight) * (Henna.db.profile.fcontainerheight/100) local padding = (Henna.db.profile.containerheight/2) * (1-Henna.db.profile.heightadjust) * (Henna.db.profile.fcontainerheight/100) local focusfontsize = max (8, math.ceil(Henna.db.profile.fontSize * Henna.db.profile.fcontainerheight/100)) -- Add frames Henna:AddContainer(self) self.Container:SetWidth(focuswidth) self.Container:SetHeight(focusheight) Henna:AddBgGraphics(self) self.Barsborder:SetTexture(cborder) self.DragFrame:SetPoint("LEFT", self.Container, "RIGHT", -12, 0) Henna:AddIcons(self, unit) self.PvP:SetPoint("TOPLEFT", self.PortraitBorder, "BOTTOMRIGHT", -20, 37) self.PvP:SetVertexColor(Henna.db.profile.maincolor.r, Henna.db.profile.maincolor.g, Henna.db.profile.maincolor.b) Henna:AddHealthBar(self) self.Health:SetHeight( focusheight * Henna.db.profile.heightadjust * Henna.db.profile.focuspmratio/100) self.Health:SetWidth( focuswidth * Henna.db.profile.widthadjust) self.Health:SetPoint("TOP", self.Container,"TOP", 0, -padding) self.Health.OverlayText:SetPoint("TOPLEFT", self.Container, "TOPLEFT", 10, 6) -- overlay full text if Henna.db.profile.showfocushealth then self.Health.OverlayFrame:Show() else self.Health.OverlayFrame:Hide() end Henna:AddPowerBar(self) self.Power:SetHeight( focusheight * Henna.db.profile.heightadjust * (100-Henna.db.profile.focuspmratio)/100) self.Power:SetWidth( focuswidth * Henna.db.profile.widthadjust) self.Power:SetPoint("BOTTOM", self.Container, "BOTTOM", 0, padding) self.Power.OverlayText:SetPoint("BOTTOMLEFT", self.Container, "BOTTOMLEFT", 10, -3) -- overlay full text if Henna.db.profile.showfocusmana then self.Health.OverlayFrame:Show() else self.Health.OverlayFrame:Hide() end Henna:AddText(self) self.Health.value:SetFont(Henna.db.profile.fontFace, focusfontsize) self.Health.value:SetPoint("RIGHT", self.Health, "RIGHT", -2, 0) self.Name:SetFont(Henna.db.profile.fontFace, focusfontsize) self.Name:SetPoint("LEFT", self.Health, "LEFT", 4, 0) self.UnitLevel:SetFont(Henna.db.profile.fontFace, focusfontsize) self.UnitLevel:SetPoint("RIGHT", self.Power, "RIGHT", -3, 0) Henna:SetMovable(self, unit) Henna:UpdateContainerPos(self,unit) self.Health.PreUpdate = PreUpdateHealth self.Health.PostUpdate = PostUpdateHealth self.Power.PreUpdate = PreUpdatePower self.Power.PostUpdate = PostUpdatePower self.PvP.Override = PostOverridePVP end local function LayoutToT(self, unit) local SkinID = Henna.db.profile.containerborder local pborder, cborder = Henna:GetSkin(SkinID) local totwidth = (Henna.db.profile.containerwidth) * (Henna.db.profile.totcontainerwidth/100) local totheight = (Henna.db.profile.containerheight) * (Henna.db.profile.totcontainerheight/100) local padding = (Henna.db.profile.containerheight/2) * (1-Henna.db.profile.heightadjust) * (Henna.db.profile.totcontainerheight/100) local totfontsize = max (8, math.ceil(Henna.db.profile.fontSize * Henna.db.profile.totcontainerheight/100)) -- Add frames Henna:AddContainer(self) self.Container:SetWidth(totwidth) self.Container:SetHeight(totheight) Henna:AddBgGraphics(self) self.Barsborder:SetTexture(cborder) self.DragFrame:SetPoint("LEFT", self.Container, "RIGHT", -12, 0) Henna:AddIcons(self, unit) self.PvP:SetPoint("TOPLEFT", self.PortraitBorder, "BOTTOMRIGHT", -20, 37) self.PvP:SetVertexColor(Henna.db.profile.maincolor.r, Henna.db.profile.maincolor.g, Henna.db.profile.maincolor.b) Henna:AddHealthBar(self) self.Health:SetHeight( totheight * Henna.db.profile.heightadjust * Henna.db.profile.totpmratio/100) self.Health:SetWidth( totwidth * Henna.db.profile.widthadjust) self.Health:SetPoint("TOP", self.Container,"TOP", 0, -padding) self.Health.OverlayText:SetPoint("TOPLEFT", self.Container, "TOPLEFT", 10, 6) -- overlay full text if Henna.db.profile.showtothealth then self.Health.OverlayFrame:Show() else self.Health.OverlayFrame:Hide() end Henna:AddPowerBar(self) self.Power:SetHeight( totheight * Henna.db.profile.heightadjust * (100-Henna.db.profile.totpmratio)/100) self.Power:SetHeight( totheight * Henna.db.profile.heightadjust * .5) self.Power:SetWidth( totwidth * Henna.db.profile.widthadjust) self.Power:SetPoint("BOTTOM", self.Container, "BOTTOM", 0, padding) self.Power.OverlayText:SetPoint("BOTTOMLEFT", self.Container, "BOTTOMLEFT", 10, -3) -- overlay full text if Henna.db.profile.showtotmana then self.Health.OverlayFrame:Show() else self.Health.OverlayFrame:Hide() end Henna:AddText(self) self.Health.value:SetFont(Henna.db.profile.fontFace, totfontsize) self.Health.value:SetPoint("RIGHT", self.Health, "RIGHT", -2, 0) self.Name:SetFont(Henna.db.profile.fontFace, totfontsize) self.Name:SetPoint("LEFT", self.Health, "LEFT", 9, 0) self.UnitLevel:SetFont(Henna.db.profile.fontFace, totfontsize) self.UnitLevel:SetPoint("RIGHT", self.Power, "RIGHT", -3, 0) Henna:SetMovable(self, unit) Henna:UpdateContainerPos(self,unit) self.Health.PreUpdate = PreUpdateHealth self.Health.PostUpdate = PostUpdateHealth self.Power.PreUpdate = PreUpdatePower self.Power.PostUpdate = PostUpdatePower self.PvP.Override = PostOverridePVP end ----------------------------------------------------------- -- Call oUF to make the bars work. function Henna:SpawnCore() oUF:RegisterStyle("HennaPlayer", LayoutPlayer) oUF:SetActiveStyle("HennaPlayer") oUF:Spawn("player", "oUF_player") oUF:RegisterStyle("HennaTarget", LayoutTarget) oUF:SetActiveStyle("HennaTarget") oUF:Spawn("target", "oUF_target") oUF:RegisterStyle("HennaPet", LayoutPet) oUF:SetActiveStyle("HennaPet") oUF:Spawn("pet", "oUF_pet") oUF:RegisterStyle("HennaFocus", LayoutFocus) oUF:SetActiveStyle("HennaFocus") oUF:Spawn("focus", "oUF_focus") oUF:RegisterStyle("HennaToT", LayoutToT) oUF:SetActiveStyle("HennaToT") oUF:Spawn("targettarget", "oUF_tot") end ----------------------------------------------------------- -- remove SET_FOCUS & CLEAR_FOCUS from menu, to prevent errors, since they are disallowed by Blizz do for k,v in pairs(UnitPopupMenus) do for x,y in pairs(UnitPopupMenus[k]) do if y == "SET_FOCUS" then table.remove(UnitPopupMenus[k],x) elseif y == "CLEAR_FOCUS" then table.remove(UnitPopupMenus[k],x) end end end end ----------------------------------------------------------- function Henna:HideBlizzRaid() if Henna.db.profile.HideBlizzardRaid then --Hide raid CompactRaidFrameManager:UnregisterAllEvents() CompactRaidFrameManager:Hide() CompactRaidFrameContainer:UnregisterEvent("RAID_ROSTER_UPDATE") CompactRaidFrameContainer:UnregisterEvent("UNIT_PET") CompactRaidFrameContainer:Hide() --Hide party for i = 1, 4 do local frame = _G["PartyMemberFrame"..i] frame:UnregisterAllEvents() frame:Hide() frame.Show = function() end end UIParent:UnregisterEvent("RAID_ROSTER_UPDATE") else --Show raid CompactRaidFrameManager:GetScript("OnLoad")(CompactRaidFrameManager) if GetNumRaidMembers() > 0 then CompactRaidFrameManager:Show() end CompactRaidFrameContainer:RegisterEvent("RAID_ROSTER_UPDATE") CompactRaidFrameContainer:RegisterEvent("UNIT_PET") CompactRaidFrameContainer:Show() -- Show party for i = 1, 4 do local frame = _G["PartyMemberFrame"..i] frame.Show = nil frame:GetScript("OnLoad")(frame) frame:GetScript("OnEvent")(frame, "PARTY_MEMBERS_CHANGED") PartyMemberFrame_UpdateMember(frame) end UIParent:RegisterEvent("RAID_ROSTER_UPDATE") end end |
|
![]() |
WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » Missing Left-click menu |
«
Previous Thread
|
Next Thread
»
|
Display Modes |
![]() |
![]() |
![]() |
|
|