Thread Tools Display Modes
05-26-10, 12:35 AM   #201
clowcadia
A Chromatic Dragonspawn
Join Date: Apr 2010
Posts: 186
ok i got a simple question

i noticed that when i use messege function and insert values from a function it displays nothing
is it because i need to insert it in a string function to form it properly?

another question how would i go about orinting a table in game in a chat box, lets say i want to know what was my last transaction if i have one in the guild vault
  Reply With Quote
05-26-10, 12:38 AM   #202
clowcadia
A Chromatic Dragonspawn
Join Date: Apr 2010
Posts: 186
reason i am asking i am looking into making a separate table that contains and reacts to player tab table
it would have the players credit in the guild , so each time a player does a transaction using this add on (ass soon as the add-ons is enabled) the add-on will record and modify his credit based on what the transaction type is if he deposits it adds a credit if withdraws it -credit
  Reply With Quote
05-26-10, 12:42 AM   #203
clowcadia
A Chromatic Dragonspawn
Join Date: Apr 2010
Posts: 186
actually come to think of it it should use guild history latest tab for more secure option, although now i think of it it becomes more sketchier
  Reply With Quote
05-26-10, 12:45 AM   #204
clowcadia
A Chromatic Dragonspawn
Join Date: Apr 2010
Posts: 186
oooo i figured out something for filtering

ok since a player can deposit 25 items a go, can the addon count how many times he had done a transaction and when he did 25 the addon would force the history to tinsert
where as normally the addon would allow hirtory to be tinserted if an hour has passet
  Reply With Quote
05-26-10, 12:52 AM   #205
clowcadia
A Chromatic Dragonspawn
Join Date: Apr 2010
Posts: 186
If your officers do more than 25 a day the date testing theory won't work unless we say deal with all transactions up to an hour before your transaction run That part is easy. As all we need to do is check if year == 0 and day == 0 and hour => 1 and minute > 0 and second > 0 obviously stopping where the variables don't exist as Ive forgotten where they stop right now rofl.
so do u mean its possible to find the exact time of a transaction using the formula u specified
because there is got to be a way to find out in seconds time, because no one is that fast and that the original wow add on for guild bank does it somehow making sure that it the log list is concrete,
  Reply With Quote
05-26-10, 12:58 AM   #206
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,934
I can't recall the exact format options but you can use the format function. Let me see if I have used it in one of my more recent projects. Hmm nope.

But basically, yes, as you guessed you need to convert your mixture of values and convert them into a string. The down side is you cannot concatenate a value that is nil so your safest bet is to generate a blank string for any values that may be nil that you may want to use before merging them together.

