Quantcast Unknown POI listed as MAP_PIN_TYPE_POI_SEEN - ESOUI
 
Thread Tools Display Modes
09/25/18, 08:09 AM   #1
MasterLenman
Join Date: Oct 2016
Posts: 2
Unknown POI listed as MAP_PIN_TYPE_POI_SEEN

I'm currently updating the Destinations addon for Murkmire, and unknown points of interest were broken by this update. The addon used to check for them like this:
Lua Code:
  1. local zoneIndex = GetCurrentMapZoneIndex()
  2.  
  3. for poiIndex = 1, GetNumPOIs(zoneIndex) do
  4.     local normalizedX, normalizedY, poiType = GetPOIMapInfo(zoneIndex, poiIndex)
  5.     local unknown = poiType == MAP_PIN_TYPE_INVALID
  6.     if unkown do ......... end
  7. end

Since 4.2.0 this no longer works, as poiType is now always MAP_PIN_TYPE_POI_SEEN, even if they are not shown to the player. Why was this changed? Does anyone know of a good new way to check for unknown POIs?
  Reply With Quote
09/26/18, 09:23 AM   #2
ZOS_DanBatson
ZOS Staff!
 
ZOS_DanBatson's Avatar
Yes this person is from ZeniMax!
Join Date: Jul 2015
Posts: 31
The new signature for that function is:

GetPOIMapInfo(zoneIndex, poiIndex) return normalizedX, normalizedZ, poiPinType, icon, isShownInCurrentMap, linkedCollectibleIsLocked, isDiscovered, isNearby

isDiscovered and isNearby were added.

Now instead of obfuscating POIs you haven't seen, we let the API know about it (where it is, which icon, etc) and we provide whether or not it's discovered and whether or not it's nearby to determine whether or not we want to show it on the map. For the purposes of addons, you can make your own determinations about what POIs you show and how (primarily using isShownInCurrentMap, isDiscovered, and isNearby), but you no longer need to cache off your own position and icon information.

If the zoneIndex and poiIndex are good, you should no longer be getting back INVALID for the poiPinType. To mirror the old behavior, in the past if isDiscovered was false and isNearby was false, poiPinType would have been INVALID.

Lua Code:
  1. local normalizedX, normalizedZ, poiPinType, icon, isShownInCurrentMap, linkedCollectibleIsLocked, isDiscovered, isNearby = GetPOIMapInfo(zoneIndex, poiIndex)
  2. local unknown = not (isDiscovered or isNearby)

Last edited by ZOS_DanBatson : 09/26/18 at 09:37 AM.
  Reply With Quote
11/04/18, 12:44 AM   #3
MasterLenman
Join Date: Oct 2016
Posts: 2
Originally Posted by ZOS_DanBatson View Post
The new signature for that function is:

GetPOIMapInfo(zoneIndex, poiIndex) return normalizedX, normalizedZ, poiPinType, icon, isShownInCurrentMap, linkedCollectibleIsLocked, isDiscovered, isNearby

isDiscovered and isNearby were added.

Now instead of obfuscating POIs you haven't seen, we let the API know about it (where it is, which icon, etc) and we provide whether or not it's discovered and whether or not it's nearby to determine whether or not we want to show it on the map. For the purposes of addons, you can make your own determinations about what POIs you show and how (primarily using isShownInCurrentMap, isDiscovered, and isNearby), but you no longer need to cache off your own position and icon information.

If the zoneIndex and poiIndex are good, you should no longer be getting back INVALID for the poiPinType. To mirror the old behavior, in the past if isDiscovered was false and isNearby was false, poiPinType would have been INVALID.

Lua Code:
  1. local normalizedX, normalizedZ, poiPinType, icon, isShownInCurrentMap, linkedCollectibleIsLocked, isDiscovered, isNearby = GetPOIMapInfo(zoneIndex, poiIndex)
  2. local unknown = not (isDiscovered or isNearby)
Thanks for the detailed response and explanation! It's working fine now in Destinations.
  Reply With Quote
