Skip to content

Commit

Permalink
Style fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Nevcairiel committed Aug 17, 2022
1 parent 429558a commit 312cc18
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 21 deletions.
4 changes: 2 additions & 2 deletions BagBrother/Events.lua
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ local Reagents = REAGENTBANK_CONTAINER

function BagBrother:BAG_UPDATE(bag)
local isBag = bag > Bank and bag <= BagSlots

if isBag then
self:SaveBag(bag, bag == Backpack)
if bag == Backpack then
Expand Down Expand Up @@ -136,4 +136,4 @@ function BagBrother:GUILDBANKBAGSLOTS_CHANGED()

self.Realm[id] = tabs
end
end
end
6 changes: 3 additions & 3 deletions BagBrother/Startup.lua
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ end
function Brother:StartupCache()
local Player = UnitName('player')
local Realm = GetRealmName()

BrotherBags = BrotherBags or {}
BrotherBags[Realm] = BrotherBags[Realm] or {}

self.Realm = BrotherBags[Realm]
self.Realm[Player] = self.Realm[Player] or {equip = {}}
self.Player = self.Realm[Player]
Expand Down Expand Up @@ -90,4 +90,4 @@ end
function Brother:RemoveEvent(event)
self:UnregisterEvent(event)
self[event] = nil
end
end
14 changes: 7 additions & 7 deletions libs/LibItemCache-1.1/Caches/BagBrother.lua
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ function Cache:GetItem(realm, player, bag, tab, slot)
else
bag = self:GetPersonalBag(realm, player, bag)
end

local item = bag and bag[slot]
if item then
return strsplit(';', item)
Expand Down Expand Up @@ -79,15 +79,15 @@ function Cache:GetItemCounts(realm, player, id)

local bank = self:GetItemCount(personal[BANK_CONTAINER], id) + self:GetItemCount(personal[REAGENTBANK_CONTAINER], id)
local bags, guild = 0, 0

for i = BACKPACK_CONTAINER, NUM_BAG_SLOTS do
bags = bags + self:GetItemCount(personal[i], id)
end

for i = FIRST_BANK_SLOT, LAST_BANK_SLOT do
bank = bank + self:GetItemCount(personal[i], id)
end

for i = 1, GetNumGuildBankTabs() do
guild = guild + self:GetItemCount(self:GetGuildTab(realm, player, i), id)
end
Expand All @@ -98,15 +98,15 @@ end
function Cache:GetItemCount(bag, id, unique)
local count = 0
local id = '^'..id

if bag then
for i,item in pairs(bag) do
if type(i) == 'number' and item:find(id) then
count = count + (not unique and tonumber(item:match(ITEM_COUNT)) or 1)
end
end
end

return count
end

Expand Down Expand Up @@ -170,4 +170,4 @@ function Cache:GetRealms()
end

return realms
end
end
18 changes: 9 additions & 9 deletions libs/LibItemCache-1.1/Core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ function Lib:GetPlayerInfo(player)
local _,class = UnitClass('player')
local _,race = UnitRace('player')
local sex = UnitSex('player')

return class, race, sex, self.FACTION
end
end
Expand Down Expand Up @@ -144,7 +144,7 @@ function Lib:GetBagInfo(player, bag)
local isCached, _,_, tab = self:GetBagType(player, bag)
local realm, player = self:GetPlayerAddress(player)
local owned = true

if tab then
if isCached then
return Cache('GetBag', realm, player, bag, tab)
Expand All @@ -164,7 +164,7 @@ function Lib:GetBagInfo(player, bag)
if isCached then
local data, size = Cache('GetBag', realm, player, bag, nil, slot)
local link, icon = self:RestoreLink(data)

return link, 0, icon, slot, tonumber(size) or 0, true
else
local link = GetInventoryItemLink('player', slot)
Expand Down Expand Up @@ -204,13 +204,13 @@ function Lib:GetItemInfo(player, bag, slot)
local realm, player = self:GetPlayerAddress(player)
local data, count = Cache('GetItem', realm, player, bag, tab, slot)
local link, icon, quality = self:RestoreLink(data)

if isVault then
return link, icon, nil, nil, nil, true
else
return icon, tonumber(count) or 1, nil, quality, nil, nil, link, true
end

elseif isVault then
return GetVoidItemInfo(1, slot)
elseif tab then
Expand All @@ -225,7 +225,7 @@ function Lib:GetItemInfo(player, bag, slot)
if link and quality < 0 then
quality = self:GetItemQuality(link)
end

return icon, count, locked, quality, readable, lootable, link
end
end
Expand Down Expand Up @@ -276,10 +276,10 @@ end
function Lib:RestorePetLink(partial)
local id, _, quality = strsplit(':', partial)
local name, icon = C_PetJournal.GetPetInfoBySpeciesID(id)

local color = select(4, GetItemQualityColor(quality))
local link = PetLinkFormat:format(color, partial, name)

return link, icon, tonumber(quality)
end

Expand All @@ -299,4 +299,4 @@ end

function Lib:HasCache()
return not self.NewCache
end
end

0 comments on commit 312cc18

Please sign in to comment.