BelegCufea / CompassHUD

A configurable compass strip showing player's heading along with questmarkers including distance and time to arive.
https://www.curseforge.com/wow/addons/compasshud
GNU General Public License v3.0
5 stars 0 forks source link

GetMapForQuestPOIs() doesn't return the correct uiMapID #3

Closed sampconrad closed 2 months ago

sampconrad commented 3 months ago

Hello.

I believe I was able to pinpoint the issue.

When calling C_QuestLog.GetMapForQuestPOIs() from the Objectives Tracker, it returns the uiMapID for the zone the player is currently in, and NOT the uiMapID for the zone the quest is located at. See images below for a better explanation:

If we print the uiMapID for a World Quest, which CompassHUD is able to correctly place a marker on the compass for, we get this: image

This is the expected return, as the player is in zone 2112 and the quest is in zone 2025.

But if we print the uiMapID for a regular quest that is also on zone 2025, it returns zone 2112 - the same zone as the player - which is incorrect: image

sampconrad commented 3 months ago

I was able to make some progress by doing this:

    else -- regular quest
      uiMapID = getMapId(questID)
      questType = questNormal

      local questsOnMap = C_QuestLog.GetQuestsOnMap(uiMapID)

      if questsOnMap then
        for _, info in ipairs(questsOnMap) do
          if info.questID == questID then
            x = info.x
            y = info.y
            break
          end
        end
      end

      print("Player uiMapId: ", playerMapId)
      print("World Quest uiMapId: ", uiMapID)
    end

This allowed me to correctly retrieve the information for regular quests, but since the getMapId() function relies on C_QuestLog.GetMapForQuestPOIs(), it only works if you open the Quest Log (default key "M") and track quests from there. If you try to track them from the Objectives Tracker, C_QuestLog.GetMapForQuestPOIs() falls into the issue described above and returns the incorrect zone ID.

image

BelegCufea commented 3 months ago

@sampconrad Thanks. I was not aware of this.

But I have a bigger problem. I can't extract x and y coordinates for quest POI. None of the following APIs work correctly for regular quests even when given the correct uiMapID:

I will look into this in the future if I try War Within (too many real life problems right now)

sampconrad commented 3 months ago

None of the following APIs work correctly for regular quests even when given the correct uiMapID:

Yeah, I noticed that. I'm curious how they're managing to do it internally because the default compass works just fine, including the behaviour you'd expect out of GetNextWaypoint(), except The C_Navigation table doesn't even have a function that does that.

image Options > Gameplay > Interface > Display > In Game Navigation image

BelegCufea commented 3 months ago

@sampconrad

Neiter C_SuperTrack :-(

Let's hope TomTom will find a way (and I will STEAL it ;-) )

sampconrad commented 3 months ago

With the change I mentioned above, the compass is able to track all manner of quests perfectly fine if I'm currently in the zone the quest takes place. It also starts tracking them automatically when I zone into the area. I know it's not ideal, but it's at least some of the original functionality being preserved.

I can open a PR if you'd like to check it out.

BelegCufea commented 3 months ago

@sampconrad OMG, sorry I am blind as a rock and can't read code.

I have made some changes to the addon and pushed a new "beta" release. My code changes are nothing to write home about as they iterate through all zone maps looking for questID using C_QuestLog.GetQuestsOnMap and your code. The iterations should ensure that the quest will be found regardless of the map the player is currently on. It's dirty and slow, but as it is called just once in a while, it should be fine.

Please try the new version and let me know if it works (at least a bit).

sampconrad commented 3 months ago

It's working great so far. Thanks, @BelegCufea!

Fingers crossed Blizzard fixes C_QuestLog.GetNextWaypoint(questID) on 11.02 coming out next month, so we can correctly place markers taking people through portals and such. Would be a cool update.

sampconrad commented 3 months ago

I've opened an issue over at https://github.com/Stanzilla/WoWUIBugs detailing our findings. It's a repo dedicated to tracking API bugs found by addon developers. Blizzard is known to monitor it, and sometimes their developers reply to issues as well.

https://github.com/Stanzilla/WoWUIBugs/issues/607

BelegCufea commented 2 months ago

OK, I was just playing with some APIs and found out that C_QuestLog.GetNextWaypoint and C_QuestLog.GetNextWaypointForMap are used for "portals." I have incorporated that into the addon, made some optimizations, and pushed a new version.

I have also found out that you can click on "Offered quests" on the Map. I was digging around but haven't found out how to get coordinates yet (though I can extract QuestID). Will try to add that into the addon if possible.

BelegCufea commented 2 months ago

OK, closing for now as it seems to work in the latest version.