View Single Post
01/12/22, 08:30 AM   #3
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,979
The globals like *CurrencyChangeReason can be found in the ESOUI API Documentation Pxx .txt files linked at the wiki's API version info (current live, PTS, or even older at the history) or here at the ESOUI forum topic about that current/older patch (see attachments at the forum threads):
https://wiki.esoui.com/APIVersion#live_API_version
https://www.esoui.com/forums/showthread.php?t=9923


If you search in the API documentation txt file for CurrencyChangeReason you will find this:
Code:
h5. CurrencyChangeReason
* CURRENCY_CHANGE_REASON_ABILITY_UPGRADE_PURCHASE
* CURRENCY_CHANGE_REASON_ACHIEVEMENT
* CURRENCY_CHANGE_REASON_ACTION
* CURRENCY_CHANGE_REASON_ANTIQUITY_REWARD
* CURRENCY_CHANGE_REASON_BAGSPACE
* CURRENCY_CHANGE_REASON_BANKSPACE
* CURRENCY_CHANGE_REASON_BANK_DEPOSIT
* CURRENCY_CHANGE_REASON_BANK_FEE
* CURRENCY_CHANGE_REASON_BANK_WITHDRAWAL
* CURRENCY_CHANGE_REASON_BATTLEGROUND
* CURRENCY_CHANGE_REASON_BOUNTY_CONFISCATED
* CURRENCY_CHANGE_REASON_BOUNTY_PAID_FENCE
* CURRENCY_CHANGE_REASON_BOUNTY_PAID_GUARD
* CURRENCY_CHANGE_REASON_BUYBACK
* CURRENCY_CHANGE_REASON_CASH_ON_DELIVERY
* CURRENCY_CHANGE_REASON_CHARACTER_UPGRADE
* CURRENCY_CHANGE_REASON_COMMAND
* CURRENCY_CHANGE_REASON_CONSUME_FOOD_DRINK
* CURRENCY_CHANGE_REASON_CONSUME_POTION
* CURRENCY_CHANGE_REASON_CONVERSATION
* CURRENCY_CHANGE_REASON_CRAFT
* CURRENCY_CHANGE_REASON_CROWNS_PURCHASED
* CURRENCY_CHANGE_REASON_CROWN_CRATE_DUPLICATE
* CURRENCY_CHANGE_REASON_DEATH
* CURRENCY_CHANGE_REASON_DECONSTRUCT
* CURRENCY_CHANGE_REASON_DEFENSIVE_KEEP_REWARD
* CURRENCY_CHANGE_REASON_DEPRECATED_0
* CURRENCY_CHANGE_REASON_DEPRECATED_1
* CURRENCY_CHANGE_REASON_DEPRECATED_2
* CURRENCY_CHANGE_REASON_EDIT_GUILD_HERALDRY
* CURRENCY_CHANGE_REASON_FEED_MOUNT
* CURRENCY_CHANGE_REASON_GUILD_BANK_DEPOSIT
* CURRENCY_CHANGE_REASON_GUILD_BANK_WITHDRAWAL
* CURRENCY_CHANGE_REASON_GUILD_FORWARD_CAMP
* CURRENCY_CHANGE_REASON_GUILD_STANDARD
* CURRENCY_CHANGE_REASON_GUILD_TABARD
* CURRENCY_CHANGE_REASON_HARVEST_REAGENT
* CURRENCY_CHANGE_REASON_ITEM_CONVERTED_TO_GEMS
* CURRENCY_CHANGE_REASON_JUMP_FAILURE_REFUND
* CURRENCY_CHANGE_REASON_KEEP_REPAIR
* CURRENCY_CHANGE_REASON_KEEP_UPGRADE
* CURRENCY_CHANGE_REASON_KILL
* CURRENCY_CHANGE_REASON_LOOT
* CURRENCY_CHANGE_REASON_LOOT_CURRENCY_CONTAINER
* CURRENCY_CHANGE_REASON_LOOT_STOLEN
* CURRENCY_CHANGE_REASON_MAIL
* CURRENCY_CHANGE_REASON_MEDAL
* CURRENCY_CHANGE_REASON_OFFENSIVE_KEEP_REWARD
* CURRENCY_CHANGE_REASON_PICKPOCKET
* CURRENCY_CHANGE_REASON_PLAYER_INIT
* CURRENCY_CHANGE_REASON_PURCHASED_WITH_CROWNS
* CURRENCY_CHANGE_REASON_PURCHASED_WITH_ENDEAVOR_SEALS
* CURRENCY_CHANGE_REASON_PURCHASED_WITH_GEMS
* CURRENCY_CHANGE_REASON_PVP_KILL_TRANSFER
* CURRENCY_CHANGE_REASON_PVP_RESURRECT
* CURRENCY_CHANGE_REASON_QUESTREWARD
* CURRENCY_CHANGE_REASON_RECIPE
* CURRENCY_CHANGE_REASON_RECONSTRUCTION
* CURRENCY_CHANGE_REASON_REFORGE
* CURRENCY_CHANGE_REASON_RESEARCH_TRAIT
* CURRENCY_CHANGE_REASON_RESPEC_ATTRIBUTES
* CURRENCY_CHANGE_REASON_RESPEC_CHAMPION
* CURRENCY_CHANGE_REASON_RESPEC_MORPHS
* CURRENCY_CHANGE_REASON_RESPEC_SKILLS
* CURRENCY_CHANGE_REASON_REWARD
* CURRENCY_CHANGE_REASON_SELL_STOLEN
* CURRENCY_CHANGE_REASON_SOULWEARY
* CURRENCY_CHANGE_REASON_SOUL_HEAL
* CURRENCY_CHANGE_REASON_STABLESPACE
* CURRENCY_CHANGE_REASON_STUCK
* CURRENCY_CHANGE_REASON_TRADE
* CURRENCY_CHANGE_REASON_TRADINGHOUSE_LISTING
* CURRENCY_CHANGE_REASON_TRADINGHOUSE_PURCHASE
* CURRENCY_CHANGE_REASON_TRADINGHOUSE_REFUND
* CURRENCY_CHANGE_REASON_TRAIT_REVEAL
* CURRENCY_CHANGE_REASON_TRAVEL_GRAVEYARD
* CURRENCY_CHANGE_REASON_UNKNOWN
* CURRENCY_CHANGE_REASON_VENDOR
* CURRENCY_CHANGE_REASON_VENDOR_LAUNDER
* CURRENCY_CHANGE_REASON_VENDOR_REPAIR
These globals are created as numbers e.g. in the global table _G of lua:
_G["CURRENCY_CHANGE_REASON_REFORGE"] = <number>

