From 965767439b61f30a71f9c26a4819c3e1f38cc5db Mon Sep 17 00:00:00 2001 From: Xruptor Date: Mon, 19 Sep 2016 16:38:57 -0400 Subject: [PATCH] Some fixes and a new feature. -Fixed an issue where the Currency Window wasn't displaying the class colors. -Added a new feature to display a green checkmark next to the currently logged in characters name. -Initial implementation of dynamic gold tooltip. --- BagSync.lua | 44 ++++++++++++++++++++++++++++++++++---------- locale/enUS.lua | 1 + modules/config.lua | 11 +++++++++++ 3 files changed, 46 insertions(+), 10 deletions(-) diff --git a/BagSync.lua b/BagSync.lua index bf911fb..bedcbd2 100644 --- a/BagSync.lua +++ b/BagSync.lua @@ -186,6 +186,7 @@ function BSYC:StartupDB() if self.options.enableCrossRealmsItems == nil then self.options.enableCrossRealmsItems = true end if self.options.enableBNetAccountItems == nil then self.options.enableBNetAccountItems = false end if self.options.enableTooltipItemID == nil then self.options.enableTooltipItemID = false end + if self.options.enableTooltipGreenCheck == nil then self.options.enableTooltipGreenCheck = true end --setup the default colors if self.options.colors == nil then self.options.colors = {} end @@ -435,6 +436,14 @@ function BSYC:GetRealmTags(srcName, srcRealm, isGuild) if not isGuild then local yName, yRealm = strsplit("^", srcName) srcName = yName + + local ReadyCheck = [[|TInterface\RaidFrame\ReadyCheck-Ready:0|t]] + --local NotReadyCheck = [[|TInterface\RaidFrame\ReadyCheck-NotReady:0|t]] + + --put a green check next to the currently logged in character name + if yName == self.currentPlayer and self.options.enableTooltipGreenCheck then + srcName = srcName.." "..ReadyCheck + end end if self.db.realmkey[srcRealm] then fullRealmName = self.db.realmkey[srcRealm] end --second, if we have a realmkey with a true realm name then use it @@ -704,7 +713,7 @@ function BSYC:CreateMoneyString(money, color) return moneystring end -function BSYC:ShowMoneyTooltip() +function BSYC:ShowMoneyTooltip(objTooltip) local tooltip = _G["BagSyncMoneyTooltip"] or nil if (not tooltip) then @@ -732,10 +741,16 @@ function BSYC:ShowMoneyTooltip() local usrData = {} - tooltip:SetOwner(UIParent, "ANCHOR_NONE") tooltip:ClearLines() tooltip:ClearAllPoints() - tooltip:SetPoint("CENTER",UIParent,"CENTER",0,0) + + if objTooltip then + tooltip:SetOwner(objTooltip, "ANCHOR_NONE") + tooltip:SetPoint("CENTER",objTooltip,"CENTER",0,0) + else + tooltip:SetOwner(UIParent, "ANCHOR_NONE") + tooltip:SetPoint("CENTER",UIParent,"CENTER",0,0) + end tooltip:AddLine("BagSync") tooltip:AddLine(" ") @@ -766,6 +781,19 @@ function BSYC:ShowMoneyTooltip() tooltip:Show() end +function BSYC:HideMoneyTooltip() + local tooltip = _G["BagSyncMoneyTooltip"] or nil + if tooltip then + tooltip:Hide() + end +end + +--hooksecurefunc("SmallMoneyFrame_OnLoad", function(tooltip) BSYC:Debug(1, tooltip:GetName()) end) +--hooksecurefunc("MoneyFrame_OnEnter", function(tooltip) BSYC:Debug(2, tooltip:GetName()) end) +--hooksecurefunc("MoneyFrame_OnLeave", function(tooltip)BSYC:Debug(3, tooltip:GetName()) end) +--hooksecurefunc("MoneyFrame_UpdateMoney", function(tooltip)BSYC:Debug(3, tooltip:GetName()) end) +--hooksecurefunc("MoneyFrame_Update", function(tooltip)BSYC:Debug(4, tooltip) end) + ------------------------ -- Currency -- ------------------------ @@ -877,6 +905,8 @@ function BSYC:AddCurrencyTooltip(frame, currencyName, addHeader) for k, v in pairs(xDB) do local yName, yRealm = strsplit("^", k) local playerName = BSYC:GetRealmTags(yName, yRealm) + + playerName = self:GetClassColor(playerName or "Unknown", self.db.global[yRealm][yName].class) for q, r in pairs(v) do if q == currencyName then @@ -901,7 +931,6 @@ function BSYC:AddCurrencyTooltip(frame, currencyName, addHeader) end end - frame:Show() end function BSYC:AddItemToTooltip(frame, link) --workaround @@ -910,7 +939,6 @@ function BSYC:AddItemToTooltip(frame, link) --workaround --if we can't convert the item link then lets just ignore it altogether local itemLink = ParseItemLink(link) if not itemLink then - frame:Show() return end @@ -919,7 +947,6 @@ function BSYC:AddItemToTooltip(frame, link) --workaround --only show tooltips in search frame if the option is enabled if self.options.tooltipOnlySearch and frame:GetOwner() and frame:GetOwner():GetName() and string.sub(frame:GetOwner():GetName(), 1, 16) ~= "BagSyncSearchRow" then - frame:Show() return end @@ -933,7 +960,6 @@ function BSYC:AddItemToTooltip(frame, link) --workaround --ignore the hearthstone and blacklisted items if shortItemID and tonumber(shortItemID) then if permIgnore[tonumber(shortItemID)] or self.db.blacklist[self.currentRealm][tonumber(shortItemID)] then - frame:Show() return end end @@ -952,7 +978,6 @@ function BSYC:AddItemToTooltip(frame, link) --workaround end end end - frame:Show() return end @@ -1092,8 +1117,7 @@ function BSYC:AddItemToTooltip(frame, link) --workaround end end end - - frame:Show() + end function BSYC:HookTooltip(tooltip) diff --git a/locale/enUS.lua b/locale/enUS.lua index e9f812f..abe2983 100644 --- a/locale/enUS.lua +++ b/locale/enUS.lua @@ -87,6 +87,7 @@ L.DisplayLineSeperator = "Display empty line seperator." L.DisplayCrossRealm = "Display Cross-Realms characters." L.DisplayBNET = "Display Battle.Net Account characters |cFFDF2B2B(Not Recommended)|r." L.DisplayItemID = "Display ItemID in tooltip." +L.DisplayGreenCheck = "Display %s next to current character name." L.ColorPrimary = "Primary BagSync tooltip color." L.ColorSecondary = "Secondary BagSync tooltip color." L.ColorTotal = "BagSync [Total] tooltip color." diff --git a/modules/config.lua b/modules/config.lua index 1469a60..b415df3 100644 --- a/modules/config.lua +++ b/modules/config.lua @@ -4,6 +4,7 @@ local config = LibStub("AceConfig-3.0") local configDialog = LibStub("AceConfigDialog-3.0") local options = {} +local ReadyCheck = [[|TInterface\RaidFrame\ReadyCheck-Ready:0|t]] options.type = "group" options.name = "BagSync" @@ -276,6 +277,16 @@ options.args.display = { set = set, arg = "display.enableTooltipItemID", }, + greencheck = { + order = 12, + type = "toggle", + name = string.format(L.DisplayGreenCheck, ReadyCheck), + width = "full", + descStyle = "hide", + get = get, + set = set, + arg = "display.enableTooltipGreenCheck", + }, }, } -- 1.7.9.5