WeakAuras

WeakAuras

206M Downloads

Add Currency trigger

glassleo opened this issue ยท 5 comments

commented

Is your feature request related to a problem? Please describe.
I think there should be a currency trigger for WeakAuaras. Currently you'd have to do it with custom code and it's a hassle.

Describe the solution you'd like
I would like a simple Currency trigger to be added based on C_CurrencyInfo.GetCurrencyInfo. It could be under Player/Unit Info, similar to how Faction Reputation works with the following data available:

  • Currency ID
  • Name
  • Icon
  • Quantity
  • Maximum Quantity
  • Quantity Earned This Week and Max Weekly Quantity

Describe alternatives you've considered
Custom triggers can do this but it would be really nice to have it built into WA.

commented

We only have a repuation trigger, because someone contributed it. The same is probably true for this kind of trigger. If there's a PR, we would add it. But at least I have no intentions of adding those kind of things.

commented

We only have a repuation trigger, because someone contributed it. The same is probably true for this kind of trigger. If there's a PR, we would add it. But at least I have no intentions of adding those kind of things.

Good to know.

commented

Note, that there are others on the team. I don't know whether @mrbuds thinks this is a worthwhile project.

Or whether @asaka-wa who did the reputation trigger (iirc) would want to give this a try.

commented

Seems no one wants to tackle it, so yeah out of scope until a PR comes.

commented

Seems no one wants to tackle it, so yeah out of scope until a PR comes.

Yeah I think that's fine. I found it pretty easy to create my own custom trigger for currencies ultimately.


If anyone sees this in the future, here's what I'm using right now. Can't promise it's perfect but it seems to do the job pretty well.

First create a Custom Option key with the following:

  • Display Name: Currency ID
  • Option key: id
  • Min: 0
  • Max: 9999999
  • Step Size: 1

Then enter the Currency ID for the currency you want to track under thew new Custom Options you just created. You can get these IDs by searching for the currency on Wowhead (it will have the ID in the address bar). For example, Tower Knowledge has the ID 1904.

Then create a custom trigger:

  • Type: Custom
  • Event Type: Status
  • Check On...: Event(s)
  • Event(s): CURRENCY_DISPLAY_UPDATE

Custom Trigger:

function()
    local c = C_CurrencyInfo.GetCurrencyInfo(aura_env.config["id"] or 0)
    return c and true or false
end

Duration Info:

function()
    local c = C_CurrencyInfo.GetCurrencyInfo(aura_env.config["id"] or 0)
    local quantity = c.quantity or 0
    local max = c.maxQuantity or 0
    
    if max >= 1 then
        return quantity, max, true
    end
    
    return quantity, quantity, true
end

Icon Info:

function()
    local c = C_CurrencyInfo.GetCurrencyInfo(aura_env.config["id"] or 0)
    return c and c.iconFileID or nil
end

Stack Info:

function()
    local c = C_CurrencyInfo.GetCurrencyInfo(aura_env.config["id"] or 0)
    return c and c.quantity or 0
end

That's it! Then in the Display section you can use the following text replacements:

  • %name - Name of the currency
  • %s or %p - Quantity
  • %t - Maximum amount (this will be the same as Quantity if the particular currency does not have a max)