RangeDisplay

RangeDisplay

3M Downloads

[Wrath] Classic conditional checks are misplaced

Road-block opened this issue ยท 2 comments

commented

The IsClassic check at the top of the RangeDisplay.lua file is used to separate mainline WoW from all the Classic flavors (Vanilla through BC to Wrath)

It is then used to exclude the focus unit and the arena2-5 units for all classic flavors.

This is wrong for BC Classic (where focus unit exists but is irrelevant as BC Classic clients no longer exist as a live game) and doubly wrong for Wrath Classic where both focus and arena1-5 units exist as valid unitids

Instead I would suggest that the variable is replaced with.

local IsMainline = (_G.WOW_PROJECT_ID == _G.WOW_PROJECT_MAINLINE)
local IsWrath = (_G.WOW_PROJECT_ID == _G.WOW_PROJECT_WRATH_CLASSIC)

and at the relevant spots have

if IsMainline or IsWrath then
  local fu = {
    unit = "focus",
    name = L["focus"],
    event = "PLAYER_FOCUS_CHANGED",
  }
  tinsert(units, fu)
end

and

  if (IsMainline or IsWrath) and self.db.global.enableArena and not arenaUnits then
    arenaUnits = {}
    tinsert(arenaUnits, arenaMasterUnit)
    tinsert(units, arenaMasterUnit)
    for i = 2, 5 do
      local au = {
        unit = ("arena%d"):format(i),
        name = L["arena%d"]:format(i),
      }
      tinsert(arenaUnits, au)
      tinsert(units, au)
    end
  end

respectively.

This will keep mastery realms where focus/arena do not exist excluded while preserve the functionality for Wrath Classic & Mainline WoW.

commented

Thanks, will look into it

commented

I don't know if you're checking curseforge tickets so I'll cross reference a related issue for LibRangeCheck-2.0 here: https://www.curseforge.com/wow/addons/librangecheck-2-0/issues/18

and do the same for this issue on the curseforge one for the library.