To convert the transaction information you have read in into something meaningful you can either use the format function ( which has some useful formatting options that I can't recall at present but may be detailed in wowwiki or the lua.org manual.

Anyway, something like the following used after you have deduced the transaction to be the one you want to display:

local transName = tName or "Unknown Player"
local transItem = tItemLink or "Unknown Item"
local transType = tType or "Unknown Transaction Type"
local transTab = tab or 0
local transItemSellPrice = itemSellPrice or 0.00
local transCount = count or 1
local transTime = hour

The reason for the or "Unknown..." lines are to make sure each value that could be nil isn't nil. Then we merge them into a single string as the following ( this way is not the format function way but the quick and dirty concatenate way ).

local transMessage = "Last Transaction : " .. transName .. " " .. transType .. " " .. " in tab " .. transTab .. ", " .. transCount .. " of item " .. transItem .. " which has a selling price of " .. transItemSellPrice .. " approximately " .. transTime .. " ago."

Then use your message to print it. If it doesn't seem to work then try the normal print(transMessage) alternative just in case it is too long for a message box. But it will say something along the following lines :
"Last Transaction : Richard withraws in tab 1, 10 of item <itemLink> which has a selling price of 120000 approximately less than 1 hour ago."

The transItemSellPrice you could wrap up in that function I mention on the first few pages of this thread to convert copper into Gold/Silver/Copper variants.
The itemLink you may have to change to itemName as that may be better to display for this purpose.
__________________


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
  Reply With Quote
05-26-10, 01:12 AM   #207
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,934
Originally Posted by clowcadia View Post
so do u mean its possible to find the exact time of a transaction using the formula u specified
because there is got to be a way to find out in seconds time, because no one is that fast and that the original wow add on for guild bank does it somehow making sure that it the log list is concrete,

By the looks of it you can only go up to an hour per transaction based on the results of this function :

tType, tName, tItemLink, count, tab1, tab2, year, month, day, hour = GetGuildBankTransaction(tab,index)

using the values in year, month, day, hour you could work out what the date is but the formula would be complex That was my next thing to work on but you're welcome to take a stab at it.

If you use the

local timeTable = date("*t")

function you should then get a break down of the values held in the table which I think I listed earlier on in the thread when I found the function and explained it somewhat. Theoretically you could then hopefully do a cheap and dirty subtraction of the relevant values to get an approximate transaction time although until I test it I don't know how close to the true transaction time it would be.

EG.
Imagine Current Date/Time in table format ("*t")= { Year = 2010, Month = 5, Day = 26, Hour = 08, Minute = 05 }
Then, imagine an example transaction was recorded as being made { Year = 0, Month = 0, Day = 1, Hour = 3 }
We can then say that the approximate transaction date could be :
approxYear = currentYear - transYear 2010
approxMonth = currentMonth - transMonth 05
approxDay = currentDay - transDay 25
approxHour = currentHour - transHour 05
So, if 05:00 on 25th May 2010 is as close to 1 day and 3hrs before 08:05 on 26th May 2010 then it could well resolve that problem. We could assume that approxMinute and approxSecond were the currentDateTime equivalents but if this was checked the next day at a different time although the values up to the hour would be accurate enough anything smaller wouldn't.

Note that I named the variables to make them easier to understand where I am getting them from

You could then convert that new date into a string to create a tableKey with the same sort of string concatenation I showed earlier.
__________________


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
  Reply With Quote
05-26-10, 01:26 AM   #208
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,934
Originally Posted by clowcadia View Post
reason i am asking i am looking into making a separate table that contains and reacts to player tab table
it would have the players credit in the guild , so each time a player does a transaction using this add on (ass soon as the add-ons is enabled) the add-on will record and modify his credit based on what the transaction type is if he deposits it adds a credit if withdraws it -credit
Is it possible that each tab will get 25 transactions processed in an hour ? Just trying to think of a simpler option for you so that you don't rely on others running it, then waiting for them to send you their details when for the most part you can get the information yourself if you check it often enough.

If say you ran the addon once an hour or two hours or whenever you feel is safe to record as many transactions as possible without hitting the 25 limit which would push transactions out that you are not aware of then only you would ever need the addon and perhaps someone else to help you if you are unable to for one reason or another.

Apart from that though the current BAG_UPDATE test I think does enough to grab the last transaction made by the user and whatever you have changed so far which , at this point I cant remember
__________________


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
  Reply With Quote
05-26-10, 01:59 AM   #209
clowcadia
A Chromatic Dragonspawn
Join Date: Apr 2010
Posts: 186
o k i rethought about it
i think the best way to go about it is
if worst case scenario a person has an add on that does his guild deposit or with drat of 98 items in a second
the add-on should tinsert a new history when each 25 times bag change happens
where as normally its would change if only the each tab log data changes somewhere
i think that is the best solution is our guild vault update event is glitchy

finding out how much is legal to withdraw or deposit into a guild vault at one time

had annother thought, but if this isnt possible it might not work

can you know ur own bag transaction? lets say bag updated because of a movement of an item i want to say u moved an item

found something that can make our life easier
this we could use to determine when bag update is loaded what happend

numberOfSlots = GetContainerNumSlots(bagID);

Last edited by clowcadia : 05-26-10 at 02:34 AM.
  Reply With Quote
05-26-10, 03:00 AM   #210
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,934
Originally Posted by clowcadia View Post
o k i rethought about it
i think the best way to go about it is
if worst case scenario a person has an add on that does his guild deposit or with drat of 98 items in a second
the add-on should tinsert a new history when each 25 times bag change happens
where as normally its would change if only the each tab log data changes somewhere
i think that is the best solution is our guild vault update event is glitchy

finding out how much is legal to withdraw or deposit into a guild vault at one time

had annother thought, but if this isnt possible it might not work

can you know ur own bag transaction? lets say bag updated because of a movement of an item i want to say u moved an item

found something that can make our life easier
this we could use to determine when bag update is loaded what happend

numberOfSlots = GetContainerNumSlots(bagID);
Bear in mind that BAG_UPDATE is called 4 times when you move an item from the guild bank ( or any bank or even any other bag I believe ) and put in your own bag. And all it gives is a bagID.

Which item it was is what will be hard to track. If we also track event ITEM_PUSH while the guild bank is open it will track any item that has been placed in the inventory which hopefully came from the bank but I can't recall what frames can be open at the same time as the guild bank that could also flag up the same event. ITEM_PUSH carries with it a bagID and itemPath which helps identify a possible item there as well.

Another possibility is this one but I can't remember if I noticed this one doing multiple things that prolonged the detail search more than aided it. If you want to test it out to see what happens the print(event,...) should display the args which will help you see what sort of information you will have to deal with using whatever functions they give us.:

"ITEM_LOCK_CHANGED" Category: Item
Fires when the "locked" status on a container or inventory item changes, usually from but not limited to Pickup functions to move items.

- If arg2 is non-nil:
arg1
Bag of updated item.
arg2
Slot of updated item.

- If arg2 is nil:
arg1
Equipment slot of item

Usually fires in pairs when an item is swapping with another.
Empty slots do not lock.
GetContainerItemInfo and IsInventoryItemLocked can be used to query lock status.
This does NOT fire on ammo pickups.
Now this is why I think not all of the events for the guild bank are complete because there is an event that is pretty identical to this one and for the guild bank itself : "GUILDBANK_ITEM_LOCK_CHANGED"

However, my print statements do not show any arguments to denote which slot and tab were locked unlike its player inventory equivalent.

I hope that explains some of my annoyance/frustration at what should have been so much easier to deal with if the equivalent functions/events worked equivlantly rofl.
__________________


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-26-10 at 03:09 AM.
  Reply With Quote
05-26-10, 04:23 AM   #211
clowcadia
A Chromatic Dragonspawn
Join Date: Apr 2010
Posts: 186
Okay I think I made a hack proof theory
----------------
on load
create ptn (personal transaction number) table just to save as a variable
-------------
if vault visible then
query guild slots = gsnumber
query bag slots = bsnumber

<if bag updated then
query guild slots = ugsnumber
query bag slots = ubsnumber

<<if false = (bsnumber == ubsnumber) then

<<<if false = (gsnumber == ugsnumber) then
tinsert player transactions, history
ptn = + 1;
<<<end

<<end

<end

end
-----------------
function tracking ptn
query transaction history table
1+ = transactiontype(deposit)
1- = transactiontype(withdraw)

<if ptn = > 98 then
message(Checking PTN Information May Cause Lag)
from personal table calculate +# + -# = ot (overall transaction value)

<<if ot > ptn then
debug using item elimination in players transaction table
(eliminating players transaction deposit by matching other withdraw tables that contain exact same values but have a withdraw value)
<<<if there are deposits that have not been touched then using history and filtering by the items date added(date collected using the add-on when the bag change triggered and the item actually been inserted) match and eliminate other guild players transaction withdraws
<<<<if there is still deposits left untouched the should be created under debug table so for me then to ask my guildies for their saves and begin manual matching(but i am sure my buddy is gonna come up with a software)
message(Please Post saved variables file in guild forum under a specifict board, then delete the saved variable file. Message will persist each time u will do transactions in guid vault untill file has been deleted)
<<<<end]
<<<end
<<end
<end
end
  Reply With Quote
