Download
(2Kb)
Download
Updated: 11-26-14 01:02 AM
Compatibility:
Warlords of Draenor (6.0.3)
Warlords of Draenor Pre-Patch (6.0.2)
Updated:11-26-14 01:02 AM
Created:11-26-14 12:54 AM
Downloads:1,325
Favorites:6
MD5:

AutoReagentBank

Version: 2
by: CobraA1 [More]

AutoReagentBank is a simple addon that deposits reagents into your Reagent Bank when you open your bank.


There is no configuration, simply enable or disable the addon as desired on your characters.

v1: Initial release
v2: Added license to file
Optional Files (0)


Post A Reply Comment Options
Unread 11-26-14, 10:46 PM  
VincentSDSH
Non-Canadian Luzer!
 
VincentSDSH's Avatar
AddOn Author - Click to view AddOns

Forum posts: 350
File comments: 257
Uploads: 12
Originally Posted by CobraA1
If you place DepositReagentBank by itself into the BANKFRAME_OPENED event, you'll get this error...
I know *sigh* that's what I was going to have to write myself something for -- it just got annoying having BugSack scream FATALITY! every time I opened the bank.

Originally Posted by CobraA1
Nope, delaying the call, even for several seconds, doesn't work. Apparently DepositReagentBank does some extra stuff needs to be done. So the code stays as-is for now, although more elegant solutions would certainly be appreciated if anybody has any ideas.
The reason I asked is b/c the construction you have doesn't prevent multiple calls (which is what I assumed it did when I glanced at it) it just gates the first of multiple (on the first open, it seems to be called once but is called multiple times as you move around the bank/tabs/etc), so I had wondered why a simplified version wasn't preferable. e.g.,
Code:
	if not BankFrameItemButton_Update_ORI then -- Copy the function and re-write it
		BankFrameItemButton_Update_ORI = BankFrameItemButton_Update 
		
		BankFrameItemButton_Update = function(button)
				BankFrameItemButton_Update_ORI(button)
		end		
	end

	DepositReagentBank()
	Print("Reagents done been chucked in the bank -- unless you didn't buy it then ignore this message")
I've had no errors or odd behavior while running it in this form (so far).


DepositReagentBank() also seems kinda blind. An error does get thrown if you don't have it but not by the DepositReagentBank() function or any other I can find.
Last edited by VincentSDSH : 11-27-14 at 12:15 AM.
Report comment to moderator  
Reply With Quote
Unread 11-26-14, 11:32 AM  
CobraA1
A Cliff Giant
 
CobraA1's Avatar
AddOn Author - Click to view AddOns

Forum posts: 73
File comments: 98
Uploads: 3
Nope, delaying the call, even for several seconds, doesn't work. Apparently DepositReagentBank does some extra stuff needs to be done. So the code stays as-is for now, although more elegant solutions would certainly be appreciated if anybody has any ideas.
Report comment to moderator  
Reply With Quote
Unread 11-26-14, 09:50 AM  
CobraA1
A Cliff Giant
 
CobraA1's Avatar
AddOn Author - Click to view AddOns

Forum posts: 73
File comments: 98
Uploads: 3
Originally Posted by VincentSDSH
Thanks for this, I was just thinking I had to write myself something for this.

I can't help but ask though, what the 'BankFrameItemButton_Update_PASS' business is all about. It's only TRUE for the first round in the update storm so it skips using the _OLD button only the first time. Simplifying the code ( to just always feed _OLD a context ) doesn't seem to produce any errors (at least with the testing I've done, using chars with and without the reagent slot). I gather I'm missing something esoteric (or bloody obvious)
If you place DepositReagentBank by itself into the BANKFRAME_OPENED event, you'll get this error:

Code:
FrameXML\BankFrame.lua:73: attempt to index local 'button' (a nil value)
FrameXML\BankFrame.lua:73: in function `BankFrameItemButton_Update'
FrameXML\BankFrame.lua:283: in function <FrameXML\BankFrame.lua:250>
Avoiding that error is really what the code is all about . . . and why, I assume, such an addon wasn't created before.

The whole purpose of the whole mess is really to temporarily bypass BankFrameItemButton_Update the first time it gets called, as DepositReagentBank apparently creates an event PLAYERREAGENTBANKSLOTS_CHANGED, which immediately calls BankFrameItemButton_Update with an invalid parameter.

I assume that this is due to something not being initialized yet, because subsequent calls to BankFrameItemButton_Update are successful and do not create the error message. Therefore, yes I do only override it once, that is intentional.

This isn't a problem for the player because it's impossible to open the bank, switch to the Reagent Bank Tab, and click the "Deposit All Reagents" button during the exact same frame that BANKFRAME_OPENED is fired. But when I automate it, I have to try to avoid creating that error message.

Now that I think about it, I could try delaying calling DepositReagentBank until a few frames in the future, rather than calling it as soon as BANKFRAME_OPENED is fired. That would be a bit more elegant and might still work, perhaps.
Report comment to moderator  
Reply With Quote
Unread 11-26-14, 05:40 AM  
VincentSDSH
Non-Canadian Luzer!
 
VincentSDSH's Avatar
AddOn Author - Click to view AddOns

Forum posts: 350
File comments: 257
Uploads: 12
Thanks for this, I was just thinking I had to write myself something for this.

I can't help but ask though, what the 'BankFrameItemButton_Update_PASS' business is all about. It's only TRUE for the first round in the update storm so it skips using the _OLD button only the first time. Simplifying the code ( to just always feed _OLD a context ) doesn't seem to produce any errors (at least with the testing I've done, using chars with and without the reagent slot). I gather I'm missing something esoteric (or bloody obvious)
Report comment to moderator  
Reply With Quote
Post A Reply



Category Jump:

Support AddOn Development!

You have just downloaded by the author . If you like this AddOn why not consider supporting the author? This author has set up a donation account. Donations ensure that authors can continue to develop useful tools for everyone.