10/21/18, 02:58 AM   #4
Hydra9268
 
Hydra9268's Avatar
AddOn Author - Click to view addons
Join Date: May 2018
Posts: 27
Thanks for the information Dan!
  Reply With Quote
10/26/18, 09:20 PM   #5
Hydra9268
 
Hydra9268's Avatar
AddOn Author - Click to view addons
Join Date: May 2018
Posts: 27
For the past few days, I've reviewed this change and remain at a loss.

The Zygor devs coded their Addon to automatically call GetPOIMapInfo whenever the map opens or changes, so the data appears to initialize at call-time. I believe this negates the need to create the map pins like how other Addons do it. (example from ChronicCollector.lua)



Here's their code from Zygor's pointer.lua file with my edits based on Dan's reply:

Lua Code:
  1. _GetPOIMapInfo_ORIG_ZGV = GetPOIMapInfo
  2. function GetPOIMapInfo( map, id, truthful )
  3.  
  4.     if truthful then
  5.         return _GetPOIMapInfo_ORIG_ZGV( map, id )
  6.     end
  7.    
  8.     local normalizedX, normalizedY, poiPinType, icon, isShownInCurrentMap, linkedCollectibleIsLocked, isDiscovered, isNearby = _GetPOIMapInfo_ORIG_ZGV( map, id )
  9.  
  10.     if icon:find("icon_missing") then
  11.         icon = ZGV.DIR.."/Arrows/Stealth/cbni0-o1egp.dds"
  12.     end
  13.  
  14.     if poiPinType == not (isDiscovered or isNearby) then
  15.         poiPinType = MAP_PIN_TYPE_INVALID
  16.     else
  17.         poiPinType = MAP_PIN_TYPE_POI_SEEN
  18.     end
  19.  
  20.     LMP:CreatePin( poiPinType, "pin-"..id, normalizedX, normalizedY )
  21.  
  22.     return normalizedX, normalizedY, poiPinType, icon, isShownInCurrentMap, linkedCollectibleIsLocked, isDiscovered, isNearby
  23. end

I tried a series of method calls with most throwing null or undefined errors.

Lua Code:
  1. ZO_WorldMapPins:CreatePin(poiPinType, id, normalizedX, normalizedY)
Lua Code:
  1. CreateSinglePOIPin( map, id)
Lua Code:
  1. g_mapPinManager:CreatePin(poiPinType, "testing", normalizedX, normalizedY)
Lua Code:
  1. ZO_MapLocations:AddLocation( map )

The last thing I tried was the popular LibMapPins library. The Library does receive the required data.


via
Lua Code:
  1. LMP:CreatePin( poiPinType, "pin-"..id, normalizedX, normalizedY )


However, I do not see undiscovered pins on the map. That's where I get lost. Any ideas on what I'm missing?

Last edited by Hydra9268 : 10/26/18 at 09:34 PM.
  Reply With Quote
10/28/18, 03:03 AM   #6
Baertram
 
Baertram's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 2,362
Not abke to help here but please do not override the functions of the game! It will break other addons if your addon does not ##OptionallDependsOn: addonName!

Please use Zo_PreHook instead and return false to call the original function, or true to end after your preehook code was run and the original function does not need to be run anymore.
  Reply With Quote
01/05/19, 11:00 PM   #7
Hydra9268
 
Hydra9268's Avatar
AddOn Author - Click to view addons
Join Date: May 2018
Posts: 27
Originally Posted by Baertram View Post
Not abke to help here but please do not override the functions of the game! It will break other addons if your addon does not ##OptionallDependsOn: addonName!

Please use Zo_PreHook instead and return false to call the original function, or true to end after your preehook code was run and the original function does not need to be run anymore.
Hi, Baertram. Thanks! I didn't understand at the time what you meant, but I do now. I removed that POS code and deprecated out of the Addon. I don't know what the hell the Zygor devs were thinking when they put that in.
  Reply With Quote

ESOUI » Developer Discussions » General Authoring Discussion » Unknown POI listed as MAP_PIN_TYPE_POI_SEEN

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