Stanzilla / WoWUIBugs

World of Warcraft UI Bug Tracker
166 stars 7 forks source link

`UnitInRange()` returns incorrect values if the player had previously logged into an Evoker #437

Closed Ghostopheles closed 1 year ago

Ghostopheles commented 1 year ago

UnitInRange(unit) returns whether or not the player is within 40 yards of the given unit, and that range drops to 25 yards on an Evoker character. This function will break if you log into an Evoker character, then switch to another ranged class, and this behavior will persist until you restart the game.

UnitInRange wiki page

Example gif

The red dot above the spell is a frame indicating the return of UnitInRange(). The indicator in the top right of the spell icon indicates the actual 40 yard range.

Steps to Reproduce

Notes

Use this bug as a thread for all those experiencing this issue. Hopefully someone can give us some insight as to why this is occurring. (looking at you Meo)

Tested on Retail 10.1.0.49570 with no addons (other than the range indicator)

Jed-Giblin commented 1 year ago

The same bug does not occur with:

IsSpellInRange(spellName, target))

Probably not relevant since the implementation(s) may not be close at all, but a note.

Ghostopheles commented 1 year ago

I know we're likely getting a new PTR build later today, but as of build 10.1.5.49908 on the PTR, this bug is still occurring.

For anyone interested, this will create a simple draggable indicator you can use to test this.

RangeBugFrame = CreateFrame("Frame", "RangeBugFrame", UIParent);

function RangeBugFrame:SetupIndicator()
    self.ICON_GREEN = "Interface\\COMMON\\Indicator-Green";
    self.ICON_RED = "Interface\\COMMON\\Indicator-Red";

    self.indicator = self:CreateTexture(self:GetName() .. "RangeIndicator", "ARTWORK");
    self.indicator:SetAllPoints();
    self.indicator:SetTexture(self.ICON_RED);
    self.indicator:Show();
end

function RangeBugFrame:OnUpdate()
    local inRange, _ = UnitInRange("target");
    if inRange then
        self.indicator:SetTexture(self.ICON_GREEN);
    else
        self.indicator:SetTexture(self.ICON_RED);
    end
end

function RangeBugFrame:Init()
    self:SetSize(40, 40);
    self:SetPoint("CENTER", UIParent, "CENTER", -200, 0);
    self:SetMovable(true);
    self:EnableMouse(true);
    self:RegisterForDrag("LeftButton");
    self:SetScript("OnMouseDown", function()
        self:StartMoving();
    end);
    self:SetScript("OnMouseUp", function()
        self:StopMovingOrSizing();
    end);

    self:SetupIndicator();

    UIParent:HookScript("OnUpdate", function() securecallfunction(self.OnUpdate, self) end);
    self:Show();
end

RangeBugFrame:Init();
Ghostopheles commented 1 year ago

As of July 12th, a hotfix was pushed that was supposed to fix this bug, but as far as I can tell, it's still occurring.

Maybe "Range indicator and raid frames should again match after logging into an Evoker and then into a different ranged class." doesn't mean what I think it means?

I imagine the fix would require a new build, so maybe Tuesday?

Ghostopheles commented 1 year ago

Fixed in build 10.1.5.50438. (Current PTR build at time of posting)