Thread Tools Display Modes
10/15/16, 06:02 AM   #1
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 1,566
[outdated] Replace usage of map* with zone*

Please do away with the mapId/index/name. They make some things like getting the mapType from a zoneIndex impossible and some of the functions are confusing at first because they do not return what one would expect.

Code:
* GetCurrentMapIndex()
** _Returns:_ *luaindex:nilable* _index_
This function could just be replaced by GetCurrentMapZoneIndex() which already returns the zoneIndex.

Code:
* GetCyrodiilMapIndex()
** _Returns:_ *luaindex:nilable* _index_

* GetImperialCityMapIndex()
** _Returns:_ *luaindex:nilable* _index_
These two should also just return the zoneIndex.

Code:
* GetMapNameByIndex(*luaindex* _mapIndex_)
** _Returns:_ *string* _mapName_
This one is nasty because mapName is not always the same as zoneName. Please consider just using the zone name instead and drop map name completely. GetMapName and GetPlayerLocationName are the same.

Code:
* GetNumMaps()
** _Returns:_ *integer* _numMaps_
This should become GetNumZones() and return the amount of zones. Currently there is no such function for zones and we have to use an ugly hack like this to get all zones:
Lua Code:
  1. local zoneIndex = 1
  2. while true do
  3.     local zoneName = GetZoneNameByIndex(zoneIndex)
  4.     if(zoneName == "") then break end
  5.     -- do something
  6.     zoneIndex = zoneIndex + 1
  7. end

Code:
* GetMapInfo(*luaindex* _index_)
** _Returns:_ *string* _name_, *[UIMapType|#UIMapType]* _mapType_, *[MapContentType|#MapContentType]* _mapContentType_, *integer* _zoneId_, *string* _description_
This function should take a zoneIndex and return an additional boolean "showInLocationTab". Nasty fact: the zoneId it returns is actually the mapId. Really confusing.

Code:
* GetZoneDescription(*integer* _zoneId_)
** _Returns:_ *string* _description_
This one takes the fake zoneId from the previous method to return the description. Not sure why it is even necessary.

Code:
* GetMapParentCategories(*luaindex* _index_)
** _Uses variable returns..._
** _Returns:_ *string* _categoryName_, *luaindex* _categoryIndex_
Should again just take the zoneIndex.

Code:
* WouldProcessMapClick(*number* _normalizedClickX_, *number* _normalizedClickY_)
** _Returns:_ *bool* _wouldProcess_, *luaindex:nilable* _resultingMapIndex_
Should return a zoneIndex.

Not sure if I missed any functions, but please consider this going forward.
In the meantime it would be very helpful if there were functions to get the mapType and mapContentType for a zoneId or maybe just to convert between mapIndex and zoneIndex.
 
10/15/16, 08:47 AM   #2
Shinni
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 167
Most of this is probably not possible because a map and a zone are two completely different things.
A map is what you see on the ingame map, the 2d representation of some area.
A zone is a complete 3d area. Essentially everything separated by a loading screen is a zone. For instance all of the overworld Craglorn is one zone, and each delve in craglorn is another individual zone, but Belkarth is part of the Craglorn overworld 3d area and thus is not an individual zone.
If a player is in Belkarth for instance, the map's name is Belkarth but the zone's name is Craglorn.

So for instance WouldProcessMapClick to return a zoneId/Index wouldn't make any sense because when you have the craglorn map open and your cursor is over belkarth, it would just return the current zoneId.

Last edited by Shinni : 10/15/16 at 08:51 AM.
 
10/18/16, 08:59 AM   #3
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 1,566
Originally Posted by Shinni View Post
Most of this is probably not possible because a map and a zone are two completely different things.
A map is what you see on the ingame map, the 2d representation of some area.
A zone is a complete 3d area. Essentially everything separated by a loading screen is a zone. For instance all of the overworld Craglorn is one zone, and each delve in craglorn is another individual zone, but Belkarth is part of the Craglorn overworld 3d area and thus is not an individual zone.
If a player is in Belkarth for instance, the map's name is Belkarth but the zone's name is Craglorn.

So for instance WouldProcessMapClick to return a zoneId/Index wouldn't make any sense because when you have the craglorn map open and your cursor is over belkarth, it would just return the current zoneId.
While you are right that a zone and a map are not the same thing, for the functions in my post it's not true.
The functions in question only cover the zone maps + tamriel and aurbis (everything you see in the location tab on the map).
Tamriel and Aurbis currently return -1 for GetCurrentMapZoneIndex(), but they could just add 2 placeholder ids for them.
WouldProcessMapClick also does not return a mapIndex for cities like Belkarth (you get true, nil in that case).
So almost all of these are covered by the zone system and thus it should be easy to replace them.
GetMapName and GetPlayerLocationName probably won't be as easy to replace, but they could at least make sure that they return zone names where they are available in order to make them compatible with the other functions.
 

ESOUI » Developer Discussions » Wish List » [outdated] Replace usage of map* with zone*

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