05-26-10, 05:16 AM   #212
clowcadia
A Chromatic Dragonspawn
Join Date: Apr 2010
Posts: 186
found a set back , cant find any function to tell me how many empty slots i have in guild bank
  Reply With Quote
05-26-10, 06:09 AM   #213
clowcadia
A Chromatic Dragonspawn
Join Date: Apr 2010
Posts: 186
uh....the GUILDBANKBAGSLOTS_CHANGED works oddly enough with a couple of glitches, but it dont freese my system anymore.. when u can try this

Code:
-- Lines beginning with '--' are comments.  
-- These help you to place descriptions about the functions you are using to help you months down the line when you need to change things.

-- These are values that once set are available throughout the addon, set them when you need to and then use them anywhere afterwards
local tType, tName, tItemLink, count, tab1, tab2, year, month, day, hour;
local itemName, itemLink, itemRarity, itemLevel, itemMinLevel, itemType, itemSubType, itemStackCount, itemEquipLoc, itemTexture, itemSellPrice;
local tAmount;
local tItemSellPrice;
local queryCount = 0;
local messageCount= 0;
local transactionLine = {};
local maxTabTransactions = 0;
local maxTabs = 0;
local maxMoneyTransactions = 0;
local currentDate = date("%m-%d-%y")
local pName;
local tabCount = 0;
local refreshCount = 0;
local logCount = 0;
local tabProcessed = {};
local Queried = false;

GuildBankTransactionsHistory = GuildBankTransactionsHistory or {}
GuildBankTransactionsTabs = GuildBankTransactionsTabs or {}
GuildBankTransactionsMoney = GuildBankTransactionsMoney or {}

-- The following is a block comment and allows for large segments to be comments instead of a line by line basis
--[[  Functions and their uses

Functions you can change to suit your requirements
=====================================================================================================================================
updateTransactionHistory(tab,index) - You use this to write to the GuildBankTransactionsHistory saved variable table specifically for tab transactions
updateMoneyTransactionHistory(index) - You use this to write to the GuildBankTransactionsHistory saved variable table specifically for money transactions
updateLastPlayerTransaction(tab) - You use this to write to the GuildBankTransactionsTabs saved variable table if you made the last tab transaction
updateLastPlayerMoneyTransaction() - You use this to write to the GuildBankTransactionsMoney saved variable table if you made the last money transaction

Functions you can change if you want to change what to store on each transaction line
=====================================================================================================================================
processTransaction(tab,index) - You use this to grab the information you want to store from the tab log in the saved variable table and when 
processMoneyTransaction(index) - You use this to grab the information you want to store from the money log into the saved variable tables and when

Functions you can change as you see fit
=====================================================================================================================================
displayMessages() - This is your function to display a message to you the user

Functions you should no longer need to change as they do every they need and passes the information onto another function to process
=====================================================================================================================================
processMoneyLog() - This function grabs every information it can from the money log transaction ready for you to use
processTabLogs() - This function grabs every information it can from the tab logs transactions ready for you to use
refreshLogInfo() - This function queries the log so that the transaction information is ready for us to use
getLogInfo() - This function gets us ready to use the data we just queried
onEvent(self,event,...) - This is the addons main frames event function and is the starting point of any addon process

--]]

