View Single Post
05-21-10, 08:57 AM   #7
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,934
Aha finally got it to work... its annoying but finally works the moment you open the guildbank frame. You have to have it open for it to work unfortunately.

Final Code and a screenshot to show how it is outputting the information :

Code:
local tType, tName, itemLink, count, tab1, tab2, year, month, day, hour;
local queryCount = 0;

local function onEvent(self,event,...)

             -- Only work if the Guild Bank Frame is open 
	if ( not GuildBankFrame:IsVisible() ) then
		return;
	end

             -- If the Guild Bank Frame has been opened then query each
             -- tabs log and contents.  And then query the money log.
	if ( event == "GUILDBANKFRAME_OPENED" ) then
		queryCount = 0;
		for tab = 1,GetNumGuildBankTabs() do
			QueryGuildBankLog(tab);
			QueryGuildBankTab(tab);
		end		
		QueryGuildBankLog(MAX_GUILDBANK_TABS+1);
             -- Each QueryGuildBank.... call will trigger this update but we only 
             -- want to display the final report which will contain everything 
             -- found.  queryCount is used to keep track of which stage we are
             -- at
	elseif ( event == "GUILDBANKLOG_UPDATE" ) then
		queryCount = queryCount + 1;
		if queryCount == GetNumGuildBankTabs() + 1 then
			for tab = 1, GetNumGuildBankTabs() do
				local maxTabTrans = GetNumGuildBankTransactions(tab);
                                      -- For each transaction in the current tab extract the information required.
				for trans = 1,maxTabTrans do
					tType, tName, itemLink, count, tab1, tab2, year, month, day, hour = GetGuildBankTransaction(tab, trans);
                                      -- If this is the last transaction then we want to display it in some form
					if trans == maxTabTrans then
						if ( tab1 ) then tab1 = GetGuildBankTabInfo(tab1); end
						if ( tab2 ) then tab2 = GetGuildBankTabInfo(tab2); end
						print("Last Item Transaction: ",tab,maxTabTrans,tType, tName, itemLink, count, tab1, tab2, year, month, day, hour, "Time Conversion = (", RecentTimeDate(year, month, day, hour),")");					
					end
				end
			end
                                      -- Now repeat the same process for the money log
			local maxMoneyTrans = GetNumGuildBankMoneyTransactions();
			for trans = 1,maxMoneyTrans do
				tType, tName, amount, years, months, days, hours = GetGuildBankMoneyTransaction(trans);
				if ( trans == maxMoneyTrans ) then
					print("Last Money Transaction: ",maxMoneyTrans,tType, tName, amount, year, month, day, hour, "Time Conversion = (", RecentTimeDate(year, month, day, hour),")");
				end
			end
		end
	end
end

local evFrame = CreateFrame("Frame","evFrame",UIParent);
evFrame:SetScript( "OnEvent", onEvent );
evFrame:RegisterEvent( "PLAYER_LOGIN" );
evFrame:RegisterEvent( "GUILDBANKLOG_UPDATE" );
evFrame:RegisterEvent( "GUILDBANKFRAME_OPENED" );
Changing amount to GetDenominationsFromCopper(amount) will convert it to x Gold x Silver x Copper etc as calculated.
Attached Thumbnails
Click image for larger version

Name:	WoWScrnShot_052110_155343.jpg
Views:	1399
Size:	416.3 KB
ID:	4286  
__________________


Characters:
Gwynedda - 70 - Demon Warlock
Galaviel - 65 - Resto Druid
Gamaliel - 61 - Disc Priest
Gwynytha - 60 - Survival Hunter
Lienae - 60 - Resto Shaman
Plus several others below level 60

Info Panel IDs : http://www.wowinterface.com/forums/s...818#post136818

Last edited by Xrystal : 05-21-10 at 05:19 PM.
  Reply With Quote