davidmeen / TomeOfTeleportation

Warcraft addon that allows easy access to teleportation spells and items.
7 stars 5 forks source link

[F] Cypher of Relocation - zone bug #40

Closed ChesterYue closed 4 months ago

ChesterYue commented 4 months ago

if TeleporterGetOption("showInWrongZone") is true. the AtZone function always return true:

local function AtZone(requiredZone)
    return function()
        if TeleporterGetOption("showInWrongZone") then
            return true
        end
        local mapID = C_Map.GetBestMapForUnit("player")
        while mapID ~= 0 do
            if mapID == requiredZone then
                return true
            end
            mapID = C_Map.GetMapInfo(mapID).parentMapID
        end
        return false
    end
end

then the function() return AtZone(MapIDMaw)() and not AtZone(MapIDKorthia)()) end for Cypher of Relocation will be false. which is not expected when TeleporterGetOption("showInWrongZone") option is true.

in this special case, we can just add an additional TeleporterGetOption("showInWrongZone") or before the AtZone function called.

in the future, if there are more case like the "Maw with Korthia", you should abstract a comprehensive function to avoid this issue.


btw, whats IDE are you using, if it's vscode, try to open this in setting, to avoid white space: 3981714209510_ pic WeChatb92d957c198ae058c8ea1c9628c8f75d