Hej
i just made this little change to have what u want
it seems to work i just made some add and delete out of my bags
handson fix
will se if i can add it that we have the choice of what we want to have
in the subdirectory StatusWindow
in the file
StatusWindowModule.lua
original looks like this
--
-- Bag slots
--
SWBagSlots = {
name = "Bag Slots",
updateEvent = "UNIT_INVENTORY_CHANGED",
Init = function(self)
if not self.initialised then
StatusWindow:HookModuleEvent(self, "UNIT_INVENTORY_CHANGED")
StatusWindow:HookModuleEvent(self, "BAG_UPDATE");
StatusWindow:HookModuleEvent(self, "BAG_OPEN");
StatusWindow:HookModuleEvent(self, "ITEM_LOCK_CHANGED");
StatusWindow:HookModuleEvent(self, "UPDATE_INVENTORY_ALERTS");
self.initialised = 1
end
end,
Update = function(self, event)
local used,total
used = 0
total = 0
for i=0,4 do
used = used + self:CountBagSlots(i)
total = total + (GetContainerNumSlots(i) or 0)
end
return string.format("Bags: %d/%d", used, total)
end,
CountBagSlots = function(self, bag)
local used = 0
for i=1,GetContainerNumSlots(bag) do
used = used + ((GetContainerItemInfo(bag, i) and 1) or 0)
end
return used
end,
}
StatusWindow:RegisterModule(SWBagSlots)
my new code red lines
--
-- Bag slots
--
SWBagSlots = {
name = "Bag Slots",
updateEvent = "UNIT_INVENTORY_CHANGED",
Init = function(self)
if not self.initialised then
StatusWindow:HookModuleEvent(self, "UNIT_INVENTORY_CHANGED")
StatusWindow:HookModuleEvent(self, "BAG_UPDATE");
StatusWindow:HookModuleEvent(self, "BAG_OPEN");
StatusWindow:HookModuleEvent(self, "ITEM_LOCK_CHANGED");
StatusWindow:HookModuleEvent(self, "UPDATE_INVENTORY_ALERTS");
self.initialised = 1
end
end,
Update = function(self, event)
local used,total
used = 0
total = 0
left = 0
for i=0,4 do
used = used + self:CountBagSlots(i)
total = total + (GetContainerNumSlots(i) or 0)
left = total - used
end
return string.format("Bags: %d/%d", left, total)
end,
CountBagSlots = function(self, bag)
local used = 0
for i=1,GetContainerNumSlots(bag) do
used = used + ((GetContainerItemInfo(bag, i) and 1) or 0)
end
return used
end,
}
StatusWindow:RegisterModule(SWBagSlots)
|