-- This is the function that will update the relevant SavedVariables table
local function updateTransactionHistory(tab,index)    
	-- For this we are using GuildBankTransactionsHistory table
	
	-- Use the existing table or create a new one
	GuildBankTransactionsHistory = GuildBankTransactionsHistory or {}
	
	-- Use the existing sub table or create a new one
	GuildBankTransactionsHistory[tab] = GuildBankTransactionsHistory[tab] or {}
	
	-- Use the existing sub table or create a new one
	GuildBankTransactionsHistory[tab][currentDate] = GuildBankTransactionsHistory[tab][currentDate] or {}
	
	-- Use the existing sub table or create a new one
	GuildBankTransactionsHistory[tab][currentDate][index] = GuildBankTransactionsHistory[tab][currentDate][index] or {};
	
	-- Add the transaction
	GuildBankTransactionsHistory[tab][currentDate][index] = transactionLine;
	
end

-- This is the function that will update the relevant Saved Variables table
local function updateMoneyTransactionHistory(index)
	-- For this we are using GuildBankTransactionsHistory table
	
	-- Use the existing table or create a new one
	GuildBankTransactionsHistory = GuildBankTransactionsHistory or {}
	
	-- Use the existing sub table or create a new one
	GuildBankTransactionsHistory["Money"] = GuildBankTransactionsHistory["Money"] or {}
	
	-- Use the existing sub table or create a new one
	GuildBankTransactionsHistory["Money"][currentDate] = GuildBankTransactionsHistory["Money"][currentDate] or {}

	-- Use the existing sub table or create a new one
	GuildBankTransactionsHistory["Money"][currentDate][index] = GuildBankTransactionsHistory["Money"][currentDate][index] or {};
	
	-- Add the transaction
	GuildBankTransactionsHistory["Money"][currentDate][index] = transactionLine;
end

-- This is the function that will update the relevant SavedVariables table
local function updateLastPlayerTransaction(tab)
	-- For this we are using GuildBankTransactionsTabs to hold information

	-- Use the existing table or create a new one
	GuildBankTransactionsTabs = GuildBankTransactionsTabs or {}
	
	-- Use the existing sub table or create a new one
	GuildBankTransactionsTabs[tab] = GuildBankTransactionsTabs[tab] or {}
	
	-- Use the existing sub table or create a new one
	GuildBankTransactionsTabs[tab][pName] = GuildBankTransactionsTabs[tab][pName] or {};
	
	-- If you made this transaction then store the details or store another message
	if ( tName == pName ) then
	    -- this inserts a new table to privious once
		tinsert( GuildBankTransactionsTabs[tab][pName], transactionLine );
	else
		GuildBankTransactionsTabs[tab][pName] = { "You didn't make the last transaction" };
	end
	
end

-- This is the function that will update the relevant SavedVariables table
local function updateLastPlayerMoneyTransaction()
	-- We are using GuildBankTransactionsMoney as a SavedVariables table to hold the money transactions for your player
	
	-- Use the existing table or create a new one
	GuildBankTransactionsMoney = GuildBankTransactionsMoney or {}
	
	-- Use the existing table or create a new one
	GuildBankTransactionsMoney[pName] = GuildBankTransactionsMoney[pName] or {}
	
	-- If you made this transaction then store the details or store another message
	if ( tName == pName ) then
	    -- this inserts a new table to privious once
		tinsert( GuildBankTransactionsMoney[pName], transactionLine );
	else
		GuildBankTransactionsMoney[pName] = { "You didn't make the last transaction" };
	end
	
end

-- This is the function we can use to process the last tab transaction line read 
local function processTransaction(tab,index)

	-- If tab1 and tab2 have valid values then get their names for clarity
	if ( tab1 ) then tab1 = GetGuildBankTabInfo(tab1); end
	if ( tab2 ) then tab1 = GetGuildBankTabInfo(tab2); end       
	
	-- Record the transaction line in a table for easier insertion into main table
	transactionLine = { 
		["Transaction Type"] = tType,
		["Tab"] = tab,
		["Players Name"] = tName,
		["Item"] = itemLink,
		["Item Selling Value"] = tItemSellPrice,
		["Item Count"] = count,
		["Transaction Time"] = hour,
	};
	
	-- We want to update the transaction history regardless of who or which transaction it is
	updateTransactionHistory(tab,index);
	
	-- If this is the last transaction for the tab then see if it was yours
	if ( index == maxTabTransactions ) then 
		updateLastPlayerTransaction(tab); 
	end
end

-- This is the function we can use to process the last money transaction line read.
local function processMoneyTransaction(index)

	-- Because the data is in memory since the last read we can just format the information we want into a transaction line
	transactionLine = { 
		["Transaction Type"] = tType,
		["Player's Name"] = tName,
		["Amount"] = tAmount,
		["Transaction Time"] = hour,
	};
	
	-- Store transaction history for the Money Log
	updateMoneyTransactionHistory(index);
	
	-- If this is the last transaction then we want to see if you the player made it
	if ( index == maxMoneyTransactions ) then
		updateLastPlayerMoneyTransaction();
	end
end

-- Once you have the functions below doing what you want you shouldn't need to touch them anymore.  
-- Just adjust the functions above to change what you want to do with the data

-- This is the function that will process the Money Logs
local function processMoneyLog()

	-- if we have processed this tab already then no need to do it again
	if ( tabProcessed[maxTabs+1] ) then return end

	-- Get the maximum number of transaction that the money log contains
	maxMoneyTransactions = GetNumGuildBankMoneyTransactions();
	
	-- Give us a debug message of how many transactions there are... you will know if it is wrong :D
	print("processMoneyLog : maxMoneyTransactions = ", maxMoneyTransactions);
	
	-- For each line in the transactions we want to process them
	for index = 1,maxMoneyTransactions do
	
		-- Get the details for the transaction line
		tType, tName, amount, years, months, days, hours = GetGuildBankMoneyTransaction(index);
		  
		  --Get converted Amount
		  tAmount = GetDenominationsFromCopper(amount);
		
		-- Process the transaction as we see fit
		processMoneyTransaction(index);
		
	end
	
	-- If there were transactions or we have read all the tabs then we must have processed this log already
	if ( maxMoneyTransactions > 0 or queryCount > maxTabs ) then
		tabProcessed[maxTabs+1] = true;
	end
	
end

-- This is the function that you use to get the information out of the tabs
local function processTabLogs()
	
	-- Get your player name for testing later on
	pName = GetUnitName("player");
	
	-- For each tab in the guild bank we want to process the transactions
	for tab = maxTabs, 1, -1 do
	
		-- Set the current tab we want to work with ( its seems to like us to do this :D )
		SetCurrentGuildBankTab(tab);
	
		-- Get the maximum number of transactions this tab contains
		maxTabTransactions = GetNumGuildBankTransactions(tab);
		
		-- If this tab has not been processed yet and it has transactions then process it
		if ( not tabProcessed[tab] and maxTabTransactions > 0 ) then
			
			-- Give us a debug message of how many transactions on the current tab there are... you will know if it is wrong :D
			print("ProcessTabLogs : tab = ", tab, " maxTabTransactions = ", maxTabTransactions);
				
			-- For each line in the transactions we want to process the information
			for index = 1, maxTabTransactions do       
			
				-- Get the values for this transaction
				tType, tName, tItemLink, count, tab1, tab2, year, month, day, hour = GetGuildBankTransaction(tab, index);
				    
				    --For each Item in the transactions we want to process the Selling to Vendor Value
				    itemName, itemLink, itemRarity, itemLevel, itemMinLevel, itemType, itemSubType, itemStackCount, itemEquipLoc, itemTexture, itemSellPrice = GetItemInfo(tItemLink); 
				    
				    --Get Item Sell value converted
				    tItemSellPrice = GetDenominationsFromCopper(itemSellPrice);
				
				-- process the transaction we have now retrieved
				processTransaction(tab,index);
			end

		end
		
		-- If there were transactions or we have read all the tabs then we must have processed this tab already
		if ( maxTabTransactions > 0 or queryCount > maxTabs ) then
			tabProcessed[tab] = true;
		end
		
	end
	SetCurrentGuildBankTab(1);
end

-- This is the function that will refresh the log information
local function refreshLogInfo(tabCount)
	-- Get the maximum number of bank tabs the guild bank currently has
	maxTabs = GetNumGuildBankTabs();
	queryCount = 0;
	
	-- We have been incrementing tabCount to ensure we get all the information
	-- But if the tabCount is more than there are tabs then we have all the information at hand so query the whole lot
	if ( tabCount > maxTabs ) then
		QueryGuildBankLog(MAX_GUILDBANK_TABS+1);
		for tab = 1,maxTabs do
			SetCurrentGuildBankTab(tab);
			QueryGuildBankLog(tab);
			QueryGuildBankTab(tab);
		end
		
		-- Then reset back to the original tab and reset the tabCount
		SetCurrentGuildBankTab(1);
		tabCount = 0;
	end
	
