diff --git a/BagSync.lua b/BagSync.lua index 91595fd..16c97b8 100644 --- a/BagSync.lua +++ b/BagSync.lua @@ -200,7 +200,8 @@ function BSYC:StartupDB() if self.options.enableRealmShortName == nil then self.options.enableRealmShortName = false end if self.options.enableLoginVersionInfo == nil then self.options.enableLoginVersionInfo = true end if self.options.enableFactionIcons == nil then self.options.enableFactionIcons = true end - + if self.options.enableShowUniqueItemsTotals == nil then self.options.enableShowUniqueItemsTotals = true end + --setup the default colors if self.options.colors == nil then self.options.colors = {} end if self.options.colors.first == nil then self.options.colors.first = { r = 128/255, g = 1, b = 0 } end @@ -453,6 +454,7 @@ end function BSYC:GetRealmTags(srcName, srcRealm, isGuild) + local tagName = srcName local fullRealmName = srcRealm --default to shortened realm first 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 @@ -464,7 +466,7 @@ function BSYC:GetRealmTags(srcName, srcRealm, isGuild) --put a green check next to the currently logged in character name, make sure to put it as current realm only. You can have toons with same name on multiple realms if srcName == self.currentPlayer and srcRealm == self.currentRealm and self.options.enableTooltipGreenCheck then - srcName = srcName.." "..ReadyCheck + tagName = tagName.." "..ReadyCheck end else --sometimes a person has characters on multiple connected servers joined to the same guild. @@ -489,7 +491,7 @@ function BSYC:GetRealmTags(srcName, srcRealm, isGuild) FactionIcon = [[|TInterface\Icons\Inv_misc_tournaments_banner_orc:18|t]] end - srcName = FactionIcon.." "..srcName + tagName = FactionIcon.." "..tagName end --add Cross-Realm and BNet identifiers to Characters not on same realm @@ -510,18 +512,18 @@ function BSYC:GetRealmTags(srcName, srcRealm, isGuild) if self.options.enableBNetAccountItems then if srcRealm and srcRealm ~= self.currentRealm then if not self.crossRealmNames[srcRealm] then - srcName = srcName.." "..rgbhex(self.options.colors.bnet).."["..bnetString..fullRealmName.."]|r" + tagName = tagName.." "..rgbhex(self.options.colors.bnet).."["..bnetString..fullRealmName.."]|r" else - srcName = srcName.." "..rgbhex(self.options.colors.cross).."["..crossString..fullRealmName.."]|r" + tagName = tagName.." "..rgbhex(self.options.colors.cross).."["..crossString..fullRealmName.."]|r" end end elseif self.options.enableCrossRealmsItems then if srcRealm and srcRealm ~= self.currentRealm then - srcName = srcName.." "..rgbhex(self.options.colors.cross).."["..crossString..fullRealmName.."]|r" + tagName = tagName.." "..rgbhex(self.options.colors.cross).."["..crossString..fullRealmName.."]|r" end end - return srcName + return tagName end ---------------------- @@ -1002,6 +1004,9 @@ function BSYC:AddItemToTooltip(frame, link) --workaround --use our stripped itemlink, not the full link local shortItemID = ToShortItemID(itemLink) + --short the shortID and ignore all BonusID's and stats + if self.options.enableShowUniqueItemsTotals then itemLink = shortItemID end + --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() @@ -1085,6 +1090,7 @@ function BSYC:AddItemToTooltip(frame, link) --workaround if type(bagInfo) == "table" then for slotID, itemValue in pairs(bagInfo) do local dblink, dbcount = strsplit(",", itemValue) + if dblink and self.options.enableShowUniqueItemsTotals then dblink = ToShortItemID(dblink) end if dblink and dblink == itemLink then allowList[q] = allowList[q] + (dbcount or 1) grandTotal = grandTotal + (dbcount or 1) @@ -1119,6 +1125,7 @@ function BSYC:AddItemToTooltip(frame, link) --workaround local tmpCount = 0 for q, r in pairs(self.db.guild[v.realm][guildN]) do local dblink, dbcount = strsplit(",", r) + if dblink and self.options.enableShowUniqueItemsTotals then dblink = ToShortItemID(dblink) end if dblink and dblink == itemLink then --if we have show guild names then don't show any guild info for the character, otherwise it gets repeated twice if not self.options.showGuildNames then diff --git a/BagSync.toc b/BagSync.toc index ee4bc67..73f2199 100644 --- a/BagSync.toc +++ b/BagSync.toc @@ -2,7 +2,7 @@ ## Title: BagSync ## Notes: BagSync tracks your characters items and displays it within tooltips. ## Author: Xruptor -## Version: 11.0 +## Version: 11.1 ## OptionalDeps: tekDebug ## SavedVariables: BagSyncDB, BagSyncOpt, BagSyncGUILD_DB, BagSyncCURRENCY_DB, BagSyncPROFESSION_DB, BagSyncBLACKLIST_DB, BagSync_REALMKEY diff --git a/libs/AceGUI-3.0/widgets/AceGUIContainer-ScrollFrame.lua b/libs/AceGUI-3.0/widgets/AceGUIContainer-ScrollFrame.lua index a95579d..52769c2 100644 --- a/libs/AceGUI-3.0/widgets/AceGUIContainer-ScrollFrame.lua +++ b/libs/AceGUI-3.0/widgets/AceGUIContainer-ScrollFrame.lua @@ -2,7 +2,7 @@ ScrollFrame Container Plain container that scrolls its content and doesn't grow in height. -------------------------------------------------------------------------------]] -local Type, Version = "ScrollFrame", 25 +local Type, Version = "ScrollFrame", 26 local AceGUI = LibStub and LibStub("AceGUI-3.0", true) if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end @@ -53,7 +53,7 @@ local methods = { self.scrollframe:SetPoint("BOTTOMRIGHT") self.scrollbar:Hide() self.scrollBarShown = nil - self.content.height, self.content.width = nil, nil + self.content.height, self.content.width, self.content.original_width = nil, nil, nil end, ["SetScroll"] = function(self, value) @@ -103,6 +103,9 @@ local methods = { self.scrollbar:Hide() self.scrollbar:SetValue(0) self.scrollframe:SetPoint("BOTTOMRIGHT") + if self.content.original_width then + self.content.width = self.content.original_width + end self:DoLayout() end else @@ -110,6 +113,9 @@ local methods = { self.scrollBarShown = true self.scrollbar:Show() self.scrollframe:SetPoint("BOTTOMRIGHT", -20, 0) + if self.content.original_width then + self.content.width = self.content.original_width - 20 + end self:DoLayout() end local value = (offset / (viewheight - height) * 1000) @@ -146,7 +152,8 @@ local methods = { ["OnWidthSet"] = function(self, width) local content = self.content - content.width = width + content.width = width - (self.scrollBarShown and 20 or 0) + content.original_width = width end, ["OnHeightSet"] = function(self, height) diff --git a/libs/AceGUI-3.0/widgets/AceGUIWidget-CheckBox.lua b/libs/AceGUI-3.0/widgets/AceGUIWidget-CheckBox.lua index e34debf..41884c1 100644 --- a/libs/AceGUI-3.0/widgets/AceGUIWidget-CheckBox.lua +++ b/libs/AceGUI-3.0/widgets/AceGUIWidget-CheckBox.lua @@ -1,7 +1,7 @@ --[[----------------------------------------------------------------------------- Checkbox Widget -------------------------------------------------------------------------------]] -local Type, Version = "CheckBox", 25 +local Type, Version = "CheckBox", 26 local AceGUI = LibStub and LibStub("AceGUI-3.0", true) if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end @@ -91,7 +91,7 @@ local methods = { if self.desc then self.desc:SetWidth(width - 30) if self.desc:GetText() and self.desc:GetText() ~= "" then - self:SetHeight(28 + self.desc:GetHeight()) + self:SetHeight(28 + self.desc:GetStringHeight()) end end end, @@ -211,7 +211,7 @@ local methods = { self.desc:Show() --self.text:SetFontObject(GameFontNormal) self.desc:SetText(desc) - self:SetHeight(28 + self.desc:GetHeight()) + self:SetHeight(28 + self.desc:GetStringHeight()) else if self.desc then self.desc:SetText("") diff --git a/libs/AceGUI-3.0/widgets/AceGUIWidget-Label.lua b/libs/AceGUI-3.0/widgets/AceGUIWidget-Label.lua index 75817a0..7a754f6 100644 --- a/libs/AceGUI-3.0/widgets/AceGUIWidget-Label.lua +++ b/libs/AceGUI-3.0/widgets/AceGUIWidget-Label.lua @@ -2,7 +2,7 @@ Label Widget Displays text and optionally an icon. -------------------------------------------------------------------------------]] -local Type, Version = "Label", 24 +local Type, Version = "Label", 26 local AceGUI = LibStub and LibStub("AceGUI-3.0", true) if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end @@ -39,23 +39,28 @@ local function UpdateImageAnchor(self) label:SetPoint("TOP", image, "BOTTOM") label:SetPoint("LEFT") label:SetWidth(width) - height = image:GetHeight() + label:GetHeight() + height = image:GetHeight() + label:GetStringHeight() else -- image on the left image:SetPoint("TOPLEFT") - if image:GetHeight() > label:GetHeight() then + if image:GetHeight() > label:GetStringHeight() then label:SetPoint("LEFT", image, "RIGHT", 4, 0) else label:SetPoint("TOPLEFT", image, "TOPRIGHT", 4, 0) end label:SetWidth(width - imagewidth - 4) - height = max(image:GetHeight(), label:GetHeight()) + height = max(image:GetHeight(), label:GetStringHeight()) end else -- no image shown label:SetPoint("TOPLEFT") label:SetWidth(width) - height = label:GetHeight() + height = label:GetStringHeight() + end + + -- avoid zero-height labels, since they can used as spacers + if not height or height == 0 then + height = 1 end self.resizing = true diff --git a/locale/enUS.lua b/locale/enUS.lua index bb1194a..b30b71a 100644 --- a/locale/enUS.lua +++ b/locale/enUS.lua @@ -2,6 +2,10 @@ local L = LibStub("AceLocale-3.0"):NewLocale("BagSync", "enUS", true) if not L then return end +--Get the best possible font for the localization langugage. +--Some fonts are better than others to display special character sets. +L.GetFontType = "Fonts\\FRIZQT__.TTF" + L.TooltipBag = "Bags:" L.TooltipBank = "Bank:" L.TooltipEquip = "Equip:" @@ -53,6 +57,7 @@ L.KeybindGold = "Show Gold tooltip." L.KeybindProfessions = "Show Professions window." L.KeybindProfiles = "Show Profiles window." L.KeybindSearch = "Show Search window." +L.ObsoleteWarning = "\n\nNote: Obsolete items will continue to show as missing. To repair this issue, scan your characters again in order to remove obsolete items.\n(Bags, Bank, Reagent, Void, etc...)" -- ----THESE ARE FOR SLASH COMMANDS L.SlashItemName = "[itemname]" L.SlashSearch = "search" @@ -93,6 +98,10 @@ L.DisplayRealmIDTags = "Display |cffff7d0a[XR]|r and |cff3587ff[BNet]|r realm id L.DisplayRealmAstrick = "Display [*] instead of server names for |cffff7d0a[XR]|r and |cff3587ff[BNet]|r." L.DisplayShortRealmName = "Display short realm names for |cffff7d0a[XR]|r and |cff3587ff[BNet]|r." L.DisplayFactionIcons = "Display faction icons in tooltip." +L.DisplayShowUniqueItemsTotals = "Enabling this option will add unique items towards the total item count, regardless of item stats. |cFF99CC33(Recommended)|r." +L.DisplayShowUniqueItemsTotals_2 = "Certain items like |cffff7d0a[Legendaries]|r can share the same name but have different stats. Since these items are treated as independent from each other, they are sometimes not counted towards the total item count. Enabling this option will completely disregard the unique item stats and treat them all the same, so long as they share the same item name.\n\nDisabling this option will display the item counts independently. Item totals will only display for each character that share the same unique item with the exact same stats. |cFFDF2B2B(Not Recommended)|r" +L.DisplayShowUniqueItemsTotalsTitle = "Show Unique Item Tooltip Totals" +L.DisplayShowUniqueItemsEnableText = "Enable unique item totals." L.ColorPrimary = "Primary BagSync tooltip color." L.ColorSecondary = "Secondary BagSync tooltip color." L.ColorTotal = "BagSync [Total] tooltip color." diff --git a/locale/ruRU.lua b/locale/ruRU.lua index 1d3e4f5..1f4b8f1 100644 --- a/locale/ruRU.lua +++ b/locale/ruRU.lua @@ -6,6 +6,10 @@ if not L then return end --special thanks to senryo +--Get the best possible font for the localization langugage. +--Some fonts are better than others to display special character sets. +L.GetFontType = "Fonts\\ARIALN.TTF" + L.TooltipBag = "В сумке:" L.TooltipBank = "В банке:" L.TooltipEquip = "На персонаже:" diff --git a/modules/blacklist.lua b/modules/blacklist.lua index 93f80f7..4bb2dc8 100644 --- a/modules/blacklist.lua +++ b/modules/blacklist.lua @@ -122,7 +122,7 @@ function Blacklist:AddEntry(entry) local label = AceGUI:Create("InteractiveLabel") label:SetText(entry) - label:SetFont(BSYC:GetFontType(), 14, THICKOUTLINE) + label:SetFont(L.GetFontType, 14, THICKOUTLINE) label:SetFullWidth(true) label:SetColor( r, g, b) label:SetCallback( diff --git a/modules/config.lua b/modules/config.lua index f284d55..2495243 100644 --- a/modules/config.lua +++ b/modules/config.lua @@ -341,6 +341,35 @@ options.args.display = { set = set, arg = "display.enableFactionIcons", }, + showuniqueitemsgroup = { + order = 17, + name = L.DisplayShowUniqueItemsTotalsTitle, + type = 'group', + guiInline = true, + args = { + title = { + order = 0, + type = "description", + name = L.DisplayShowUniqueItemsTotals, + }, + title_2 = { + order = 1, + type = "description", + name = L.DisplayShowUniqueItemsTotals_2, + }, + showuniqueitems = { + order = 2, + type = 'toggle', + name = L.DisplayShowUniqueItemsEnableText, + width = "full", + desc = "hide", + get = get, + set = set, + arg = "display.enableShowUniqueItemsTotals", + } + } + } + }, } diff --git a/modules/currency.lua b/modules/currency.lua index ff8deef..68b9b59 100644 --- a/modules/currency.lua +++ b/modules/currency.lua @@ -44,7 +44,7 @@ function Currency:AddEntry(entry, isHeader) if isHeader then label:SetText(entry.header) - label:SetFont(BSYC:GetFontType(), 14, THICKOUTLINE) + label:SetFont(L.GetFontType, 14, THICKOUTLINE) label:SetFullWidth(true) label:SetColor(unpack(label.userdata.color)) label:ApplyJustifyH("CENTER") @@ -53,7 +53,7 @@ function Currency:AddEntry(entry, isHeader) label:ToggleHeaderHighlight(true) else label:SetText(entry.name) - label:SetFont(BSYC:GetFontType(), 14, THICKOUTLINE) + label:SetFont(L.GetFontType, 14, THICKOUTLINE) label:SetFullWidth(true) label.userdata.color = {64/255, 224/255, 208/255} label:SetColor(unpack(label.userdata.color)) diff --git a/modules/professions.lua b/modules/professions.lua index bfb5a84..4d2940b 100644 --- a/modules/professions.lua +++ b/modules/professions.lua @@ -19,7 +19,7 @@ function Professions:OnEnable() local information = AceGUI:Create("Label") information:SetText(L.ProfessionInformation) - information:SetFont(BSYC:GetFontType(), 12, THICKOUTLINE) + information:SetFont(L.GetFontType, 12, THICKOUTLINE) information:SetColor(1, 165/255, 0) information:SetFullWidth(true) ProfessionsFrame:AddChild(information) @@ -50,7 +50,7 @@ function Professions:AddEntry(entry, isHeader) if isHeader then label:SetText(entry.player) - label:SetFont(BSYC:GetFontType(), 14, THICKOUTLINE) + label:SetFont(L.GetFontType, 14, THICKOUTLINE) label:SetFullWidth(true) label:SetColor(unpack(label.userdata.color)) label:ApplyJustifyH("CENTER") @@ -60,7 +60,7 @@ function Professions:AddEntry(entry, isHeader) else local labelText = entry.name..format(" |cFFFFFFFF(%s)|r", entry.level) label:SetText(labelText) - label:SetFont(BSYC:GetFontType(), 14, THICKOUTLINE) + label:SetFont(L.GetFontType, 14, THICKOUTLINE) label:SetFullWidth(true) if entry.recipes then label.userdata.color = {153/255,204/255,51/255} --primary profession color it green diff --git a/modules/profiles.lua b/modules/profiles.lua index 3c7d371..576cee8 100644 --- a/modules/profiles.lua +++ b/modules/profiles.lua @@ -31,7 +31,7 @@ function Profiles:OnEnable() --I wish Ace3 had better methods for modifying the alignment of widgets on a container.... --list has to be in order for editing, warning, ddlist, deletebutton, confirmbutton, etc.. warning:SetText(L.DeleteWarning) - warning:SetFont(BSYC:GetFontType(), 14, THICKOUTLINE) + warning:SetFont(L.GetFontType, 14, THICKOUTLINE) warning:ClearAllPoints() warning:SetPoint( "CENTER", ProfilesFrame.frame, "CENTER", 10, 55) diff --git a/modules/recipes.lua b/modules/recipes.lua index 8379fd5..9f00a6c 100644 --- a/modules/recipes.lua +++ b/modules/recipes.lua @@ -17,7 +17,7 @@ function Recipes:OnEnable() RecipesFrame:EnableResize(false) local information = AceGUI:Create("BagSyncInteractiveLabel") - information:SetFont(BSYC:GetFontType(), 14, THICKOUTLINE) + information:SetFont(L.GetFontType, 14, THICKOUTLINE) information:SetColor(153/255,204/255,51/255) information:SetFullWidth(true) information:ApplyJustifyH("CENTER") @@ -26,7 +26,7 @@ function Recipes:OnEnable() Recipes.information = information local label = AceGUI:Create("BagSyncInteractiveLabel") - label:SetFont(BSYC:GetFontType(), 14, THICKOUTLINE) + label:SetFont(L.GetFontType, 14, THICKOUTLINE) label:SetFullWidth(true) label:SetText(" ") --add an empty space just to show the label label:SetHeaderHighlight("Interface\\QuestFrame\\UI-QuestTitleHighlight") @@ -57,7 +57,7 @@ function Recipes:AddEntry(entry) local label = AceGUI:Create("InteractiveLabel") label:SetText(name) - label:SetFont(BSYC:GetFontType(), 14, THICKOUTLINE) + label:SetFont(L.GetFontType, 14, THICKOUTLINE) label:SetFullWidth(true) label:SetColor(unpack(color)) label:SetImage(icon) diff --git a/modules/search.lua b/modules/search.lua index 1aa7dab..5a774e9 100644 --- a/modules/search.lua +++ b/modules/search.lua @@ -53,18 +53,25 @@ function Search:OnEnable() local warningframe = AceGUI:Create("Window") warningframe:SetTitle(L.WarningHeader) warningframe:SetWidth(300) - warningframe:SetHeight(170) + warningframe:SetHeight(280) warningframe.frame:SetParent(SearchFrame.frame) warningframe:SetLayout("Flow") warningframe:EnableResize(false) local warninglabel = AceGUI:Create("Label") warninglabel:SetText(L.WarningItemSearch) - warninglabel:SetFont(BSYC:GetFontType(), 14, THICKOUTLINE) + warninglabel:SetFont(L.GetFontType, 14, THICKOUTLINE) warninglabel:SetColor(1, 165/255, 0) --orange, red is just too much sometimes warninglabel:SetFullWidth(true) warningframe:AddChild(warninglabel) + local warninglabel2 = AceGUI:Create("Label") + warninglabel2:SetText(L.ObsoleteWarning) + warninglabel2:SetFont(L.GetFontType, 14, THICKOUTLINE) + warninglabel2:SetColor(50/255, 165/255, 0) + warninglabel2:SetFullWidth(true) + warningframe:AddChild(warninglabel2) + Search.warningframe = warningframe Search.warninglabel = warninglabel @@ -98,7 +105,7 @@ function Search:AddEntry(entry) local r, g, b, hex = GetItemQualityColor(rarity) label:SetText(name) - label:SetFont(BSYC:GetFontType(), 14, THICKOUTLINE) + label:SetFont(L.GetFontType, 14, THICKOUTLINE) label:SetFullWidth(true) label:SetColor( r, g, b) label:SetImage(texture) @@ -128,7 +135,6 @@ end function Search:DoSearch(searchStr) local searchStr = searchStr or self.searchbar:GetText() searchStr = searchStr:lower() --always make sure everything is lowercase when doing searches - self.searchbar:SetText() --erase current text local searchTable = {} local tempList = {}