Skip to content

Commit

Permalink
Further fixes to getting bag info after login
Browse files Browse the repository at this point in the history
  • Loading branch information
phyber committed Sep 15, 2019
1 parent 39cd27f commit 7e885ab
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 39 deletions.
1 change: 1 addition & 0 deletions .luacheckrc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ max_line_length = false

-- We don't want to check externals Libs or this config file
exclude_files = {
".release/",
"Libs/",
".luacheckrc",
}
Expand Down
81 changes: 42 additions & 39 deletions Core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ do
-- If we already cached a result, use that.
if bagQuality[itemID] then
local icon = bagIcon[itemID]
local quality = bagIcon[itemID]
local quality = bagQuality[itemID]

return quality, icon
end
Expand Down Expand Up @@ -229,49 +229,52 @@ function dataobj:OnTooltipShow()
local bagSize = GetContainerNumSlots(i)

if bagSize ~= nil and bagSize > 0 then
local name, quality, icon, _
name = GetBagName(i)

if i == 0 then
icon = "Interface\\Icons\\INV_Misc_Bag_08:16"
quality = select(4, GetItemQualityColor(1))
else
_,_,quality,_,_,_,_,_,_,icon = GetItemInfo(name)
quality = select(4, GetItemQualityColor(quality))
icon = icon .. ":16"
end
local name = GetBagName(i)

local freeSlots = GetContainerNumFreeSlots(i)
local takenSlots = bagSize - freeSlots
local colour
if name then
local quality, icon

if db.showColours then
colour = GetBagColour((bagSize - takenSlots) / bagSize)
name = ("|c%s%s|r"):format(quality, name)
end
if i == 0 then
icon = "Interface\\Icons\\INV_Misc_Bag_08:16"
quality = select(4, GetItemQualityColor(1))
else
quality, icon = GetBagIconAndQuality(name)
quality = select(4, GetItemQualityColor(quality))
icon = icon .. ":16"
end

if db.showDepletion then
takenSlots = bagSize - takenSlots
end
local freeSlots = GetContainerNumFreeSlots(i)
local takenSlots = bagSize - freeSlots
local colour

if db.showColours then
colour = GetBagColour((bagSize - takenSlots) / bagSize)
name = ("|c%s%s|r"):format(quality, name)
end

if db.showDepletion then
takenSlots = bagSize - takenSlots
end

local textL, textR
textL = ("|T%s|t %s"):format(icon, name)

if db.showTotal then
textR = ("%s%d/%d%s"):format(
colour and colour or "",
takenSlots,
bagSize,
colour and "|r" or ""
)
else
textR = ("%s%d%s"):format(
colour and colour or "",
takenSlots,
colour and "|r" or ""
)
local textL, textR
textL = ("|T%s|t %s"):format(icon, name)

if db.showTotal then
textR = ("%s%d/%d%s"):format(
colour and colour or "",
takenSlots,
bagSize,
colour and "|r" or ""
)
else
textR = ("%s%d%s"):format(
colour and colour or "",
takenSlots,
colour and "|r" or ""
)
end
self:AddDoubleLine(textL, textR)
end
self:AddDoubleLine(textL, textR)
end
end
end
Expand Down

0 comments on commit 7e885ab

Please sign in to comment.