diff --git a/Cursive.toc b/Cursive.toc index 67c11f8..b7ea083 100644 --- a/Cursive.toc +++ b/Cursive.toc @@ -1,6 +1,6 @@ ## Interface: 11200 -## Title: [|CFF33AAFFSUPERWOW|R] Cursive 2.4.8 -## Title-zhCN: [|CFF33AAFFSUPERWOW|R] Cursive 2.4.8 +## Title: [|CFF33AAFFSUPERWOW|R] Cursive 2.5.0 +## Title-zhCN: [|CFF33AAFFSUPERWOW|R] Cursive 2.5.0 ## Author: Pepopo ## Notes: Uses SuperWoW GUIDs to show units in combat and track curses ## Notes-zhCN: 使用SuperWoW的GUID功能来显示战斗中的单位并监视诅咒等 diff --git a/settings.lua b/settings.lua index f3c9bdc..990131f 100644 --- a/settings.lua +++ b/settings.lua @@ -41,6 +41,8 @@ Cursive:RegisterDefaults("profile", { curseordering = L["Expiring soonest -> latest"], curseshowdecimals = false, + invertbars = false, + expandupwards = false, filterincombat = true, filterhostile = true, @@ -67,11 +69,42 @@ local function splitString(str, delimiter) end local barOptions = { + ["invertbars"] = { + type = "toggle", + name = "Invert Bar Display", + desc = "Show sections in order 3-2-1 and reverse element order in sections 1 and 3", + order = 1, + get = function() + return Cursive.db.profile.invertbars + end, + set = function(v) + Cursive.db.profile.invertbars = v + Cursive.UpdateFramesFromConfig() + end, + }, + ["expandupwards"] = { + type = "toggle", + name = "Expand Bars Upwards", + desc = "Make bars expand upwards instead of downwards", + order = 2, + get = function() + return Cursive.db.profile.expandupwards + end, + set = function(v) + Cursive.db.profile.expandupwards = v + Cursive.UpdateFramesFromConfig() + end, + }, + ["spacer1"] = { + type = "header", + name = "Section Display", + order = 5, + }, ["showtargetindicator"] = { type = "toggle", name = L["Show Targeting Arrow"], desc = L["Show Targeting Arrow"], - order = 1, + order = 10, get = function() return Cursive.db.profile.showtargetindicator end, @@ -84,7 +117,7 @@ local barOptions = { type = "toggle", name = L["Show Raid Icons"], desc = L["Show Raid Icons"], - order = 10, + order = 15, get = function() return Cursive.db.profile.showraidicons end, @@ -110,7 +143,7 @@ local barOptions = { type = "toggle", name = L["Show Unit Name"], desc = L["Show Unit Name"], - order = 30, + order = 25, get = function() return Cursive.db.profile.showunitname end, @@ -123,7 +156,7 @@ local barOptions = { type = "toggle", name = "Always Show Current Target", desc = "Always show current target at the bottom of the mob list if it is not already shown", - order = 32, + order = 30, get = function() return Cursive.db.profile.alwaysshowcurrenttarget end, @@ -131,6 +164,11 @@ local barOptions = { Cursive.db.profile.alwaysshowcurrenttarget = v end, }, + ["spacer2"] = { + type = "header", + name = "Size & Appearance", + order = 35, + }, ["barwidth"] = { type = "range", name = L["Health Bar/Unit Name Width"], diff --git a/ui.lua b/ui.lua index e622b14..321f70c 100644 --- a/ui.lua +++ b/ui.lua @@ -95,7 +95,10 @@ local function UpdateRootBarFrame() end ui.rootBarFrame:SetWidth(config.maxcol * GetBarWidth()) - ui.rootBarFrame:SetHeight(config.maxrow * config.height) + -- Calculate height: title area + all rows + extra spacing + local title_size = 12 + config.spacing + local total_height = title_size + (config.maxrow * (config.height + config.spacing)) + config.spacing + ui.rootBarFrame:SetHeight(total_height) end local function CreateRoot() @@ -283,7 +286,15 @@ end local function CreateBarFirstSection(unitFrame, guid) local config = Cursive.db.profile local firstSection = CreateFrame("Frame", "Cursive1stSection", unitFrame) - firstSection:SetPoint("LEFT", unitFrame, "LEFT", 0, 0) + + if config.invertbars then + -- When inverted, position relative to second section (rightmost) + firstSection:SetPoint("LEFT", unitFrame.secondSection, "RIGHT", 0, 0) + else + -- Normal positioning (leftmost) + firstSection:SetPoint("LEFT", unitFrame, "LEFT", 0, 0) + end + firstSection:SetWidth(GetBarFirstSectionWidth()) firstSection:SetHeight(config.height) firstSection:EnableMouse(false) @@ -294,8 +305,13 @@ local function CreateBarFirstSection(unitFrame, guid) local targetLeft = firstSection:CreateTexture(nil, "OVERLAY") targetLeft:SetWidth(ui.targetIndicatorSize) targetLeft:SetHeight(8) - targetLeft:SetPoint("LEFT", unitFrame, "LEFT", 0, 0) - targetLeft:SetTexture("Interface\\AddOns\\Cursive\\img\\target-left") + if config.invertbars then + targetLeft:SetPoint("RIGHT", firstSection, "RIGHT", 0, 0) + targetLeft:SetTexture("Interface\\AddOns\\Cursive\\img\\target-right") + else + targetLeft:SetPoint("LEFT", unitFrame, "LEFT", 0, 0) + targetLeft:SetTexture("Interface\\AddOns\\Cursive\\img\\target-left") + end targetLeft:Hide() unitFrame.target_left = targetLeft end @@ -305,7 +321,11 @@ local function CreateBarFirstSection(unitFrame, guid) local icon = firstSection:CreateTexture(nil, "OVERLAY") icon:SetWidth(config.raidiconsize) icon:SetHeight(config.raidiconsize) - icon:SetPoint("RIGHT", firstSection, "RIGHT", 0, 0) + if config.invertbars then + icon:SetPoint("LEFT", firstSection, "LEFT", 0, 0) + else + icon:SetPoint("RIGHT", firstSection, "RIGHT", 0, 0) + end icon:SetTexture("Interface\\TargetingFrame\\UI-RaidTargetingIcons") icon:Hide() unitFrame.icon = icon @@ -315,7 +335,15 @@ end local function CreateBarSecondSection(unitFrame, guid) local config = Cursive.db.profile local secondSection = CreateFrame("Button", "Cursive2ndSection", unitFrame) - secondSection:SetPoint("LEFT", unitFrame.firstSection, "RIGHT", 0, 0) + + if config.invertbars then + -- When inverted, position relative to third section (which is created first) + secondSection:SetPoint("LEFT", unitFrame.thirdSection, "RIGHT", 0, 0) + else + -- Normal positioning relative to first section + secondSection:SetPoint("LEFT", unitFrame.firstSection, "RIGHT", 0, 0) + end + secondSection:SetWidth(GetBarSecondSectionWidth()) secondSection:SetHeight(config.height) unitFrame.secondSection = secondSection @@ -387,7 +415,15 @@ local function CreateBarThirdSection(unitFrame, guid) local config = Cursive.db.profile local thirdSection = CreateFrame("Frame", "Cursive3rdSection", unitFrame) - thirdSection:SetPoint("LEFT", unitFrame.secondSection, "RIGHT", 0, 0) + + if config.invertbars then + -- When inverted, this is positioned first (leftmost) + thirdSection:SetPoint("LEFT", unitFrame, "LEFT", 0, 0) + else + -- Normal positioning relative to second section + thirdSection:SetPoint("LEFT", unitFrame.secondSection, "RIGHT", 0, 0) + end + thirdSection:SetWidth(GetBarThirdSectionWidth()) thirdSection:SetHeight(config.height) thirdSection:EnableMouse(false) @@ -398,7 +434,15 @@ local function CreateBarThirdSection(unitFrame, guid) local curse = thirdSection:CreateTexture(nil, "OVERLAY") curse:SetWidth(config.curseiconsize) curse:SetHeight(config.curseiconsize) - curse:SetPoint("LEFT", thirdSection, "LEFT", i * ui.padding + ((i - 1) * config.curseiconsize), 0) + + if config.invertbars then + -- When inverted, position from right to left + local rightOffset = i * ui.padding + ((i - 1) * config.curseiconsize) + curse:SetPoint("RIGHT", thirdSection, "RIGHT", -rightOffset, 0) + else + -- Normal positioning from left to right + curse:SetPoint("LEFT", thirdSection, "LEFT", i * ui.padding + ((i - 1) * config.curseiconsize), 0) + end curse.timer = thirdSection:CreateFontString(nil, "OVERLAY", "GameFontNormal") curse.timer:SetFontObject(GameFontHighlight) @@ -423,9 +467,18 @@ local function CreateBar(row, col, guid) unitFrame:SetWidth(width) unitFrame:SetHeight(config.height) - CreateBarFirstSection(unitFrame, guid) - CreateBarSecondSection(unitFrame, guid) - CreateBarThirdSection(unitFrame, guid) + local config = Cursive.db.profile + if config.invertbars then + -- Create sections in reverse order: 3 -> 2 -> 1 + CreateBarThirdSection(unitFrame, guid) + CreateBarSecondSection(unitFrame, guid) + CreateBarFirstSection(unitFrame, guid) + else + -- Normal order: 1 -> 2 -> 3 + CreateBarFirstSection(unitFrame, guid) + CreateBarSecondSection(unitFrame, guid) + CreateBarThirdSection(unitFrame, guid) + end ui.unitFrames[col][row] = unitFrame return unitFrame @@ -434,7 +487,14 @@ end local function GetBarCords(row, col) local config = Cursive.db.profile local x = (col - 1) * GetBarWidth() - local y = row * (config.height + config.spacing) -- don't subtract 1 to account for header + local y + if config.expandupwards then + -- For upward expansion: start from bottom with spacing, then go up + y = config.spacing + ((row - 1) * (config.height + config.spacing)) + else + -- For downward expansion: use original logic (don't subtract 1 to account for header) + y = -(row * (config.height + config.spacing)) + end return x, y end @@ -510,10 +570,15 @@ local function DisplayGuid(guid) local x, y = GetBarCords(ui.row, ui.col) -- update position if required - if not unitFrame.pos or unitFrame.pos ~= x .. -y then + local config = Cursive.db.profile + if not unitFrame.pos or unitFrame.pos ~= x .. y then unitFrame:ClearAllPoints() - unitFrame:SetPoint("TOPLEFT", ui.rootBarFrame, "TOPLEFT", x, -y) - unitFrame.pos = x .. -y + if config.expandupwards then + unitFrame:SetPoint("BOTTOMLEFT", ui.rootBarFrame, "BOTTOMLEFT", x, y) + else + unitFrame:SetPoint("TOPLEFT", ui.rootBarFrame, "TOPLEFT", x, y) + end + unitFrame.pos = x .. y end -- check for shared debuffs