AdiBags

AdiBags

8M Downloads

UpgradeIcon broken for bank

ghr74 opened this issue ยท 1 comments

commented

Back in #174 , it seems that the UpgradeIcon functionality for the bank was taken out to hotfix the occuring error. However, that shouldn't be the final fix for this since it's certainly possible to make it work. I looked at the issue and worked out a for now seemingly mostly working fix, it's only got a little quirk I've found so far, maybe someone has an idea on how to fix it properly.

I'll be talking about /widgets/ItemButton.lua

The basic issue is that the bag icons are made from the "ContainerFrameItemButtonTemplate" (line 61), however the bank icons are made from the "BankItemButtonGenericTemplate" (see line 122-ish). The UpgradeIcon texture however is only available on the "ContainerFrameItemButtonTemplate" (line 87 here).
Simply changing the template the bank icons use fixes this issue but leads to a whole mess of other issues, so I abandoned that approach.

What I've got working now adds the UpgradeIcon texture to the bank icons manually, code (around line 124):

function bankButtonProto:OnAcquire(container, bag, slot)
	self.UpgradeIcon = self:CreateTexture()
	self.UpgradeIcon:SetAtlas("bags-greenarrow", true)
	self.UpgradeIcon:SetShown(false)
	self.UpgradeIcon:ClearAllPoints()
	self.UpgradeIcon:SetPoint("TOPLEFT",self,"TOPLEFT",0,0)
	self.GetInventorySlot = nil -- Remove the method added by the template
	self.inventorySlot = bag == REAGENTBANK_CONTAINER and ReagentBankButtonIDToInvSlotID(slot) or BankButtonIDToInvSlotID(slot)
	return buttonProto.OnAcquire(self, container, bag, slot)
end

Of course, this also requires modifying the function on line 147 to allow the bank to be processed:

function bankButtonProto:UpdateUpgradeIcon()
	if self.bag ~= REAGENTBANK_CONTAINER then
		buttonProto.UpdateUpgradeIcon(self)
	end
end

The only issue/quirk I've found so far is that when dropping an item with the UpgradeIcon texture on the empty slot icon in the bank, the UpgradeIcon texture seems to "stick" to the empty slot icon until you repeat this.

commented

As I recall, this was resolved.