Skip to content
Closed
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
53 changes: 52 additions & 1 deletion modules/ItemLevel.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
-- @Author: Brian Thurlow
-- @Date: 06/19/2017 02:19:51 PM
-- @Last modified by: Brian Thurlow
-- @Last modified time: 06/20/2017 02:16:24 PM



--[[
AdiBags - Adirelle's bag addon.
Copyright 2013-2014 Adirelle (adirelle@gmail.com)
Expand Down Expand Up @@ -64,6 +71,8 @@ function mod:OnInitialize()
minLevel = 1,
ignoreJunk = true,
ignoreHeirloom = true,
textPos = 'TOPLEFT',
upgIconPos = 'TOPLEFT',
},
})
if self.db.profile.colored == true then
Expand Down Expand Up @@ -97,6 +106,10 @@ end
function mod:OnDisable()
for _, text in pairs(texts) do
text:Hide()
if _.UpgradeIcon then
_.UpgradeIcon:ClearAllPoints()
_.UpgradeIcon:SetPoint("TOPLEFT",_,"TOPLEFT")
end
end
end

Expand Down Expand Up @@ -137,6 +150,10 @@ function mod:UpdateButton(event, button)
end
text:SetText(level)
text:SetTextColor(colorSchemes[settings.colorScheme](level, quality, reqLevel, (loc ~= "")))
--Update Position Based on settings
text:ClearAllPoints()
text:SetPoint(settings.textPos, button, settings.textPos)
--------------------------------------
return text:Show()
end
end
Expand Down Expand Up @@ -165,7 +182,7 @@ function mod:GetOptions()
},
colorScheme = {
name = L['Color scheme'],
desc = L['Which color scheme should be used to display the item level ?'],
desc = L['Which color scheme should be used to display the item level?'],
type = 'select',
hidden = SyLevelBypass,
values = {
Expand Down Expand Up @@ -197,6 +214,40 @@ function mod:GetOptions()
type = 'toggle',
order = 50,
},
textPos = {
name = L['Text Position'],
desc = L['Where to show the item level?'],
type = 'select',
values = {
TOPLEFT = L['Top Left'],
TOPRIGHT = L['Top Right'],
TOP = L['Top'],
LEFT = L['Left'],
RIGHT = L['Right'],
CENTER = L['Center'],
BOTTOMLEFT = L['Bottom Left'],
BOTTOMRIGHT = L['Bottom Right'],
BOTTOM = L['Bottom'],
},
order = 60,
},
upgIconPos = {
name = L['Upgrade Icon Position'],
desc = L['Where to show the upgrade icon?'],
type = 'select',
values = {
TOPLEFT = L['Top Left'],
TOPRIGHT = L['Top Right'],
TOP = L['Top'],
LEFT = L['Left'],
RIGHT = L['Right'],
CENTER = L['Center'],
BOTTOMLEFT = L['Bottom Left'],
BOTTOMRIGHT = L['Bottom Right'],
BOTTOM = L['Bottom'],
},
order = 70,
},
}, addon:GetOptionHandler(self)
end

Expand Down
25 changes: 22 additions & 3 deletions widgets/ItemButton.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
-- @Author: Brian Thurlow
-- @Date: 06/19/2017 02:19:51 PM
-- @Last modified by: Brian Thurlow
-- @Last modified time: 06/20/2017 02:06:14 PM



--[[
AdiBags - Adirelle's bag addon.
Copyright 2010-2014 Adirelle (adirelle@gmail.com)
Expand Down Expand Up @@ -122,6 +129,11 @@ local bankButtonClass, bankButtonProto = addon:NewClass("BankItemButton", "ItemB
bankButtonClass.frameTemplate = "BankItemButtonGenericTemplate"

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)
Expand All @@ -140,9 +152,7 @@ function bankButtonProto:GetInventorySlot()
end

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

--------------------------------------------------------------------------------
Expand Down Expand Up @@ -355,7 +365,16 @@ function buttonProto:UpdateNew()
end

function buttonProto:UpdateUpgradeIcon()
self.UpgradeIcon:SetShown(IsContainerItemAnUpgrade(self.bag, self.slot) or false)
if self.UpgradeIcon then
local isUpgrade = IsContainerItemAnUpgrade(self.bag, self.slot)
if addon.db.profile.modules['ItemLevel'] then
local pos = addon.db:GetNamespace('ItemLevel',true).profile.upgIconPos
self.UpgradeIcon:ClearAllPoints()
self.UpgradeIcon:SetPoint(pos,self,pos)
end

self.UpgradeIcon:SetShown(isUpgrade or false)
end
end

local function GetBorder(bag, slot, itemId, settings)
Expand Down