ElvUI Equipment Sets Datatext

ElvUI Equipment Sets Datatext

199k Downloads

bugs (and bugfixes) for gearset indexing and string color coding

ajamafalous opened this issue ยท 1 comments

commented

There are a few bugs that I've been fixing on my local version of the addon for a few weeks now that I finally decided I would submit issues for, so that I stop having to reimplement them every time. I'm attaching my file to this post so you can diff it to see what I've changed.

ElvUI_EquipmentSetsDT.txt

  1. The Blizzard API for gearsets is busted (you have a comment implying as much), but not in the way that your indexing fixes, or at least not on the characters I tested.

    The problem is that Blizzard doesn't compress the array that they save gearsets into after you delete one, and it always adds a new gearset to the first empty index. You can recreate this test by doing the following on a new character:

    i. Create gearsets A, B, C. The gearset array will be a[0] = A, a[1] = B, a[2] = C
    ii. Delete gearset B. The gearset array will be a[0] = A, a[1]= null, a[2] = C
    iii. Create gearset D. The gearset array will be a[0] = A, a[1] = D, a[2] = C
    

    In practice, this means that a) the wacky local minimum and local maximums don't do the right thing and aren't necessary [anymore?], and b) a for loop that goes from 0 to getNumEquipmentSets() is not guaranteed to find all sets. In Step (ii) above, for example, numSets will be 2, and the for loop will only check a[0] and a[1], only finding gearset A. Instead, you need to iterate over the GetEquipmentSetInfo(i) array starting at i = 0 and ending once you've found the same number of gearsets that getNumEquipmentSets() returns. I did this with separate variables for 'i' and 'found sets' in a while loop.

  2. After the hexColor change, there are many places where "|cff" is being appended to strings. Seems like |cff is necessary for color but not hexColor, and so places where they were being used interchangeably are bugged? I went through and just tried to remove |cff from "|cff%s" any place I saw hexColor being used (and had to add |cff to the front of a few places where color was also being used in the same spot). I'm not sure what's going on under the hood on the color stuff, though, so I may have missed some, or there may be a simpler/more robust way to fix it. The attached code doesn't have any buggy color/text fields on my personal testing/setup, though.

commented

For code changes you should just do a pull request, so I can review the changes and merge them into the code directly.