From a663ee3dcdc3026e55d82348834f6113d8145186 Mon Sep 17 00:00:00 2001 From: azuraji <72912613+azuraji@users.noreply.github.com> Date: Wed, 7 Dec 2022 13:24:18 +0100 Subject: [PATCH] * Add support for Renown reputation introduced in Dragonflight * Add support for Friendship reputation introduced in Mists of Pandaria * Fix various bugs * Remove several unused or redundant options in the Dewdrop menu * Remove rest icon * Miscellaneous quality of life fixes --- FuBar/libs/Dewdrop-2.0/Dewdrop-2.0.lua | 2 - FuBar/libs/Tablet-2.0/Tablet-2.0.lua | 8 +- .../Changelog-FuBar_FuXPFu-r61204.txt | 10 - FuBar_FuXPFu/FuBar_FuXPFu.lua | 973 ++++++++++-------- FuBar_FuXPFu/FuBar_FuXPFu.toc | 7 +- FuBar_FuXPFu/FuXPLocals.lua | 236 ++--- FuBar_FuXPFu/Libs/Dewdrop-2.0/Dewdrop-2.0.lua | 10 +- .../Libs/FuBarPlugin-2.0/FuBarPlugin-2.0.lua | 49 +- FuBar_FuXPFu/Libs/Tablet-2.0/Tablet-2.0.lua | 62 +- FuBar_FuXPFu/iconrest.tga | Bin 3114 -> 0 bytes 10 files changed, 650 insertions(+), 707 deletions(-) delete mode 100644 FuBar_FuXPFu/Changelog-FuBar_FuXPFu-r61204.txt delete mode 100644 FuBar_FuXPFu/iconrest.tga diff --git a/FuBar/libs/Dewdrop-2.0/Dewdrop-2.0.lua b/FuBar/libs/Dewdrop-2.0/Dewdrop-2.0.lua index ff748a9..6649b1f 100644 --- a/FuBar/libs/Dewdrop-2.0/Dewdrop-2.0.lua +++ b/FuBar/libs/Dewdrop-2.0/Dewdrop-2.0.lua @@ -1946,7 +1946,6 @@ function OpenSlider(self, parent) sliderFrame:SetBackdropColor(TOOLTIP_DEFAULT_BACKGROUND_COLOR.r, TOOLTIP_DEFAULT_BACKGROUND_COLOR.g, TOOLTIP_DEFAULT_BACKGROUND_COLOR.b) sliderFrame:EnableMouse(true) sliderFrame:EnableMouseWheel(true) - sliderFrame:Hide() sliderFrame:SetPoint("CENTER", UIParent, "CENTER") local slider = CreateFrame("Slider", nil, sliderFrame, "BackdropTemplate") sliderFrame.slider = slider @@ -2277,7 +2276,6 @@ function OpenSlider(self, parent) end end - sliderFrame.lastValue = parent.sliderValue local level = parent.level diff --git a/FuBar/libs/Tablet-2.0/Tablet-2.0.lua b/FuBar/libs/Tablet-2.0/Tablet-2.0.lua index a66b6e7..05a97d7 100644 --- a/FuBar/libs/Tablet-2.0/Tablet-2.0.lua +++ b/FuBar/libs/Tablet-2.0/Tablet-2.0.lua @@ -2563,9 +2563,11 @@ function Tablet:Register(parent, ...) if script then script(...) end - if self.registry[parent] and self.registry[parent].tooltip and self.registry[parent].tooltip == self.tooltip then - self.tooltip:Hide() - end + -- Prevent Tablet from closing on parent mousedown + + -- if self.registry[parent] and self.registry[parent].tooltip and self.registry[parent].tooltip == self.tooltip then + -- self.tooltip:Hide() + -- end end) end if parent:HasScript("OnMouseWheel") then diff --git a/FuBar_FuXPFu/Changelog-FuBar_FuXPFu-r61204.txt b/FuBar_FuXPFu/Changelog-FuBar_FuXPFu-r61204.txt deleted file mode 100644 index 28c7776..0000000 --- a/FuBar_FuXPFu/Changelog-FuBar_FuXPFu-r61204.txt +++ /dev/null @@ -1,10 +0,0 @@ ------------------------------------------------------------------------- -r61204 | phanx | 2008-02-13 17:29:45 -0500 (Wed, 13 Feb 2008) | 2 lines -Changed paths: - M /trunk/FuBar_FuXPFu/FuBar_FuXPFu.toc - M /trunk/FuBar_FuXPFu/Libs - M /trunk/FuBar_FuXPFu/embeds.xml - -FuBar_FuXPFu: -- Added AceHook-2.1 to externals ------------------------------------------------------------------------- diff --git a/FuBar_FuXPFu/FuBar_FuXPFu.lua b/FuBar_FuXPFu/FuBar_FuXPFu.lua index c8996f1..a7b09c6 100644 --- a/FuBar_FuXPFu/FuBar_FuXPFu.lua +++ b/FuBar_FuXPFu/FuBar_FuXPFu.lua @@ -6,35 +6,42 @@ local crayon = AceLibrary:HasInstance("Crayon-2.0") and AceLibrary("Crayon-2.0") FuXP = AceLibrary("AceAddon-2.0"):new("FuBarPlugin-2.0", "AceDB-2.0", "AceEvent-2.0", "AceConsole-2.0", "AceHook-2.1") +local watchedFactionIndex = "0" +local watchedFactionID = 0 + +local queryFactions = true + local defaults = { - FuBarFactionLink = false, - TekAutoRepLink = false, - WatchedFaction = false, - Faction = 0, - ShowText = "None", ShowRep = false, ShowXP = true, Shadow = true, - Thickness = 2, + Thickness = 2.4, + UndockedLoc = "Bottom", Spark = 1, Spark2 = 1, - ToGo = true, - BorderTop = true, XP = {0, 0.4,.9,1}, Rest = {1, 0.2, 1, 1}, - None = {0.3, 0.3, 0.3, 0}, - Rep = { - 0.0549019607843137, -- [1] - 0.631372549019608, -- [2] - 0.184313725490196, -- [3] + None = { + 0.3, -- [1] + 0.3, -- [2] + 0.3, -- [3] + 0 -- [4] }, - ParagonRep = {0.7, 0.84, 0.97, 1}, NoRep = { - 0, -- [1] + 0, -- [1] 0.298039215686275, -- [2] - 0, -- [3] - 0, -- [4] - } + 0, -- [3] + 0, -- [4] + }, + Rep = { + 0.0549019607843137, -- [1] + 0.631372549019608, -- [2] + 0.184313725490196, -- [3] + 0 -- [4] + }, + RenownRep = {0, 0.6901, 0.741176}, + ParagonRep = {0.7, 0.84, 0.97}, + FriendshipRep = {1, 0.870588235, 0.631372549}, } local L = AceLibrary("AceLocale-2.2"):new("FuXP") @@ -86,215 +93,218 @@ function FuXP:SetNoXPColor(r, g, b, a) self.NoXPTex:SetVertexColor(r, g, b, a) end +function FuXP:UpdateFactionMenu() + if not self.OnMenuRequest then return end + + if queryFactions then + local factionTable = {} + local watchedFactionID = select(6, GetWatchedFactionInfo()) + + for factionIndex = 1, GetNumFactions() do + local name, _, _, _, _, _, _, _, isHeader, _, _, _, _, factionID = GetFactionInfo(factionIndex) + if not isHeader then + if watchedFactionID == factionID then + watchedFactionIndex = tostring(factionIndex) + end + + factionTable[tostring(factionIndex)] = name + end + end + + self.OnMenuRequest.args.faction.validate = factionTable + self.refreshMenu = true + else + queryFactions = true + end +end + function FuXP:SetupMenu() - FuXP:QueryFactions() local optionsTable = { - type = 'group', - args = { - colours = { - type = 'group', - name = L["Colours"], - desc = L["Set the Bar Colours"], - args = { - currentXP = { - type = "color", - name = L["Current XP"], - desc = L["Sets the color of the XP Bar"], - hasAlpha = true, - get = "GetXPColor", - set = "SetXPColor", - order = 110, - }, - restedXP = { - type = 'color', - name = L["Rested XP"], - desc = L["Sets the color of the Rested Bar"], - hasAlpha = true, - get = "GetRestColor", - set = "SetRestColor", - order = 111, - }, - color = { - type = 'color', - name = L["No XP"], - desc = L["Sets the empty color of the XP Bar"], - hasAlpha = true, - get = "GetNoXPColor", - set = "SetNoXPColor", - order = 112, - }, - rep = { - type = 'color', - name = L["Reputation"], - desc = L["Sets the color of the Rep Bar"], - hasAlpha = true, - get = "GetRepColor", - set = "SetRepColor", - order = 113, - }, - norep = { - type = 'color', - name = L["No Rep"], - desc = L["Sets the empty color of the Reputation Bar"], - hasAlpha = true, - get = "GetNoRepColor", - set = "SetNoRepColor", - order = 114, - }, + type = 'group', + args = { + faction = { + type = 'text', + name = "|cff71d5ff" .. L["Watched Faction"] .. "|r", + desc = L["Select faction to watch"], + tooltipTitle = L["Watched Faction"], + get = function() + return watchedFactionIndex + end, + set = function(v) + SetWatchedFactionIndex(tonumber(v)); + end, + validate = {}, + order = 120, }, - }, - properties = { - type = 'group', - name = L["Properties"], - desc = L["Set the Bar Properties"], - args = { - spark = { - type = 'range', - name = L["Spark intensity"], - desc = L["Brightness level of Spark"], - get = function() return FuXP.db.profile.Spark end, - set = function(v) - FuXP.db.profile.Spark = v - FuXP.Spark:SetAlpha(v) - FuXP.Spark2:SetAlpha(v) - FuXP.RepSpark:SetAlpha(v) - FuXP.RepSpark2:SetAlpha(v) - end, - min = 0, - max = 1, - step = 0.01, - bigStep = 0.05, - order = 115 - }, - thickness = { - type = 'range', - name = L["Thickness"], - desc = L["Sets thickness of XP Bar"], - get = function() return FuXP.db.profile.Thickness end, - set = function(v) - FuXP:SetThickness(v) - end, - min = 1.5, - max = 8, - step = 0.1, - order = 116 + properties = { + type = 'group', + name = L["Bar Properties"], + desc = L["Set the Bar Properties"], + args = { + spark = { + type = 'range', + name = L["Spark intensity"], + desc = L["Brightness level of Spark"], + get = function() return self.db.profile.Spark end, + set = function(v) + self.db.profile.Spark = v + self:SetSparkAlpha(v) + end, + min = 0, + max = 1, + step = 0.01, + bigStep = 0.05, + order = 115 + }, + thickness = { + type = 'range', + name = L["Thickness"], + desc = L["Sets thickness of XP Bar"], + get = function() return self.db.profile.Thickness end, + set = function(v) + self:SetThickness(v) + end, + min = 1.5, + max = 8, + step = 0.1, + order = 116 + }, + shadow = { + type = 'toggle', + name = L["Shadow"], + desc = L["Toggles Shadow under the bottommost bar"], + get = function() return self.db.profile.Shadow end, + set = function() + self.db.profile.Shadow = not self.db.profile.Shadow + self:Reanchor() + end, + order = 117 + }, + showxp = { + type = 'toggle', + name = L["Show XP Bar"], + desc = L["Show the XP Bar"], + get = function() return self.db.profile.ShowXP end, + set = function() + self.db.profile.ShowXP = not self.db.profile.ShowXP + self:Reanchor() + end, + order = 119 + }, + showrep = { + type = 'toggle', + name = L["Show Rep Bar"], + desc = L["Show the Rep Bar"], + get = function() return self.db.profile.ShowRep end, + set = function() + self.db.profile.ShowRep = not self.db.profile.ShowRep + self:Reanchor() + end, + order = 120 + }, + undocked = { + type = 'text', + name = L["Undocked position"], + desc = L["Selects which side of an undocked panel you want the bars on."], + get = function() return self.db.profile.UndockedLoc end, + set = function(loc) + self.db.profile.UndockedLoc = loc + self:Reanchor() + end, + validate = { [1] = L["Top"], [2] = L["Bottom"] }, + order = 123, + } }, - shadow = { - type = 'toggle', - name = L["Shadow"], - desc = L["Toggles Shadow under XP Bar"], - get = function() return FuXP.db.profile.Shadow end, - set = function() - FuXP.db.profile.Shadow = not FuXP.db.profile.Shadow - if FuXP.db.profile.Shadow then - FuXP.Border:Show() - else - FuXP.Border:Hide() - end - end, - order = 117 - }, - showxp = { - type = 'toggle', - name = L["Show XP Bar"], - desc = L["Show the XP Bar"], - get = function() return FuXP.db.profile.ShowXP end, - set = function() - FuXP.db.profile.ShowXP = not FuXP.db.profile.ShowXP - FuXP:Reanchor() - end, - order = 119 - }, - showrep = { - type = 'toggle', - name = L["Show Rep Bar"], - desc = L["Show the Reputation Bar"], - get = function() return FuXP.db.profile.ShowRep end, - set = function() - FuXP.db.profile.ShowRep = not FuXP.db.profile.ShowRep - FuXP:Reanchor() - end, - order = 120 + order = 121, + }, + colours = { + type = 'group', + name = L["Colors"], + desc = L["Set the Bar Colors"], + args = { + currentXP = { + type = "color", + name = L["Current XP"], + desc = L["Sets the color of the XP Bar"], + hasAlpha = true, + get = "GetXPColor", + set = "SetXPColor", + order = 110, + }, + restedXP = { + type = 'color', + name = L["Rested XP"], + desc = L["Sets the color of the Rested Bar"], + hasAlpha = true, + get = "GetRestColor", + set = "SetRestColor", + order = 111, + }, + color = { + type = 'color', + name = L["No XP"], + desc = L["Sets the empty color of the XP Bar"], + hasAlpha = true, + get = "GetNoXPColor", + set = "SetNoXPColor", + order = 112, + }, + rep = { + type = 'color', + name = L["Rep"], + desc = L["Sets the color of the Rep Bar"], + hasAlpha = true, + get = "GetRepColor", + set = "SetRepColor", + order = 113, + }, + norep = { + type = 'color', + name = L["No Rep"], + desc = L["Sets the empty color of the Rep Bar"], + hasAlpha = true, + get = "GetNoRepColor", + set = "SetNoRepColor", + order = 114, + }, }, - undocked = { - type = 'text', - usage = '<'..L['Location']..'>', - name = L["Undocked Position"], - desc = L["Selects which side of an undocked panel you want the bars on."], - get = function() return FuXP.db.profile.UndockedLoc end, - set = function(loc) - FuXP.db.profile.UndockedLoc = loc - FuXP:Reanchor() - end, - validate = { ["Top"] = L["Top"], ["Bottom"] = L["Bottom"] }, - order = 123, - } + order = 122, }, - }, - faction = { - type = 'text', - usage = '<'.. L["Faction"].. '>', - name = L["Faction"], - desc = L["Select Faction"], - get = function() - return tostring(self.db.profile.Faction) - end, - set = function(v) - self.db.profile.Faction = tostring(v); - SetWatchedFactionIndex(tonumber(v)); - end, - validate = FuXP.FactionTable, - order = 121, - }, - showtext = { - type = 'text', - usage = '<'..L["None||Rep||XP"]..'>', - name = L["Show Text"], - desc = L["Show the XP or Rep"], - get = function() return FuXP.db.profile.ShowText end, - set = function(show) - FuXP.db.profile.ShowText = show; - FuXP:OnTextUpdate(); - end, - validate = { ["XP"] = L["XP"], ["Rep"] = L["Rep"], ["None"] = L["None"] }, - order = 122 - }, - togo = { - type = 'toggle', - name = L["XP to go"], - desc = L["Show XP to go"], - get = function() return self.db.profile.ToGo end, - set = function() self.db.profile.ToGo = not self.db.profile.ToGo; self:UpdateText() end, - order = 123 - }, + } } -} - FuXP.OnMenuRequest = optionsTable - FuXP:RegisterChatCommand(L["AceConsole-commands"], optionsTable) + self.OnMenuRequest = optionsTable + self:UpdateFactionMenu() + + self:RegisterChatCommand(L["AceConsole-commands"], optionsTable) end - FuXP.hasIcon = true - FuXP.cannotDetachTooltip = true - FuXP.defaultPosition = "CENTER" - FuXP.hideWithoutStandby = true - FuXP.cannotAttachToMinimap = true - FuXP.independentProfile = true +FuXP.hasIcon = true +FuXP.cannotDetachTooltip = true +FuXP.defaultPosition = "CENTER" +FuXP.hideWithoutStandby = true +FuXP.cannotAttachToMinimap = true +FuXP.independentProfile = true function FuXP:OnInitialize() - self.version = "3.".. string.sub("$Revision: 61204 $", 12, -3) self:RegisterDB("FuXPDB") self:RegisterDefaults('profile', defaults) - self:SetupMenu() + -- self:SetupMenu() + + local RestedXP = CreateFrame("Frame", "FuRestXPBar", UIParent) + local restex = RestedXP:CreateTexture("RestedXPTex") + restex:SetTexture("Interface\\AddOns\\FuBar_FuXPFu\\Textures\\texture.tga") + restex:SetVertexColor(self.db.profile.Rest[1], self.db.profile.Rest[2], self.db.profile.Rest[3], self.db.profile.Rest[4]) + restex:ClearAllPoints() + restex:SetAllPoints(RestedXP) + RestedXP:SetHeight(self.db.profile.Thickness) local XPBar = CreateFrame("Frame", "FuXPBar", UIParent) local tex = XPBar:CreateTexture("XPBarTex") - -- XPBar:SetFrameStrata("MEDIUM") tex:SetTexture("Interface\\AddOns\\FuBar_FuXPFu\\Textures\\texture.tga") tex:SetVertexColor(self.db.profile.XP[1], self.db.profile.XP[2], self.db.profile.XP[3], self.db.profile.XP[4]) tex:ClearAllPoints() tex:SetAllPoints(XPBar) - tex:Show() XPBar:SetHeight(self.db.profile.Thickness) local spark = XPBar:CreateTexture("XPSpark", "OVERLAY") @@ -307,35 +317,22 @@ function FuXP:OnInitialize() local spark2 = XPBar:CreateTexture("XPSpark2", "OVERLAY") spark2:SetTexture("Interface\\AddOns\\FuBar_FuXPFu\\Textures\\glow2.tga") spark2:SetWidth(128) - spark2:SetAlpha(self.db.profile.Spark or 1) spark2:SetHeight((self.db.profile.Thickness) * 8) spark2:SetBlendMode("ADD") - local RestedXP = CreateFrame("Frame", "FuRestXPBar", UIParent) - local restex = RestedXP:CreateTexture("RestedXPTex") - restex:SetTexture("Interface\\AddOns\\FuBar_FuXPFu\\Textures\\texture.tga") - restex:SetVertexColor(self.db.profile.Rest[1], self.db.profile.Rest[2], self.db.profile.Rest[3], self.db.profile.Rest[4]) - restex:ClearAllPoints() - restex:Show() - restex:SetAllPoints(RestedXP) - RestedXP:SetHeight(self.db.profile.Thickness) - local NoXP = CreateFrame("Frame", "FuNoXPBar", UIParent) local notex = NoXP:CreateTexture("NoXPTex") notex:SetTexture("Interface\\AddOns\\FuBar_FuXPFu\\Textures\\texture.tga") notex:SetVertexColor(self.db.profile.None[1], self.db.profile.None[2], self.db.profile.None[3], self.db.profile.None[4]) notex:ClearAllPoints() - notex:Show() notex:SetAllPoints(NoXP) NoXP:SetHeight(self.db.profile.Thickness) local Rep = CreateFrame("Frame", "FuRepBar", UIParent) - -- Rep:SetFrameStrata("BACKGROUND") local reptex = Rep:CreateTexture("RepTex", "BACKGROUND") reptex:SetTexture("Interface\\AddOns\\FuBar_FuXPFu\\Textures\\texture.tga") reptex:SetVertexColor(self.db.profile.Rep[1], self.db.profile.Rep[2], self.db.profile.Rep[3], self.db.profile.Rep[4]) reptex:ClearAllPoints() - reptex:Show() reptex:SetAllPoints(Rep) Rep:SetHeight(self.db.profile.Thickness) @@ -349,7 +346,6 @@ function FuXP:OnInitialize() local rspark2 = Rep:CreateTexture("RepSpark2", "OVERLAY") rspark2:SetTexture("Interface\\AddOns\\FuBar_FuXPFu\\Textures\\glow2.tga") rspark2:SetWidth(128) - rspark2:SetAlpha(self.db.profile.Spark or 1) rspark2:SetHeight((self.db.profile.Thickness) * 8) rspark2:SetBlendMode("ADD") @@ -358,13 +354,9 @@ function FuXP:OnInitialize() noreptex:SetTexture("Interface\\AddOns\\FuBar_FuXPFu\\Textures\\texture.tga") noreptex:SetVertexColor(self.db.profile.NoRep[1], self.db.profile.NoRep[2], self.db.profile.NoRep[3], self.db.profile.NoRep[4]) noreptex:ClearAllPoints() - noreptex:Show() noreptex:SetAllPoints(NoRep) NoRep:SetHeight(self.db.profile.Thickness) - --Rep:SetFrameLevel(2) - Rep:SetFrameLevel(NoRep:GetFrameLevel() + 1) -- An attempt to fix the spark... - local Border = CreateFrame("Frame", "BottomBorder", UIParent) local bordtex = Border:CreateTexture("BottomBorderTex") bordtex:SetTexture("Interface\\AddOns\\FuBar_FuXPFu\\Textures\\border.tga") @@ -373,10 +365,6 @@ function FuXP:OnInitialize() bordtex:SetAllPoints(Border) Border:SetHeight(5) - if not self.db.profile.Shadow then - Border:Hide() - end - self.XPBar = XPBar self.XPBarTex = tex @@ -411,52 +399,34 @@ end function FuXP:OnEnable() self:RegisterBucketEvent("UPDATE_EXHAUSTION", 60, "Update") - self:RegisterEvent("PLAYER_UPDATE_RESTING", "CheckIcon") - -- self:RegisterEvent("PLAYER_LEVEL_UP", "OnLevelUp") - self:RegisterEvent("PLAYER_XP_UPDATE", "OnTextUpdate") - self:RegisterEvent("UPDATE_FACTION", "OnTextUpdate") - self:SecureHook("SetWatchedFactionIndex", "UpdateInABit"); + self:RegisterEvent("PLAYER_XP_UPDATE", "OnTextUpdate") + self:RegisterEvent("UPDATE_FACTION", "OnUpdateFaction") + + self:SecureHook("SetWatchedFactionIndex"); self:ScheduleRepeatingEvent("XPFuBar", self.Reanchor, 1, self) - self:ScheduleRepeatingEvent("XPFuRep", self.GetRep, 3, self) self:SetupMenu() end -function FuXP:GetRep() - if not self.FactionTable or #self.FactionTable == 0 then - self:QueryFactions() - else - self:CancelScheduledEvent("XPFuRep") - end + +function FuXP:OnUpdateFaction() + self:UpdateFactionMenu() + self:OnTextUpdate() end -function FuXP:UpdateInABit(index) - - if(not index) then index = self.db.profile.Faction end +function FuXP:SetWatchedFactionIndex(index) + queryFactions = false + if not index then index = 0 end - if index == 0 then - self.db.profile.Faction = 0 - self.db.profile.ShowRep = false; - self:Update() - return - end - self.db.profile.Faction = index; - self:ScheduleEvent(function() FuXP:Update() end, 2); + watchedFactionIndex = tostring(index) end -function FuXP:CheckIcon() - if IsResting() then - self:SetIcon('iconrest.tga') - else - self:SetIcon(true) - end +function FuXP:OnHide() + self:HideBar() end function FuXP:OnDisable() self:HideBar() - -- MainMenuExpBar:Show() - -- ReputationWatchBar:Show() - -- ExhaustionTick:Show() end function FuXP:FuBar_ChangedPanels() @@ -466,12 +436,23 @@ function FuXP:FuBar_ChangedPanels() end end +function FuXP:SetSparkAlpha(alpha) + self.Spark:SetAlpha(alpha) + self.Spark2:SetAlpha(alpha) + self.RepSpark:SetAlpha(alpha) + self.RepSpark2:SetAlpha(alpha) +end + function FuXP:Reanchor() - local point, relpoint, y + if self.db.profile.hidden or self.panel and self.panel.GetAttachPoint then + self:CancelScheduledEvent("XPFuBar") - if self.db.profile.hidden or self.panel and self.panel["GetAttachPoint"] then - self:CancelScheduledEvent("XPFuBar") + if self.db.profile.hidden then return end else + if self.Loaded then + self:HideBar() + end + return end @@ -480,13 +461,15 @@ function FuXP:Reanchor() if not self.Panel then self.Panel = self.panel end - + + self.BorderTex:SetTexCoord(1, 0, 0, 1) + + local point, relpoint, y if self.Panel:GetAttachPoint() == "BOTTOM" then self.Side = "BOTTOM" self.FuPanel = FuBar:GetTopmostBottomPanel() point = "BOTTOMLEFT" relpoint = "TOPLEFT" - self.BorderTex:SetTexCoord(1,0,1,0) if jostle then jostle:RegisterBottom(self.XPBar) jostle:RegisterBottom(self.RepBar) @@ -497,24 +480,21 @@ function FuXP:Reanchor() self.FuPanel = FuBar:GetBottommostTopPanel() point = "TOPLEFT" relpoint = "BOTTOMLEFT" - self.BorderTex:SetTexCoord(1,0,0,1) if jostle then jostle:RegisterTop(self.XPBar) jostle:RegisterTop(self.RepBar) end y = -1 else - if FuXP.db.profile.UndockedLoc == "Top" then + if self.db.profile.UndockedLoc == "Top" then self.Side = "BOTTOM" point = "BOTTOMLEFT" relpoint = "TOPLEFT" - self.BorderTex:SetTexCoord(1,0,1,0) y = 1 - else + else -- Bottom self.Side = "TOP" point = "TOPLEFT" relpoint = "BOTTOMLEFT" - self.BorderTex:SetTexCoord(1,0,0,1) y = -1 end if jostle then @@ -537,34 +517,67 @@ function FuXP:Reanchor() self.RepSpark2:ClearAllPoints() self.Border:ClearAllPoints() - if self.db.profile.ShowXP then + + local xpBarYOffset = 7.6 + local barFrameLevel = 200 + local isMaxLevel = UnitLevel("player") == MAX_PLAYER_LEVEL + if self.db.profile.ShowXP and not isMaxLevel then self.XPBar:SetParent(self.FuPanel.frame) - self.XPBar:SetPoint(point, self.FuPanel.frame, relpoint, 0, 0) - self.Spark:SetPoint("RIGHT", self.XPBar, "RIGHT",11,0) - self.Spark2:SetPoint("RIGHT", self.XPBar, "RIGHT",11,0) + + if self.db.profile.UndockedLoc == "Top" then + self.XPBar:SetPoint(point, self.FuPanel.frame, relpoint, 0, y * xpBarYOffset - self.db.profile.Thickness) + else + self.XPBar:SetPoint(point, self.FuPanel.frame, relpoint, 0, y * xpBarYOffset) + end + + self.Spark:SetPoint("RIGHT", self.XPBar, "RIGHT", 11, 0) + self.Spark2:SetPoint("RIGHT", self.XPBar, "RIGHT", 11, 0) self.RestedXP:SetPoint("LEFT", self.XPBar, "RIGHT") self.NoXP:SetPoint("LEFT", self.RestedXP, "RIGHT") + + self.XPBar:SetFrameLevel(barFrameLevel) + self.RestedXP:SetFrameLevel(barFrameLevel - 1) + + if self.db.profile.Shadow == true then + self.Border:SetParent(self.XPBar) + self.Border:SetPoint("TOPLEFT", self.XPBar, "BOTTOMLEFT") + self.Border:SetFrameLevel(barFrameLevel - 1) + end end - if self.db.profile.ShowRep then - if self.db.profile.ShowXP then - self.RepBar:SetParent(self.FuPanel.frame) + if self.db.profile.ShowRep and watchedFactionID ~= 0 then + self.RepBar:SetParent(self.FuPanel.frame) - if UnitLevel("player") ~= MAX_PLAYER_LEVEL then - self.RepBar:SetPoint(point, self.FuPanel.frame, relpoint, 0, y * self.XPBar:GetHeight()) - else - self.RepBar:SetPoint(point, self.FuPanel.frame, relpoint, 0, y * self.XPBar:GetHeight() - 2) + if self.db.profile.UndockedLoc == "Top" then + self.RepBar:SetPoint(point, self.FuPanel.frame, relpoint, 0, y * xpBarYOffset) + else + self.RepBar:SetPoint(point, self.FuPanel.frame, relpoint, 0, y * (xpBarYOffset - self.db.profile.Thickness)) + end + + if self.db.profile.ShowXP and not isMaxLevel then + self.RepBar:SetFrameLevel(barFrameLevel + 1) + + if self.db.profile.Shadow == true then + self.Border:SetParent(self.XPBar) + self.Border:SetPoint("TOPLEFT", self.XPBar, "BOTTOMLEFT") + self.Border:SetFrameLevel(barFrameLevel) end else - self.RepBar:SetParent(self.FuPanel.frame) - self.RepBar:SetPoint(point, self.FuPanel.frame, relpoint, 0, 0) + self.RepBar:SetFrameLevel(barFrameLevel) + + if self.db.profile.Shadow == true then + self.Border:SetParent(self.RepBar) + self.Border:SetPoint("TOPLEFT", self.RepBar, "BOTTOMLEFT") + self.Border:SetFrameLevel(barFrameLevel - 1) + end end + self.NoRep:SetPoint("LEFT", self.RepBar, "RIGHT") + self.NoRep:SetFrameLevel(self.RepBar:GetFrameLevel() - 1) self.RepSpark:SetPoint("RIGHT", self.RepBar, "RIGHT", 11, 0) self.RepSpark2:SetPoint("RIGHT", self.RepBar, "RIGHT", 11, 0) end - self.Border:SetParent(self.db.profile.ShowRep and self.RepBar or self.XPBar) - self.Border:SetPoint(point, self.db.profile.ShowRep and self.RepBar or self.XPBar, relpoint) - self.RepBar:SetFrameLevel(self.NoRep:GetFrameLevel() + 1) + self:SetSparkAlpha(self.db.profile.Spark) + self:ShowBar() self:UpdateData() if jostle then jostle:Refresh() end @@ -582,7 +595,8 @@ function FuXP:ShowBar() if self.db.profile.Shadow == true then self.Border:Show() end - if self.db.profile.ShowRep == true then + + if self.db.profile.ShowRep == true and watchedFactionID ~= 0 then self.RepBar:Show() self.RepSpark:Show() self.RepSpark2:Show() @@ -613,6 +627,7 @@ function FuXP:SetThickness(thickness) self.RepSpark:SetHeight((thickness) * 8) self.RepSpark2:SetHeight((thickness) * 8) self.NoRep:SetHeight(thickness) + self.Border:SetHeight(thickness) self.db.profile.Thickness = thickness self:Reanchor() if jostle then jostle:Refresh() end @@ -620,38 +635,50 @@ end function FuXP:OnDataUpdate() if not self.Panel then return end - - local name, standing, minRep, maxRep, currentRep, factionID = GetWatchedFactionInfo() local total = self.Panel.frame:GetWidth() - - local currentRepParagon, maxRepParagon = C_Reputation.GetFactionParagonInfo(factionID) - if currentRepParagon ~= nil then - minRep = 0 - maxRep = maxRepParagon - currentRep = currentRepParagon % maxRepParagon + if self.db.profile.ShowRep == true and watchedFactionID ~= 0 then + local name, standing, minRep, maxRep, currentRep, factionID = GetWatchedFactionInfo() + + local renownReputationData = C_MajorFactions.GetMajorFactionData(factionID) + local currentRepParagon, maxRepParagon = C_Reputation.GetFactionParagonInfo(factionID) + local friendshipReputationInfo = C_GossipInfo.GetFriendshipReputation(factionID) - self.RepBarTex:SetVertexColor(self.db.profile.ParagonRep[1], self.db.profile.ParagonRep[2], self.db.profile.ParagonRep[3], self.db.profile.ParagonRep[4]) - self.RepSpark:SetVertexColor(self.db.profile.ParagonRep[1], self.db.profile.ParagonRep[2], self.db.profile.ParagonRep[3], self.db.profile.ParagonRep[4]) - else - self.RepBarTex:SetVertexColor(self.db.profile.Rep[1], self.db.profile.Rep[2], self.db.profile.Rep[3], self.db.profile.Rep[4]) - self.RepSpark:SetVertexColor(self.db.profile.Rep[1], self.db.profile.Rep[2], self.db.profile.Rep[3], self.db.profile.Spark or 1) - end + if renownReputationData ~= nil then --Renown + minRep = 0 + maxRep = renownReputationData.renownLevelThreshold + currentRep = renownReputationData.renownReputationEarned - if self.db.profile.ShowRep == true then - local repBarWidth = ((currentRep - minRep)/(maxRep-minRep))*total + self.RepBarTex:SetVertexColor(self.db.profile.RenownRep[1], self.db.profile.RenownRep[2], self.db.profile.RenownRep[3], 1) + self.RepSpark:SetVertexColor(self.db.profile.RenownRep[1], self.db.profile.RenownRep[2], self.db.profile.RenownRep[3], self.db.profile.Spark) + elseif currentRepParagon ~= nil then --Paragon + minRep = 0 + maxRep = maxRepParagon + currentRep = currentRepParagon % maxRepParagon + + self.RepBarTex:SetVertexColor(self.db.profile.ParagonRep[1], self.db.profile.ParagonRep[2], self.db.profile.ParagonRep[3], self.db.profile.ParagonRep[4]) + self.RepSpark:SetVertexColor(self.db.profile.ParagonRep[1], self.db.profile.ParagonRep[2], self.db.profile.ParagonRep[3], self.db.profile.Spark) + elseif friendshipReputationInfo.friendshipFactionID == factionID then --Friendship + minRep = 0 + maxRep = friendshipReputationInfo.nextThreshold and friendshipReputationInfo.nextThreshold - friendshipReputationInfo.reactionThreshold or friendshipReputationInfo.maxRep + currentRep = maxRep - (friendshipReputationInfo.nextThreshold and friendshipReputationInfo.nextThreshold - friendshipReputationInfo.standing or 0) + + self.RepBarTex:SetVertexColor(self.db.profile.FriendshipRep[1], self.db.profile.FriendshipRep[2], self.db.profile.FriendshipRep[3], self.db.profile.FriendshipRep[4]) + self.RepSpark:SetVertexColor(self.db.profile.FriendshipRep[1], self.db.profile.FriendshipRep[2], self.db.profile.FriendshipRep[3], self.db.profile.Spark) + else + self.RepBarTex:SetVertexColor(self.db.profile.Rep[1], self.db.profile.Rep[2], self.db.profile.Rep[3], self.db.profile.Rep[4]) + self.RepSpark:SetVertexColor(self.db.profile.Rep[1], self.db.profile.Rep[2], self.db.profile.Rep[3], self.db.profile.Spark) + end + + local repBarWidth = (maxRep - currentRep == 0 and 1 or ((currentRep - minRep) / (maxRep - minRep))) * total if repBarWidth == 0 then repBarWidth = 0.1 end self.RepBar:SetWidth(repBarWidth) - self.NoRep:SetWidth(((maxRep - currentRep)/(maxRep - minRep))*total) + self.Border:SetWidth(repBarWidth + 4) + self.NoRep:SetWidth(((maxRep - currentRep) / (maxRep - minRep)) * total) end - - self.XPBar:Hide() - self.RestedXP:Hide() - self.NoXP:Hide() - self.Border:Hide() if self.db.profile.ShowXP == true and UnitLevel("player") ~= MAX_PLAYER_LEVEL then local currentXP = UnitXP("player") @@ -663,55 +690,76 @@ function FuXP:OnDataUpdate() remainXP = 0 end - self.XPBar:SetWidth((currentXP / maxXP) * total) + local xpBarWidth = (currentXP / maxXP) * total + + if xpBarWidth == 0 then xpBarWidth = 0.1 end + + self.XPBar:SetWidth(xpBarWidth) + self.Border:SetWidth(xpBarWidth) if (restXP + currentXP) / maxXP > 1 then self.RestedXP:SetWidth(total - self.XPBar:GetWidth()) else self.RestedXP:SetWidth((restXP / maxXP) * total + 0.001) end self.NoXP:SetWidth((remainXP / maxXP) * total) - - self.XPBar:Show() - self.RestedXP:Show() - self.NoXP:Show() - self.Border:Show() end end --- function FuXP:OnLevelUp(newLevel) --- if self.db.profile.ShowXP == true and newLevel == MAX_PLAYER_LEVEL then --- self.XPBar:Hide() --- self.Spark:Hide() --- self.Spark2:Hide() --- self.RestedXP:Hide() --- self.NoXP:Hide() --- end --- end +-- https://stackoverflow.com/a/10990879/633098 +local function numWithCommas(n) + return tostring(math.floor(n)):reverse():gsub("(%d%d%d)","%1,"):gsub(",(%-?)$","%1"):reverse() +end function FuXP:OnTextUpdate() - FuXP:OnDataUpdate() + local name, standing, minRep, maxRep, currentRep, factionID = GetWatchedFactionInfo() + + watchedFactionID = factionID + + self:OnDataUpdate() + self:Reanchor() + + local max, xp = UnitXPMax("player"), UnitXP("player") + local toGo = max - xp + -- Setup watched factions - if self.db.profile.ShowText == "Rep" and self.db.profile.Faction ~= 0 then - local name, standing, minRep, maxRep, currentRep, factionID = GetWatchedFactionInfo() - if standing <= 0 then return end -- 'Unknown' usually means that the player just started their character and aren't tracking any faction - local max, xp = UnitXPMax("player"), UnitXP("player") - local toGo = max - xp + if factionID ~= 0 then -- 'Unknown' usually means that the player just started their character and aren't tracking any faction + -- Renown Reputation introduced in Dragonflight: + -- https://wowpedia.fandom.com/wiki/API_C_MajorFactions.GetMajorFactionData + + local renownReputationData = C_MajorFactions.GetMajorFactionData(factionID) -- Paragon Reputation introduced in Legion: -- https://wow.gamepedia.com/Reputation#Paragon -- https://wow.gamepedia.com/API_C_Reputation.GetFactionParagonInfo local currentRepParagon, maxRepParagon = C_Reputation.GetFactionParagonInfo(factionID) + + -- Friendship Reputation introduced in Mists of Pandaria: + -- https://wowpedia.fandom.com/wiki/API_C_GossipInfo.GetFriendshipReputation - local factionStandingLabel = _G["FACTION_STANDING_LABEL"..standing] + local friendshipReputationInfo = C_GossipInfo.GetFriendshipReputation(factionID) + + local factionStandingLabel = _G["FACTION_STANDING_LABEL" .. standing] + + if renownReputationData ~= nil then --Renown + minRep = 0 + maxRep = renownReputationData.renownLevelThreshold + currentRep = renownReputationData.renownReputationEarned - if currentRepParagon ~= nil then + factionStandingLabel = "|cff00b0bdRenown " .. renownReputationData.renownLevel + elseif currentRepParagon ~= nil then --Paragon minRep = 0 maxRep = maxRepParagon currentRep = currentRepParagon % maxRepParagon factionStandingLabel = "|cffB2D7F7Paragon" + elseif friendshipReputationInfo.friendshipFactionID == factionID then --Friendship + minRep = 0 + maxRep = friendshipReputationInfo.nextThreshold and friendshipReputationInfo.nextThreshold - friendshipReputationInfo.reactionThreshold or friendshipReputationInfo.maxRep + currentRep = maxRep - (friendshipReputationInfo.nextThreshold and friendshipReputationInfo.nextThreshold - friendshipReputationInfo.standing or 0) + + factionStandingLabel = "|cffffdea1" .. friendshipReputationInfo.reaction .. "|r" else local standingColor @@ -733,32 +781,20 @@ function FuXP:OnTextUpdate() standingColor = "|cff00ffff" --Exalted end - factionStandingLabel = standingColor..factionStandingLabel + factionStandingLabel = standingColor .. factionStandingLabel end - - if name then - if UnitLevel("player") == MAX_PLAYER_LEVEL then - self:SetText(string.format(L["%s: %3.0f%% (%s/%s) (%s)"], name, ((currentRep-minRep)/(maxRep-minRep))*100 , currentRep-minRep, maxRep-minRep, factionStandingLabel.."|r")) + if UnitLevel("player") ~= MAX_PLAYER_LEVEL then + if maxRep - currentRep > 0 then + self:SetText(string.format(L["%s: %3.0f%% (%s/%s) (%s) // XP: %3.0f%%/%s to go"], name, ((currentRep - minRep) / (maxRep - minRep)) * 100, numWithCommas(currentRep - minRep), numWithCommas(maxRep - minRep), factionStandingLabel .. "|r", math.floor(xp / max * 100), numWithCommas(toGo))) else - self:SetText(string.format(L["%s: %3.0f%% (%s/%s) (%s) // XP: %s%%/%s to go"], name, ((currentRep-minRep)/(maxRep-minRep))*100 , currentRep-minRep, maxRep-minRep, factionStandingLabel.."|r", math.floor(xp/max * 100), toGo)) + self:SetText(string.format(L["%s (%s) // XP: %3.0f%%/%s to go"], name, factionStandingLabel .. "|r", math.floor(xp / max * 100), numWithCommas(toGo))) end + else + self:SetText(string.format(L["%s: %3.0f%% (%s/%s) (%s)"], name, ((currentRep - minRep) / (maxRep - minRep)) * 100 , numWithCommas(currentRep - minRep), numWithCommas(maxRep - minRep), factionStandingLabel .. "|r")) end - elseif self.db.profile.ShowText == "XP" then - local max, xp = UnitXPMax("player"), UnitXP("player") - local toGo = max - xp - local percentToGo = math.floor(toGo / max * 100) - if crayon then - toGo = "|cff"..crayon:GetThresholdHexColor(toGo, 0) .. toGo .. "|r" - percentToGo = "|cff"..crayon:GetThresholdHexColor(percentToGo) .. percentToGo .. "|r" - end - if self.db.profile.ToGo then - self:SetText(string.format("%s (%s%%)", toGo, percentToGo)) - else - self:SetText(string.format("%s/%s (%s%%)", xp, max, math.floor(xp/max * 100))) - end else - self:SetText("FuXPFu") + self:SetText(string.format(L["XP: %3.0f%%/%s to go"], math.floor(xp / max * 100), numWithCommas(toGo))) end end @@ -767,18 +803,15 @@ function FuXP:OnTooltipUpdate() local currentXP = UnitXP("player") local toLevelXP = totalXP - currentXP local toLevelXPPercent = math.floor((currentXP / totalXP) * 100) - local xp = tablet:AddCategory( - 'columns', 2 - ) + local xpCat = tablet:AddCategory('columns', 2) - if self.panel:GetAttachPoint() ~= self.Side then - self:Reanchor() - end + local showXPBar = self.db.profile.ShowXP == true and UnitLevel('player') ~= MAX_PLAYER_LEVEL + if showXPBar then + local xpEx, xpExPercent - if self.db.profile.ShowXP == true and UnitLevel('player') < MAX_PLAYER_LEVEL then if GetXPExhaustion() then - local xpEx = GetXPExhaustion() - local xpExPercent + xpEx = GetXPExhaustion() + if xpEx - toLevelXP > 0 then xpExPercent = math.floor(((xpEx - toLevelXP) / totalXP) * 100) else @@ -787,128 +820,156 @@ function FuXP:OnTooltipUpdate() if crayon then -- Scale: 1 - 100 -- ExXP: 1 - toLevelXP - xpEx = "|cff"..crayon:GetThresholdHexColor(xpEx, 1, toLevelXP * 0.25, toLevelXP * 0.5, toLevelXP * 0.75, toLevelXP) .. xpEx .. "|r" - xpExPercent = "|cff"..crayon:GetThresholdHexColor(xpExPercent, 1, 25, 50, 75, 100) .. xpExPercent .. "|r" + xpEx = "|cff" .. crayon:GetThresholdHexColor(xpEx, 1, toLevelXP * 0.25, toLevelXP * 0.5, toLevelXP * 0.75, toLevelXP) .. numWithCommas(xpEx) .. "|r" + xpExPercent = "|cff" .. crayon:GetThresholdHexColor(xpExPercent, 1, 25, 50, 75, 100) .. xpExPercent .. "|r" end if GetXPExhaustion() - toLevelXP > 0 then - xpExPercent = "100% + "..xpExPercent + xpExPercent = "100% + " .. xpExPercent end - xp:AddLine( - 'text', L["Rested XP"], - 'text2', string.format("%s (%s%%)", xpEx, xpExPercent) - ) + end if crayon then - currentXP = "|cff"..crayon:GetThresholdHexColor(currentXP, 1, totalXP * 0.25, totalXP * 0.5, totalXP * 0.75, totalXP) .. currentXP .. "|r" - toLevelXP = "|cff"..crayon:GetThresholdHexColor(toLevelXP, totalXP, totalXP * 0.75, totalXP * 0.5, totalXP * 0.25, 1) .. toLevelXP .. "|r" + currentXP = "|cff"..crayon:GetThresholdHexColor(currentXP, 1, totalXP * 0.25, totalXP * 0.5, totalXP * 0.75, totalXP) .. numWithCommas(currentXP) .. "|r" + toLevelXP = "|cff"..crayon:GetThresholdHexColor(toLevelXP, totalXP, totalXP * 0.75, totalXP * 0.5, totalXP * 0.25, 1) .. numWithCommas(toLevelXP) .. "|r" toLevelXPPercent = "|cff"..crayon:GetThresholdHexColor(toLevelXPPercent, 1, 25, 50, 75, 100) .. toLevelXPPercent .. "|r" end - xp:AddLine( + xpCat:AddLine( 'text', L["Current XP"], - 'text2', string.format("%s/%s (%s%%)", currentXP, totalXP, toLevelXPPercent) + 'text2', string.format("%s/%s (%s%%)", currentXP, numWithCommas(totalXP), toLevelXPPercent), + 'size2', 11 ) - xp:AddLine( - 'text', L["To Level"], - 'text2', toLevelXP + xpCat:AddLine( + 'text', L["To level"], + 'text2', toLevelXP, + 'size2', 11 ) + if (xpEx) then + xpCat:AddLine( + 'text', L["Rested XP"], + 'text2', string.format("%s (%s%%)", xpEx, xpExPercent), + 'size2', 11 + ) + end end + if self.db.profile.ShowRep == true then - local name, _, standing, _, maxRep, currentRep, _, _, _, _, _, _, _, factionID = GetFactionInfo(self.db.profile.Faction) + local _, standing, _, _, _, factionID = GetWatchedFactionInfo() - local standingColor + if standing > 0 then -- 'Unknown' usually means that the player just started their character and aren't tracking any faction + local name, _, _, minRep, maxRep, currentRep = GetFactionInfoByID(factionID) - local currentRepParagon, maxRepParagon = C_Reputation.GetFactionParagonInfo(factionID) + local standingColor - if currentRepParagon ~= nil then - maxRep = maxRepParagon - currentRep = currentRepParagon % maxRepParagon + local renownReputationData = C_MajorFactions.GetMajorFactionData(factionID) + local currentRepParagon, maxRepParagon = C_Reputation.GetFactionParagonInfo(factionID) + local friendshipReputationInfo = C_GossipInfo.GetFriendshipReputation(factionID) - standing = "|cffB2D7F7Paragon|r" --Paragon - else - if standing == 1 then - standingColor = "|cffcc2222" --Hated - elseif standing == 2 then - standingColor = "|cffff0000" --Hostile - elseif standing == 3 then - standingColor = "|cffee6622" --Unfriendly - elseif standing == 4 then - standingColor = "|cffD1BB48" --Neutral - elseif standing == 5 then - standingColor = "|cff00ff00" --Friendly - elseif standing == 6 then - standingColor = "|cff00ff88" --Honored - elseif standing == 7 then - standingColor = "|cff00ffcc" --Revered - elseif standing == 8 then - standingColor = "|cff00ffff" --Exalted - end + if renownReputationData ~= nil then + maxRep = renownReputationData.renownLevelThreshold + currentRep = renownReputationData.renownReputationEarned - standing = standingColor.._G["FACTION_STANDING_LABEL"..standing].."|r" - end + standing = "|cff00b0bdRenown " .. renownReputationData.renownLevel .. "|r" --Renown + elseif currentRepParagon ~= nil then + maxRep = maxRepParagon + currentRep = currentRepParagon % maxRepParagon - xp:AddLine( - 'text', L["Faction"], - 'text2', "|cffFFEBBB"..name.."|r", - 'size2', 13 - ) - xp:AddLine( - 'text', L["Rep to next standing"], - 'text2',"|cffffffff"..(maxRep - currentRep).."|r" , - 'size2', 12 - ) - - xp:AddLine( - 'text', L["Current standing"], - 'text2', standing - ) - end - -- local Hint = "" + standing = "|cffB2D7F7Paragon|r" --Paragon + elseif friendshipReputationInfo.friendshipFactionID == factionID then + maxRep = friendshipReputationInfo.nextThreshold and friendshipReputationInfo.nextThreshold - friendshipReputationInfo.reactionThreshold or friendshipReputationInfo.maxRep + currentRep = maxRep - (friendshipReputationInfo.nextThreshold and friendshipReputationInfo.nextThreshold - friendshipReputationInfo.standing or 0) - -- Hint = L["Click to send your current xp to an open editbox."] - -- if self.db.profile.Faction ~= 0 then - -- Hint = Hint .."\n"..L["Shift Click to send your current rep to an open editbox."] - -- end + local rankInfo = C_GossipInfo.GetFriendshipReputationRanks(factionID) + standing = "|cffffdea1" .. friendshipReputationInfo.reaction .. " (" .. rankInfo.currentLevel .. "/" .. rankInfo.maxLevel .. ")|r" --Friendship + else + if standing == 1 then + standingColor = "|cffcc2222" --Hated + elseif standing == 2 then + standingColor = "|cffff0000" --Hostile + elseif standing == 3 then + standingColor = "|cffee6622" --Unfriendly + elseif standing == 4 then + standingColor = "|cffD1BB48" --Neutral + elseif standing == 5 then + standingColor = "|cff00ff00" --Friendly + elseif standing == 6 then + standingColor = "|cff00ff88" --Honored + elseif standing == 7 then + standingColor = "|cff00ffcc" --Revered + elseif standing == 8 then + standingColor = "|cff00ffff" --Exalted + end + + standing = standingColor .. _G["FACTION_STANDING_LABEL" .. standing] .. "|r" + end - -- tablet:SetHint(Hint) -end + tablet:AddCategory( + 'text', "|cffe3e3e3" .. name .. "|r", + 'justify', 'CENTER', + 'size', 13, + 'hideBlankLine', not showXPBar + ):AddLine('text', '') -function FuXP:OnClick() - local totalXP = UnitXPMax("player") - local currentXP = UnitXP("player") - local toLevelXP = totalXP - currentXP - local name, desc, standing, minRep, maxRep, currentRep = GetFactionInfo(self.db.profile.Faction) - local xpEx = GetXPExhaustion() or 0 - local xpExPercent - if xpEx - toLevelXP > 0 then - xpExPercent = math.floor(((xpEx - toLevelXP) / totalXP) * 100) - else - xpExPercent = math.floor((xpEx / totalXP) * 100) + local repCat2 = tablet:AddCategory( + 'columns', 2, + 'hideBlankLine', true + ) + repCat2:AddLine( + 'text', L["Current standing"], + 'text2', standing + ) + if maxRep - currentRep > 0 then + repCat2:AddLine( + 'text', L["Reputation to next standing"], + 'text2', "|cffffffff" .. numWithCommas(maxRep - currentRep) .. "|r", + 'size2', 11 + ) end - if not IsShiftKeyDown() or self.db.profile.Faction == 0 then - DEFAULT_CHAT_FRAME.editBox:SetText(string.format("%s/%s (%3.0f%%) %d to go (%3.0f%% rested)", currentXP,totalXP, (currentXP/totalXP)*100, totalXP - currentXP, xpExPercent)) - elseif self.db.profile.Faction ~= 0 then - DEFAULT_CHAT_FRAME.editBox:SetText(string.format("%s: %s/%s (%3.2f%%, %s)", - name, - currentRep - minRep, - maxRep - minRep, - (currentRep-minRep)/(maxRep-minRep)*100, - _G["FACTION_STANDING_LABEL"..standing])) + if renownReputationData ~= nil then + local repCat3 = tablet:AddCategory() + + if renownReputationData.isUnlocked then + repCat3:AddLine( + 'text', "|cffe8e8e8Click to view |r|cff00b0bdRenown|r", + 'justify', 'CENTER', + 'size', 10 + ) + else + repCat3:AddLine( + 'text', "|cffff2020To view Renown, " .. string.gsub(renownReputationData.unlockDescription, "^Complete the quest", "complete the quest\n") .. "|r", + 'justify', 'CENTER', + 'size', 10, + 'wrap', true + ) + end + elseif friendshipReputationInfo.friendshipFactionID == factionID then + local repCat3 = tablet:AddCategory() + + repCat3:AddLine( + 'text', "|cffffdea1" .. friendshipReputationInfo.text .. "|r", + 'justify', 'CENTER', + 'size', 10, + 'wrap', true + ) + end + end end end -function FuXP:QueryFactions(noupdate) - if not self.FactionTable then self.FactionTable = {} end; - local WatchedFaction = GetWatchedFactionInfo(); - for factionIndex = 1, GetNumFactions() do - local name, _, _, _, _ , _ ,_ , _, isHeader = GetFactionInfo(factionIndex) +function FuXP:OnClick() + local renownReputationData = C_MajorFactions.GetMajorFactionData(watchedFactionID) + + if renownReputationData ~= nil and renownReputationData.isUnlocked then + tablet:Close() + + MajorFactions_LoadUI(); - if not isHeader then - if WatchedFaction == name then - self.db.profile.Faction = factionIndex; - end - self.FactionTable[tostring(factionIndex)] = name + if MajorFactionRenownFrame:IsShown() and MajorFactionRenownFrame:GetCurrentFactionID() == watchedFactionID then + ToggleMajorFactionRenown(); + else + HideUIPanel(MajorFactionRenownFrame); + EventRegistry:TriggerEvent("MajorFactionRenownMixin.MajorFactionRenownRequest", watchedFactionID); + ShowUIPanel(MajorFactionRenownFrame); end end - return self.FactionTable end diff --git a/FuBar_FuXPFu/FuBar_FuXPFu.toc b/FuBar_FuXPFu/FuBar_FuXPFu.toc index 4334aa9..8e7e773 100644 --- a/FuBar_FuXPFu/FuBar_FuXPFu.toc +++ b/FuBar_FuXPFu/FuBar_FuXPFu.toc @@ -4,14 +4,13 @@ ## Notes: Lightweight XP Bar ## Notes-zhCN: 迷你经验条 ## Notes-zhTW: 輕量級的經驗值條模組。 -## Version: 10.0.2.4 -## Author: Wobin +## Version: 10.0.2.5 +## Author: Wobin, azuraji ## eMail: wobster@gmail.com ## X-Credits: Bant (For the design) ## X-Category: Interface Enhancements -## X-WoWIPortal: wobin ## Dependencies: FuBar -## OptionalDeps: Ace2, DewdropLib, TabletLib, FuBarPlugin-2.0, JostleLib, CrayonLib, FuBar, FuBar_Factions, tekAutoRep +## OptionalDeps: Ace2, DewdropLib, TabletLib, FuBarPlugin-2.0, JostleLib, CrayonLib, FuBar ## SavedVariables: FuXPDB ## X-Embeds: Ace2, Dewdrop-2.0, Tablet-2.0, FuBarPlugin-2.0 diff --git a/FuBar_FuXPFu/FuXPLocals.lua b/FuBar_FuXPFu/FuXPLocals.lua index 33ec12b..917f5f6 100644 --- a/FuBar_FuXPFu/FuXPLocals.lua +++ b/FuBar_FuXPFu/FuXPLocals.lua @@ -3,10 +3,10 @@ L:RegisterTranslations("enUS", function() return { ["AceConsole-commands"] = { "/FuXPFu" }, - ["Colours"] = true, - ["Set the Bar Colours"] = true, + ["Colors"] = true, + ["Set the Bar Colors"] = true, - ["Properties"] = true, + ["Bar Properties"] = true, ["Set the Bar Properties"] = true, ["Current XP"] = true, @@ -18,17 +18,17 @@ L:RegisterTranslations("enUS", function() return { ["No XP"] = true, ["Sets the empty color of the XP Bar"] = true, - ["Reputation"] = true, + ["Rep"] = true, ["Sets the color of the Rep Bar"] = true, ["No Rep"] = true, - ["Sets the empty color of the Reputation Bar"] = true, + ["Sets the empty color of the Rep Bar"] = true, ["Show XP Bar"] = true, ["Show the XP Bar"] = true, ["Show Rep Bar"] = true, - ["Show the Reputation Bar"] = true, + ["Show the Rep Bar"] = true, ["Spark intensity"] = true, ["Brightness level of Spark"] = true, @@ -37,68 +37,45 @@ L:RegisterTranslations("enUS", function() return { ["Sets thickness of XP Bar"] = true, ["Shadow"] = true, - ["Toggles Shadow under XP Bar"] = true, + ["Toggles Shadow under the bottommost bar"] = true, ["Remaining"] = true, ["Show Remaining in Bar"] = true, - ["Select Faction"] = true, + ["Select faction to watch"] = true, ["Faction"] = true, ["Watched Faction"] = true, - ["Hook-ins"] = true, - ["Options to hook in other addons"] = true, - - ["FuBar Faction Link"]= true, - ["Link to FubBar Factions"] = true, - - ["Tek AutoRep"] = true, - ["Hook into TekAutoRep's automatic rep changes"] = true, - - ['Location'] = true, - ["Undocked Position"] = true, + ["Undocked position"] = true, ["Selects which side of an undocked panel you want the bars on."] = true, - ["None||Rep||XP"] = true, - ["Show Text"] = true, - ["Show the XP or Rep"] = true, - ["XP to go"] = true, - ["Show XP to go"] = true, - ["Short Rep Name"] = true, - ["Show short names for factions"] = true, - ["The "] = true, - ["%s: %3.0f%% (%s/%s) (%s)"] = true, - ["%s: %3.0f%% (%s/%s) (%s) // XP: %s%%/%s to go"] = true, - ["%s to go (%3.0f%%)"] = true, + ["%s: %3.0f%% (%s/%s) (%s) // XP: %3.0f%%/%s to go"] = true, + ["%s (%s) // XP: %3.0f%%/%s to go"] = true, + ["XP: %3.0f%%/%s to go"] = true, ["Current XP"] = true, - ["To Level"] = true, + ["To level"] = true, ["Rested XP"] = true, ["Click to send your current xp to an open editbox."] = true, ["Shift Click to send your current rep to an open editbox."] = true, ["Faction"] = true, - ["Rep to next standing"] = true, + ["Reputation to next standing"] = true, ["Current standing"] = true, - ["%s/%s (%3.0f%%) %d to go (%3.0f%% rested)"] = true, - ["%s:%s/%s (%3.2f%%) Currently %s with %d to go"] = true, - ["Top"] = true, ["Bottom"] = true, ["XP"] = true, - ["Rep"] = true, - ["None"] = true, } end) L:RegisterTranslations("koKR", function() return { ["AceConsole-commands"] = { "/FuXPFu" }, - ["Colours"] = "색상", - ["Set the Bar Colours"] = "바의 색상을 설정합니다", + ["Colors"] = "색상", + ["Set the Bar Colors"] = "바의 색상을 설정합니다", - ["Properties"] = "표시 내용", + ["Bar Properties"] = "표시 내용", ["Set the Bar Properties"] = "바의 표시 내용을 설정합니다", ["Current XP"] = "현재 경험치", @@ -110,17 +87,17 @@ L:RegisterTranslations("koKR", function() return { ["No XP"] = "남은 경험치", ["Sets the empty color of the XP Bar"] = "남은 경험치 바의 색상을 설정합니다", - ["Reputation"] = "평판", + ["Rep"] = "평판", ["Sets the color of the Rep Bar"] = "평판바의 색상을 설정합니다", ["No Rep"] = "남은 평판", - ["Sets the empty color of the Reputation Bar"] = "남은 평판바의 색상을 설정합니다", + ["Sets the empty color of the Rep Bar"] = "남은 평판바의 색상을 설정합니다", ["Show XP Bar"] = "경험치바 표시", ["Show the XP Bar"] = "경험치 바를 표시합니다", ["Show Rep Bar"] = "평판바 표시", - ["Show the Reputation Bar"] = "평판바를 표시합니다", + ["Show the Rep Bar"] = "평판바를 표시합니다", ["Spark intensity"] = "구분선", ["Brightness level of Spark"] = "구분선의 밝기 정도를 설정합니다", @@ -129,67 +106,42 @@ L:RegisterTranslations("koKR", function() return { ["Sets thickness of XP Bar"] = "경험치바의 굵기를 설정합니다", ["Shadow"] = "음영", - ["Toggles Shadow under XP Bar"] = "경험치 바 하단의 그림자를 토글합니다", + ["Toggles Shadow under the bottommost bar"] = "경험치 바 하단의 그림자를 토글합니다", ["Remaining"] = "잔상", ["Show Remaining in Bar"] = "바에 잔상 표시합니다.", - ["Select Faction"] = "진영 선택", + ["Select faction to watch"] = "진영 선택", ["Faction"] = "진영", ["Watched Faction"] = "표시중인 평판", - ["Hook-ins"] = "참조", - ["Options to hook in other addons"] = "다른 애드온의 기능을 참조합니다", - - ["FuBar Faction Link"]= "FuBar Faction 연결", - ["Link to FubBar Factions"] = "FuBar Faction과 연결합니다", - --- ["Tek AutoRep"] = true, - ["Hook into TekAutoRep's automatic rep changes"] = "TekAutoRep의 자동 평편 변경 기능을 적용합니다", - - ['Location'] = "위치", - ["Undocked Position"] = "패널분리시 위치", + ["Undocked position"] = "패널분리시 위치", ["Selects which side of an undocked panel you want the bars on."] = "패널을 분리 하였을 경우 패널의 어느쪽에 바를 표시할지를 선택합니다.", - ["XP|Rep|None"] = "경험치|평판|없음", - ["Show Text"] = "텍스트 표시", - ["Show the XP or Rep"] = "경험치 또는 평판 표시", - ["XP to go"] = "레벨업 까지 남은 경험치", - ["Show XP to go"] = "레벨업 까지 남은 경험치 표시", - ["Short Rep Name"] = "짧은 평판명", - ["Show short names for factions"] = "짧은 평판명을 표시합니다.", - ["The "] = "The ", - ["%s: %3.0f%% (%s/%s) %s left"] = "%s 진영: %3.0f%% (%s/%s) %s 남았음", - ["%s to go (%3.0f%%)"] = "%s 남았음 (%3.0f%%)", ["Current XP"] = "현재 경험치", - ["To Level"] = "남은 경험치", + ["To level"] = "남은 경험치", ["Rested XP"] = "휴식 경험치", ["Click to send your current xp to an open editbox."] = "클릭시 입력창이 열려 있을 경우 현재 경험치를 출력합니다.", ["Shift Click to send your current rep to an open editbox."] = "Shift 클릭시 입력창이 열려 있을 경우 현재 평판을 출력합니다.", ["Faction"] = "진영", - ["Rep to next standing"] = "다음 단계까지 남은 평판", + ["Reputation to next standing"] = "다음 단계까지 남은 평판", ["Current rep"] = "현재 평판", - ["%s/%s (%3.0f%%) %d to go (%3.0f%% rested)"] = "현재 경험치는 %s/%s (%3.0f%%). %d 남았습니다", - ["%s:%s/%s (%3.2f%%) Currently %s with %d to go"] = "%s 진영: %s/%s (%3.2f%%) 현재 %s 평판에 %d를 더 올리면 다음 등급이 됩니다", - ["Top"] = "위", ["Bottom"] = "아래", ["XP"] = "경험치" , - ["Rep"] = "평판", - ["None"] = "없음", } end) L:RegisterTranslations("zhTW", function() return { ["AceConsole-commands"] = { "/FuXPFu" }, - ["Colours"] = "顏色", - ["Set the Bar Colours"] = "設定經驗/聲望條顏色", + ["Colors"] = "顏色", + ["Set the Bar Colors"] = "設定經驗/聲望條顏色", - ["Properties"] = "屬性", + ["Bar Properties"] = "屬性", ["Set the Bar Properties"] = "設定經驗/聲望條屬性", ["Current XP"] = "現在經驗", @@ -201,17 +153,17 @@ L:RegisterTranslations("zhTW", function() return { ["No XP"] = "空白經驗條", ["Sets the empty color of the XP Bar"] = "設定空白經驗條顏色", - ["Reputation"] = "現在聲望", + ["Rep"] = "現在聲望", ["Sets the color of the Rep Bar"] = "設定現在聲望顏色", ["No Rep"] = "空白聲望條", - ["Sets the empty color of the Reputation Bar"] = "設定空白聲望條顏色", + ["Sets the empty color of the Rep Bar"] = "設定空白聲望條顏色", ["Show XP Bar"] = "顯示經驗條", ["Show the XP Bar"] = "顯示經驗條", ["Show Rep Bar"] = "顯示聲望條", - ["Show the Reputation Bar"] = "顯示聲望條", + ["Show the Rep Bar"] = "顯示聲望條", ["Spark intensity"] = "分界亮度", ["Brightness level of Spark"] = "設定現在值與剩餘值分界標誌的亮度", @@ -220,67 +172,42 @@ L:RegisterTranslations("zhTW", function() return { ["Sets thickness of XP Bar"] = "設定經驗/聲望條的厚度", ["Shadow"] = "陰影效果", - ["Toggles Shadow under XP Bar"] = "開啟經驗/聲望條的陰影效果", + ["Toggles Shadow under the bottommost bar"] = "開啟經驗/聲望條的陰影效果", ["Remaining"] = "顯示剩餘值", ["Show Remaining in Bar"] = "在經驗/聲望條顯示剩餘值", - ["Select Faction"] = "選擇陣營", + ["Select faction to watch"] = "選擇陣營", ["Faction"] = "陣營", ["Watched Faction"] = "監察的陣營", - ["Hook-ins"] = "連結", - ["Options to hook in other addons"] = "設定與其他插件的連結", - - ["FuBar Faction Link"]= "FuBar Fraction 連結", - ["Link to FubBar Factions"] = "連結到 FuBar Faction 插件", - - ["Tek AutoRep"] = "Tek AutoRep", - ["Hook into TekAutoRep's automatic rep changes"] = "連結到 TekAutoRep 插件的自動監察陣營功能", - - ['Location'] = "位置", - ["Undocked Position"] = "附著位置", + ["Undocked position"] = "附著位置", ["Selects which side of an undocked panel you want the bars on."] = "設定經驗/聲望條附著在面板的哪一側", - ["XP|Rep|None"] = "經驗|聲望|無", - ["Show Text"] = "顯示文字", - ["Show the XP or Rep"] = "顯示經驗或聲望", - ["XP to go"] = "尚欠經驗", - ["Show XP to go"] = "顯示升級尚欠經驗", - ["Short Rep Name"] = "簡短陣營", - ["Show short names for factions"] = "顯示簡短陣營名稱", - ["The "] = "", - ["%s: %3.0f%% (%s/%s) %s left"] = "%s: %3.0f%% (%s/%s) 尚欠: %s", - ["%s to go (%3.0f%%)"] = "%s: 尚欠 (%3.0f%%)", ["Current XP"] = "現在經驗", - ["To Level"] = "升級需要經驗", + ["To level"] = "升級需要經驗", ["Rested XP"] = "獎勵經驗", ["Click to send your current xp to an open editbox."] = "\n|cffeda55f左擊: |r向聊天輸入框發送經驗值。", ["Shift Click to send your current rep to an open editbox."] = "|cffeda55fShift-左擊: |r向聊天輸入框發送聲望值。", ["Faction"] = "陣營", - ["Rep to next standing"] = "提升聲望等級需要聲望", + ["Reputation to next standing"] = "提升聲望等級需要聲望", ["Current rep"] = "現在聲望", - ["%s/%s (%3.0f%%) %d to go (%3.0f%% rested)"] = "%s/%s (%3.0f%%) 升聲望尚欠: %d (%3.0f%% 獎勵)", - ["%s:%s/%s (%3.2f%%) Currently %s with %d to go"] = "%s:%s/%s (%3.2f%%) 現在聲望: %s 升聲望尚欠: %d", - ["Top"] = "頂部", ["Bottom"] = "底部", ["XP"] = "經驗", - ["Rep"] = "聲望", - ["None"] = "無", } end) L:RegisterTranslations("frFR", function() return { ["AceConsole-commands"] = { "/FuXPFu" }, - ["Colours"] = "Couleurs", - ["Set the Bar Colours"] = "D\195\169finit les couleurs de la barre", + ["Colors"] = "Couleurs", + ["Set the Bar Colors"] = "D\195\169finit les couleurs de la barre", - ["Properties"] = "Propri\195\169t\195\169s", + ["Bar Properties"] = "Propri\195\169t\195\169s", ["Set the Bar Properties"] = "Change les propri\195\169t\195\169s de la barre", ["Current XP"] = "XP actuelle", @@ -292,17 +219,17 @@ L:RegisterTranslations("frFR", function() return { ["No XP"] = "Exp\195\169rience - Vide", ["Sets the empty color of the XP Bar"] = "Choisit la couleur de la partie vide de la barre d'exp\195\169rience", - ["Reputation"] = "R\195\169putation", + ["Rep"] = "R\195\169putation", ["Sets the color of the Rep Bar"] = "Choisit la couleur de la barre de r\195\169putation", ["No Rep"] = "R\195\169putation - Vide", - ["Sets the empty color of the Reputation Bar"] = "Choisit la couleur de la partie vide de la barre de r\195\169putation", + ["Sets the empty color of the Rep Bar"] = "Choisit la couleur de la partie vide de la barre de r\195\169putation", ["Show XP Bar"] = "Afficher la barre d'exp\195\169rience", ["Show the XP Bar"] = "Affiche la barre d'exp\195\169rience", ["Show Rep Bar"] = "Afficher la barre de r\195\169putation", - ["Show the Reputation Bar"] = "Affiche la barre de r\195\169putation", + ["Show the Rep Bar"] = "Affiche la barre de r\195\169putation", ["Spark intensity"] = "Intencit\195\169 de l'\195\169tincelle", ["Brightness level of Spark"] = "R\195\168gle l'intensit\195\169 de l'\195\169tincelle sur la barre d'exp\195\169rience", @@ -311,55 +238,33 @@ L:RegisterTranslations("frFR", function() return { ["Sets thickness of XP Bar"] = "R\195\168gle l'\195\169paisseur de la barre d'XP", ["Shadow"] = "Ombrage", - ["Toggles Shadow under XP Bar"] = "Active/d\195\169sactive l'ombrage de la barre d'XP", + ["Toggles Shadow under the bottommost bar"] = "Active/d\195\169sactive l'ombrage de la barre d'XP", ["Remaining"] = "Restant", ["Show Remaining in Bar"] = "Afficher l'XP restante pour ce niveau dans la barre", - ["Select Faction"] = "S\195\169lectionne la faction", + ["Select faction to watch"] = "S\195\169lectionne la faction", ["Faction"] = "Faction", ["Watched Faction"] = "Faction monitor\195\169e", - ["Hook-ins"] = "Interactions", - ["Options to hook in other addons"] = "Options pour int\195\169ragir avec d'autres addons", - - ["FuBar Faction Link"]= "Lier à FuBar_Factions", - ["Link to FubBar Factions"] = "Active l'interaction avec FuBar_Factions", - - ["Tek AutoRep"] = "TekAutoRep", - ["Hook into TekAutoRep's automatic rep changes"] = "Interagit avec TekAutoRep pour les changements de r\195\169putation automatiques", - - ['Location'] = "Position", - ["Undocked Position"] = "Position", + ["Undocked position"] = "Position", ["Selects which side of an undocked panel you want the bars on."] = "Choisit de quel cot\195\169 d'un panneau libre vous voulez les barres", - ["XP|Rep|None"] = "XP|Rep|Rien", - ["Show Text"] = "Afficher le texte", - ["Show the XP or Rep"] = "Affiche l'XP ou la r\195\169putation", - ["XP to go"] = "XP restant", - ["Show XP to go"] = "Affiche l'XP restant", - ["%s: %3.0f%% (%s/%s) %s left"] = "%s: %3.0f%% (%s/%s) %s restant", - ["%s to go (%3.0f%%)"] = "%s restant (%3.0f%%)", ["Current XP"] = "XP actuelle", - ["To Level"] = "Jusqu'au niveau", + ["To level"] = "Jusqu'au niveau", ["Rested XP"] = "XP repos\195\169", ["Click to send your current xp to an open editbox."] = "Cliquer pour ins\195\169rer votre XP actuelle dans une fen\195\170tre de discussion", ["Shift Click to send your current rep to an open editbox."] = "Maj-Clic pour ins\195\169rer votre r\195\169putation actuelle dans une fen\195\170tre de discussion", ["Faction"] = "Faction", - ["Rep to next standing"] = "R\195\169putation jusqu'au prochain palier", + ["Reputation to next standing"] = "R\195\169putation jusqu'au prochain palier", ["Current rep"] = "R\195\169putation actuelle", - ["%s/%s (%3.0f%%) %d to go (%3.0f%% rested)"] = "%s/%s (%3.0f%%) %d restant", - ["%s:%s/%s (%3.2f%%) Currently %s with %d to go"] = "%s:%s/%s (%3.2f%%) actuel %s et %d restant", - ["Top"] = "Haut", ["Bottom"] = "Bas", ["XP"] = "XP", - ["Rep"] = "Reput", - ["None"] = "Aucun", } end) L:RegisterTranslations("zhCN", function() return { @@ -368,10 +273,10 @@ L:RegisterTranslations("zhCN", function() return { --http://www.dreamgen.cn ["AceConsole-commands"] = { "/FuXPFu" }, - ["Colours"] = "颜色", - ["Set the Bar Colours"] = "设置经验值/声望值条颜色", + ["Colors"] = "颜色", + ["Set the Bar Colors"] = "设置经验值/声望值条颜色", - ["Properties"] = "属性", + ["Bar Properties"] = "属性", ["Set the Bar Properties"] = "设置经验值/声望值条属性", ["Current XP"] = "当前经验值", @@ -383,17 +288,17 @@ L:RegisterTranslations("zhCN", function() return { ["No XP"] = "经验值条背景", ["Sets the empty color of the XP Bar"] = "设置经验值条背景颜色", - ["Reputation"] = "声望值", + ["Rep"] = "声望值", ["Sets the color of the Rep Bar"] = "设置声望值条颜色", ["No Rep"] = "声望值条背景", - ["Sets the empty color of the Reputation Bar"] = "设置声望值条背景颜色", + ["Sets the empty color of the Rep Bar"] = "设置声望值条背景颜色", ["Show XP Bar"] = "显示经验值条", ["Show the XP Bar"] = "显示经验值条", ["Show Rep Bar"] = "显示声望值条", - ["Show the Reputation Bar"] = "显示声望值条", + ["Show the Rep Bar"] = "显示声望值条", ["Spark intensity"] = "游标亮度", ["Brightness level of Spark"] = "设置游标亮度", @@ -402,56 +307,31 @@ L:RegisterTranslations("zhCN", function() return { ["Sets thickness of XP Bar"] = "设置经验值/声望值条高度", ["Shadow"] = "阴影", - ["Toggles Shadow under XP Bar"] = "是否显示阴影", + ["Toggles Shadow under the bottommost bar"] = "是否显示阴影", ["Remaining"] = "剩余值", ["Show Remaining in Bar"] = "在 FuBar 上显示经验/声望的剩余值", - ["Select Faction"] = "选择阵营", + ["Select faction to watch"] = "选择阵营", ["Faction"] = "阵营", ["Watched Faction"] = "关注的阵营", - ["Hook-ins"] = "兼容", - ["Options to hook in other addons"] = "与其它插件的兼容设置", - - ["FuBar Faction Link"] = "FuBar Faction 连接", - ["Link to FubBar Factions"] = "与 FuBar Faction 进行连接", - - ["Tek AutoRep"] = "Tek AutoRep", - ["Hook into TekAutoRep's automatic rep changes"] = "与 TekAutoRep 插件的自动声望监视功能进行连接", - - --['Location'] = true, - ["Undocked Position"] = "依附位置", + ["Undocked position"] = "依附位置", ["Selects which side of an undocked panel you want the bars on."] = "选择声望值/经验值条在该 FuBar 条的哪一侧显示", - --["XP|Rep|None"] = true, - ["Show Text"] = "显示文本", - ["Show the XP or Rep"] = "显示经验值/声望值", - ["XP to go"] = "剩余经验", - ["Show XP to go"] = "显示到达下一等级的剩余经验值", - --["Short Rep Name"] = "简短阵营名", - --["Show short names for factions"] = "", - --["The "] = "", - ["%s: %3.0f%% (%s/%s) %s left"] = "%s: %3.0f%% (%s/%s) 尚欠%s", - ["%s to go (%3.0f%%)"] = "尚欠%s (%3.0f%%)", ["Current XP"] = "当前经验值", - ["To Level"] = "升级仍需", + ["To level"] = "升级仍需", ["Rested XP"] = "休息奖励", ["Click to send your current xp to an open editbox."] = "单击将你的当前经验值信息发送到聊天输入框", ["Shift Click to send your current rep to an open editbox."] = "Shift-单击将你的当前声望值信息发送到聊天输入框", ["Faction"] = "阵营", - ["Rep to next standing"] = "到达下一关系需要", + ["Reputation to next standing"] = "到达下一关系需要", ["Current rep"] = "当前关系", - ["%s/%s (%3.0f%%) %d to go (%3.0f%% rested)"] = "%s/%s (%3.0f%%),升级需要:%d", - ["%s:%s/%s (%3.2f%%) Currently %s with %d to go"] = "%s:%s/%s (%3.2f%%),当前关系:%s,升级需要:%d", - ["Top"] = "上", ["Bottom"] = "下", ["XP"] = "经验", - ["Rep"] = "声望", - ["None"] = "无", } end) diff --git a/FuBar_FuXPFu/Libs/Dewdrop-2.0/Dewdrop-2.0.lua b/FuBar_FuXPFu/Libs/Dewdrop-2.0/Dewdrop-2.0.lua index 971d5f1..6649b1f 100644 --- a/FuBar_FuXPFu/Libs/Dewdrop-2.0/Dewdrop-2.0.lua +++ b/FuBar_FuXPFu/Libs/Dewdrop-2.0/Dewdrop-2.0.lua @@ -882,7 +882,7 @@ local function AcquireLevel(self, level) end frame:EnableMouse(true) frame:EnableMouseWheel(true) - local backdrop = CreateFrame("Frame", nil, frame) + local backdrop = CreateFrame("Frame", nil, frame, "BackdropTemplate") backdrop:SetAllPoints(frame) backdrop:SetBackdrop(tmp( 'bgFile', "Interface\\Tooltips\\UI-Tooltip-Background", @@ -1921,7 +1921,7 @@ end function OpenSlider(self, parent) if not sliderFrame then - sliderFrame = CreateFrame("Frame", nil, nil) + sliderFrame = CreateFrame("Frame", nil, nil, "BackdropTemplate") sliderFrame:SetWidth(100) sliderFrame:SetHeight(170) sliderFrame:SetScale(UIParent:GetScale()) @@ -1946,9 +1946,8 @@ function OpenSlider(self, parent) sliderFrame:SetBackdropColor(TOOLTIP_DEFAULT_BACKGROUND_COLOR.r, TOOLTIP_DEFAULT_BACKGROUND_COLOR.g, TOOLTIP_DEFAULT_BACKGROUND_COLOR.b) sliderFrame:EnableMouse(true) sliderFrame:EnableMouseWheel(true) - sliderFrame:Hide() sliderFrame:SetPoint("CENTER", UIParent, "CENTER") - local slider = CreateFrame("Slider", nil, sliderFrame) + local slider = CreateFrame("Slider", nil, sliderFrame, "BackdropTemplate") sliderFrame.slider = slider slider:SetOrientation("VERTICAL") slider:SetMinMaxValues(0, 1) @@ -2277,7 +2276,6 @@ function OpenSlider(self, parent) end end - sliderFrame.lastValue = parent.sliderValue local level = parent.level @@ -2344,7 +2342,7 @@ end function OpenEditBox(self, parent) if not editBoxFrame then - editBoxFrame = CreateFrame("Frame", nil, nil) + editBoxFrame = CreateFrame("Frame", nil, nil, "BackdropTemplate") editBoxFrame:SetWidth(200) editBoxFrame:SetHeight(40) editBoxFrame:SetScale(UIParent:GetScale()) diff --git a/FuBar_FuXPFu/Libs/FuBarPlugin-2.0/FuBarPlugin-2.0.lua b/FuBar_FuXPFu/Libs/FuBarPlugin-2.0/FuBarPlugin-2.0.lua index ad11fbd..c5006bc 100644 --- a/FuBar_FuXPFu/Libs/FuBarPlugin-2.0/FuBarPlugin-2.0.lua +++ b/FuBar_FuXPFu/Libs/FuBarPlugin-2.0/FuBarPlugin-2.0.lua @@ -419,16 +419,6 @@ function FuBarPlugin:RegisterTablet() end end, 'menu', self.OnMenuRequest and function(level, value, valueN_1, valueN_2, valueN_3, valueN_4) - -- if level == 1 then - -- local name = tostring(self) - -- if not name:find('^table:') then - -- name = name:gsub("|c%x%x%x%x%x%x%x%x(.-)|r", "%1") - -- Dewdrop:AddLine( - -- 'text', name, - -- 'isTitle', true - -- ) - -- end - -- end if type(self.OnMenuRequest) == "function" then self:OnMenuRequest(level, value, true, valueN_1, valueN_2, valueN_3, valueN_4) elseif type(self.OnMenuRequest) == "table" then @@ -579,6 +569,12 @@ function FuBarPlugin:Hide(check) if Dewdrop:IsOpen(self.frame) or (self.minimapFrame and Dewdrop:IsOpen(self.minimapFrame)) then Dewdrop:Close() end + + if type(self.OnHide) == "function" then + if not self:IsDisabled() then + self:OnHide() + end + end end function FuBarPlugin:SetIcon(path) @@ -1114,11 +1110,13 @@ function FuBarPlugin:OpenMenu(frame) Tablet:Close() end - if not Dewdrop:IsRegistered(self:GetFrame()) then - if type(self.OnMenuRequest) == "table" and (not self.OnMenuRequest.handler or self.OnMenuRequest.handler == self) and self.OnMenuRequest.type == "group" then - Dewdrop:InjectAceOptionsTable(self, self.OnMenuRequest) - if self.OnMenuRequest.args and CheckFuBar() and not self.independentProfile then - self.OnMenuRequest.args.profile = nil + if not Dewdrop:IsRegistered(self:GetFrame()) or self.refreshMenu then + if not self.refreshMenu then + if type(self.OnMenuRequest) == "table" and (not self.OnMenuRequest.handler or self.OnMenuRequest.handler == self) and self.OnMenuRequest.type == "group" then + Dewdrop:InjectAceOptionsTable(self, self.OnMenuRequest) + if self.OnMenuRequest.args and CheckFuBar() and not self.independentProfile then + self.OnMenuRequest.args.profile = nil + end end end @@ -1161,22 +1159,29 @@ function FuBarPlugin:OpenMenu(frame) end end, 'point', function(frame) + local pluginSide = self.panel and self.panel:GetPluginSide(self) + local x, y = frame:GetCenter() - local leftRight - if x < GetScreenWidth() / 2 then - leftRight = "LEFT" + local horizontalPosition + if (pluginSide == "CENTER") then + horizontalPosition = "" + elseif (x < GetScreenWidth() / 2) then + horizontalPosition = "LEFT" else - leftRight = "RIGHT" + horizontalPosition = "RIGHT" end if y < GetScreenHeight() / 2 then - return "BOTTOM" .. leftRight, "TOP" .. leftRight + return "BOTTOM" .. horizontalPosition, "TOP" .. horizontalPosition else - return "TOP" .. leftRight, "BOTTOM" .. leftRight + return "TOP" .. horizontalPosition, "BOTTOM" .. horizontalPosition end end, 'dontHook', true ) + + self.refreshMenu = nil end + if frame == self:GetFrame() then Dewdrop:Open(self:GetFrame()) elseif frame ~= UIParent then @@ -1217,7 +1222,7 @@ function FuBarPlugin.OnEmbedInitialize(FuBarPlugin, self) local text = frame:CreateFontString(name .. "Text", "ARTWORK") text:SetWidth(134) text:SetHeight(24) - text:SetPoint("LEFT", icon, "RIGHT", 0, 1) + text:SetPoint("LEFT", icon, "RIGHT", 0, 0) text:SetFontObject(GameFontNormal) end self.frame = frame diff --git a/FuBar_FuXPFu/Libs/Tablet-2.0/Tablet-2.0.lua b/FuBar_FuXPFu/Libs/Tablet-2.0/Tablet-2.0.lua index 510df2e..05a97d7 100644 --- a/FuBar_FuXPFu/Libs/Tablet-2.0/Tablet-2.0.lua +++ b/FuBar_FuXPFu/Libs/Tablet-2.0/Tablet-2.0.lua @@ -265,7 +265,8 @@ end}) local headerSize, normalSize if GameTooltipHeaderText then - headerSize = select(2,GameTooltipHeaderText:GetFont()) + -- headerSize = select(2,GameTooltipHeaderText:GetFont()) + headerSize = 5 else headerSize = 14 end @@ -434,7 +435,7 @@ do TabletData.SetHint = wrap(TabletData.SetHint, "TabletData:SetHint") function TabletData:SetTitle(title) - self.title = nil + self.title = title or "Title" end TabletData.SetTitle = wrap(TabletData.SetTitle, "TabletData:SetTitle") @@ -786,6 +787,7 @@ do end local fontSizePercent = category.tabletData.tablet.fontSizePercent + local w = 0 self.checkWidth = 0 testString = category.tabletData.tablet.buttons[1].col1 @@ -1160,7 +1162,8 @@ local function AcquireFrame(self, registration, data, detachedData) tooltip.data = data tooltip.detachedData = detachedData local fontSizePercent = tooltip.data and tooltip.data.fontSizePercent or 1 - local transparency = tooltip.data and tooltip.data.transparency or 0.75 + --local fontSizePercent = 1 + local transparency = tooltip.data and tooltip.data.transparency or 0.8 local r = tooltip.data and tooltip.data.r or 0 local g = tooltip.data and tooltip.data.g or 0 local b = tooltip.data and tooltip.data.b or 0 @@ -1174,7 +1177,7 @@ local function AcquireFrame(self, registration, data, detachedData) frame:SetFrameLevel(12) end else - tooltip = CreateFrame("Frame", "Tablet20Frame", UIParent) + tooltip = CreateFrame("Frame", "Tablet20Frame", UIParent, "BackdropTemplate") tooltip:SetParent(GetMainFrame()) self.tooltip = tooltip tooltip.data = data @@ -1190,10 +1193,10 @@ local function AcquireFrame(self, registration, data, detachedData) 'tileSize', 16, 'edgeSize', 16, 'insets', new( - 'left', 5, - 'right', 5, - 'top', 5, - 'bottom', 5 + 'left', 3, + 'right', 3, + 'top', 3, + 'bottom', 3 ) ) tooltip:SetBackdrop(backdrop) @@ -1253,7 +1256,7 @@ local function AcquireFrame(self, registration, data, detachedData) scrollFrame:SetPoint("BOTTOMRIGHT", -5, 5) scrollChild:SetWidth(1) scrollChild:SetHeight(1) - local slider = CreateFrame("Slider", "Tablet20FrameSlider", scrollFrame) + local slider = CreateFrame("Slider", "Tablet20FrameSlider", scrollFrame, "BackdropTemplate") tooltip.slider = slider slider:SetOrientation("VERTICAL") slider:SetMinMaxValues(0, 1) @@ -1397,7 +1400,12 @@ local function AcquireFrame(self, registration, data, detachedData) val = 0 end self.scrollFrame:SetVerticalScroll(val) - self.slider:SetValue(val / max) + -- TODO: In Dragonflight both values are 0? + if max > 0 then + self.slider:SetValue(val / max) + else + self.slider:SetValue(0) + end end tooltip.Show = wrap(tooltip.Show, "tooltip:Show") @@ -1996,7 +2004,7 @@ function AcquireDetachedFrame(self, registration, data, detachedData) if not tooltip then AcquireFrame(self, {}) end - local detached = CreateFrame("Frame", "Tablet20DetachedFrame" .. (#detachedTooltips + 1), GetMainFrame()) + local detached = CreateFrame("Frame", "Tablet20DetachedFrame" .. (#detachedTooltips + 1), GetMainFrame(), "BackdropTemplate") detachedTooltips[#detachedTooltips+1] = detached detached.notInUse = true detached:EnableMouse(not data.locked) @@ -2009,7 +2017,7 @@ function AcquireDetachedFrame(self, registration, data, detachedData) detached.fontSizePercent = 1 detached.maxLines = 0 detached.buttons = {} - detached.transparency = 0.75 + detached.transparency = 1 detached.r = 0 detached.g = 0 detached.b = 0 @@ -2021,10 +2029,10 @@ function AcquireDetachedFrame(self, registration, data, detachedData) 'tileSize', 16, 'edgeSize', 16, 'insets', tmp.b( - 'left', 5, - 'right', 5, - 'top', 5, - 'bottom', 5 + 'left', 3, + 'right', 3, + 'top', 3, + 'bottom', 3 ) )) detached.locked = detachedData.locked @@ -2045,8 +2053,8 @@ function AcquireDetachedFrame(self, registration, data, detachedData) detached:SetScript("OnDragStop", function(this) detached:StopMovingOrSizing() detached.moving = nil - detached:SetClampedToScreen(1) - detached:SetClampedToScreen(nil) + detached:SetClampedToScreen(true) + detached:SetClampedToScreen(false) local anchor local offsetx local offsety @@ -2236,7 +2244,7 @@ function AcquireDetachedFrame(self, registration, data, detachedData) scrollFrame:SetPoint("BOTTOMRIGHT", -5, 5) scrollChild:SetWidth(1) scrollChild:SetHeight(1) - local slider = CreateFrame("Slider", detached:GetName() .. "Slider", scrollFrame) + local slider = CreateFrame("Slider", detached:GetName() .. "Slider", scrollFrame, "BackdropTemplate") detached.slider = slider slider:SetOrientation("VERTICAL") slider:SetMinMaxValues(0, 1) @@ -2436,8 +2444,8 @@ function Tablet:Open(fakeParent, parent) end local offsetx = 0 local offsety = 0 - frame:SetClampedToScreen(1) - frame:SetClampedToScreen(nil) + frame:SetClampedToScreen(true) + frame:SetClampedToScreen(false) if frame:GetBottom() and frame:GetLeft() then if frame:GetRight() > GetScreenWidth() then offsetx = frame:GetRight() - GetScreenWidth() @@ -2555,16 +2563,18 @@ function Tablet:Register(parent, ...) if script then script(...) end - if self.registry[parent] and self.registry[parent].tooltip and self.registry[parent].tooltip == self.tooltip then - self.tooltip:Hide() - end + -- Prevent Tablet from closing on parent mousedown + + -- if self.registry[parent] and self.registry[parent].tooltip and self.registry[parent].tooltip == self.tooltip then + -- self.tooltip:Hide() + -- end end) end if parent:HasScript("OnMouseWheel") then local script = parent:GetScript("OnMouseWheel") - parent:SetScript("OnMouseWheel", function(...) + parent:SetScript("OnMouseWheel", function(this, arg1) if script then - script(...) + script(this, arg1) end if self.registry[parent] and self.registry[parent].tooltip then self.registry[parent].tooltip:Scroll(arg1 < 0) diff --git a/FuBar_FuXPFu/iconrest.tga b/FuBar_FuXPFu/iconrest.tga deleted file mode 100644 index 25bd712be76d6df9dd6ead0b83f1acc03c1c69ad..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3114 zcmY*bc~n&A6~6;B0}Py*VHr@i8FqnzVNn5PA3-q;%m@mCK|oOu2`Yjphzua0f@oqu zja%c=7`HZ_9$TBbG}a!?+StTujV78zjZ3S|N&AO~U+?!OJxSr*H}8G#e)o5m-*@jL zQqlkZ48;Gg`^DpkxHwb$EYr@-B-*akF^+ zlcJ2ec3Eic=ove;y#^Vzz4}`ghw6|}RI<%5>e~G=b&P^m53>vjIm_Zu8x(3kS#+U} zu^is?HFfU=Zv?H`4r<-{nur}9S7GCQbc=rUL00 z$v6c^gY@ieWHM-S9;k8SIQ8!5Ol<*mkAdu*@>Lr-iqSJPaqA2ia;ssT@-@<3%t|TqY?_j zL;F@`$IugJ8*?Hc3N$f-ZTm-X-T01zn6crE9>-ZTPUAP>i5x^2b2xw+ObNJU>2A3K0Ay2nT(DG@;(wZWp2#U;N z*cI6}D4dvpf{^l*EV$0A8CR`h)Q&CCYxkdldgKsXX3vEzB!<(H3GWl<;rGcs=+1u% z-Q}AIx%LpoKi`Jy%u;xiFGc*v_hEehE@Cg=LfnVnAmQe7==YqK-~&gFApY~G2!HP; z!moUZs81gv>e?e{mUnZ8;@N?0C{nZFVy%RF?>o?YzI_Rru@i8~ErcvM60+D-sF(w~ zbALg={TEQbb_iY@w!weX9w@jEDRZp|+;$L2w|{`?+G9-U*@=LmgYaI_FFBy8Zbj(H zKOycZ5Pb3yyw`7s-_|$bW?RhVNrpT%2lB)eC}-KAIr1($@XL$PynYNWdBt#wG;uBC zKx%)uE^dL(?>~aVwh$D|l{dt4Gvqpl^82uO==YyS$icI4;=?P|Ka`0jYCka!%7Q9{ zoc|o!7IrF}c@b#j{fUqnr$dp(4kR=AW|u;9@OSLMF_D3jTr~@vBG`B+A4I<}(1dWQ zk*JUT0j`^PoCrcjFyW(^aC&xz?^O-!5P9JST<0$5J-j9y2;);F$QPFd-_hgnf9pK! zvU3xnB?shbxsWIEaVRK(`p{W+pl=M?j$wF|RKY1>+PK^_9SNPAk+FFvrfnKS{+G{D zaPvE)kL-ksY3cb=8M4O?AY;>ZPf>7`Ntl?8oZW}f z{O}oSzxW2#pM8PazuiIIz3&jchDQRIQ5l;ARZ%&-TY6vkZQ1w8LlHN{qAFXwY~qf$ z9(XKTE%g@njM>oS&w+Y|6)HY#8g@)Qs|-$)XE2NNVb>ItL#yExb^csv`9a0UkrJ}u zmQ~Epyq;%+%3Q=2idlzGA%{hilA(+=!gEOrCcJ+1fo5^bG7oNZ&hDi(CZDctPkffG zgW6m?P6nooU_lU%NRTnp6;qg|+-u0lY~r@t zL#8ag2naFFdc~cJOso*g3NeEFsnP~zawa@171E(&6lf~y&uJGn>7@CkB1@%5P;K)_ zMAJH??|2ha21gN4u@rKX@SD53k%vhvixeVHOf89-D9ta1=7}c!5TjJm6f=O&tDGBS zKt&yFRAHXFkm+lQ0w!xv*Z2A>74=z>p6 zFVyvGz!ZQxJL5Wg9y^rAePTLf;had7FSmw7sep>f+`y8#i!v>=^{b#=wi-SwI}kFs z9m!({KApZ}&zMhb^Pr+=fk_J4@x2gQ-|BF{mjVs*-HXbP>)QLj(H}bV&!7Xp`j2nl zF#HC#Ga);mvd)FNgxQo~hQi+fRbCOisvF^1SqF`^0^W5^Fzh{y&?6_Gg&aQq&~W&~ z1K;j}4vx}C!jg$#MbOe`o-cX%dbpKTd3ratN2&_vb$Tvc`M$1a2)eF8OxV5`!N0zM zpm#1nfBHRyo&5k27ypWg%Qp~l={kb;o`B!_P4H`33tfHFZm*gpnZbJxh5C++su{pZ z`b3pJ!N@HoQzkvSI{O9GsOME()Y-Q%&H6EM7dv}}$H;|RV!rwT_Lw{0LlJZP xUof1y$US@nx`t+GEVhkoRwsS$N+13r4DnYwXKvoSf|7#bqPX(>g2KFb`Y&h^x6c3o