ESOUIMods / LoreBooks

An Elder Scrolls Online Addon which displays map pins for Shalidor's Library books and Eidetic Memory Scrolls
Other
1 stars 3 forks source link

Zoning issue fix #5

Closed yachoor closed 1 year ago

yachoor commented 1 year ago

Some zones have multiple sections with different mapIds, but same map texture. The list of eidetic books for current mapId is only updated if zone texture changed, so pins from previous area are displayed (usually there are none) until map is changed (can be done manually by zooming out). This fixes it by getting eidetic data for current mapId when it is different then previous.

The areas where I encountered this issue: Zenithar's Abbey in Blackwood, Garrick's Rest in High Isle, Greymoor Keep: West Wing in Blackreach: Greymoor Caverns

yachoor commented 1 year ago

If you want to test it, here are 2 books in Zenithar's Abbey (one in first area, second in one a little north from the entrance, following the road):

  [6451] = {
    ["c"] = true,
    ["cn"] = "Books of Blackwood",
    ["n"] = "Rebel's Faded Letter",
    ["q"] = 6623,
    ["e"] = {
      [1] = { ["px"] = 0.6420044250, ["py"] = 0.6377716072, ["pm"] = 1986, ["d"] = true, ["zx"] = 0.6411860050, ["zy"] = 0.6379076121, ["zm"] = 1887, },
    },
  },
  [6450] = {
    ["c"] = true,
    ["cn"] = "Books of Blackwood",
    ["n"] = "Tattered Trader's Log",
    ["q"] = 6623,
    ["e"] = {
      [1] = { ["px"] = 0.6420439739, ["py"] = 0.6378879946, ["pm"] = 1985, ["d"] = true, ["zx"] = 0.6411860050, ["zy"] = 0.6379076121, ["zm"] = 1887, },
    },
  },

/lmdgetpos on both sides of the door between those areas:

2022-12-16 17:08:03.423 - D/LibMapData - -----
2022-12-16 17:08:03.423 - D/LibMapData - GetPlayerPos
2022-12-16 17:08:03.423 - D/LibMapData - blackwood/zhmain_base_0
2022-12-16 17:08:03.423 - D/LibMapData - zoneName: Zenithar's Abbey
2022-12-16 17:08:03.423 - D/LibMapData - mapName: Zenithar's Abbey
2022-12-16 17:08:03.423 - D/LibMapData - ZoneId: 1259
2022-12-16 17:08:03.424 - D/LibMapData - mapId: 1985
2022-12-16 17:08:03.424 - D/LibMapData - zoneIndex: 832
2022-12-16 17:08:03.424 - D/LibMapData - isDungeon: true
2022-12-16 17:08:03.424 - D/LibMapData - isMainZone: false
2022-12-16 17:08:03.424 - D/LibMapData - isSubzone: true
2022-12-16 17:08:03.424 - D/LibMapData - isWorld: false
2022-12-16 17:08:03.424 - D/LibMapData - currentFloor: 1 of 0
2022-12-16 17:08:03.424 - D/LibMapData - X: 0.21443736553192
2022-12-16 17:08:03.424 - D/LibMapData - Y: 0.39289447665215
2022-12-16 17:08:03.424 - D/LibMapData - GPS X: 0.64202437394845
2022-12-16 17:08:03.424 - D/LibMapData - GPS Y: 0.63783559461896
2022-12-16 17:08:03.424 - D/LibMapData - worldX: 163363
2022-12-16 17:08:03.424 - D/LibMapData - worldY: 54562
2022-12-16 17:08:03.424 - D/LibMapData - worldZ: 58375
2022-12-16 17:08:52.700 - D/LibDebugLogger - Loading screen started
2022-12-16 17:08:53.066 - D/LibMapData - OnWorldMapChanged
2022-12-16 17:08:53.122 - D/LibDebugLogger - Loading screen ended (duration: 0.422s)
2022-12-16 17:08:53.135 - D/LibMapData - SetPlayerLocation
2022-12-16 17:08:53.172 - D/LibMapData - OnWorldPositionChanged
2022-12-16 17:08:53.172 - D/LibMapData - SetPlayerLocation
2022-12-16 17:08:53.172 - D/LibMapData - OnWorldPositionChanged
2022-12-16 17:08:53.172 - D/LibMapData - SetPlayerLocation
2022-12-16 17:08:55.237 - D/LibMapData - -----
2022-12-16 17:08:55.237 - D/LibMapData - GetPlayerPos
2022-12-16 17:08:55.237 - D/LibMapData - blackwood/zhmain_base_0
2022-12-16 17:08:55.237 - D/LibMapData - zoneName: Zenithar's Abbey
2022-12-16 17:08:55.237 - D/LibMapData - mapName: Zenithar's Abbey
2022-12-16 17:08:55.237 - D/LibMapData - ZoneId: 1259
2022-12-16 17:08:55.237 - D/LibMapData - mapId: 1986
2022-12-16 17:08:55.237 - D/LibMapData - zoneIndex: 832
2022-12-16 17:08:55.237 - D/LibMapData - isDungeon: true
2022-12-16 17:08:55.237 - D/LibMapData - isMainZone: false
2022-12-16 17:08:55.237 - D/LibMapData - isSubzone: true
2022-12-16 17:08:55.237 - D/LibMapData - isWorld: false
2022-12-16 17:08:55.237 - D/LibMapData - currentFloor: 1 of 0
2022-12-16 17:08:55.237 - D/LibMapData - X: 0.20912951231003
2022-12-16 17:08:55.238 - D/LibMapData - Y: 0.36468130350113
2022-12-16 17:08:55.238 - D/LibMapData - GPS X: 0.64200562504424
2022-12-16 17:08:55.238 - D/LibMapData - GPS Y: 0.63782440718596
2022-12-16 17:08:55.238 - D/LibMapData - worldX: 159637
2022-12-16 17:08:55.238 - D/LibMapData - worldY: 54644
2022-12-16 17:08:55.238 - D/LibMapData - worldZ: 56127
Sharlikran commented 1 year ago