end

-- This is the function that starts the information gathering off
local function getLogInfo()
	queryCount = queryCount + 1;
	processTabLogs();	
	processMoneyLog();	
end

-- This is the function that the frame will use to process the events as they happen
local function onEvent(self,event,...)

if ( event == "GUILDBANKBAGSLOTS_CHANGED" ) then
      print(event)
   end
	
	-- When this addon is loaded make sure the Blizzard GuildBank UI is loaded
	if ( event == "ADDON_LOADED" ) then
		if ( arg1 == "GuildBankTransactions" ) then
			if ( not IsAddOnLoaded("Blizzard_GuildBankUI") ) then
				LoadAddOn("Blizzard_GuildBankUI");
			end
			tabCount = 0;
			logCount = 0;
		end

	-- If you have just opened the guild bank frame then refresh the Log Information
	elseif ( event == "GUILDBANKFRAME_OPENED" ) then
		-- reset the tabProcessing status whenever we open the frame
		tabProcessed = {};
		tabCount = tabCount + 1;
		logCount = 0;
		refreshLogInfo(tabCount);

	-- If your bag has had an update and the guild bank frame is open then refresh the Log Info just in case it was a guild bank transaction too
	elseif ( event == "BAG_UPDATE" ) then
		if ( GuildBankFrame:IsVisible() ) then 
			refreshLogInfo(maxTabs+1);
		end
		
	-- When the blizzard GuildBankUI is loaded it processes each tab so lets use that to get our info
	-- It also does this when you first open the frame 
	elseif ( event == "GUILDBANK_UPDATE_TABS" ) then
		tabCount = tabCount + 1;
		refreshLogInfo(tabCount);
		
	-- If the GUILDBANKLOG_UPDATE event has been triggered due to refreshing the Log Info then process the Log Information we now have
	elseif ( event == "GUILDBANKLOG_UPDATE" ) then
		logCount = logCount + 1;
		getLogInfo(logCount);
	end
end

-- Create the Frame that will handle any events, it currently has no physical form but it is in memory
local evFrame = CreateFrame("Frame","evFrame",UIParent);

-- Inform the frame that it will process several events
evFrame:SetScript( "OnEvent", onEvent );

-- Inform the frame which events it will process
evFrame:RegisterEvent( "ADDON_LOADED" );
evFrame:RegisterEvent( "BAG_UPDATE" );
evFrame:RegisterEvent( "GUILDBANKLOG_UPDATE" );
evFrame:RegisterEvent( "GUILDBANKFRAME_OPENED" );
evFrame:RegisterEvent( "GUILDBANK_UPDATE_TABS" );
evFrame:RegisterEvent( "GUILDBANKBAGSLOTS_CHANGED" );
dont know how to prevent it running 3 times at first few times but its woring nicely

when i actually put something in it runs 9 times then 15 times for witdrawal

lol tested it with either guild tab change having inside bag change even or vise versa dose nothing

but understanding the times it does it makes me think why dont we let it run depending on a transaction(i think we can figure out a transaction based on the number of free slots changed in bags) a number of times and then either ont he last or first and let it run and on a specific number of it running we can have it load the transactions and actually set our own time of transaction made

also if ur curious about why it does it so many times, that be cool to figure out and fix. but other then that i can figure this out, but i just dont know how to use 2 events that depend on eachother(or i dont need to i can just do the bag free slots function) but i havent slept so me sleepy

Last edited by clowcadia : 05-26-10 at 06:28 AM.
  Reply With Quote
05-26-10, 07:25 AM   #214
clowcadia
A Chromatic Dragonspawn
Join Date: Apr 2010
Posts: 186
lol any idea what i am doing wrong

Code:
if ( event == "GUILDBANKBAGSLOTS_CHANGED" ) then
  bNumberOfFreeSlots, BagType = GetContainerNumFreeSlots(0);
  bNumberOfFreeSlots, BagType = GetContainerNumFreeSlots(1);
  bNumberOfFreeSlots, BagType = GetContainerNumFreeSlots(2);
  bNumberOfFreeSlots, BagType = GetContainerNumFreeSlots(3);
  bNumberOfFreeSlots, BagType = GetContainerNumFreeSlots(4);
  if ( aNumberOfFreeSlots == bNumberOfFreeSlots ) == false then
  print(event)
  end
  end