They should be always used instead of hardcoding the number 1, 2, 3 etc. in your addons as they might change one day. We have had that happening with a few already in the past, e.g. BAG_* constants or INVENTORY_* constants (not sure which one changed).

Unfortunately there is no way to turn the constants into there name string (constant name).
If you need this you need to build your own lookup table.
Lua Code:
  1. local myLookupTable = {
  2.   [CURRENCY_CHANGE_REASON_REFORGE] = "CURRENCY_CHANGE_REASON_REFORGE",
  3. }


You could also do a loop over the whole table _G with
for key, value in pairs(_G) do
myLookupTable[_G[key]] = key --will create a table with a global as key and the same key String as value for your lookup
end
and build that lookup tbale this way BUT you WILL be having trouble at many entries as the table _G not only stores the constants but also all other values like functions, classes etc. You'd have to sort them out by using type(value) == "number" etc., and some even raise lua error messages as they need to be looped with a special "insecure code check" function, etc.
Addons like zgoo and merTorchbug do this to show you the values in their UI.
e.g. with merTorchbug enabled you can type /tb in the chat and in the shown UI (first load will parse the whol table _G and thus it will show you how long it took to do so in the chat -> around 1-5+ seconds depening on your hardware) you can browse the constants, strings, funcitons, and other globals then.

If I'm unsure what value is what constant I use merTorchbug and open the constants tab, use the search box and type in currency_change_ and then will see the list with the name of the constant and it's value.

Last edited by Baertram : 01/12/22 at 08:36 AM.
  Reply With Quote