LibCurrencyInfo
About
This is a library mainly for addon developer to get currencies' related information.
API
lib:GetCurrencyByID(currencyID, lang)
Arguments
- currencyID: Integer - ID of the currency to retrieve
- lang (optional): String - language code which the language you would like to retrieve. If nil, then player's game client language will be used.
The valid input is specified below:- enUS
- deDE
- esES
- esMX
- frFR
- itIT
- koKR
- ptBR
- ruRU
- zhCN
- zhTW
Returns
- name: String - the name of the currency, localized to the language
- amount : Number - Current amount of the currency at index
- texture: Number - The textureID of the currency's icon.
- 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
- rarity: Integer - Rarity indicator for this currency
- categoryID: Number - The currency's corresponding categoryID
- categoryName: String - The currency's corresponding category name
- currencyDesc: String - The currency's description
The 1st to 8th return values will be retrieved by calling GetCurrencyInfo() within this function. If you don't need the 9th ~ 11th values, then it's up to you to use either GetCurrencyInfo() or lib:GetCurrencyByID().
lib:GetCurrencyByCategoryID(categoryID)
Arguments
- categoryID: Integer - ID of currency's category
Returns
- currencyArray: Table - returns the table array for the specified currency category. The array contains the currency IDs belong to this category.
lib:GetCurrencyTokenStrings(currencyID, lang)
Arguments
- currencyID: Integer - ID of the currency to retrieve
- lang (optional): String - language code which the language you would like to retrieve. If nil, then player's game client language will be used.
The valid input is specified below:- enUS
- deDE
- esES
- esMX
- frFR
- itIT
- koKR
- ptBR
- ruRU
- zhCN
- zhTW
Returns
- tooltipText: String - this will return a string with combination of currency name, currency description, and the gained amount of this currency.
This is mainly to be used in GameToolTip. The format will be something like below:
Legionfall War Supplies
Use to further the construction of valuable structures on the Broken Shore.
Total Cap: 100/1,000
Data
The currency data is set to global so if you would need some further specific need, then you can create your customized codes by accessing the library data.
lib.data.CurrencyByCategory
Array key is categoryID, array value is the currency IDs belong to this category.
For example:
[1] = { -- Miscellaneous 81, -- Epicurean's Award 402, -- Ironpaw Token 515, -- Darkmoon Prize Ticket 1379, -- Trial of Style Token },
lib.data.CurrencyCategories
Stores the currency category's display names, in all languages. For example:
[1] = { <br /> enUS="Miscellaneous",<br /> deDE="Verschiedenes",<br /> esES="Miscelánea",<br /> esMX="Miscelánea",<br /> frFR="Divers",<br /> itIT="Varie",<br /> koKR="기타",<br /> ptBR="Diversos",<br /> ruRU="Разное",<br /> zhCN="其它",<br /> zhTW="雜項" <br />},
lib.data.Currencies
Stores all the currencies' ID, categoryID, and a flag of hide set to true if this specific currency is inactive or not to be displayed in player's game client.
Some examples:
[1] = { id=1, category=1, hide=true }, -- Currency Token Test Token 4, Miscellaneous [2] = { id=2, category=1, hide=true }, -- Currency Token Test Token 2, Miscellaneous [4] = { id=4, category=1, hide=true }, -- Currency Token Test Token 5, Miscellaneous [22] = { id=22, category=41, hide=true }, -- Birmingham Test Item 3, Test [42] = { id=42, category=1, hide=true }, -- Badge of Justice, Miscellaneous [61] = { id=61, category=21 }, -- Dalaran Jewelcrafter's Token, Wrath of the Lich King [81] = { id=81, category=1 }, -- Epicurean's Award, Miscellaneous
lib.data.CurrencyDesc
This is where we stored the currencies' description. This is useful when we want to retrieve this information unless WoW release any API to fulfill this need.
Table example:
[61] = { <br /> enUS="Tiffany Cartier's shop in Dalaran will gladly accept these tokens for unique jewelcrafting recipes.", <br /> deDE="Tiffany Cartiers Geschäft in Dalaran wird diese Symbole im Tausch gegen einzigartige Juweliersrezepte dankend annehmen.", <br /> esES="La tienda de Tiffany Cartier en Dalaran cambiará gustosamente estos talismanes por recetas de joyería.", <br /> esMX="La tienda de Tiffany Cartier en Dalaran cambiará gustosamente estos talismanes por recetas de joyería.", <br /> frFR="La boutique de Tiffany Kartier, à Dalaran, accepte avec joie ces marques contre des dessins de joaillerie uniques.", <br /> itIT="Il negozio di Tiffany Cartier a Dalaran accetterà volentieri questi emblemi in cambio di esclusivi modelli da orefice.", <br /> koKR="달라란에 있는 티파니 까르티엘의 가게에서 보석세공 디자인으로 교환하는 데 사용합니다.", <br /> ptBR="A loja Sojoia Kara em Dalaran aceita de bom grado essas fichas por instruções de joalheria raras.", <br /> ruRU="В магазине Тиффани Картье, что в Даларане, вам с радостью обменяют эти знаки на уникальные ювелирные эскизы.", <br /> zhCN="达拉然的蒂凡妮·卡蒂亚会欣然接受这些代币,并用稀有的珠宝加工图鉴来交换。", <br /> zhTW="蒂芬妮·卡地亞位於達拉然的商店相當願意用獨特的珠寶設計圖來交換這些徽章。" <br />},
Comments