WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   GetCurrencyInfo (https://www.wowinterface.com/forums/showthread.php?t=42064)

unlimit 12-10-11 04:50 PM

GetCurrencyInfo
 
http://wowprogramming.com/docs/api/GetCurrencyInfo

According to wowprogramming.com, it returns: name, amount, texture, earnedThisWeek, weeklyMax, totalMax, isDiscovered

lua Code:
  1. function CurrencyText()
  2.     local name, currentAmount = GetCurrencyInfo(392)
  3.     -- Honor
  4.     return string.format("%0.0f%% | %s / %s", (currentAmount/4000)*100, currentAmount, 4000);
  5. end
  6.  
  7. currencytext = CurrencyText();

I tried using totalMax in this, but it wasn't working.

Using 4000 works fine, obviously, but I don't really understand the point of having "totalMax" if it doesn't return anything? Or maybe, I wasn't going about it the right way?

Seerah 12-10-11 05:06 PM

lua Code:
  1. function CurrencyText()
  2.     local name, currentAmount,_,_,_,totalMax = GetCurrencyInfo(392)
  3.     -- Honor
  4.     return string.format("%0.0f%% | %s / %s", (currentAmount/totalMax)*100, currentAmount, totalMax);
  5. end
  6.  
  7. currencytext = CurrencyText();

unlimit 12-10-11 05:07 PM

>_<

http://www.youtube.com/watch?v=wOKK8mAkiUI

edit: Welll, no, it still doesn't work quite right.

Code:

/script function CurrencyText() local name, currentAmount,_,_,_,totalMax = GetCurrencyInfo(396) return string.format("%0.0f%% | %s / %s", (currentAmount/totalMax)*100, currentAmount, totalMax); end currencytext = CurrencyText(); print(currencytext)
It was returning 400,000 as my honor cap, instead of 4000. Sooo, I tried a few other currencies: conquest returns 0, justice returns 400,000, etc.. c.c Maybe it only works on a few currencies?

Barjack 12-10-11 05:48 PM

It does indeed seem that the maximum values are incorrect as returned by that function (or perhaps just returned multiplied by 100 for some reason). I checked some other UI functions like GetCurrencyListInfo and they also return values inflated by 100 times. Unfortunately I think JP and Honor are the only currencies left in the game with hard caps so it's hard to tell if there is a trend going on here.

I checked Blizzard's UI code to see how they do it, and it seems like the answer is that they don't either. No Lua/XML of Blizzard's uses the max value returned by these functions. In fact, the only time the max value appears is on a tooltip when GameTooltip:SetCurrencyToken is called--a hard-coded function. That tooltip also provides info like "Season Total Earned" which is not provided by any Lua-accessible function.


All times are GMT -6. The time now is 08:26 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI