Thread Tools Display Modes
12-10-11, 04:50 PM   #1
unlimit
Lookin' Good
 
unlimit's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 484
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?
__________________


kúdan: im playing pantheon
JRCapablanca: no youre not
** Pantheon has been Banned. **
  Reply With Quote
12-10-11, 05:06 PM   #2
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
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();
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
12-10-11, 05:07 PM   #3
unlimit
Lookin' Good
 
unlimit's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 484
>_<

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?
__________________


kúdan: im playing pantheon
JRCapablanca: no youre not
** Pantheon has been Banned. **

Last edited by unlimit : 12-10-11 at 05:21 PM.
  Reply With Quote
12-10-11, 05:48 PM   #4
Barjack
A Black Drake
AddOn Author - Click to view addons
Join Date: Apr 2009
Posts: 89
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.

Last edited by Barjack : 12-10-11 at 06:11 PM.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » GetCurrencyInfo


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