Go Back   WowAce Forums > Addon Chat > Libraries
Libraries Threads for new libraries and mixins.

Reply
 
Thread Tools
Old 04-29-2010   #1
myrroddin
Amazing Member
 
Join Date: May 2006
Location: Edmonton, Canada
Posts: 1,158
Send a message via MSN to myrroddin
Default LibGuildBankComm-1.0 Official Thread

LibGuildBankComm-1.0 is designed for bag and inventory addons to communicate the contents of the Guild Bank, regardless of the addon in question. Bag and Inventory addons will need to embed this lib (I think) as it isn't automatic unless you have this lib.

I will do up some docs after the project is finished, approved, .. even created on wowace. Right now it isn't created, because I need feedback. This is my first attempt at writing a library file, and I'm sure I botched something.

Thus far, the two callbacks are GuildBankComm_RosterUpdate(unit, contents) and GuildBankComm_ContentsChanged(unit, contents). The first fires when someone new joins the guild, and the second fires when the contents of the guild bank change, whether money or items.

Do not use this lib with any addons right now! It isn't working, and the _ContentsChanged() callback is missing in places. What I need is people to teach me how to scan tabs for items, adding them to gbContents.numTab.item one, gbContents.numTab.item two, etc, because I couldn't quite figure that part out. If it is not needed to have the tab number, that's fine.

Please poke sticks at this, tell me where I went wrong, what you want to see added (is there any APIs you want?) and generally go over this with the fine tooth comb, please. Xinhuan was mentioning something about the .pkgmeta, which I did not provide, but if there is something special I need to do in the .pkgmeta, then I do not know what it is. I was just going to create a normal .pkgmeta file.

When it is working, any authors using this lib will also need AceAddon-3.0, AceEvent-3.0, and AceComm-3.0 along with LibStub and CallbackHandler-1.0.
Attached Files
File Type: zip LibGuildBankComm-1.0.zip (27.9 KB, 3 views)
myrroddin is offline   Reply With Quote
Old 04-29-2010   #2
Adirelle
Legendary Member
 
Adirelle's Avatar
 
Join Date: Dec 2006
Posts: 2,390
Default Re: LibGuildBankComm-1.0 Official Thread

Why does this ever fire the GuildBankComm_RosterUpdate callback ?
__________________
Author of AdiButtonAuras, AdiBags, Squire2 and several other addons.

Each time you hit your "copy" command with a block of code, think about a way to refactor it so it did what you want without using the "paste" command.
Adirelle is online now   Reply With Quote
Old 04-29-2010   #3
Xinhuan
Asian Sheep Lover
 
Xinhuan's Avatar
 
Join Date: Aug 2007
Location: Singapore
Posts: 4,033
Default Re: LibGuildBankComm-1.0 Official Thread

While I don't intend to write any specifics as to the wow's guild bank API, you can see how I use it to store guild bank information in BankItems when certain guild bank events fire.
__________________
Author/Maintainer of Postal, Omen3, GemHelper, BankItems, WoWEquip, GatherMate, Routes, HandyNotes and some others.
Xinhuan is offline   Reply With Quote
Old 04-29-2010   #4
Starinnia
Hero Member
 
Starinnia's Avatar
 
Join Date: Jun 2006
Location: Chicago
Posts: 654
Default Re: LibGuildBankComm-1.0 Official Thread

You could also look at MobileVault to learn about using the API Gbank functions.

