Thread Tools Display Modes
09-06-13, 06:24 AM   #1
Malsomnus
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Apr 2013
Posts: 203
Guild Bank API

In a nutshell: the guild supplies flasks for raid nights by putting stacks of 3 flasks each in a GB tab and letting each raider withdraw one stack. I reckon it would save the officers time if I could write an add-on that automatically splits stacks for them.
So I've found the function that lets me pick up part of a stack from guild bank, so I can take 3 flasks out of a bigger stack, and I just can't find a function that drops the item from the cursor into a guild bank slot.
Am I missing something? Is this somehow fundamentally impossible to do? Or is the function just hidden somewhere with an uninformative name?
__________________
SanityCheck - If you've ever said the words "Sorry, I forgot" then you need this add-on.

Remember, every time you post a comment on an add-on, a kitten gets its wings!
  Reply With Quote
09-06-13, 07:19 AM   #2
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,290
Maybe this?
http://www.wowwiki.com/MACRO_click

Like this macro simulates right click on your item in your main bag on the 16th slot:

/click ContainerFrame1Item16 RightButton

Last edited by Resike : 09-06-13 at 07:26 AM.
  Reply With Quote
09-06-13, 07:55 AM   #3
Malsomnus
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Apr 2013
Posts: 203
Even better is the first note in that link. Yeah, this should probably do the trick, thanks
__________________
SanityCheck - If you've ever said the words "Sorry, I forgot" then you need this add-on.

Remember, every time you post a comment on an add-on, a kitten gets its wings!
  Reply With Quote
09-06-13, 08:13 AM   #4
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,290
The bad part it's seems like you cant call macros like that from addons. However i saw a nasty workaround: To open the chat box, paste some string into it and simulate enter. But i dont remember which addon was that.
  Reply With Quote
09-06-13, 08:39 AM   #5
Malsomnus
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Apr 2013
Posts: 203
Originally Posted by Resike View Post
The bad part it's seems like you cant call macros like that from addons. However i saw a nasty workaround: To open the chat box, paste some string into it and simulate enter. But i dont remember which addon was that.
That is practically a war crime
I'm just going to do what that link says that the macro does, and directly call the OnClick of the bank buttons (I'm almost positive that they are buttons).
__________________
SanityCheck - If you've ever said the words "Sorry, I forgot" then you need this add-on.

Remember, every time you post a comment on an add-on, a kitten gets its wings!
  Reply With Quote
09-06-13, 08:49 AM   #6
Dridzt
A Pyroguard Emberseer
 
Dridzt's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2005
Posts: 1,360
You're over-complicating things.

All you need is SplitGuildBankItem(tab,slot,amount) and PickupGuildBankItem(tab,slot)
(at the core, obviously you'll need more code to find the appropriate items/stacks, and empty space, or make empty space etc)

Neither is protected.
PickupGuildBankItem() works as both a 'pick-up' or 'place-down' depending what's on the cursor / not, what's in the bankslot / not.

Last edited by Dridzt : 09-06-13 at 08:51 AM.
  Reply With Quote
09-06-13, 09:25 AM   #7
Malsomnus
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Apr 2013
Posts: 203
That does sound simpler. That function needs a more informative name
__________________
SanityCheck - If you've ever said the words "Sorry, I forgot" then you need this add-on.

Remember, every time you post a comment on an add-on, a kitten gets its wings!
  Reply With Quote
09-06-13, 01:38 PM   #8
myrroddin
A Pyroguard Emberseer
 
myrroddin's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 1,240
If you do end up writing an AddOn to work with the guild bank, you could look at LibGuildBankComm. It doesn't have APIs for what you want, but as Dridzt said, you don't need much. However, it offers many other benefits.
  Reply With Quote
09-08-13, 02:59 PM   #9
Malsomnus
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Apr 2013
Posts: 203
The bug I ended up with is quite interesting.
It appears that I cannot call SplitGuildBankItem and PickupGuildBankItem more than 4 times at once - after that I can see that they are called correctly but they don't do anything. I wonder if there's any way around that except waiting a bit before calling them again.
__________________
SanityCheck - If you've ever said the words "Sorry, I forgot" then you need this add-on.

Remember, every time you post a comment on an add-on, a kitten gets its wings!
  Reply With Quote
09-08-13, 03:24 PM   #10
Dridzt
A Pyroguard Emberseer
 
Dridzt's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2005
Posts: 1,360
I think there's a round-trip server side somewhere in guild bank updates so you'll have to put a delay in yeah.

I don't know specifics but I remember some addons that do sorting/stacking etc had that issue and a delay between updates was the solution.
  Reply With Quote
09-09-13, 01:03 AM   #11
humfras
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Oct 2009
Posts: 131
Originally Posted by Dridzt View Post
I think there's a round-trip server side somewhere in guild bank updates so you'll have to put a delay in yeah.

I don't know specifics but I remember some addons that do sorting/stacking etc had that issue and a delay between updates was the solution.
Correct, there is a server-side delay to prevent picking/moving a bazillion items from the guild bank at once.
Seems to be roughly 0.5 seconds (at least that's a good delay to make it work).
__________________
Author of VuhDo CursorCastBar OptiTaunt Poisoner RaidMobMarker
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Guild Bank API


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