Quantcast

Update HereBeDragons to 2.04

Ludovicus [10-13-20 - 12:50]
Update HereBeDragons to 2.04
Filename
libs/HereBeDragons/CHANGELOG.md
libs/HereBeDragons/HereBeDragons-2.0.lua
libs/HereBeDragons/HereBeDragons-Pins-2.0.lua
diff --git a/libs/HereBeDragons/CHANGELOG.md b/libs/HereBeDragons/CHANGELOG.md
index a9e523f..eb3d0cc 100755
--- a/libs/HereBeDragons/CHANGELOG.md
+++ b/libs/HereBeDragons/CHANGELOG.md
@@ -1,17 +1,11 @@
 # Lib: HereBeDragons

-## [2.03-release](https://github.com/Nevcairiel/HereBeDragons/tree/2.03-release) (2020-02-08)
-[Full Changelog](https://github.com/Nevcairiel/HereBeDragons/compare/2.02-release...2.03-release)
+## [2.04-release](https://github.com/Nevcairiel/HereBeDragons/tree/2.04-release) (2020-10-13)
+[Full Changelog](https://github.com/Nevcairiel/HereBeDragons/compare/2.03-release...2.04-release) [Previous Releases](https://github.com/Nevcairiel/HereBeDragons/releases)

-- Unify overriding instance IDs
-- Add more 8.3 vision phasing IDs
-- Update TOC for 8.3
-- Add static override for the minor vision in the Vale of Eternal Bossoms
-- Check for existing static overrides as well
-- Avoid dynamically mapping instances in both directions
-- Properly mark variables as unused
-- Add Uldum N'zoth Invasion Scenario override
-- Add Arms Warrior Artifact Scenario override
-- Add a dynamic instance ID override tracker for unknown scenarios
-- Consistently specify an error level
-- Add a type check for showFlag, otherwise it might error later
+- Update TOC
+- Don't consider instance -1 as valid for overrides
+- Remove HereBeDragons-1.0 compat folder
+- Use C\_Minimap.GetViewRadius on WoW 9.0 instead guessing based on zoom
+    This avoids MINIMAP\_UPDATE\_ZOOM spam, which was degrading performance.
+- Migrate to GitHub actions
diff --git a/libs/HereBeDragons/HereBeDragons-2.0.lua b/libs/HereBeDragons/HereBeDragons-2.0.lua
index 2862cc4..a74c7a1 100755
--- a/libs/HereBeDragons/HereBeDragons-2.0.lua
+++ b/libs/HereBeDragons/HereBeDragons-2.0.lua
@@ -256,7 +256,7 @@ local function UpdateCurrentPosition(instanceCheck)
     -- try to override the instance if possible
     if instanceCheck then
         local _x, _y, instance = HereBeDragons:GetPlayerWorldPosition()
-        if instance and mapData[uiMapID] and mapData[uiMapID].instance ~= instance and uiMapID ~= -1 and not instanceIDOverrides[instance] and not instanceIDOverrides[mapData[uiMapID].instance] then
+        if instance and instance ~= -1 and mapData[uiMapID] and mapData[uiMapID].instance ~= instance and uiMapID ~= -1 and not instanceIDOverrides[instance] and not instanceIDOverrides[mapData[uiMapID].instance] then
             dynamicInstanceIDOverrides[instance] = mapData[uiMapID].instance
         end
     end
diff --git a/libs/HereBeDragons/HereBeDragons-Pins-2.0.lua b/libs/HereBeDragons/HereBeDragons-Pins-2.0.lua
index 4fddedd..409c091 100755
--- a/libs/HereBeDragons/HereBeDragons-Pins-2.0.lua
+++ b/libs/HereBeDragons/HereBeDragons-Pins-2.0.lua
@@ -1,6 +1,6 @@
 -- HereBeDragons-Pins is a library to show pins/icons on the world map and minimap

-local MAJOR, MINOR = "HereBeDragons-Pins-2.0", 7
+local MAJOR, MINOR = "HereBeDragons-Pins-2.0", 8
 assert(LibStub, MAJOR .. " requires LibStub")

 local pins, _oldversion = LibStub:NewLibrary(MAJOR, MINOR)
@@ -8,6 +8,8 @@ if not pins then return end

 local HBD = LibStub("HereBeDragons-2.0")

+local WoW90 = select(4, GetBuildInfo()) >= 90000
+
 pins.updateFrame          = pins.updateFrame or CreateFrame("Frame")

 -- storage for minimap pins
@@ -214,9 +216,13 @@ local function UpdateMinimapPins(force)
     if x ~= lastXY or y ~= lastYY or diffZoom or facing ~= lastFacing or force then
         -- minimap information
         minimapShape = GetMinimapShape and minimap_shapes[GetMinimapShape() or "ROUND"]
-        mapRadius = minimap_size[indoors][zoom] / 2
         minimapWidth = pins.Minimap:GetWidth() / 2
         minimapHeight = pins.Minimap:GetHeight() / 2
+        if WoW90 then
+            mapRadius = C_Minimap.GetViewRadius()
+        else
+            mapRadius = minimap_size[indoors][zoom] / 2
+        end

         -- update upvalues for icon placement
         lastZoom = zoom
@@ -289,7 +295,11 @@ local function UpdateMinimapIconPosition()

     if x ~= lastXY or y ~= lastYY or facing ~= lastFacing or refresh then
         -- update radius of the map
-        mapRadius = minimap_size[indoors][zoom] / 2
+        if WoW90 then
+            mapRadius = C_Minimap.GetViewRadius()
+        else
+            mapRadius = minimap_size[indoors][zoom] / 2
+        end
         -- update upvalues for icon placement
         lastXY, lastYY = x, y
         lastFacing = facing
@@ -308,12 +318,14 @@ local function UpdateMinimapIconPosition()
 end

 local function UpdateMinimapZoom()
-    local zoom = pins.Minimap:GetZoom()
-    if GetCVar("minimapZoom") == GetCVar("minimapInsideZoom") then
-        pins.Minimap:SetZoom(zoom < 2 and zoom + 1 or zoom - 1)
+    if not WoW90 then
+        local zoom = pins.Minimap:GetZoom()
+        if GetCVar("minimapZoom") == GetCVar("minimapInsideZoom") then
+            pins.Minimap:SetZoom(zoom < 2 and zoom + 1 or zoom - 1)
+        end
+        indoors = GetCVar("minimapZoom")+0 == pins.Minimap:GetZoom() and "outdoor" or "indoor"
+        pins.Minimap:SetZoom(zoom)
     end
-    indoors = GetCVar("minimapZoom")+0 == pins.Minimap:GetZoom() and "outdoor" or "indoor"
-    pins.Minimap:SetZoom(zoom)
 end

 -------------------------------------------------------------------------------------------