Xruptor / BagSync

BagSync tracks your characters items and displays it within tooltips.
http://www.wowinterface.com/downloads/info15351-BagSync.html
Other
32 stars 21 forks source link

New Currency Sort doesn't work for expansions with "The " in the title #384

Open Protuhj opened 5 hours ago

Protuhj commented 5 hours ago

I modified the code in currency.lua to see what was happening as follows:

    --lets get an expansion list so we can sort the top part by expansion release
    for i=0, GetNumExpansions() do
        local eTmp = _G['EXPANSION_NAME'..i]
        if eTmp then
            print("Expansion: EXPANSION_NAME" .. tostring(i) .. " is: " .. eTmp)
            expansionList[eTmp] = i
        else
            print("Unknown expansion: EXPANSION_NAME" .. i)
        end
    end

    for unitObj in Data:IterateUnits() do
        if not unitObj.isGuild and unitObj.data.currency then
            for k, v in pairs(unitObj.data.currency) do
                local header = v.header or L.Currency

                --only do the entry once per currencyID
                if not tempList[k]  then
                    print("sort index for " .. header .. " is: " .. tostring(BSYC.options.sortCurrencyByExpansion and expansionList[header] or -100))

    ..... snip here .....

The first print out I added shows that the _G['EXPANSION_NAME .. i] results in the full expansion name, including "The" -- e.g. "The Burning Crusade" and "The War Within".

The second print out I added shows that the header field doesn't include "The" for those same expansions, resulting in TBC and TWW to be sorted with -100 instead of their appropriate value.

(You can see these header value names in the "real" currency window.)

Protuhj commented 5 hours ago

I modified the upper loop as follows to fix it temporarily, you might have your own way to solve it:

    --lets get an expansion list so we can sort the top part by expansion release
    for i=0, GetNumExpansions() do
        local eTmp = _G['EXPANSION_NAME'..i]
        if eTmp then
            eTmp = eTmp:gsub("^The ", "")
            expansionList[eTmp] = i
        end
    end