Skip to content

Commit

Permalink
Updated libraries
Browse files Browse the repository at this point in the history
  • Loading branch information
gi2k15 committed Nov 26, 2022
1 parent d08b0a4 commit fe8e35d
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 14 deletions.
42 changes: 30 additions & 12 deletions Libs/HereBeDragons-2.0.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
-- HereBeDragons is a data API for the World of Warcraft mapping system

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

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

local WOW_INTERFACE_VER = select(4, GetBuildInfo())
local WoWClassic = (WOW_PROJECT_ID == WOW_PROJECT_CLASSIC)
local WoWBC = (WOW_PROJECT_ID == WOW_PROJECT_BURNING_CRUSADE_CLASSIC)
local WoWBC = (WOW_PROJECT_ID ~= WOW_PROJECT_MAINLINE) and WOW_INTERFACE_VER >= 20500 and WOW_INTERFACE_VER < 30000
local WoWWrath = (WOW_PROJECT_ID ~= WOW_PROJECT_MAINLINE) and WOW_INTERFACE_VER >= 30400 and WOW_INTERFACE_VER < 40000

-- Data Constants
local COSMIC_MAP_ID = 946
Expand Down Expand Up @@ -59,7 +61,6 @@ local instanceIDOverrides = {
-- Legion
[1478] = 1220, -- Temple of Elune Scenario (Val'Sharah)
[1495] = 1220, -- Protection Paladin Artifact Scenario (Stormheim)
[1498] = 1220, -- Havoc Demon Hunter Artifact Scenario (Suramar)
[1502] = 1220, -- Dalaran Underbelly
[1533] = 0, -- Karazhan Artifact Scenario
[1539] = 0, -- Arm Warrior Artifact Tirisfal Scenario
Expand All @@ -82,7 +83,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 < 16 then
if not oldversion or oldversion < 21 then
-- wipe old data, if required, otherwise the upgrade path isn't triggered
if oldversion then
wipe(mapData)
Expand All @@ -93,19 +94,30 @@ if not oldversion or oldversion < 16 then
-- map transform data extracted from UIMapAssignment.db2 (see HereBeDragons-Scripts on GitHub)
-- format: instanceID, newInstanceID, minY, maxY, minX, maxX, offsetY, offsetX
local transformData
if WoWBC then
if WoWClassic then
transformData = {}
elseif 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 },
}
elseif WoWWrath then
transformData = {
{ 530, 0, 4800, 16000, -10133.3, -2666.67, -2400, 2662.8 },
{ 530, 1, -6933.33, 533.33, -16000, -8000, 10339.7, 17600 },
{ 609, 0, -10000, 10000, -10000, 10000, 0, 0 },
}
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 },
{ 1014, 870, 3200, 5333.3, 1066.7, 2666.7, 0, 0 },
{ 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 },
{ 1498, 1220, -533.3, 2133.3, 3733.3, 5866.7, 0, 0 },
{ 1545, 1220, -2666.7, 0, 4800, 8000, 0, -0 },
{ 1599, 1, 4800, 5866.7, -4266.7, -3200, -490.6, -0.4 },
{ 1609, 571, 6400, 8533.3, -1600, 533.3, 512.8, 545.3 },
}
Expand Down Expand Up @@ -209,14 +221,19 @@ if not oldversion or oldversion < 16 then
elseif WoWBC then
worldMapData[0] = { 44688.53, 29791.24, 32681.47, 11479.44 }
worldMapData[1] = { 44878.66, 29916.10, 8723.96, 14824.53 }
elseif WoWWrath then
worldMapData[0] = { 48033.24, 32020.8, 36867.97, 14848.84 }
worldMapData[1] = { 47908.72, 31935.28, 8552.61, 18467.83 }
worldMapData[571] = { 47662.7, 31772.19, 25198.53, 11072.07 }
else
worldMapData[0] = { 76153.14, 50748.62, 65008.24, 23827.51 }
worldMapData[1] = { 77803.77, 51854.98, 13157.6, 28030.61 }
worldMapData[1] = { 77621.13, 51854.98, 18576.47, 28030.61 }
worldMapData[571] = { 71773.64, 50054.05, 36205.94, 12366.81 }
worldMapData[870] = { 67710.54, 45118.08, 33565.89, 38020.67 }
worldMapData[1220] = { 82758.64, 55151.28, 52943.46, 24484.72 }
worldMapData[1642] = { 77933.3, 51988.91, 44262.36, 32835.1 }
worldMapData[1643] = { 76060.47, 50696.96, 55384.8, 25774.35 }
worldMapData[2444] = { 111420.37, 74283, 86088.21, 15682.4 }
end
end

Expand All @@ -234,7 +251,7 @@ if not oldversion or oldversion < 16 then
fixupZones()

-- try to fill in holes in the map list
for i = 1, 2000 do
for i = 1, 2500 do
if not mapData[i] then
local mapInfo = C_Map.GetMapInfo(i)
if mapInfo and mapInfo.name then
Expand Down Expand Up @@ -321,11 +338,6 @@ HereBeDragons.eventFrame:RegisterEvent("ZONE_CHANGED_INDOORS")
HereBeDragons.eventFrame:RegisterEvent("NEW_WMO_CHUNK")
HereBeDragons.eventFrame:RegisterEvent("PLAYER_ENTERING_WORLD")

-- if we're loading after entering the world (ie. on demand), update position now
if IsLoggedIn() then
UpdateCurrentPosition(true)
end

--- Return the localized zone name for a given uiMapID
-- @param uiMapID uiMapID of the zone
function HereBeDragons:GetLocalizedMap(uiMapID)
Expand Down Expand Up @@ -567,3 +579,9 @@ function HereBeDragons:GetPlayerZonePosition(allowOutOfBounds)
end
return nil, nil, nil, nil
end

-- if we're loading after entering the world (ie. on demand), update position now
-- This needs to remain at the bottom of the library to ensure all functions are loaded before they are needed
if IsLoggedIn() then
UpdateCurrentPosition(true)
end
4 changes: 2 additions & 2 deletions Libs/HereBeDragons-Pins-2.0.lua
Original file line number Diff line number Diff line change
@@ -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", 8
local MAJOR, MINOR = "HereBeDragons-Pins-2.0", 11
assert(LibStub, MAJOR .. " requires LibStub")

local pins, _oldversion = LibStub:NewLibrary(MAJOR, MINOR)
Expand Down Expand Up @@ -493,7 +493,7 @@ pins.updateFrame:SetScript("OnUpdate", OnUpdateHandler)
local function OnEventHandler(frame, event, ...)
if event == "CVAR_UPDATE" then
local cvar, value = ...
if cvar == "ROTATE_MINIMAP" then
if cvar == "rotateMinimap" or cvar == "ROTATE_MINIMAP" then
rotateMinimap = (value == "1")
queueFullUpdate = true
end
Expand Down

0 comments on commit fe8e35d

Please # to comment.