This really isn't the issue but it's the bane of my existence. There are several places that ZOS will change the area, zone, map, map texture, whatever you want to call it and there are other functions that are not called.

SetMapToPlayerLocation will force a change. That is why when you open the map everything updates. I can explain several places this happens. Windhelm and Eastmarch for example.

Sharlikran commented 1 year ago

image

I am in Eastmarch where I am standing.

Sharlikran commented 1 year ago

image

I am in Windhelm where I am standing.

Sharlikran commented 1 year ago

I will probably tinker with it but this won't fix it because there is more going on in the background. I will use ESOProfiler and see if I can figure it out and if I do then I'll update LibMapData and Lorebooks.

yachoor commented 1 year ago

Oh, don't know about other problems, but they seem a little different, I just had this single issue - I was standing in a dungeon that has single map texture - in case of Zenithar's Abbey it's blackwood/zhmain_base_0. When you first enter you're on mapId 1985 and since I came from outside and it was new map texture the addon loaded the books for mapId 1985 and the book showed up, Then I moved north, entered a door separating another area - it had mapId 1986. But the addon checked that the texture is the same and did not load books for mapId 1986 :( LMD.mapTexture was still blackwood/zhmain_base_0 and lastZone was same - it has just one map texture, but multiple mapId for different sections. So I just made sure that if it has loaded books for some mapId, but now I'm on different mapId, it loads the books too

Sharlikran commented 1 year ago

Where I was showing you above, your map texture and map ID fix didn't change the loaded books after leaving the city. Because neither change. It changes coming from Eastmarch to the city though.

Yeah there are many places it will do something like that and then when it does the compas pins or the map pins do not update until SetMapToPlayerLocation is called to force changes. Which happens when you open the map.

I see your point though. I will test it in some of the other areas where I tried to fix this and see what happens. No worries. Just wanted to mention that I have been plagued with this since I started.

Sharlikran commented 1 year ago

And just to be sure I check this properly

Zenithar's Abbey in Blackwood, Garrick's Rest in High Isle, Greymoor Keep: West Wing in Blackreach: Greymoor Caverns

I add the books you mentioned and when I change areas I open the map and then the eidetic memory books will update and display properly. Which happens because of checking both the texture and map ID, correct?

yachoor commented 1 year ago

Yes - it will show one book in first area and when you move to the next it will show the one in current area. Without the change it showed the first one all the time and you had to manually change the map (for example by zooming out) for it to switch to display the second one.

yachoor commented 1 year ago

Book showing up when I'm in entrance area: image Another book showing when I'm in north area: image

The whole area looks like that - with every map having at least 1 book: Screenshot 2022-12-20 174855

I should probably add fake pins in each map for books in all other maps so they would show up all the time

Sharlikran commented 1 year ago

Ahh yes that is a bit different. I forget what I put in place for that. I had to deal with that in Cold Harbor. I guess make the fake pins but that's not really what I would have wanted to have. For example 20 pins to display 4 books. I either have something in place or did not complete it yet, I forget.

I'll take care of that though as I am picky about the API. That is partially what my library was for but I have not completed it yet.

Sharlikran commented 1 year ago

I am completely changing the behavior of LibMapData because I notice with some extra SecurePostHooks and such that there is already a lot going on in the background that the game does as it wants/needs to.

Sharlikran commented 1 year ago

As an example there is a specific spot in Coldharbor and on Amenos where once you move to the new location by whatever means, say through a Door then you are technically in the new location. For example you are in Amenos Station and you leave.

Well you are now in High Isle and Amenos on the main world map. However, right after you leave the event that triggers if I watch for it there is no map change once you leave. You have to walk a ways before the map will change and there isn't anything that triggers that change unless you open the map.

However at that point once you open the map of course the information will update because all the internal handlers fire. I need them to fire if it is a legitimate reason after you leave Amenos Station. Without causing a performance hit.

So this will take some time. I don't know when I will be done.

Sharlikran commented 1 year ago

I'm gonna close this because but keep the conversation here. It isn't really what needs to happen over all. I have to update LibMapData and I am in the process of getting that done so that what you are mentioning will behave the way you expect.

Sharlikran commented 1 year ago

Well the idea I had to queue a change for the events when you change areas like you are describing for the Abby worked but now it causes it to happen twice because there is probably some internal variable I can not set like g_MapControl:Dirty(false) or something.

Sharlikran commented 1 year ago

@yachoor I am still working on LibMapData but would you please manually download the mod from the main page, manually install it and tell me how it works with the current changes?

https://github.com/ESOUIMods/LoreBooks/archive/refs/heads/master.zip

Sharlikran commented 1 year ago

@yachoor if you didn't try the version at the above link please do if you have time. I am testing it but I am also using a different LibMapData. I'm going to see how it works in the locations you mentioned.

yachoor commented 1 year ago

Will test now, sorry didn't see it earlier, was busy looking for new books in Galen :)

yachoor commented 1 year ago

@Sharlikran Everything seems to be updating correctly - the books show up changing areas

Sharlikran commented 1 year ago

https://github.com/ESOUIMods/LibMapData/archive/refs/heads/dev-queue.zip

@yachoor what about when you manually install that version of LibMapData?

yachoor commented 1 year ago

@Sharlikran Everything seems to be updating fine too, but I get logs like "1671741768 :SetMapToPlayerLocation" every 5-70ms

Sharlikran commented 1 year ago

I will remove all the debug messages once I am completely done. Although if you have a lot of mads calling that, that is weird. I have it happen only when the map is open.

yachoor commented 1 year ago

Ah, it's the MiniMap by Fyrakin [Masteroshi430's branch] addon that calls it so often - if I hide the minimap it's not spamming at all - triggers only once on area change and 1/s when I open the normal map

Sharlikran commented 1 year ago

Yeah, and you can test with the new version a little easier by commenting out the SetUpHooks() hook function.

    SLASH_COMMANDS["/lmdgetpos"] = function() GetPlayerPos() end -- used

    SetUpHooks()

    -- DEBUG

Comment that out

Sharlikran commented 1 year ago

See if you can find somewhere that it does not update properly but just playing. Don't go out of your way. Visit places that you feel are problematic if you want but I just want to know of places I can try if it's not working.