Thread Tools Display Modes
03/01/16, 04:06 PM   #1
Terrillyn
AddOn Author - Click to view addons
Join Date: Jan 2016
Posts: 24
[outdated] GetUnitSubZoneIndex() & GetSubZoneNameByIndex()

In looking for a way to get the characters current subzone (in order to determine if we are in a city or not) there doesn't seem to be a way to even get the subzone index the best I can do is create a table with all the city names in every language and do a pattern compare to GetPlayerLocationName() or string.match(GetPlayerLocationName(), "([%w%p]+)%s?") (but this doesn't work with other languages). There needs to be a way to identify the players subzone location particularly the subZoneIndex, the only other way atm is to use the map api, but this wont work properly if the player is using the map or if the map hasn't loaded.

I suggest two functions GetUnitSubZoneIndex() and GetSubZoneNameByIndex().
Code:
GetUnitSubZoneIndex(unitTag)
    returns number: subZoneIndex
GetSubZoneNameByIndex(subZoneIndex)
    returns string: subZoneName, string: subZoneMapName
 
03/03/16, 11:14 PM   #2
circonian
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 613
Try this:
Lua Code:
  1. local zoneIndex, poiIndex = GetCurrentSubZonePOIIndices()
  2. if poiIndex then
  3.     local normalizedX, normalizedZ, poiType, iconPath = GetPOIMapInfo(zoneIndex, poiIndex)
  4.     if iconPath:find("poi_city") then
  5.         -- in a city
  6.     end
  7. end

Should work in any language.
 
03/04/16, 06:54 AM   #3
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,964
I tried this code to check if I'm in a delve e.g. (if iconPath:find("poi_delve") then ) but GetCurrentSubZonePOIIndices() always returns nil for zoneIndex and poiIndex for me, except if I'm in some public dungeons or inside a group dungeon.

If I'm in a quest area, city, delve or other zone it will just always be nil (german client) :-(

Edit:
It is working in the Craglorn area all of sudden, but not in other areas as it seems.
If I'm inside a city of Glenumbra it will return nil for the zoneIndex and poiIndex, same as i'm inside a delve in Stormhaven e.g.

Edit2:
After beeing to Craglorn and porting back to Stormhaven the function returns correct information all of sudden!
It seems as if it needs an initiator (Craglorn area?) somehow... Should be reported to ZOS_Chip as a bug maybe?

Edit3:
I guess I understood the functions wrong.
I thought it will return the indices if I'm inside a delve too. For a city it is working if I'm inside the city (but only if i've been to Craglorn once as it seems).
But inside a delve it is not working. It will only work if I stand in front of a delve as the delve is shown as a POI on the map then.

Last edited by Baertram : 03/04/16 at 12:16 PM.
 
03/07/16, 03:44 AM   #4
circonian
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 613
Originally Posted by Baertram View Post
Edit3:
I guess I understood the functions wrong.
I thought it will return the indices if I'm inside a delve too. For a city it is working if I'm inside the city (but only if i've been to Craglorn once as it seems).
But inside a delve it is not working. It will only work if I stand in front of a delve as the delve is shown as a POI on the map then.
If I remember right that was the same problem I had with WaypointIt, that it would not work inside the delve. Although that method can be used for other types of POIs besides cities. It works in public/group dungeons, wayshrines, dark anchors, group boss areas, mundus stones, cities, exc...
 

ESOUI » Developer Discussions » Wish List » [outdated] GetUnitSubZoneIndex() & GetSubZoneNameByIndex()


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