diff --git a/Localization.enUS.lua b/Localization.enUS.lua index 3e0ecbc..50ac0b5 100644 --- a/Localization.enUS.lua +++ b/Localization.enUS.lua @@ -126,6 +126,7 @@ PerfectRaidLocals = { ["Shadow Protection"] = "Shadow Protection", ["Shaman"] = "Shaman", ["Show HP deficit"] = "Show HP deficit", + ["Show group number"] = "Show group number", ["Show options GUI"] = "Show options GUI", ["Sort Frames By:"] = "Sort Frames By:", ["Soulstone Resurrection"] = "Soulstone Resurrection", diff --git a/PerfectRaid.lua b/PerfectRaid.lua index 551e438..2aa6e7d 100644 --- a/PerfectRaid.lua +++ b/PerfectRaid.lua @@ -140,6 +140,9 @@ function PerfectRaid:UpdateRaidFrames() for idx,entry in ipairs(list) do self:CreateRaidFrame(idx) end + + -- Call RAID_ROSTER_UPDATE to update subgroup, etc. + self:RAID_ROSTER_UPDATE() end function PerfectRaid:SavePosition(name) @@ -201,12 +204,20 @@ end function PerfectRaid:CreateRaidFrame(idx) local options = self.db.profile.headers[idx] local name = "PRHeader"..idx + local template = "SecureRaidGroupHeaderTemplate" + if options.partyFrame then + name = name .. "Party" + template = "SecurePartyHeaderTemplate" + end + local frame = getglobal(name) if not frame then - frame = CreateFrame("Frame", name, UIParent, "SecureRaidGroupHeaderTemplate") + frame = CreateFrame("Frame", name, UIParent, template) frame.title = frame:CreateFontString(nil, "ARTWORK", "GameFontNormalSmall") - frame.title:SetPoint("BOTTOM", frame, "TOP", 0, 3) + local offset = options.partyFrame and 17 or 3 + + frame.title:SetPoint("BOTTOM", frame, "TOP", 0, offset) frame.backdrop = { bgFile = "Interface\\Tooltips\\UI-Tooltip-Background"; @@ -216,6 +227,14 @@ function PerfectRaid:CreateRaidFrame(idx) } end + if options.partyFrame then + -- Create the playerFrame here + -- frame.player = CreateFrame("Button", name.."Player", frame, "SecureUnitButtonTemplate") + -- frame.player:SetPoint("BOTTOMLEFT", frame, "TOPLEFT", 0, 0) + -- self.ConfigureButton(frame.player) + -- frame.player:SetAttribute("unit", "player") + end + if options.disabled then frame:Hide() return @@ -262,10 +281,15 @@ function PerfectRaid:CreateRaidFrame(idx) return frame end -function PerfectRaid:GetColoredName(unit) +function PerfectRaid:GetColoredName(unit, idx) local class = select(2, UnitClass(unit)) or "WARRIOR" local color = RAID_CLASS_COLORS[class] - return string.format("|cFF%02x%02x%02x%s|r", color.r*255, color.g*255, color.b*255, UnitName(unit) or "Unknown") + local group = "" + if idx then + group = string.format("%s-", select(3, GetRaidRosterInfo(idx))) + end + + return string.format("%s|cFF%02x%02x%02x%s|r", group, color.r*255, color.g*255, color.b*255, UnitName(unit) or "Unknown") end function PerfectRaid:CHAT_MSG_SYSTEM(event, msg) @@ -447,8 +471,10 @@ local function OnAttributeChanged(frame, name, value) -- Do Visual Configuration here local unit = value - frame.name:SetText(self:GetColoredName(unit)) - -- frame.name:SetText(UnitName(unit)) + frame.idx = value:match("^raid(%d+)$") + local nametext = self:GetColoredName(unit, frame.options.showgroupnum and frame.idx) + frame.name:SetText(nametext) + -- frame.name:SetText(UnitName(unit))G local class = select(2, UnitClass(unit)) or "WARRIOR" frame.class = class @@ -527,6 +553,7 @@ function PerfectRaid.ConfigureButton(button) button.headerName = parent:GetName() local options = self.db.profile.headers[parent.idx] + button.options = options local leftbox = CreateFrame("Frame", nil, button) button.leftbox = leftbox @@ -618,4 +645,14 @@ function PerfectRaid:RAID_ROSTER_UPDATE() if self.moving then self.moving:StopMovingOrSizing() end + + -- Update group numbers here + for unit,list in pairs(self.frames) do + for frame in pairs(list) do + if frame.idx then + local nametext = self:GetColoredName(unit, frame.options.showgroupnum and frame.idx) + frame.name:SetText(nametext) + end + end + end end diff --git a/PerfectRaid_Frames.lua b/PerfectRaid_Frames.lua index 52f0f2f..ce3fb89 100644 --- a/PerfectRaid_Frames.lua +++ b/PerfectRaid_Frames.lua @@ -313,6 +313,11 @@ function Frames:CreateEditFrame(parent) classColor:SetPoint("TOPLEFT", strict, "BOTTOMLEFT", 0, 0) classColor:Show() + local showGroupNum = CreateFrame("CheckButton", "PRFrame_ShowGroupNum", PROptions_Frames_Edit, "PRCheckTemplate") + showGroupNum.Label:SetText(L["Show group number"]) + showGroupNum:SetPoint("TOPLEFT", classColor, "BOTTOMLEFT", 0, 0) + showGroupNum:Show() + local reverseBar = CreateFrame("CheckButton", "PRFrame_ReverseBar", PROptions_Frames_Edit, "PRCheckTemplate") reverseBar.Label:SetText(L["Reverse HP bars"]) reverseBar:SetPoint("TOPLEFT", hbackdrop, "TOPRIGHT", 160, 0) @@ -449,6 +454,7 @@ function Frames:EditEntry() PRFrame_Strict:SetChecked(entry.strict) PRFrame_ColorClass:SetChecked(entry.colorclass) + PRFrame_ShowGroupNum:SetChecked(entry.showgroupnum) PRFrame_ReverseBar:SetChecked(entry.reverse) PRFrame_Deficit:SetChecked(entry.deficit) PRFrame_AlignRight:SetChecked(entry.alignright) @@ -517,6 +523,7 @@ function Frames:SaveEntry() local manaheight = PRFrame_ManaHeight:GetValue() local strict = PRFrame_Strict:GetChecked() local colorclass = PRFrame_ColorClass:GetChecked() + local showgroupnum = PRFrame_ShowGroupNum:GetChecked() local reverse = PRFrame_ReverseBar:GetChecked() local deficit = PRFrame_Deficit:GetChecked() local alignright = PRFrame_AlignRight:GetChecked() @@ -535,7 +542,7 @@ function Frames:SaveEntry() if not (numColumns and maxUnits and colSpacing and colAnchor) and (numColumns or maxUnits or colSpacing or colAnchor) then err = L["If you choose any of the column options, all of them become required fields. Please choose the number of columns, max units, column spacing and column anchor."] - elseif not filter then + elseif not filter and not partyFrame then err = L["You must select at least one class or group to display."] end @@ -561,6 +568,7 @@ function Frames:SaveEntry() entry.manaheight = manaheight entry.strict = strict entry.colorclass = colorclass + entry.showgroupnum = showgroupnum entry.reverse = reverse entry.deficit = deficit entry.alignright = alignright @@ -576,7 +584,12 @@ function Frames:SaveEntry() -- Update button layouts local idx = PROptions_Frames.selected if idx then - local header = getglobal("PRHeader"..idx) + local name = "PRHeader"..idx + if partyFrame then + name = name .. "Party" + end + + local header = getglobal(name) for i=1,header:GetNumChildren() do local button = header:GetAttribute("child"..i) PerfectRaid:UpdateButtonLayout(button)