Mercurial > wow > wowdb-profiler
changeset 501:f64b4ed77b77 7.0.3-7
Fixed currency ID support to properly handle nil currency names or currency textures when doing a lookup.
author | MMOSimca <mmosimca@gmail.com> |
---|---|
date | Thu, 13 Oct 2016 10:28:33 -0400 |
parents | 26ee8074e5ba |
children | 21397b33ba36 |
files | Main.lua |
diffstat | 1 files changed, 10 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/Main.lua Thu Oct 13 10:22:57 2016 -0400 +++ b/Main.lua Thu Oct 13 10:28:33 2016 -0400 @@ -326,6 +326,7 @@ function CurrencyInfoToID(name, texture) + if not name or not texture then return nil end return currency_info_lookup[("%s:%s"):format(name, texture)] end @@ -1044,7 +1045,9 @@ for i = 1, entry["rewards"]["currency_count"] do local name, texture_path, quantity = _G.GetQuestLogRewardCurrencyInfo(i, quest_id) local currency_id = CurrencyInfoToID(name, texture_path) - table.insert(entry["rewards"]["currencies"], ("%d:%d"):format(quantity, currency_id)) + if currency_id and currency_id ~= 0 then + table.insert(entry["rewards"]["currencies"], ("%d:%d"):format(quantity, currency_id)) + end end end @@ -2553,11 +2556,13 @@ local texture_path, amount_required, item_link, name = _G.GetMerchantItemCostItem(item_index, cost_index) -- Try to detect if this is actually a currency by looking for a nil item_link or item ID - local is_item = item_link and ItemLinkToID(item_link) - - if not is_item then + local is_currency = (not item_link) or (not ItemLinkToID(item_link)) + + if is_currency then local currency_id = CurrencyInfoToID(name, texture_path) - currency_list[#currency_list + 1] = ("(%s:%d)"):format(amount_required, currency_id) + if currency_id and currency_id ~= 0 then + currency_list[#currency_list + 1] = ("(%s:%d)"):format(amount_required, currency_id) + end end end