Skip to content

Commit

Permalink
feat(TBag): Update functions for 11.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Cilraaz committed Jun 6, 2024
1 parent 6972d49 commit 6527ced
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
9 changes: 7 additions & 2 deletions TBag/Buttons.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ local GetContainerItemCooldown = GetContainerItemCooldown or (C_Container and C_
local GetContainerItemInfo = GetContainerItemInfo or (C_Container and C_Container.GetContainerItemInfo)
local ShowContainerSellCursor = ShowContainerSellCursor or (C_Container and C_Container.ShowContainerSellCursor)

-- C_Item locals
local GetItemIconByID = C_Item.GetItemIconByID
local GetItemIDForItemInfo = C_Item.GetItemIDForItemInfo

-- Generic itembutton implementation
TBag.ItemButton = {}
local ItemButton = TBag.ItemButton
Expand Down Expand Up @@ -259,12 +263,13 @@ function ItemButton.Update(self)
if itemlink then
frame_texture:SetAlpha(1)
if itemlink:sub(1,5) == "item:" then
texture = GetItemIcon(itm[TBag.I_ITEMLINK])
local itemID = GetItemIDForItemInfo(itemlink)
texture = GetItemIconByID(itemID)
elseif itemlink:sub(1,10) == "battlepet:" then
local _, _, _, speciesID = TBag:GetItemID(itemlink)
_, texture = C_PetJournal.GetPetInfoBySpeciesID(speciesID)
elseif string.find(itemlink, "keystone") then
texture = GetItemIcon(158923)
texture = GetItemIconByID(158923)
end
else
if cfg.show_bag_icons == 1 then
Expand Down
14 changes: 11 additions & 3 deletions TBag/TBag.lua
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ local tostring = tostring
-- Blizzard function locals
local GetMoney = GetMoney

-- C_AddOns locals
local GetAddOnMetadata = C_AddOns.GetAddOnMetadata
local LoadAddOn = C_AddOns.LoadAddOn

-- C_Container locals
local ContainerIDToInventoryID = C_Container.ContainerIDToInventoryID
local GetContainerItemInfo = C_Container.GetContainerItemInfo
Expand All @@ -42,7 +46,8 @@ local SplitContainerItem = C_Container.SplitContainerItem
local GetDetailedItemLevelInfo = C_Item.GetDetailedItemLevelInfo
local GetItemFamily = C_Item.GetItemFamily
local GetItemID = C_Item.GetItemID
--local GetItemIcon = C_Item.GetItemIcon
local GetItemIDForItemInfo = C_Item.GetItemIDForItemInfo
local GetItemIconByID = C_Item.GetItemIconByID
local GetItemInfo = C_Item.GetItemInfo
local GetItemName = C_Item.GetItemName
local GetItemQualityColor = C_Item.GetItemQualityColor
Expand Down Expand Up @@ -1605,8 +1610,11 @@ function TBag:GetBagTexture(playerid, bag)
texture = "Interface\\Icons\\INV_Misc_Bag_SatchelofCenarius.blp"
else
local itemlink = self:GetPlayerBagCfg(playerid, bag, self.I_ITEMLINK)
if (itemlink) then
texture = GetItemIcon(itemlink)
if itemlink then
local itemID = GetItemIDForItemInfo(itemlink)
end
if itemID then
texture = GetItemIconByID(itemID)
else
texture = "interface\\paperdoll\\UI-PaperDoll-Slot-Bag"
end
Expand Down
2 changes: 1 addition & 1 deletion TBag/Tokens.lua
Original file line number Diff line number Diff line change
Expand Up @@ -178,5 +178,5 @@ function Tokens.ScanAndUpdate()
Tokens.Update(TBnkFrame_TokenFrame)
end

TokenFramePopup.BackpackCheckBox.Text:SetText(L["Show on TBag"])
TokenFramePopup.BackpackCheckbox.Text:SetText(L["Show on TBag"])
TOKEN_SHOW_ON_BACKPACK = L["Checking this option will allow you to track this currency type in TBag for this character.\n\nYou can also Shift-click a currency to add or remove it from being tracked in TBag."]

0 comments on commit 6527ced

Please sign in to comment.