WarBoard

10 - warboard coin error

What steps will reproduce the problem?
1. On entry to game
2. changes to pack space
3.

What is the expected output? What do you see instead?
Usually bar fills as bag space is taken. Just stays white now

What version of the product are you using?
0.5.3

Do you have an error log of what happened?
Script Call failed - Error while calling [WarBoard_Coin.OnPlayerBagSpaceUpdated]:
[string "Interface/AddOns\WarBoard\WarBoard_Coin\WarBoard_Coin.lua";]:104: attempt to call field 'GetItem' (a nil value)

Please provide any additional information below.
Still keeps track of coin just fine. Not real dire need of it. Just thought u might wanna know.

User When Change
computerpunk Jul 20, 2009 at 04:44 UTC Changed status from New to Fixed
zurass Jun 21, 2009 at 18:36 UTC Create

You must login to post a comment. Don't have an account? Register to get one!

  • 1 comment
  • Avatar of Garkin Garkin Jun 26, 2009 at 10:04 UTC - 0 likes

    Based on code published by Sihirbaz (http://war.curse.com/downloads/war-addons/details/snt-bar.aspx#503347) I have fixed this tooltip and bar error for WarBoard_Coin. There could be added some coloring for currency&crafting items and also there could be displayed total slots available for those two bags but as I'm not a real coder, I didn't do it yet.

    This is complete listing of WarBoard_Coin.lua:

    if not WarBoard_Coin then WarBoard_Coin = {} end
    local WarBoard_Coin = WarBoard_Coin
    local WindowSetAlpha, WindowSetTintcolor, StatusBarSetMaximumValue, StatusBarSetCurrentValue, Tooltips, GetNumberOfItemsInPocket,
    	  LabelSetText, towstring, floor, mod =
    	  WindowSetAlpha, WindowSetTintcolor, StatusBarSetMaximumValue, StatusBarSetCurrentValue, Tooltips, GetNumberOfItemsInPocket,
    	  LabelSetText, towstring, math.floor, math.mod
    
    function WarBoard_Coin.Initialize()
    	if (WarBoard.AddMod("WarBoard_Coin")) then
    		WindowSetAlpha("WarBoard_CoinImageFrame", 0.75)
    		WindowSetAlpha( "WarBoard_CoinBagsFull", 0 )
    		WindowSetTintColor( "WarBoard_CoinBagsFull", 255, 0, 0 )
    		
    		RegisterEventHandler(SystemData.Events.PLAYER_MONEY_UPDATED, "WarBoard_Coin.OnPlayerCoinUpdate")
    		RegisterEventHandler(SystemData.Events.PLAYER_INVENTORY_SLOT_UPDATED, "WarBoard_Coin.OnPlayerBagSpaceUpdated")
    		RegisterEventHandler(SystemData.Events.PLAYER_QUEST_ITEM_SLOT_UPDATED, "WarBoard_Coin.OnPlayerBagSpaceUpdated")
    		RegisterEventHandler(SystemData.Events.PLAYER_CURRENCY_SLOT_UPDATED, "WarBoard_Coin.OnPlayerBagSpaceUpdated")
    		RegisterEventHandler(SystemData.Events.PLAYER_CRAFTING_SLOT_UPDATED, "WarBoard_Coin.OnPlayerBagSpaceUpdated") 
    		RegisterEventHandler(SystemData.Events.PLAYER_CAREER_RANK_UPDATED, "WarBoard_Coin.OnPlayerBagSpaceUpdated")
    		WarBoard_Coin.OnPlayerBagSpaceUpdated()
    		WarBoard_Coin.OnPlayerCoinUpdate()
    	end
    end
    
    function WarBoard_Coin.OnPlayerBagSpaceUpdated()
    	local pTotal, pMax = WarBoard_Coin.GetNumberOfItemsInPocket(EA_Window_Backpack.TYPE_INVENTORY)
    	StatusBarSetMaximumValue( "WarBoard_CoinBagBar", pMax )
    	StatusBarSetCurrentValue( "WarBoard_CoinBagBar", pTotal )
    	local red = 0
    	local green = 255
    	local alpha = 0.5
    	if ( (pMax - pTotal) <= 9 and (pMax - pTotal) > 5) then
    		red = 255 - (((pMax - pTotal) - 5) * 51 )
    		WindowSetAlpha( "WarBoard_CoinBagsFull", 0 )
    	elseif ( (pMax - pTotal) <= 5 ) then
    		red = 255
    		green = (pMax - pTotal) * 51
    		alpha = 1
    		WindowSetAlpha( "WarBoard_CoinBagsFull", 0 )
    	end
    	if ( (pMax - pTotal) == 0 ) then
    		WindowSetAlpha( "WarBoard_CoinBagsFull", 1 )
    	end
    	WindowSetTintColor( "WarBoard_CoinBarBackground", red, green, 0 )
    	WindowSetAlpha( "WarBoard_CoinBarBackground", alpha )
    end
    
    function WarBoard_Coin.OnMouseOver()
    	local pTotal, pMax = WarBoard_Coin.GetNumberOfItemsInPocket(EA_Window_Backpack.TYPE_INVENTORY)
    	local pQuests = WarBoard_Coin.GetNumberOfItemsInPocket(EA_Window_Backpack.TYPE_QUEST)
    	local pCurrency, pMaxCurrency = WarBoard_Coin.GetNumberOfItemsInPocket(EA_Window_Backpack.TYPE_CURRENCY)
    	local pCrafting, pMaxCrafting = WarBoard_Coin.GetNumberOfItemsInPocket(EA_Window_Backpack.TYPE_CRAFTING) 
    
    	Tooltips.CreateTextOnlyTooltip( "WarBoard_Coin", nil)
    	Tooltips.AnchorTooltip( WarBoard.GetModToolTipAnchor( "WarBoard_Coin" ) )
    	Tooltips.SetTooltipColor( 1, 1, 255, 255, 255 )
    	Tooltips.SetTooltipText( 1, 1, L"Bags Info" )
    	Tooltips.SetTooltipText( 2, 1, L"---------------------------------------")
    	Tooltips.SetTooltipText( 3, 1, L"Total Available Bag Slots: " ) 
    	Tooltips.SetTooltipText( 3, 2, towstring( pMax ) )
    	Tooltips.SetTooltipText( 4, 1, L"Filled Bag Slots: " )
    	Tooltips.SetTooltipText( 4, 2, towstring( pTotal ) )
    	Tooltips.SetTooltipColor( 4, 2, 247, 194, 088 )
    	Tooltips.SetTooltipText( 5, 1, L"Open Bag Slots: " )
    	Tooltips.SetTooltipText( 5, 2, towstring( pMax - pTotal ) )
    	Tooltips.SetTooltipColor( 5, 2, 0, 200, 0 )
    	Tooltips.SetTooltipText( 6, 1, L"Currency Items: " )
    	Tooltips.SetTooltipText( 6, 2, towstring( pCurrency ) )
    	Tooltips.SetTooltipText( 7, 1, L"Crafting Items: " )
    	Tooltips.SetTooltipText( 7, 2, towstring( pCrafting ) )
    	Tooltips.SetTooltipText( 8, 1, L"Quest Items: " )
    	Tooltips.SetTooltipText( 8, 2, towstring( pQuests ) )
    	Tooltips.Finalize()
    end
    
    function WarBoard_Coin.GetNumberOfItemsInPocket( pocketNumber )
    	local count = 0
    	local itemsTable = EA_Window_Backpack.GetItemsFromBackpack( pocketNumber )
    	for slotNum, itemData in pairs(itemsTable) do
    		if (EA_Window_Backpack.ValidItem(itemData)) then
    			count = count + 1
    		end
        	end
    	return count, #itemsTable 
    end
    
    function WarBoard_Coin.OnClick()
    	EA_Window_Backpack.ToggleShowing()
    end
    
    function WarBoard_Coin.OnPlayerCoinUpdate()
    	local curMoney = GameData.Player.money
    	local g = floor (curMoney / 10000)
    	local s = floor ((curMoney - (g * 10000)) / 100)
    	local b = mod (curMoney, 100)
    
    	LabelSetText( "WarBoard_CoinGold", (towstring(g)))
    	LabelSetText( "WarBoard_CoinSilver", (towstring(s)))
    	LabelSetText( "WarBoard_CoinBrass", (towstring(b)))
    end
    
  • 1 comment

Facts

Last updated
Mar 30, 2012
Reported
Jun 21, 2009
Status
Fixed - Developer made requested changes. QA should verify.
Type
Defect - A shortcoming, fault, or imperfection
Priority
Medium - Normal priority.
Votes
1

Reported by

Possible assignees