Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature]: Support Currencies in wrath #248

Closed
fryguy1013 opened this issue Feb 27, 2024 · 1 comment
Closed

[Feature]: Support Currencies in wrath #248

fryguy1013 opened this issue Feb 27, 2024 · 1 comment
Assignees

Comments

@fryguy1013
Copy link

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.

@Cidan
Copy link
Owner

Cidan commented Feb 27, 2024

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

@Cidan Cidan moved this from To Triage to Released in BetterBags Issue Tracker May 2, 2024
@Cidan Cidan closed this as completed by moving to Released in BetterBags Issue Tracker May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

No branches or pull requests

2 participants