diff --git a/CaerdonWardrobe.lua b/CaerdonWardrobe.lua index 661b27e..942f5c0 100644 --- a/CaerdonWardrobe.lua +++ b/CaerdonWardrobe.lua @@ -145,9 +145,54 @@ function CaerdonWardrobeMixin:SetItemButtonMogStatusFilter(originalButton, isFil end end +function CaerdonWardrobeMixin:SetupCaerdonButton(originalButton, item, feature, locationInfo, options) + local button = originalButton.caerdonButton + if not button then + button = CreateFrame("Frame", nil, originalButton) + button.searchOverlay = originalButton.searchOverlay + originalButton.caerdonButton = button + end + + if not button.mogStatus then + mogStatusBackground = button:CreateTexture(nil, "ARTWORK", nil, 1) + mogStatus = button:CreateTexture(nil, "ARTWORK", nil, 2) + mogStatus.mogStatusBackground = mogStatusBackground + button.mogStatus = mogStatus + end + + if not button.bindsOnText then + button.bindsOnText = button:CreateFontString(nil, "ARTWORK", "SystemFont_Outline_Small") -- TODO: Note: placing directly on button to enable search fade - need to check on other addons + end + +end + function CaerdonWardrobeMixin:SetItemButtonStatus(originalButton, item, feature, locationInfo, options, status, bindingStatus) local button = originalButton.caerdonButton + -- Make sure it's sitting in front of the frame it's going to overlay + local levelCheckFrame = originalButton + if options and options.relativeFrame then + if options.relativeFrame:GetObjectType() == "Texture" then + levelCheckFrame = options.relativeFrame:GetParent() + else + levelCheckFrame = options.relativeFrame + end + end + + if levelCheckFrame then + button:SetFrameStrata(levelCheckFrame:GetFrameStrata()) + button:SetFrameLevel(levelCheckFrame:GetFrameLevel() + 1) + end + + button:ClearAllPoints() + button:SetSize(0,0) + + if options and options.relativeFrame then + button:SetAllPoints(options.relativeFrame) + else + button:SetAllPoints(originalButton) + end + -- Had some addons messing with frame level resulting in this getting covered by the parent button. -- Haven't seen any negative issues with bumping it up, yet, but keep an eye on it if -- the status icon overlaps something it shouldn't. @@ -172,6 +217,17 @@ function CaerdonWardrobeMixin:SetItemButtonStatus(originalButton, item, feature, end end + -- local mogFlash = button.mogFlash + -- if not mogFlash then + -- mogFlash = button:CreateTexture(nil, "OVERLAY") + -- mogFlash:SetAlpha(0) + -- mogFlash:SetBlendMode("ADD") + -- mogFlash:SetAtlas("bags-glow-flash", true) + -- mogFlash:SetPoint("CENTER") + + -- button.mogFlash = mogFlash + -- end + local showAnim = false if status == "waiting" then showAnim = true @@ -440,7 +496,7 @@ function CaerdonWardrobeMixin:SetItemButtonStatus(originalButton, item, feature, mogStatus:SetTexCoord(-1/32, 33/32, -1/32, 33/32) mogStatus:SetTexture("Interface\\MINIMAP\\MapQuestHub_Icon32") elseif status == "collected" then - if IsGearSetStatus(bindingStatus, item) and (CaerdonWardrobeConfig.Binding.ShowGearSetsAsIcon or options.forceGearSetsAsIcon) then + if IsGearSetStatus(bindingStatus, item) and CaerdonWardrobeConfig.Binding.ShowGearSetsAsIcon then mogStatus:SetTexCoord(16/64, 48/64, 16/64, 48/64) mogStatus:SetTexture("Interface\\Store\\category-icon-clothes") end @@ -454,7 +510,7 @@ function CaerdonWardrobeMixin:SetItemButtonStatus(originalButton, item, feature, alpha = 0.5 mogStatus:SetTexCoord(16/64, 48/64, 16/64, 48/64) mogStatus:SetTexture("Interface\\Common\\StreamCircle") - -- elseif IsGearSetStatus(bindingStatus, item) and (CaerdonWardrobeConfig.Binding.ShowGearSetsAsIcon or options.forceGearSetsAsIcon) then + -- elseif IsGearSetStatus(bindingStatus, item) and CaerdonWardrobeConfig.Binding.ShowGearSetsAsIcon then -- mogStatus:SetTexCoord(16/64, 48/64, 16/64, 48/64) -- mogStatus:SetTexture("Interface\\Store\\category-icon-clothes") end @@ -526,14 +582,9 @@ function CaerdonWardrobeMixin:SetItemButtonBindType(button, item, feature, locat return end - if not bindsOnText then - bindsOnText = button:CreateFontString(nil, "ARTWORK", "SystemFont_Outline_Small") -- TODO: Note: placing directly on button to enable search fade - need to check on other addons - caerdonButton.bindsOnText = bindsOnText - end - local bindingText = "" if IsGearSetStatus(bindingStatus, item) then -- is gear set - if (CaerdonWardrobeConfig.Binding.ShowGearSets and not options.forceGearSetsAsIcon) then + if CaerdonWardrobeConfig.Binding.ShowGearSets then bindingText = "|cFFFFFFFF" .. bindingStatus .. "|r" end else @@ -570,55 +621,53 @@ function CaerdonWardrobeMixin:SetItemButtonBindType(button, item, feature, locat bindsOnText:SetText(bindingText) - if not options.fixedBindingPosition then - -- Measure text and resize accordingly - bindsOnText:ClearAllPoints() - bindsOnText:SetSize(0,0) - bindsOnText:SetPoint("LEFT") - bindsOnText:SetPoint("RIGHT") + -- Measure text and resize accordingly + bindsOnText:ClearAllPoints() + bindsOnText:SetSize(0,0) + bindsOnText:SetPoint("LEFT") + bindsOnText:SetPoint("RIGHT") - local newWidth = bindsOnText:GetStringWidth() - if newWidth > button:GetWidth() then - newWidth = button:GetWidth() - end - local newHeight = bindsOnText:GetHeight() - - bindsOnText:ClearAllPoints() - bindsOnText:SetSize(newWidth, newHeight) - - local bindingScale = options.bindingScale or 1 - local bindingPosition = options.overrideBindingPosition or CaerdonWardrobeConfig.Binding.Position - local xOffset = 1 - if options.bindingOffsetX ~= nil then - xOffset = options.bindingOffsetX - end + local newWidth = bindsOnText:GetStringWidth() + if newWidth > button:GetWidth() then + newWidth = button:GetWidth() + end + local newHeight = bindsOnText:GetHeight() - local yOffset = 2 - if options.bindingOffsetY ~= nil then - yOffset = options.bindingOffsetY - end + bindsOnText:ClearAllPoints() + bindsOnText:SetSize(newWidth, newHeight) - local hasCount = (button.count and button.count > 1) or options.hasCount - - if string.find(bindingPosition, "BOTTOM") then - if hasCount then - yOffset = options.itemCountOffset or 15 - end - end + local bindingScale = options.bindingScale or 1 + local bindingPosition = options.overrideBindingPosition or CaerdonWardrobeConfig.Binding.Position + local xOffset = 1 + if options.bindingOffsetX ~= nil then + xOffset = options.bindingOffsetX + end - if string.find(bindingPosition, "TOP") then - yOffset = yOffset * -1 - end + local yOffset = 2 + if options.bindingOffsetY ~= nil then + yOffset = options.bindingOffsetY + end - if string.find(bindingPosition, "RIGHT") then - xOffset = xOffset * -1 + local hasCount = (button.count and button.count > 1) or options.hasCount + + if string.find(bindingPosition, "BOTTOM") then + if hasCount then + yOffset = options.itemCountOffset or 15 end + end - if options and options.relativeFrame then - bindsOnText:SetAllPoints(options.relativeFrame, xOffset, yOffset) - else - bindsOnText:SetPoint(bindingPosition, xOffset, yOffset) - end + if string.find(bindingPosition, "TOP") then + yOffset = yOffset * -1 + end + + if string.find(bindingPosition, "RIGHT") then + xOffset = xOffset * -1 + end + + if options and options.relativeFrame then + bindsOnText:SetAllPoints(options.relativeFrame, xOffset, yOffset) + else + bindsOnText:SetPoint(bindingPosition, xOffset, yOffset) end if(options.bindingScale) then @@ -698,65 +747,8 @@ function CaerdonWardrobeMixin:ClearButton(button) end end -function CaerdonWardrobeMixin:CreateButtonIfNeeded(originalButton, item, feature, locationInfo, options) - local button = originalButton.caerdonButton - - if not button then - button = CreateFrame("Frame", nil, originalButton) - button.searchOverlay = originalButton.searchOverlay - originalButton.caerdonButton = button - end - - -- Make sure it's sitting in front of the frame it's going to overlay - local levelCheckFrame = originalButton - if options and options.relativeFrame then - if options.relativeFrame:GetObjectType() == "Texture" then - levelCheckFrame = options.relativeFrame:GetParent() - else - levelCheckFrame = options.relativeFrame - end - end - - if levelCheckFrame then - button:SetFrameStrata(levelCheckFrame:GetFrameStrata()) - button:SetFrameLevel(levelCheckFrame:GetFrameLevel() + 1) - end - - if options and not options.fixedStatusPosition and not options.fixedBindingPosition then - button:ClearAllPoints() - button:SetSize(0,0) - - if options and options.relativeFrame then - button:SetAllPoints(options.relativeFrame) - else - button:SetAllPoints(originalButton) - end - end - - local mogStatus = button.mogStatus - if not mogStatus then - local mogStatusBackground = button:CreateTexture(nil, "ARTWORK", nil, 1) - mogStatus = button:CreateTexture(nil, "ARTWORK", nil, 2) - mogStatus.mogStatusBackground = mogStatusBackground - button.mogStatus = mogStatus - end - - local bindsOnText = button.bindsOnText - if not bindsOnText then - bindsOnText = button:CreateFontString(nil, "ARTWORK", "SystemFont_Outline_Small") -- TODO: Note: placing directly on button to enable search fade - need to check on other addons - button.bindsOnText = bindsOnText - end - - local newWidth = bindsOnText:GetStringWidth() - if newWidth > button:GetWidth() then - newWidth = button:GetWidth() - end - local newHeight = bindsOnText:GetHeight() - bindsOnText:SetSize(newWidth, newHeight) -end - function CaerdonWardrobeMixin:UpdateButton(button, item, feature, locationInfo, options) - self:CreateButtonIfNeeded(button, item, feature, locationInfo, options) + self:SetupCaerdonButton(button, item, feature, locationInfo, options) if item == nil then self:ClearButton(button) @@ -992,4 +984,4 @@ end function CaerdonWardrobeMixin:UPDATE_EXPANSION_LEVEL() -- Can change while logged in! self:RefreshItems() -end +end \ No newline at end of file diff --git a/CaerdonWardrobe.toc b/CaerdonWardrobe.toc index 62d6ba5..b9e9d44 100755 --- a/CaerdonWardrobe.toc +++ b/CaerdonWardrobe.toc @@ -5,7 +5,7 @@ ## Title: Caerdon Wardrobe ## Notes: Shows BOE / BOA, openable, and unlearned pets, toys, mounts and wardrobe indicator on bank / bag / auction / merchant / guild bank / loot frame / loot roll / encounter journal slots ## Author: Caerdon -## Version: v3.6.2 +## Version: v3.6.3 ## SavedVariables: CaerdonWardrobeConfig ## OptionalDeps: WoWUnit, AdiBags, AngrierWorldQuests, ArkInventory, Baganator, Bagnon, BaudBag, BetterBags, cargBags_Nivaya, Combuctor, ElvUI, Inventorian, KkthnxUI, LiteBag, Pawn, Skillet, Sorted, VenturePlan, WorldQuestsList, WorldQuestTracker, ZygorGuidesViewer diff --git a/external/Baganator/Core.Baganator.lua b/external/Baganator/Core.Baganator.lua index 78b88c0..90d0b36 100644 --- a/external/Baganator/Core.Baganator.lua +++ b/external/Baganator/Core.Baganator.lua @@ -11,7 +11,6 @@ end local options = { fixedStatusPosition = true, statusProminentSize = 16, - -- forceGearSetsAsIcon = false } function BaganatorMixin:Init() @@ -35,6 +34,8 @@ function BaganatorMixin:Init() CaerdonWardrobe:UpdateButton(itemButton, item, self, { locationKey = details.itemLink }, options) end + -- Ideally, we'd only show if we have a status to show, but UpdateButton is running asynchronously, so we can't account for it here. + -- Unfortunately, this means that mog status will override options in Baganator's icon corner setup even if it doesn't have anything to show. return shouldShow end, function(itemButton) -- Create Caerdon Button with nil item to create caerdonButton ahead of time for all slots @@ -61,17 +62,14 @@ function BaganatorMixin:Init() end CaerdonWardrobe:UpdateButton(itemButton, item, self, { locationKey = details.itemLink }, options) end - - -- if shouldShow and (bindsOnText:GetText() == "" or bindsOnText:GetText() == nil) then - -- shouldShow = false - -- end - -- return shouldShow + -- Ideally, we'd only show if we have a binding to show, but UpdateButton is running asynchronously, so we can't account for it here. + -- Unfortunately, this means that binding will override options in Baganator's icon corner setup even if it doesn't have anything to show. return true end, function(itemButton) CaerdonWardrobe:UpdateButton(itemButton, nil, self, nil, options) return itemButton.caerdonButton.bindsOnText - end, {corner = "bottom_right", priority = 2}) + end, {corner = "bottom_left", priority = 2}) end function BaganatorMixin:GetTooltipData(item, locationInfo) diff --git a/types/RecipeMixin.lua b/types/RecipeMixin.lua index d628a54..143f295 100644 --- a/types/RecipeMixin.lua +++ b/types/RecipeMixin.lua @@ -273,7 +273,7 @@ end -- local recipeName, recipeID = C_Item.GetItemSpell(caerdonItem:GetItemLink()) -- print(recipeName or "" .. ": " .. tostring(recipeID)) - local spellName, spellID = C_Item.GetItemSpell(caerdonItem:GetItemLink()) + -- local spellName, spellID = C_Item.GetItemSpell(caerdonItem:GetItemLink()) -- print(spellName) if caerdonItem.extraData and caerdonItem.extraData.recipeInfo then @@ -281,7 +281,8 @@ end end if not itemType.recipe then - local recipeName = string.gsub(caerdonItem:GetItemName(), "Recipe: ", "") + local checkName = caerdonItem:GetItemName() + local recipeName = string.gsub(checkName or "", "Recipe: ", "") recipeName = string.gsub(recipeName, "Schematic: ", "") recipeName = string.gsub(recipeName, "Design: ", "") recipeName = string.gsub(recipeName, "Plans: ", "")