This commit is contained in:
Bunny67
2017-12-23 14:08:21 +03:00
parent 1fdd15d497
commit 49fd843612
14 changed files with 905 additions and 2263 deletions
@@ -61,7 +61,7 @@ function LoadSkin()
skinPulloutFrames()
end)
hooksecurefunc("RaidPullout_Update", function(pullOutFrame)
--[[hooksecurefunc("RaidPullout_Update", function(pullOutFrame)
local pfName = pullOutFrame:GetName()
for i = 1, pullOutFrame.numPulloutButtons do
local pfBName = pfName.."Button"..i
@@ -88,7 +88,7 @@ function LoadSkin()
_G[pfBName.."TargetTargetFrame"].backdrop:SetPoint("BOTTOMRIGHT", -(E.PixelMode and 10 or 9), E.PixelMode and 8 or 7)
end
end
end)
end)]]
-- ReadyCheckFrame
E:StripTextures(ReadyCheckFrame)
@@ -4,8 +4,11 @@ local TT = E:NewModule("Tooltip", "AceHook-3.0", "AceEvent-3.0");
--Cache global variables
--Lua functions
local unpack = unpack
local twipe, tinsert, tconcat = table.wipe, table.insert, table.concat
--WoW API / Variables
local targetList, inspectCache = {}, {}
local classification = {
worldboss = format("|cffAF5050 %s|r", BOSS),
rareelite = format("|cffAF5050+ %s|r", ITEM_QUALITY3_DESC),
@@ -149,6 +152,37 @@ function TT:UPDATE_MOUSEOVER_UNIT(_, unit)
end
end
local unitTarget = unit.."target"
if self.db.targetInfo and unit ~= "player" and UnitExists(unitTarget) then
local targetColor;
if UnitIsPlayer(unitTarget) then
local _, class = UnitClass(unitTarget);
targetColor = CUSTOM_CLASS_COLORS and CUSTOM_CLASS_COLORS[class] or RAID_CLASS_COLORS[class];
else
local reaction = UnitReaction(unitTarget, "player") or 4
targetColor = E.db.tooltip.useCustomFactionColors and E.db.tooltip.factionColors[reaction] or FACTION_BAR_COLORS[reaction]
end
GameTooltip:AddDoubleLine(format("%s:", TARGET), format("|cff%02x%02x%02x%s|r", targetColor.r * 255, targetColor.g * 255, targetColor.b * 255, UnitName(unitTarget)))
end
local numParty, numRaid = GetNumPartyMembers(), GetNumRaidMembers()
if self.db.targetInfo and (numParty > 0 or numRaid > 0) then
for i = 1, (numRaid > 0 and numRaid or numParty) do
local groupUnit = (numRaid > 0 and "raid"..i or "party"..i)
if UnitIsUnit(groupUnit.."target", unit) and (not UnitIsUnit(groupUnit,"player")) then
local _, class = UnitClass(groupUnit)
local color = CUSTOM_CLASS_COLORS and CUSTOM_CLASS_COLORS[class] or RAID_CLASS_COLORS[class]
tinsert(targetList, format("%s%s", E:RGBToHex(color.r, color.g, color.b), UnitName(groupUnit)))
end
end
local numList = getn(targetList)
if numList > 0 then
GameTooltip:AddLine(format("%s (|cffffffff%d|r): %s", L["Targeted By:"], numList, tconcat(targetList, ", ")), nil, nil, nil, true)
twipe(targetList)
end
end
if color then
GameTooltipStatusBar:SetStatusBarColor(color.r, color.g, color.b)
else
@@ -0,0 +1,4 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/">
<Script file="Party.lua"/>
<Script file="Raid.lua"/>
</Ui>
@@ -0,0 +1,149 @@
local E, L, V, P, G = unpack(ElvUI)
local UF = E:GetModule("UnitFrames")
local _G = _G
local tinsert = table.insert
local CreateFrame = CreateFrame;
local InCombatLockdown = InCombatLockdown;
local UnregisterStateDriver = UnregisterStateDriver;
local RegisterStateDriver = RegisterStateDriver;
local IsInInstance = IsInInstance;
local ns = oUF
local ElvUF = ns.oUF
assert(ElvUF, "ElvUI was unable to locate oUF.")
function UF:Construct_PartyFrames()
self:SetScript("OnEnter", UnitFrame_OnEnter)
self:SetScript("OnLeave", UnitFrame_OnLeave)
self.RaisedElementParent = CreateFrame("Frame", nil, self)
self.RaisedElementParent.TextureParent = CreateFrame("Frame", nil, self.RaisedElementParent)
self.RaisedElementParent:SetFrameLevel(self:GetFrameLevel() + 100)
self.BORDER = E.Border
self.SPACING = E.Spacing
self.SHADOW_SPACING = 3
self.Health = UF:Construct_HealthBar(self, true, true, "RIGHT");
self.Power = UF:Construct_PowerBar(self, true, true, "LEFT");
self.Power.frequentUpdates = false;
self.Portrait3D = UF:Construct_Portrait(self, "model");
self.Portrait2D = UF:Construct_Portrait(self, "texture");
self.InfoPanel = UF:Construct_InfoPanel(self);
self.Name = UF:Construct_NameText(self);
self.unitframeType = "party"
UF:Update_StatusBars()
UF:Update_FontStrings()
UF:Update_PartyFrames(self, UF.db["units"]["party"])
return self;
end
function UF:Update_PartyHeader(header, db)
header.db = db
if not header.positioned then
header:ClearAllPoints()
header:SetPoint("BOTTOMLEFT", E.UIParent, "BOTTOMLEFT", 4, 195)
E:CreateMover(header, header:GetName().."Mover", L["Party Frames"], nil, nil, nil, "ALL,PARTY,ARENA")
header.positioned = true
header:RegisterEvent("PLAYER_LOGIN")
header:RegisterEvent("ZONE_CHANGED_NEW_AREA")
header:SetScript("OnEvent", UF["PartySmartVisibility"])
end
UF.PartySmartVisibility(header)
end
function UF:PartySmartVisibility(event)
--if(not self.db or (self.db and not self.db.enable) or (UF.db and not UF.db.smartRaidFilter) or self.isForced) then
-- self.blockVisibilityChanges = false;
-- return;
--end
--if(event == "PLAYER_REGEN_ENABLED") then self:UnregisterEvent("PLAYER_REGEN_ENABLED"); end
--self.blockVisibilityChanges = true;
--if(not InCombatLockdown()) then
-- local inInstance, instanceType = IsInInstance();
-- if(inInstance and (instanceType == "raid" or instanceType == "pvp")) then
-- UnregisterStateDriver(self, "visibility");
-- self:Hide();
-- self.blockVisibilityChanges = true;
-- elseif(self.db.visibility) then
-- RegisterStateDriver(self, "visibility", self.db.visibility);
-- self.blockVisibilityChanges = false;
-- end
--else
-- self:RegisterEvent("PLAYER_REGEN_ENABLED");
--end
end
function UF:Update_PartyFrames(frame, db)
frame.db = db
frame.Portrait = db.portrait.style == "2D" and frame.Portrait2D or frame.Portrait3D
frame.colors = ElvUF.colors
frame:RegisterForClicks(self.db.targetOnMouseDown and "LeftButtonDown" or "LeftButtonUp", self.db.targetOnMouseDown and "RightButtonDown" or "RightButtonUp")
do
if self.thinBorders then
frame.SPACING = 0
frame.BORDER = E.mult
else
frame.BORDER = E.Border
frame.SPACING = E.Spacing
end
frame.ORIENTATION = db.orientation
frame.UNIT_WIDTH = db.width
frame.UNIT_HEIGHT = db.infoPanel.enable and (db.height + db.infoPanel.height) or db.height
frame.USE_POWERBAR = db.power.enable
frame.POWERBAR_DETACHED = db.power.detachFromFrame
frame.USE_INSET_POWERBAR = not frame.POWERBAR_DETACHED and db.power.width == "inset" and frame.USE_POWERBAR
frame.USE_MINI_POWERBAR = (not frame.POWERBAR_DETACHED and db.power.width == "spaced" and frame.USE_POWERBAR)
frame.USE_POWERBAR_OFFSET = db.power.offset ~= 0 and frame.USE_POWERBAR and not frame.POWERBAR_DETACHED
frame.POWERBAR_OFFSET = frame.USE_POWERBAR_OFFSET and db.power.offset or 0
frame.POWERBAR_HEIGHT = not frame.USE_POWERBAR and 0 or db.power.height
frame.POWERBAR_WIDTH = frame.USE_MINI_POWERBAR and (frame.UNIT_WIDTH - (frame.BORDER*2))/2 or (frame.POWERBAR_DETACHED and db.power.detachedWidth or (frame.UNIT_WIDTH - ((frame.BORDER+frame.SPACING)*2)))
frame.USE_PORTRAIT = db.portrait and db.portrait.enable
frame.USE_PORTRAIT_OVERLAY = frame.USE_PORTRAIT and (db.portrait.overlay or frame.ORIENTATION == "MIDDLE")
frame.PORTRAIT_WIDTH = (frame.USE_PORTRAIT_OVERLAY or not frame.USE_PORTRAIT) and 0 or db.portrait.width
frame.CLASSBAR_WIDTH = 0
frame.CLASSBAR_YOFFSET = 0
frame.USE_INFO_PANEL = not frame.USE_MINI_POWERBAR and not frame.USE_POWERBAR_OFFSET and db.infoPanel.enable
frame.INFO_PANEL_HEIGHT = frame.USE_INFO_PANEL and db.infoPanel.height or 0
frame.BOTTOM_OFFSET = UF:GetHealthBottomOffset(frame)
frame.VARIABLES_SET = true
end
frame:SetWidth(frame.UNIT_WIDTH)
frame:SetHeight(frame.UNIT_HEIGHT)
UF:Configure_InfoPanel(frame)
UF:Configure_HealthBar(frame)
UF:UpdateNameSettings(frame)
UF:Configure_Power(frame)
UF:Configure_Portrait(frame)
frame:UpdateAllElements("ElvUI_UpdateAllElements");
end
UF["headerstoload"]["party"] = true
@@ -0,0 +1,167 @@
local E, L, V, P, G = unpack(ElvUI)
local UF = E:GetModule("UnitFrames")
local tinsert = table.insert;
local CreateFrame = CreateFrame
local InCombatLockdown = InCombatLockdown
local IsInInstance = IsInInstance
local GetInstanceInfo = GetInstanceInfo
local UnregisterStateDriver = UnregisterStateDriver
local RegisterStateDriver = RegisterStateDriver
local ns = oUF
local ElvUF = ns.oUF
assert(ElvUF, "ElvUI was unable to locate oUF.")
function UF:Construct_RaidFrames()
self:SetScript("OnEnter", UnitFrame_OnEnter)
self:SetScript("OnLeave", UnitFrame_OnLeave)
self.RaisedElementParent = CreateFrame("Frame", nil, self)
self.RaisedElementParent.TextureParent = CreateFrame("Frame", nil, self.RaisedElementParent)
self.RaisedElementParent:SetFrameLevel(self:GetFrameLevel() + 100)
self.Health = UF:Construct_HealthBar(self, true, true, "RIGHT");
self.Power = UF:Construct_PowerBar(self, true, true, "LEFT");
self.Power.frequentUpdates = false;
self.Portrait3D = UF:Construct_Portrait(self, "model");
self.Portrait2D = UF:Construct_Portrait(self, "texture");
self.Name = UF:Construct_NameText(self);
self.InfoPanel = UF:Construct_InfoPanel(self);
UF:Update_StatusBars();
UF:Update_FontStrings();
self.unitframeType = "raid";
UF:Update_RaidFrames(self, UF.db["units"]["raid"]);
return self;
end
function UF:RaidSmartVisibility(event)
--[[if(not self.db or (self.db and not self.db.enable) or (UF.db and not UF.db.smartRaidFilter) or self.isForced) then
self.blockVisibilityChanges = false;
return;
end
if(event == "PLAYER_REGEN_ENABLED") then self:UnregisterEvent("PLAYER_REGEN_ENABLED"); end
if(not InCombatLockdown()) then
self.isInstanceForced = nil;
local inInstance, instanceType = IsInInstance();
if(inInstance and (instanceType == "raid" or instanceType == "pvp")) then
local _, _, _, _, maxPlayers = GetInstanceInfo();
local mapID = GetCurrentMapAreaID();
if(UF.mapIDs[mapID]) then
maxPlayers = UF.mapIDs[mapID];
end
UnregisterStateDriver(self, "visibility");
if(maxPlayers < 40) then
self:Show();
self.isInstanceForced = true;
self.blockVisibilityChanges = false;
if(ElvUF_Raid.numGroups ~= E:Round(maxPlayers/5) and event) then
UF:CreateAndUpdateHeaderGroup("raid");
end
else
self:Hide();
self.blockVisibilityChanges = true;
end
elseif(self.db.visibility) then
RegisterStateDriver(self, "visibility", self.db.visibility);
self.blockVisibilityChanges = false;
if(ElvUF_Raid.numGroups ~= self.db.numGroups) then
UF:CreateAndUpdateHeaderGroup("raid");
end
end
else
self:RegisterEvent("PLAYER_REGEN_ENABLED");
return;
end]]
end
function UF:Update_RaidHeader(header, db)
header.db = db;
if not header.positioned then
header:ClearAllPoints()
header:SetPoint("BOTTOMLEFT", E.UIParent, "BOTTOMLEFT", 4, 195)
E:CreateMover(header, header:GetName().."Mover", L["Raid Frames"], nil, nil, nil, "ALL,RAID")
-- header:RegisterEvent("PLAYER_LOGIN")
-- header:RegisterEvent("ZONE_CHANGED_NEW_AREA")
-- header:SetScript("OnEvent", UF["RaidSmartVisibility"])
header.positioned = true
end
--UF.RaidSmartVisibility(header)
end
function UF:Update_RaidFrames(frame, db)
frame.db = db
frame.Portrait = frame.Portrait or (db.portrait.style == "2D" and frame.Portrait2D or frame.Portrait3D)
frame.colors = ElvUF.colors
--frame:RegisterForClicks(self.db.targetOnMouseDown and "AnyDown" or "AnyUp")
do
if self.thinBorders then
frame.SPACING = 0
frame.BORDER = E.mult
else
frame.BORDER = E.Border
frame.SPACING = E.Spacing
end
frame.SHADOW_SPACING = 3
frame.ORIENTATION = db.orientation
frame.UNIT_WIDTH = db.width
frame.UNIT_HEIGHT = db.infoPanel.enable and (db.height + db.infoPanel.height) or db.height
frame.USE_POWERBAR = db.power.enable
frame.POWERBAR_DETACHED = db.power.detachFromFrame
frame.USE_INSET_POWERBAR = not frame.POWERBAR_DETACHED and db.power.width == "inset" and frame.USE_POWERBAR
frame.USE_MINI_POWERBAR = (not frame.POWERBAR_DETACHED and db.power.width == "spaced" and frame.USE_POWERBAR)
frame.USE_POWERBAR_OFFSET = db.power.offset ~= 0 and frame.USE_POWERBAR and not frame.POWERBAR_DETACHED
frame.POWERBAR_OFFSET = frame.USE_POWERBAR_OFFSET and db.power.offset or 0
frame.POWERBAR_HEIGHT = not frame.USE_POWERBAR and 0 or db.power.height
frame.POWERBAR_WIDTH = frame.USE_MINI_POWERBAR and (frame.UNIT_WIDTH - (frame.BORDER*2))/2 or (frame.POWERBAR_DETACHED and db.power.detachedWidth or (frame.UNIT_WIDTH - ((frame.BORDER+frame.SPACING)*2)))
frame.USE_PORTRAIT = db.portrait and db.portrait.enable
frame.USE_PORTRAIT_OVERLAY = frame.USE_PORTRAIT and (db.portrait.overlay or frame.ORIENTATION == "MIDDLE")
frame.PORTRAIT_WIDTH = (frame.USE_PORTRAIT_OVERLAY or not frame.USE_PORTRAIT) and 0 or db.portrait.width
frame.CLASSBAR_WIDTH = 0
frame.CLASSBAR_YOFFSET = 0
frame.USE_INFO_PANEL = not frame.USE_MINI_POWERBAR and not frame.USE_POWERBAR_OFFSET and db.infoPanel.enable
frame.INFO_PANEL_HEIGHT = frame.USE_INFO_PANEL and db.infoPanel.height or 0
frame.BOTTOM_OFFSET = UF:GetHealthBottomOffset(frame)
frame.VARIABLES_SET = true
end
frame:SetWidth(frame.UNIT_WIDTH)
frame:SetHeight(frame.UNIT_HEIGHT)
UF:Configure_InfoPanel(frame)
UF:Configure_HealthBar(frame)
UF:UpdateNameSettings(frame)
UF:Configure_Power(frame)
UF:Configure_Portrait(frame)
frame:UpdateAllElements("ElvUI_UpdateAllElements")
end
UF["headerstoload"]["raid"] = true
@@ -3,4 +3,5 @@
<Script file="Tags.lua"/>
<Include file="Elements\Load_Elements.xml"/>
<Include file="Units\Load_Units.xml"/>
<Include file="Groups\Load_Groups.xml"/>
</Ui>
@@ -65,11 +65,6 @@ UF["headerGroupBy"] = {
header:SetAttribute("sortMethod", "NAME")
header:SetAttribute("groupBy", "CLASS")
end,
["MTMA"] = function(header)
header:SetAttribute("groupingOrder", "MAINTANK,MAINASSIST,NONE")
header:SetAttribute("sortMethod", "NAME")
header:SetAttribute("groupBy", "ROLE")
end,
["NAME"] = function(header)
header:SetAttribute("groupingOrder", "1,2,3,4,5,6,7,8")
header:SetAttribute("sortMethod", "NAME")
@@ -577,11 +572,12 @@ function UF.groupPrototype:Configure_Groups(self)
if self.mover then
self.mover.positionOverride = DIRECTION_TO_GROUP_ANCHOR_POINT[direction]
E:UpdatePositionOverride(self.mover:GetName())
self:GetScript("OnSizeChanged")(self) --Mover size is not updated if frame is hidden, so call an update manually
--E:UpdatePositionOverride(self.mover:GetName())
--self:GetScript("OnSizeChanged")(self) --Mover size is not updated if frame is hidden, so call an update manually
end
self:SetSize(width - db.horizontalSpacing, height - db.verticalSpacing)
self:SetWidth(width - db.horizontalSpacing)
self:SetHeight(height - db.verticalSpacing)
end
function UF.groupPrototype:Update(self)
@@ -603,7 +599,7 @@ function UF.groupPrototype:AdjustVisibility(self)
group:Show()
else
if group.forceShow then
group:Hide()
--group:Hide()
UF:UnshowChildUnits(group, group:GetChildren())
group:SetAttribute("startingIndex", 1)
else
@@ -650,7 +646,7 @@ function UF.headerPrototype:Update(isForced)
end
function UF.headerPrototype:Reset()
self:Hide()
--self:Hide()
self:SetAttribute("showPlayer", true)
@@ -685,7 +681,7 @@ function UF:CreateHeader(parent, groupFilter, overrideName, template, groupName,
"groupFilter", groupFilter,
"showParty", true,
"showRaid", true,
"showSolo", true,
"showSolo", false,
template and "template", template)
header.groupName = group
@@ -761,7 +757,7 @@ function UF:CreateAndUpdateHeaderGroup(group, groupFilter, template, headerUpdat
if headerUpdate or not self[group].mover then
UF["headerFunctions"][group]:Configure_Groups(self[group])
if not self[group].isForced and not self[group].blockVisibilityChanges then
RegisterStateDriver(self[group], "visibility", db.visibility)
-- RegisterStateDriver(self[group], "visibility", db.visibility)
end
else
UF["headerFunctions"][group]:Configure_Groups(self[group])
@@ -774,8 +770,8 @@ function UF:CreateAndUpdateHeaderGroup(group, groupFilter, template, headerUpdat
E:EnableMover(self[group].mover:GetName())
end
else
UnregisterStateDriver(self[group], "visibility")
self[group]:Hide()
-- UnregisterStateDriver(self[group], "visibility")
-- self[group]:Hide()
if self[group].mover then
E:DisableMover(self[group].mover:GetName())
end
@@ -789,7 +785,7 @@ function UF:CreateAndUpdateHeaderGroup(group, groupFilter, template, headerUpdat
local db = UF.db["units"][group]
if db.enable ~= true then
UnregisterStateDriver(UF[group], "visibility")
UF[group]:Hide()
--UF[group]:Hide()
if(UF[group].mover) then
E:DisableMover(UF[group].mover:GetName())
end
@@ -904,10 +900,11 @@ function UF:UpdateAllHeaders(event)
shouldUpdateHeader = true
end
self:CreateAndUpdateHeaderGroup(group, nil, nil, shouldUpdateHeader)
header:Hide()
header:Show()
if group == "party" or group == "raid" or group == "raid40" then
--Update BuffIndicators on profile change as they might be using profile specific data
self:UpdateAuraWatchFromHeader(group)
--self:UpdateAuraWatchFromHeader(group)
end
end
end