Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions config/Options.lua
Original file line number Diff line number Diff line change
Expand Up @@ -641,6 +641,66 @@ local function GetOptions()
},
}
},
ItemUpgrade = {
name = ITEM_UPGRADE,
type = 'group',
inline = true,
order = 400,
set = function(info, value, ...)
local db = addon.db.profile
db[info[#info]] = value
addon:UpdateUpgradeIcon()
end,
args = {
upgradeIconAnchor = {
name = L['Anchor'],
type = 'select',
values = {
TOPLEFT = L['Top Left'],
TOP = L['Top'],
TOPRIGHT = L['Top Right'],
LEFT = L['Left'],
CENTER = L['Center'],
RIGHT = L['Right'],
BOTTOMLEFT = L['Bottom Left'],
BOTTOM = L['Bottom'],
BOTTOMRIGHT = L['Bottom Right'],
},
sorting = {
[1] = "TOPLEFT",
[2] = "TOP",
[3] = "TOPRIGHT",
[4] = "LEFT",
[5] = "CENTER",
[6] = "RIGHT",
[7] = "BOTTOMLEFT",
[8] = "BOTTOM",
[9] = "BOTTOMRIGHT",
},
order = 10,
},
upgradeIconOffsetX = {
name = L["X Offset"],
desc = L["Offset in X direction (horizontal) from the given anchor point."],
type = 'range',
min = -20,
max = 20,
step = 1,
bigStep = 1,
order = 20,
},
upgradeIconOffsetY = {
name = L["Y Offset"] ,
desc = L["Offset in Y direction (vertical) from the given anchor point."],
type = 'range',
min = -20,
max = 20,
step = 1,
bigStep = 1,
order = 30,
},
},
},
},
},
filters = {
Expand Down
3 changes: 3 additions & 0 deletions core/Constants.lua
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,9 @@ addon.DEFAULT_SETTINGS = {
hideAnchor = false,
autoDeposit = false,
compactLayout = false,
upgradeIconAnchor = "TOPLEFT",
upgradeIconOffsetX = 0,
upgradeIconOffsetY = 0,
},
char = {
collapsedSections = {
Expand Down
1 change: 1 addition & 0 deletions core/Core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ function addon:OnEnable()
self.bagFont:ApplySettings()
self.sectionFont:ApplySettings()
self:UpdatePositionMode()
self:UpdateUpgradeIcon()

self:Debug('Enabled')
end
Expand Down
23 changes: 22 additions & 1 deletion widgets/ItemButton.lua
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ function buttonProto:OnCreate()
self.NewItemTexture:Hide()
end
self.SplitStack = nil -- Remove the function set up by the template
self.UpgradeIcon:ClearAllPoints()
self.UpgradeIcon:SetPoint(addon.db.profile.upgradeIconAnchor, self, addon.db.profile.upgradeIconOffsetX, addon.db.profile.upgradeIconOffsetY)
end

function buttonProto:OnAcquire(container, bag, slot)
Expand Down Expand Up @@ -121,6 +123,13 @@ end
local bankButtonClass, bankButtonProto = addon:NewClass("BankItemButton", "ItemButton")
bankButtonClass.frameTemplate = "BankItemButtonGenericTemplate"

function bankButtonProto:OnCreate()
self.UpgradeIcon = self:CreateTexture(nil, "OVERLAY", nil, 1)
self.UpgradeIcon:SetAtlas("bags-greenarrow", true)
self.UpgradeIcon:Hide()
buttonProto.OnCreate(self)
end

function bankButtonProto:OnAcquire(container, bag, slot)
self.GetInventorySlot = nil -- Remove the method added by the template
self.inventorySlot = bag == REAGENTBANK_CONTAINER and ReagentBankButtonIDToInvSlotID(slot) or BankButtonIDToInvSlotID(slot)
Expand All @@ -140,7 +149,7 @@ function bankButtonProto:GetInventorySlot()
end

function bankButtonProto:UpdateUpgradeIcon()
if self.bag ~= BANK_CONTAINER and self.bag ~= REAGENTBANK_CONTAINER then
if self.bag ~= REAGENTBANK_CONTAINER then
buttonProto.UpdateUpgradeIcon(self)
end
end
Expand All @@ -167,6 +176,18 @@ hooksecurefunc(addon, 'OnInitialize', function()
containerButtonPool:PreSpawn(160)
end)

function addon:UpdateUpgradeIcon()
local db = addon.db.profile
for button, _ in addon:GetPool("ItemButton"):IterateAllObjects() do
button.UpgradeIcon:ClearAllPoints()
button.UpgradeIcon:SetPoint(db.upgradeIconAnchor, button, db.upgradeIconOffsetX, db.upgradeIconOffsetY)
end
for button, _ in addon:GetPool("BankItemButton"):IterateAllObjects() do
button.UpgradeIcon:ClearAllPoints()
button.UpgradeIcon:SetPoint(db.upgradeIconAnchor, button, db.upgradeIconOffsetX, db.upgradeIconOffsetY)
end
end

--------------------------------------------------------------------------------
-- Model data
--------------------------------------------------------------------------------
Expand Down