Quantcast

Update HBD to 2.06-release v16

Ludovicus [05-18-21 - 22:30]
Update HBD to 2.06-release v16
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 eb3d0cc..d2d0d58 100755
--- a/libs/HereBeDragons/CHANGELOG.md
+++ b/libs/HereBeDragons/CHANGELOG.md
@@ -1,11 +1,8 @@
 # Lib: HereBeDragons

-## [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)
+## [2.06-release](https://github.com/Nevcairiel/HereBeDragons/tree/2.06-release) (2021-05-08)
+[Full Changelog](https://github.com/Nevcairiel/HereBeDragons/compare/2.05-release...2.06-release) [Previous Releases](https://github.com/Nevcairiel/HereBeDragons/releases)

-- 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
+- Fixup Luacheck
+- Update API check to be independent of WoW version
+- Add transform and worldmap data for BC
diff --git a/libs/HereBeDragons/HereBeDragons-2.0.lua b/libs/HereBeDragons/HereBeDragons-2.0.lua
index a74c7a1..f7a601a 100755
--- a/libs/HereBeDragons/HereBeDragons-2.0.lua
+++ b/libs/HereBeDragons/HereBeDragons-2.0.lua
@@ -1,6 +1,6 @@
 -- HereBeDragons is a data API for the World of Warcraft mapping system

-local MAJOR, MINOR = "HereBeDragons-2.0", 14
+local MAJOR, MINOR = "HereBeDragons-2.0", 16
 assert(LibStub, MAJOR .. " requires LibStub")

 local HereBeDragons, oldversion = LibStub:NewLibrary(MAJOR, MINOR)
@@ -15,7 +15,8 @@ HereBeDragons.worldMapData     = HereBeDragons.worldMapData or {}
 HereBeDragons.transforms       = HereBeDragons.transforms or {}
 HereBeDragons.callbacks        = HereBeDragons.callbacks or CBH:New(HereBeDragons, nil, nil, false)

-local WoWClassic = select(4, GetBuildInfo()) < 20000
+local WoWClassic = (WOW_PROJECT_ID == WOW_PROJECT_CLASSIC)
+local WoWBC = (WOW_PROJECT_ID == WOW_PROJECT_BURNING_CRUSADE_CLASSIC)

 -- Data Constants
 local COSMIC_MAP_ID = 946
@@ -81,7 +82,7 @@ local function overrideInstance(instance) return instanceIDOverrides[instance] o
 HereBeDragons.___DIIDO = dynamicInstanceIDOverrides

 -- gather map info, but only if this isn't an upgrade (or the upgrade version forces a re-map)
-if not oldversion or oldversion < 7 then
+if not oldversion or oldversion < 16 then
     -- wipe old data, if required, otherwise the upgrade path isn't triggered
     if oldversion then
         wipe(mapData)
@@ -91,14 +92,24 @@ if not oldversion or oldversion < 7 then

     -- map transform data extracted from UIMapAssignment.db2 (see HereBeDragons-Scripts on GitHub)
     -- format: instanceID, newInstanceID, minY, maxY, minX, maxX, offsetY, offsetX
-    local transformData = {
-        { 530, 0, 4800, 16000, -10133.3, -2666.67, -2400, 2400 },
-        { 530, 1, -6933.33, 533.33, -16000, -8000, 10133.3, 17600 },
-        { 732, 0, -3200, 533.3, -533.3, 2666.7, -611.8, 3904.3 },
-        { 1064, 870, 5391, 8148, 3518, 7655, -2134.2, -2286.6 },
-        { 1208, 1116, -2666, -2133, -2133, -1600, 10210, 2410 },
-        { 1460, 1220, -1066.7, 2133.3, 0, 3200, -2333.9, 966.7 },
-    }
+    local transformData
+    if WoWBC then
+        transformData = {
+            { 530, 0, 4800, 16000, -10133.3, -2666.67, -2400, 2662.8 },
+            { 530, 1, -6933.33, 533.33, -16000, -8000, 10339.7, 17600 },
+        }
+    else
+        transformData = {
+            { 530, 1, -6933.33, 533.33, -16000, -8000, 9916, 17600 },
+            { 530, 0, 4800, 16000, -10133.3, -2666.67, -2400, 2400 },
+            { 732, 0, -3200, 533.3, -533.3, 2666.7, -611.8, 3904.3 },
+            { 1064, 870, 5391, 8148, 3518, 7655, -2134.2, -2286.6 },
+            { 1208, 1116, -2666, -2133, -2133, -1600, 10210.7, 2411.4 },
+            { 1460, 1220, -1066.7, 2133.3, 0, 3200, -2333.9, 966.7 },
+            { 1599, 1, 4800, 5866.7, -4266.7, -3200, -490.6, -0.4 },
+            { 1609, 571, 6400, 8533.3, -1600, 533.3, 512.8, 545.3 },
+        }
+    end

     local function processTransforms()
         for _, transform in pairs(transformData) do
@@ -193,8 +204,11 @@ if not oldversion or oldversion < 7 then

         -- data for the azeroth world map
         if WoWClassic then
-            worldMapData[0] = { 44688.53, 29795.11, 32601.04, 9894.93 }
-            worldMapData[1] = { 44878.66, 29916.10, 8723.96, 14824.53 }
+            worldMapData[0] = { 44688.53, 29795.11, 32601.04,  9894.93 }
+            worldMapData[1] = { 44878.66, 29916.10,  8723.96, 14824.53 }
+        elseif WoWBC then
+            worldMapData[0] = { 44688.53, 29791.24, 32681.47, 11479.44 }
+            worldMapData[1] = { 44878.66, 29916.10,  8723.96, 14824.53 }
         else
             worldMapData[0] = { 76153.14, 50748.62, 65008.24, 23827.51 }
             worldMapData[1] = { 77803.77, 51854.98, 13157.6, 28030.61 }
diff --git a/libs/HereBeDragons/HereBeDragons-Pins-2.0.lua b/libs/HereBeDragons/HereBeDragons-Pins-2.0.lua
index 409c091..e19b29e 100755
--- a/libs/HereBeDragons/HereBeDragons-Pins-2.0.lua
+++ b/libs/HereBeDragons/HereBeDragons-Pins-2.0.lua
@@ -8,7 +8,7 @@ if not pins then return end

 local HBD = LibStub("HereBeDragons-2.0")

-local WoW90 = select(4, GetBuildInfo()) >= 90000
+local MinimapRadiusAPI = C_Minimap and C_Minimap.GetViewRadius

 pins.updateFrame          = pins.updateFrame or CreateFrame("Frame")

@@ -218,7 +218,7 @@ local function UpdateMinimapPins(force)
         minimapShape = GetMinimapShape and minimap_shapes[GetMinimapShape() or "ROUND"]
         minimapWidth = pins.Minimap:GetWidth() / 2
         minimapHeight = pins.Minimap:GetHeight() / 2
-        if WoW90 then
+        if MinimapRadiusAPI then
             mapRadius = C_Minimap.GetViewRadius()
         else
             mapRadius = minimap_size[indoors][zoom] / 2
@@ -295,7 +295,7 @@ local function UpdateMinimapIconPosition()

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

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