BetterBags

BetterBags

1M Downloads

[Feature]: Support Currencies in wrath

fryguy1013 opened this issue ยท 1 comments

commented

Describe the feature

Support currencies in wrath like they are in retail

Describe the implementation

I got this working in my local copy by adding the "Show Currencies" dropdown to the frames\classic\context.lua taken from the retail version of that file (this almost certainly will break in classic era/sod). Then I added a bunch of shims in frames\currency.lua for the wrath versions of the functions (the big one taken from weakauras code):

local C_CurrencyInfo_GetCurrencyListInfo = C_CurrencyInfo.GetCurrencyListInfo;
if (not C_CurrencyInfo_GetCurrencyListInfo) then
  C_CurrencyInfo_GetCurrencyListInfo = function(index)
    local name, isHeader, isExpanded, isUnused, isWatched, _, icon, _, hasWeeklyLimit, _, _, itemID = GetCurrencyListInfo(index)
    local currentAmount, earnedThisWeek, weeklyMax, totalMax, isDiscovered, rarity
    if itemID then
      _, currentAmount, _, earnedThisWeek, weeklyMax, totalMax, isDiscovered, rarity = GetCurrencyInfo(itemID)
    end
    local currencyInfo = {
      name = name,
      description = "",
      isHeader = isHeader,
      isHeaderExpanded = isExpanded,
      isTypeUnused = isUnused,
      isShowInBackpack = isWatched,
      quantity = currentAmount,
      trackedQuantity = 0,
      iconFileID = icon,
      maxQuantity = totalMax,
      canEarnPerWeek = hasWeeklyLimit,
      quantityEarnedThisWeek = earnedThisWeek,
      isTradeable = false,
      quality = rarity,
      maxWeeklyQuantity = weeklyMax,
      totalEarned = 0,
      discovered = isDiscovered,
      useTotalEarnedForMaxQty = false,
    }
    return currencyInfo
  end
end

local C_CurrencyInfo_SetCurrencyBackpack = C_CurrencyInfo.SetCurrencyBackpack;
if (not C_CurrencyInfo_SetCurrencyBackpack) then
  C_CurrencyInfo_SetCurrencyBackpack = function(index, backpack)
    if backpack then
      return SetCurrencyBackpack(index, 1)
    else
      return SetCurrencyBackpack(index, 0)
    end
  end
end

local C_CurrencyInfo_GetCurrencyListSize = C_CurrencyInfo.GetCurrencyListSize;
if (not C_CurrencyInfo_GetCurrencyListSize) then
  C_CurrencyInfo_GetCurrencyListSize = GetCurrencyListSize;
end

Also I had to change the font from xxx12Font to GameFontNormalSmall in currency.lua

I suck at lua and don't really have the long-term maintenance of this project in mind so I don't want to submit a PR like this with its obvious deficiencies. I just wanted to see how hard it would be.

commented

I'll evaluate how to do this longer term -- but Cata is right around the corner, not sure about it. We'll see!