Although I have to ask, why do we need a lib for this? It would seem that most users would only have maybe 1 or 2 addons that would interact with the guild bank... (I'm really just asking, not trying to discourage you from writing it.)
__________________
Author of SimpleMD, MobileVault, MillHelp, Sifter, ComboPointsRedux, RealID Toons, and Prescription.
Starinnia is offline   Reply With Quote
Old 04-29-2010   #5
Adirelle
Legendary Member
 
Adirelle's Avatar
 
Join Date: Dec 2006
Posts: 2,390
Default Re: LibGuildBankComm-1.0 Official Thread

Quote:
Originally Posted by Starinnia View Post
Although I have to ask, why do we need a lib for this? It would seem that most users would only have maybe 1 or 2 addons that would interact with the guild bank... (I'm really just asking, not trying to discourage you from writing it.)
I guess it is about having a common communication channel, so several, different bag/bank addons could still display the guild bank.
__________________
Author of AdiButtonAuras, AdiBags, Squire2 and several other addons.

Each time you hit your "copy" command with a block of code, think about a way to refactor it so it did what you want without using the "paste" command.
Adirelle is online now   Reply With Quote
Old 04-29-2010   #6
Starinnia
Hero Member
 
Starinnia's Avatar
 
Join Date: Jun 2006
Location: Chicago
Posts: 654
Default Re: LibGuildBankComm-1.0 Official Thread

Ah, so syncing between users in a guild. To allow for updates when you aren't actually looking at the bank but somebody else is.

That sounds like something cool.
__________________
Author of SimpleMD, MobileVault, MillHelp, Sifter, ComboPointsRedux, RealID Toons, and Prescription.
Starinnia is offline   Reply With Quote
Old 04-30-2010   #7
myrroddin
Amazing Member
 
Join Date: May 2006
Location: Edmonton, Canada
Posts: 1,158
Send a message via MSN to myrroddin
Default Re: LibGuildBankComm-1.0 Official Thread

Quote:
Originally Posted by Starinnia View Post
Although I have to ask, why do we need a lib for this? It would seem that most users would only have maybe 1 or 2 addons that would interact with the guild bank... (I'm really just asking, not trying to discourage you from writing it.)
Quote:
Originally Posted by Adirelle View Post
I guess it is about having a common communication channel, so several, different bag/bank addons could still display the guild bank.
Exactly. The idea is that if three different guildies use three different bank/inventory addons, say TBag, OneBag, and ArkInventory, if the addons used the lib, then no matter which guildie visits the gbank, all three get updated at once.
myrroddin is offline   Reply With Quote
Old 04-30-2010   #8
myrroddin
Amazing Member
 
Join Date: May 2006
Location: Edmonton, Canada
Posts: 1,158
Send a message via MSN to myrroddin
Default Re: LibGuildBankComm-1.0 Official Thread

Quote:
Originally Posted by Adirelle View Post
Why does this ever fire the GuildBankComm_RosterUpdate callback ?
My thought process was that if someone joins the guild, then that callback would fire, and the new member, if they had a compatible bag addon, would automatically get the updated contents of the gbank.

If you look further into the code, and hopefully I did it correctly, when you the player leave a guild, the array with the gbank contents gets wiped to reduce resources and add a bit of security. The security probably isn't necessary, as a player cannot access the gbank of a guild he/she is not a member of, but still.
myrroddin is offline   Reply With Quote
Old 04-30-2010   #9
Adirelle
Legendary Member
 
Adirelle's Avatar
 
Join Date: Dec 2006
Posts: 2,390
Default Re: LibGuildBankComm-1.0 Official Thread

This means that, when a new player logged in, every lib-using players would send the bank content over the guild channel, whether the newcomer had the library or not. That would be spammy as hell ; imagine 30 people that sent the bank content every time someone logged in.

I would recommend you to attach a timestamp to the data, which would be the last time the data was updated. And then use the following logic to handle sync:

Code:
When the player logs in, send "REQUEST" with data timestamp.

When receiving "REQUEST" with a data timestamp:
- if the received timespamp is greater or equal to the local timestamp, ignore the message,
- else start the sync timer,

If the running sync timer ends without being cancelled, send a "SYNC" message with local data and timestamp.

When receiving "SYNC" with data and timestamp:
- if the received timestamp is greater than the local timestamp, update the data and cancel any running sync timer,
- if the local timestamp is greater than the received timestamp, start the sync timer.
I think that to be efficient, the sync timer delay should be a value depending on data age. This way, players having more up-to-date data would respond earlier, preventing other players with older data to send them.

And BTW, when updating data directly from the bank tab, do not send any update message before the player closed the window.

Given that the guildbank API only allows one tab to be scanned at once, I think you will have to handle each tab as a separate piece of data, with its own timestamp.
__________________
Author of AdiButtonAuras, AdiBags, Squire2 and several other addons.

Each time you hit your "copy" command with a block of code, think about a way to refactor it so it did what you want without using the "paste" command.

Last edited by Adirelle; 04-30-2010 at 11:21 AM.
Adirelle is online now   Reply With Quote
Old 04-30-2010   #10
myrroddin
Amazing Member
 
Join Date: May 2006
Location: Edmonton, Canada
Posts: 1,158
Send a message via MSN to myrroddin
Default Re: LibGuildBankComm-1.0 Official Thread

Reworking, might be into the weekend before I zip up a new copy. I am taking the advice, as it is good.
myrroddin is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

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

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

Forum Jump


All times are GMT. The time now is 05:39 PM.