Broker_Currencyflow

Broker_Currencyflow

48.1k Downloads

ShadowLands: attempt to call global 'GetCurrencyInfo' (a nil value)

yoshimo opened this issue ยท 9 comments

commented
Message: ...e\AddOns\Broker_Currencyflow\Broker_Currencyflow.lua line 1095:
   attempt to call global 'GetCurrencyInfo' (a nil value)

commented

Current API for reference: https://wowwiki.fandom.com/wiki/API_GetCurrencyInfo

Signature
name, CurrentAmount, texture, earnedThisWeek, weeklyMax, totalMax, isDiscovered = GetCurrencyInfo(index)

Arguments
 - index - Integer - Index of the currency to retrieve

Return
 - name - String - the name of the currency, localized to the language
 - amount - Number - Current amount of the currency at index
 - texture - String - The file name of the currency's icon. As of 5.2.0, does include the path (\\Interface\\Icons\\)
 - earnedThisWeek - Number - The amount of the currency earned this week
 - weeklyMax - Number - Maximum amount of currency possible to be earned this week
 - totalMax - Number - Total maximum currency possible to stockpile
 - isDiscovered - Boolean - Whether the character has ever got some of this currency

Possibilities:

  • blizzard is renaming and it hasn't been updated yet
  • blizzard hasn't enabled full api on beta.

Sadly I do not yet have beta so I can't do anything other than look at resources for API's but cannot see anything in regards to currency at the minute, will keep an eye on this as beta progresses [and hopefully I get invited at some point :)]

commented

Ah ok, so perhaps GetCurrencyInfo(index) needs to be C_CurrencyInfo.GetCurrencyInfo(index) - can you give this a try?

commented

Isn't that simple

Message: ...e\AddOns\Broker_Currencyflow\Broker_Currencyflow.lua line 803:
   bad argument #2 to 'format' (string expected, got table)
commented

the return value has also changed, instead of multiple values you get an object.
see: https://github.com/Stanzilla/WoWUIBugs/wiki/9.0.1-Consolidated-UI-Changes#c_currencyinfogetcurrencyinfotype
and https://www.townlong-yak.com/framexml/beta/Blizzard_APIDocumentation#C_CurrencyInfo.GetCurrencyInfo

something like
amount, texture, earnedThisWeek, weeklyMax, totalMax = select(2,GetCurrencyInfo(currencyId))
could be changed to

    local currencyInfo = C_CurrencyInfo.GetCurrencyInfo(currencyId)
    if currencyInfo ~= nil then
      amount = currencyInfo.quantity
      earnedThisWeek = currencyInfo.quantityEarnedThisWeek
      weeklyMax = currencyInfo.maxWeeklyQuantity
      totalMax = currencyInfo.maxQuantity
commented

@agentschmitt thanks for that code, looks like it's working like a charm finally managed to test this on PTR - please check out that branch and have a play, the icons don't work yet, but as far as I can tell basic functionality now works.

commented

Icons work now, additionally have added the new currencies in preparation for prepatch.

commented

For me the 9.0 branch works on beta client. Can see gold of my characters again without lua errors.
But had to download it from git. i also tried to install alpha by client but this had lua errors for me.

commented

Yes this is currently not ready for release until 9.0 ships as shipping now would probably break the 8.x client, it will be released for curse on launch day ready for Shadowlands release, glad the branch is working for you on beta :)