WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   AddOn Help/Support (https://www.wowinterface.com/forums/forumdisplay.php?f=3)
-   -   LF community help with a very handy function... (https://www.wowinterface.com/forums/showthread.php?t=56910)

Nightness 12-19-18 04:26 AM

LF community help with a very handy function...
 
Edit: NVM figured it out.

Code:

local frame = CreateFrame("Frame", "GetZoneInfoFrame");
frame:RegisterEvent("ZONE_CHANGED");
frame:RegisterEvent("ZONE_CHANGED_NEW_AREA");
frame:SetScript("OnEvent", function ()
        local zoneName, areaName, worldName, instanceType, isManaged = GetZoneInfo();
end);

-- Returns: zone, area, world, instanceType, isManaged (Blizzard made the group)
-- ZoneTypes: "unknown", "world", "dungeon" (despite group type),
--      "raid" (despite group type), "battleground", or "arena".
local function GetZoneInfo()
        local name, type, difficultyIndex, difficultyName, maxPlayers, dynamicDifficulty, isDynamic, instanceMapId, lfgID = GetInstanceInfo();
        local isRestricted = HasLFGRestrictions();

        if (type == nil or type == "") then type = "unknown"
        elseif (type == "none") then type = "world"
        elseif (type == "party") then type = "dungeon"
        elseif (type == "pvp") then type = "battleground" end

        local isManaged = false;
        local area = GetRealZoneText();
        local zone = GetMinimapZoneText()
        if (type == "arena" or type == "battleground" or isRestricted) then isManaged = true end

        return zone, area, name, type, isManaged;
end



All times are GMT -6. The time now is 11:00 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI