Thread Tools Display Modes
08-05-24, 11:48 AM   #1
Glisern
A Defias Bandit
AddOn Author - Click to view addons
Join Date: Jul 2019
Posts: 2
What is required for a currency update?

So I've made an addon that does something with currencies.

However I cannot for the life of me figure out how to load it in when the addon starts.

The only way to actually get the information, is to go into the currencies tab, click on one that is transferable, and wait until the red transfer button stops having the loading symbol, and just says "transfer"

Does anyone know if it's possible for an addon to trigger this update? And if so, how?

All I know is that the event trace says "ACCOUNT_CHARACTER_CURRENCY_DATA_RECEIVED"
and that including "Blizzard_TokenUI" as a RequiredDepsdoes nothing
  Reply With Quote
08-05-24, 12:30 PM   #2
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 6,007
In regards to your specific query - I have never played with the currency tab so can't really answer your question without researching it myself. Hopefully someone has played with it before and can steer you in the right direction. Good Luck.

Some useful links

Here is a link with a basic example of how to create an addon, with additional learning steps for specific aspects.

https://warcraft.wiki.gg/wiki/Create..._in_15_Minutes


The only thing it doesn't do ( I think ) is the dependancy part of your query. This link may help you understand that part of addons.

https://warcraft.wiki.gg/wiki/TOC_format


Looking at an existing up to date addon ( the simpler the better ) can be a good source for help.

Basically you want some sort of event management to handle what to do when certain events trigger.
In regards to the dependancy, you have 2 options.
1. Add the dependancy to your TOC file to have that addon load before yours ( or should do )
2. Use your addon's ADDON_LOADED event to monitor when the other addons are loaded and continue on once all have been checked as loaded.

And, if you haven't seen it yet, this is the main page for the api help.
https://warcraft.wiki.gg/wiki/Warcra..._customization

I visit the Blizzard API code alot to help in my addon work. The link below takes you to the one I use.
https://github.com/Gethe/wow-ui-sour...terface/AddOns
You can change from live to other versions as needed.
__________________


All Level 70 Characters:
Demon Warlock
Resto Druid
Disc Priest
Resto Shaman
Survival Hunter
Augment Evoker
Frost Mage
Vengence Demon Hunter
Rogue ( was subtlety )

Brewmaster Monk (TR)
Prot Paladin (TR)
Blood Death Knight ( TR)

As you can see I am missing a warrior

And .. I don't have all the allied races covered. Time Runner time when it happens again


Last edited by Xrystal : 08-05-24 at 12:34 PM.
  Reply With Quote
08-05-24, 12:51 PM   #3
Glisern
A Defias Bandit
AddOn Author - Click to view addons
Join Date: Jul 2019
Posts: 2
Originally Posted by Xrystal View Post
In regards to your specific query - I have never played with the currency tab so can't really answer your question without researching it myself. Hopefully someone has played with it before and can steer you in the right direction. Good Luck.
Thank you. Unfortunately none of the links are really useful because I either know it, cause it's not the first addon I've made, or because the UI code is not useable by me, either due to not accessible from user written code, or lack of knowledge on my behalf.

As said, including the blizzard addon that deals with this, that being blizzard_tokenui (https://github.com/Gethe/wow-ui-sour...ansfer.lua#L14) one in the.toc file as a dependancy does nothing, because the update event is only triggered, seemingly, when the red transfer button is first visible, for the first time after starting the wow client.

Hence my question if there's any way to trigger that myself.

EDIT: I take back some of what I said. One of the links had a part of the answer I THINK.
I needed to combine the event of login with a C_ function that returns nothing, but seems to be a trigger for the update. By doing it like that, I'm hoping and thinking the data loads in before the login/reload screen actually goes away, and before the user has a chance to use the addon.

Thanks for the help, cross your fingers :P

Last edited by Glisern : 08-05-24 at 01:17 PM. Reason: Some of what I said was wrong.
  Reply With Quote
08-05-24, 01:59 PM   #4
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,974
No guarantees but try this as an example:

Lua Code:
  1. local f = CreateFrame("Frame")
  2. f:RegisterEvent("CURRENCY_DISPLAY_UPDATE")
  3. f:RegisterEvent("CURRENCY_TRANSFER_FAILED")
  4. f:RegisterEvent("ACCOUNT_CHARACTER_CURRENCY_DATA_RECEIVED")
  5. f:RegisterEvent("PLAYER_ENTERING_WORLD")
  6.  
  7. f:SetScript("OnEvent", function(self, event, ...)
  8.     if event == "PLAYER_ENTERING_WORLD" then
  9.         self:UnregisterEvent("PLAYER_ENTERING_WORLD")
  10.         C_CurrencyInfo.RequestCurrencyDataForAccountCharacters() -- send request for data
  11.         return
  12.     end
  13.        -- check events for data ready
  14.     if C_CurrencyInfo.IsAccountCharacterCurrencyDataReady() then
  15.         print("Currency: Ready") -- Currencies should be ready here
  16.     else
  17.         print("Currency: Not Ready")
  18.     end
  19. end)
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote
08-05-24, 02:15 PM   #5
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 6,007
Fizzle Beat me to it .. but this might add to that code in some form.

Aha .. have you tried using this function in conjunction with that event ?

Lua Code:
  1. C_CurrencyInfo.RequestCurrencyDataForAccountCharacters();


I suspect that similar to some of the other systems in wow now, you have to request the data before you can access it. This might be the addon way to get the currency information loaded into memory instead of the users way by opening the window.

The event like the other's like this should then trigger letting you know the data is available.


So what I would do is:

1. on PLAYER_LOGIN use that function to request the data
2. on ACCOUNT_CHARACTER_CURRENCY_DATA_RECEIVED do your stuff

your stuff would include the following:

Lua Code:
  1. accountCurrencyData = FetchCurrencyDataFromAccountCharacters
which should give you access to the following set of table entries
Lua Code:
  1. {
  2.             Name = "CharacterCurrencyData",
  3.             Type = "Structure",
  4.             Fields =
  5.             {
  6.                 { Name = "characterGUID", Type = "WOWGUID", Nilable = false },
  7.                 { Name = "characterName", Type = "string", Nilable = false },
  8.                 { Name = "currencyID", Type = "number", Nilable = false },
  9.                 { Name = "quantity", Type = "number", Nilable = false },
  10.             },
  11.         },

Not knowing what your plans are for your addon I'll stop there but I got this info from:
https://github.com/Gethe/wow-ui-sour...umentation.lua

and

https://github.com/Gethe/wow-ui-sour...ansfer.lua#L58

And this block of code explains the spinny thing happening .. it's waiting for that data to be available
https://github.com/Gethe/wow-ui-sour...ansfer.lua#L77


Hope that helps you Unless you found them already rofl.
__________________


All Level 70 Characters:
Demon Warlock
Resto Druid
Disc Priest
Resto Shaman
Survival Hunter
Augment Evoker
Frost Mage
Vengence Demon Hunter
Rogue ( was subtlety )

Brewmaster Monk (TR)
Prot Paladin (TR)
Blood Death Knight ( TR)

As you can see I am missing a warrior

And .. I don't have all the allied races covered. Time Runner time when it happens again

  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » What is required for a currency update?


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