Thread Tools Display Modes
12-19-18, 04:26 AM   #1
Nightness
An Aku'mai Servant
AddOn Author - Click to view addons
Join Date: Feb 2009
Posts: 32
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

Last edited by Nightness : 12-20-18 at 02:47 AM.
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » LF community help with a very handy function...

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off