View Single Post
09-22-10, 07:04 AM   #254
d16174l4n63l
A Fallenroot Satyr
 
d16174l4n63l's Avatar
Join Date: Mar 2008
Posts: 20
Code:
    -- Text display
    {    name = "Stats", parent = "Container",
        anchor_to = "CENTER", anchor_from = "CENTER",
        text = {
            string = function()
                -- monies
                local gold = format("%.1f|cffffd700g|r",GetMoney()/10000)
		-- bag space
		local numberOfSlots0 = GetContainerNumSlots(0);
		local numberOfSlots1 = GetContainerNumSlots(1);
		local numberOfSlots2 = GetContainerNumSlots(2);
		local numberOfSlots3 = GetContainerNumSlots(3);
		local numberOfSlots4 = GetContainerNumSlots(4);
		local numberOfFreeSlots0 = GetContainerNumFreeSlots(0);
		local numberOfFreeSlots1 = GetContainerNumFreeSlots(1);
		local numberOfFreeSlots2 = GetContainerNumFreeSlots(2);
		local numberOfFreeSlots3 = GetContainerNumFreeSlots(3);
		local numberOfFreeSlots4 = GetContainerNumFreeSlots(4);
		inv = numberOfSlots0 + numberOfSlots1 + numberOfSlots2 + numberOfSlots3 + numberOfSlots4
		finv = numberOfFreeSlots0 + numberOfFreeSlots1 + numberOfFreeSlots2 + numberOfFreeSlots3 + numberOfFreeSlots4
		bag = (finv.. "|" ..inv)
                -- durability
                local durability = 100
                for i = 1, 11 do
                    if GetInventoryItemDurability(i) ~= nil then
                        local dur, max = GetInventoryItemDurability(i)
                        local perc = dur / max * 100
                        if perc < durability then
                            durability = floor(perc)
                        end
                    end
                end

                -- fps
                local fps = floor(GetFramerate())

                -- memory
                local memory = 0
                UpdateAddOnMemoryUsage()
                for i = 1, GetNumAddOns() do
                    if IsAddOnLoaded(i) then
                        memory = memory + GetAddOnMemoryUsage(i)
                    end
                end
                memory = format("%.1f", memory/1024)

                -- latency
                local latency = select(3,GetNetStats())

                return format(":: %s :: %s%%dur :: %sfps :: %smB :: %sbag :: %sms ::", gold, durability, fps, memory, bag, latency)
            end, update = 1,
            size=13, shadow=1, font = "Fonts\\FRIZQT__.TTF",
        }
    },
This is a modification of the stats bar a few threads bag but with free bag space and total bag space. The graphics have been removed I hope this helps someone
  Reply With Quote