WoW:API GetCurrencyInfo: Difference between revisions

After further investigation, I realized the entire page was outdated, so I updated, and added an example of the updated function, as well as adding in when the patch was changed.
(After further investigation, I realized the entire page was outdated, so I updated, and added an example of the updated function, as well as adding in when the patch was changed.)
Line 3: Line 3:
Retrieve Information about a currency at index including it's amount.
Retrieve Information about a currency at index including it's amount.
<!-- List return values and arguments as well as function name, follow Blizzard usage convention for args -->
<!-- List return values and arguments as well as function name, follow Blizzard usage convention for args -->
  localized_label, amount, icon_file_name = GetCurrencyInfo(index)
  name, CurrentAmount, texture, earnedThisWeek, weeklyMax, totalMax, isDiscovered = GetCurrencyInfo(index)


== Arguments ==
== Arguments ==
Line 10: Line 10:


== Returns ==
== Returns ==
:localized_label, amount, icon_file_name  <!-- Include this line ONLY IF there are multiple return values and a large number of arguments -->
'''name'''
<!-- List each return value, together with its type -->
;localized_label : String - the name of the currency, localized to the language
;amount : Number - Current amount of the currency at index
;icon_file_name : String - The file name of the currency's icon.  Does <s>not</s> include the path (\\Interface\\Icons\\)


''  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
: <!-- Include this line ONLY IF there are multiple return values and a large number of arguments --><!-- List each return value, together with its type --> 
== Details ==
== Details ==
<!-- Details not appropriate for the main description can go here.  
<!-- Details not appropriate for the main description can go here.  
Line 89: Line 111:
|}
|}


== Example(s) ==
# This Example will Output every currency you have Discovered, and have at least one of, to the Main chat Frame.
local name, currentAmount, texture, earnedThisWeek, weeklyMax, totalMax, isDiscovered = nil,nil,nil,nil,nil,nil,nil;
for i = 61,777,1 do
    name, currentAmount, texture, earnedThisWeek, weeklyMax, totalMax, isDiscovered = GetCurrencyInfo(i);
    if name ~= nil and isDiscovered and currentAmount > 0 then
      if weeklyMax > 0 then
          DEFAULT_CHAT_FRAME:AddMessage(string.format("(%s): Current: %d Earned This Week: %d/%d",name,currentAmount,earnedThisWeek,weeklyMax))
      else
          DEFAULT_CHAT_FRAME:AddMessage(string.format("(%s): Current: %d",name,currentAmount))
      end
    end
end
== Patch Changes ==
* Some time after Patch 4.0.1, the returns changed from "localized_label, amount, icon_file_name = GetCurrencyInfo(id)" to "name, currentAmount, texture, weeklyMax, totalMax, isDiscovered = GetCurrencyInfo(index)"
== References ==
== References ==
{{reflist}}
{{reflist}}
Anonymous user