Code:
elseif ( event == "BAG_UPDATE" ) then
	aNumberOfFreeSlots, BagType = GetContainerNumFreeSlots(0);
  aNumberOfFreeSlots, BagType = GetContainerNumFreeSlots(1);
  aNumberOfFreeSlots, BagType = GetContainerNumFreeSlots(2);
  aNumberOfFreeSlots, BagType = GetContainerNumFreeSlots(3);
  aNumberOfFreeSlots, BagType = GetContainerNumFreeSlots(4);
  aNumberOfFreeSlots, BagType = GetContainerNumFreeSlots(5);
		if ( GuildBankFrame:IsVisible() ) then 
			refreshLogInfo(maxTabs+1);
		end
  Reply With Quote
05-26-10, 08:25 AM   #215
clowcadia
A Chromatic Dragonspawn
Join Date: Apr 2010
Posts: 186
ok tested this and it works better than it had before
Code:
local function onEvent(self,event,...)
if ( event == "BAG_UPDATE" ) then
elseif ( event == "GUILDBANKBAGSLOTS_CHANGED" ) then
print(event)
end
end
only 2s it runs for each transaction made
and once on load but the probleme is i think it disables other functions that allow me to see the chat bar function when i load the guild vault window and probaly doesnt record anything either
  Reply With Quote
05-26-10, 09:01 AM   #216
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,934
the BagID value for that function may not be as simple as a running number sequence. Although the working example on this page says both the numbers and the fact that there are constants to use instead rofl.

http://www.wowwiki.com/BagId

Also, in case you were thinking of taking the bagType into account for something then you might want to read through this http://www.wowwiki.com/BagType.

Also, http://www.wowwiki.com/API_GetContainerItemInfo, will explain something about the lockedItem test used to see if an item is in the process of a transaction of some sort. Auction, Trading etc.

Code:
local maxBagSlots, bagSlotCount, bagType;
-- Your personal bags
for bagID = 1, NUM_BAG_SLOTS do
     bagSlotCount, bagType = GetContainerNumFreeSlots(bagID);
     maxBagSlots = GetContainerNumSlots(bagID);
     for slotID = 1, maxBagSlots do
          bagItemTexture, bagItemCount, bagItemLocked, bagItemQuality, bagItemReadable = GetContainerItemInfo(bagID, slotID);
          bagItemID = GetContainerItemID(bagID, slotID);
          bagItemLink = GetContainerItemLink(bagID, slotID)
          if ( bagItemID ) then
             -- we have something in here 
             multipleItemInfo = GetItemInfo(bagItemID) ... or whatever the function is rofl
          end
     end
end
Another useful function to look at for its description is http://www.wowwiki.com/API_GetNumBankSlots but seeing as you're dealing with guild bank you may not need to worry about this block of code for this project just use a set of variables to keep the bagIDs in the correct order. I'll add some variables you can use below all this stuff.

Code:
-- Your personal bank bags
for bankBagID = NUM_BAG_SLOTS+1 to NUM_BAG_SLOTS+NUM_BANKBAGSLOTS do
    bankBagNumSlots, bankBagFull = GetNumBankSlots();
    -- Other ContainerItem functions can be used here too 
    -- bear in mind that this loop will also include bags you don't have
    -- but I recall one of the transactions returning 0 if the bag doesn't exist
    -- so double check each function I added in the other code block and use
    -- if/end statements to test before doing the related functions
end
Code:
maxPurchasedGuildBankTabs = GetNumGuildBankTabs()
for tabID = 1, MAX_GUILD_BANK_TABS do
    -- if we haven't purchased any more tabs then stop here
    if ( tabID > maxPurchaedGuildBankTabs ) then break; end
    -- We have purchased this tab so carry on
    gbTabName, gbTabTexture = GetGuildBankTabInfo(tabID)
    for slotID = 1, MAX_SLOTS_PER_GULD_BANK_TAB do
        gbItemTexture, gbItemAmount, gbItemLoocked = GetGuildBankItemInfo(tabID, slotID)
        gbItemLink = GetGuildBankItemLink(tabID, slotID) 
    end
end
If you decide to use the GuildBankPermission test then you might want to read up on the limitations and alternative functions http://www.wowwiki.com/API_GetGuildBankTabPermissions.

Code:
-- max Numer of Bag Slots you can own
local maxPersonalBagCount = NUM_BAG_SLOTS;
-- first/last of Personal Bag IDs for use with for/end blocks
local firstPersonalBagID = 0;
local lastPersonalBagID = maxPersonalBagCount;
-- max Number of your Bank bag Slots
local maxPersonalBankBagCount = NUM_BANKBAGSLOTS;
-- first/last bagIDs for your Bank bag Slots
local firstPersonalBankBagID = maxPersonalBagCount + 1;
local lastPersonalBagBagID = maxPersonalBagCount + maxPersonalBankBagCount;
-- maximum number of slots per guild bank tab
local maxGuildBankSlotsPerTab = MAX_GUILDBANK_SLOTS_PER_TAB;
local maxGuildBankTabs = MAX_GUILDBANK_TABS ( double check this one rofl )
Oh, think this function is something you might want to look at based on some earlier comments you made :

inventoryId = ContainerIDToInventoryID(bagID)

It converts the ContainerID into an InventoryID that is usable in some functions like PutItemInBag like functions which I believe you mentioned once or twice

Well theres a start to some more investigation on bag information. There are more item functions and inventory functions that you can use on any itemID or itemLink you can get hold of. Remember to test for a valid itemID or itemLink before trying to use it as sometimes they will return nil if you haven't looked at the item at least once manually
__________________


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
  Reply With Quote
05-26-10, 09:02 AM   #217
clowcadia
A Chromatic Dragonspawn
Join Date: Apr 2010
Posts: 186
got u something ^^ i think u might like its like present from ur apprentice that can blow ur mind..(or try)

Code:
-- If your bag has had an update and the guild bank frame is open then refresh the Log Info just in case it was a guild bank transaction too
	elseif ( event == "GUILDBANKBAGSLOTS_CHANGED" ) then
		if ( GuildBankFrame:IsVisible() ) then
		messageCount = messageCount + 1;
		if ( messageCount < 2 ) then
			refreshLogInfo(maxTabs+1);
			end
		end
works perfectly replacing the BAG_UPDATE
might wanna change the count but it dont freese anything anymore now i just want to have it intergrated if the bag slots get changed
  Reply With Quote
05-26-10, 09:11 AM   #218
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,934
Originally Posted by clowcadia View Post
ok tested this and it works better than it had before
Code:
local function onEvent(self,event,...)
if ( event == "BAG_UPDATE" ) then
elseif ( event == "GUILDBANKBAGSLOTS_CHANGED" ) then
print(event)
end
end
only 2s it runs for each transaction made
and once on load but the probleme is i think it disables other functions that allow me to see the chat bar function when i load the guild vault window and probaly doesnt record anything either
Yes, with that code block you have turned off the other event tests that query the code.

What I do if I want to make sure certain events are utilised when another event has taken place is to first watch for a consistent order of events and use a variable to store the last event caught and test against it before processing another one. In most cases it will work but for things like BAG_UPDATE you may have to do something special. Heres an example:

Bear in mind I may be making the event names up at this point rofl
Code:
if ( event == "GUILD_BANK_FRAME_OPENED" ) then
    lastEvent = event;
    guildBankFrameOpen = true;
elseif ( event == "GUILD_BANK_FRAME_CLOSED") then
    lastEvent = event;
    guildBankFrameOpen = false;
elseif ( event == "BAG_UPDATE" ) then
    lastEvent = event;
    if ( guildBankFrameOpen ) then 
       -- we may be doing a guild bank transaction so do something to test this
       if ( lastBagUpdated and arg1 == lastBagUpdated ) then
          -- bagUpdate inside same bag .. hmm not sure what to do here yet
       else
          -- possible bag movement so get some values to later use
          fromBagID = lastBagUpdated;
          toBagID = arg1;
          -- Some functions to check which items were moved but not sure how
          -- maybe something to do wth the lockStatus of an item 
          lastBagUpdated = arg1;
    end
end
As you can see it can get pretty complicated so like I did with the other code you may find it more useful to break the blocks into functions and pass parameters to them to keep the code tidier and more readable.
__________________


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
  Reply With Quote
05-26-10, 09:11 AM   #219
clowcadia
A Chromatic Dragonspawn
Join Date: Apr 2010
Posts: 186
also i thinki i did this right to reset the message count i had(i changed its name)

Code:
-- If the GUILDBANKLOG_UPDATE event has been triggered due to refreshing the Log Info then process the Log Information we now have
	elseif ( event == "GUILDBANKLOG_UPDATE" ) then
	    ggbbscCount = 0;
		logCount = logCount + 1;
		getLogInfo(logCount);
	end
  Reply With Quote
05-26-10, 09:14 AM   #220
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,934
Originally Posted by clowcadia View Post
got u something ^^ i think u might like its like present from ur apprentice that can blow ur mind..(or try)

Code:
-- If your bag has had an update and the guild bank frame is open then refresh the Log Info just in case it was a guild bank transaction too
	elseif ( event == "GUILDBANKBAGSLOTS_CHANGED" ) then
		if ( GuildBankFrame:IsVisible() ) then
		messageCount = messageCount + 1;
		if ( messageCount < 2 ) then
			refreshLogInfo(maxTabs+1);
			end
		end
works perfectly replacing the BAG_UPDATE
might wanna change the count but it dont freese anything anymore now i just want to have it intergrated if the bag slots get changed
cool you're getting there rofl

I'm gonna leave you with playing with these bag update things and I'm gonna try and see if I can get some sort of transactiontime reference for a transaction unless you got my theoretical tests integrated and working
__________________


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
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Trying to see guild bank transaction information


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off