Broker_Currencyflow

Broker_Currencyflow

48.1k Downloads

Currency Names

DreadfulSanity opened this issue ยท 2 comments

commented

I cannot figure out why that is the case, but the currency names in the settings > columns section are the name of the character that is logged in. When I delete the saved variables settings, first char is fine. Logging into the next character results again in all currencies named after my character. Archaeology fragments are named properly. Everything else looks like this:

grafik

commented

Yea I've seen this happen too, very curious bug, no idea how/why it happens, I first noticed it in pre-patch where all the currencies became "Korrak's Revenge" - #7 - i'll keep an eye out.

commented

I have a fix for this - you're referencing a variable "name" that is never set in Currencyflow:LoadCurrencies().
I also refactored the function a bit to do what you were doing already but with considerably less repetition of the code.
See below.

-- This function tries to update the currencies list with client info
function Currencyflow:LoadCurrencies()
  for id,currency in pairs(tracking) do
    local name, icon
    if currency.type == TYPE_CURRENCY then
      local currencyInfo = C_CurrencyInfo.GetCurrencyInfo(id)
      if currencyInfo ~= nil then
        name = currencyInfo.name
        icon = currencyInfo.iconFileID
      end
    elseif currency.type == TYPE_ITEM then
      name, _, _, _, _, _, _, _, _, icon, _ = GetItemInfo(id)
    elseif currency.type == TYPE_FRAGMENT then
      local name, icon, _, _ = GetArchaeologyRaceInfo(currency.index)
      -- Another dumb marvel of blizz consistency. When info
      -- is not available, instead of returning nil or "",
      -- this one puts "UNKNOWN" in the name.... sigh...
      if icon == nil or icon == "" then
         name = nil
      end
    end

    if name ~= nil and name ~= "" then
       currency.name = name
    else
       currency.name = "|cff999999"..currency.name.."|r"
    end

    if icon ~= nil and icon ~= "" then
       currency.icon = icon
    else
       currency.icon = ICON_QM
    end
  end
end