Skip to content

Commit

Permalink
Making WOTLK Instances work again (first try).
Browse files Browse the repository at this point in the history
  • Loading branch information
IrcDirk committed Jan 25, 2023
1 parent adda0b1 commit b24806e
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 10 deletions.
42 changes: 33 additions & 9 deletions Carbonite/NxMap.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2304,6 +2304,12 @@ function Nx.Map:MinimapUpdate()
self.MMMenuIFull:SetChecked(lOpts.NXMMFull)
Nx.Menu:CheckUpdate(self.MMMenuIFull)
end
if Nx.db.profile.MiniMap.InstanceTogFullSize then
local _, instanceType = GetInstanceInfo()
if self:IsInstanceMap (Nx.Map.RMapId) or (instanceType ~= nil and instanceType ~= "none") then
lOpts.NXMMFull=true
end
end
if zoomType == 0 then
al = 1
end
Expand Down Expand Up @@ -4444,6 +4450,7 @@ function Nx.Map:Update (elapsed)
end
local dungeontest = Nx.Map:GetCurrentMapDungeonLevel()
self.InstanceId = false

if self:IsInstanceMap (Nx.Map.UpdateMapID) and not self.CurOpts.NXInstanceMaps then
self.InstanceId = Nx.Map.UpdateMapID
plZX = plZX * 100
Expand Down Expand Up @@ -4476,11 +4483,16 @@ function Nx.Map:Update (elapsed)
self.InstLevelSet = -1
end

self.PlyrX = x + plZX * 1002 / 25600
self.PlyrY = y + plZY * 668 / 25600 + (lvl - 1) * 668 / 256
local layerIndex = WorldMapFrame:GetCanvasContainer():GetCurrentLayerIndex();
local layers = C_Map.GetMapArtLayers(mapId)

self.PlyrX = x + plZX * layers[layerIndex].layerWidth / 25600
self.PlyrY = y + plZY * layers[layerIndex].layerHeight / 25600 + (lvl - 1) * layers[layerIndex].layerHeight / 256
-- self.InstanceLevel = GetCurrentMapDungeonLevel()

self.PlyrSpeed = 0

Nx.Map.MouseOver = false
elseif plZX > 0 or plZY > 0 then -- Update world position of player if we can get it

plZX = plZX * 100
Expand Down Expand Up @@ -5225,12 +5237,6 @@ function Nx.Map:SwitchRealMap (id)
self:SetInstanceMap() -- Turn it off
end

if Nx.db.profile.MiniMap.InstanceTogFullSize then
self.LOpts.NXMMFull = false
if self:IsInstanceMap (id) then
self.LOpts.NXMMFull = true
end
end
local map = Nx.Map:GetMap (1)
map.Guide:UpdateMapIcons()
end
Expand Down Expand Up @@ -9053,6 +9059,20 @@ function Nx.Map:InitTables()
Nx.Map.MapWorldInfo[k].OBaseMap = winfo.BaseMap
end
end
for k, v in pairs (Nx.Zones) do
if Nx.Map:GetContinentMapID(k) == 113 then
local name, minLvl, maxLvl, faction, cont, entryId, ex, ey, z = Nx.Split ("|", v)
if cont == "5" then
local _, _ , _, data = Nx.Map:GetLegacyMapInfo(k);
for mk, mv in pairs (data) do
mk = tonumber(mk)
if mk ~= nil and mv ~= k then
Nx.Zones[mv] = v
end
end
end
end
end
for k, v in pairs (Nx.Zones) do
if worldInfo[k] then
local name, minLvl, maxLvl, faction, cont, entryId, ex, ey = Nx.Split ("|", v)
Expand Down Expand Up @@ -9437,7 +9457,11 @@ function Nx.Map:SetToCurrentZone()
end

function Nx.Map:GetCurrentMapAreaID()
local mapID = Nx.Map.MouseOver and WorldMapFrame:GetMapID() or MapUtil.GetDisplayableMapForPlayer()
local displayableMapID = MapUtil.GetDisplayableMapForPlayer()
local mapID = Nx.Map.MouseOver and WorldMapFrame:GetMapID() or displayableMapID

local _, instanceType = GetInstanceInfo()
if (instanceType ~= nil and instanceType ~= "none") then mapID = displayableMapID end
return mapID
end

Expand Down
2 changes: 1 addition & 1 deletion Carbonite/NxMapData.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4909,7 +4909,7 @@ function Nx.Map:GetLegacyMapInfo(uiMapId)
if not c then return end

local m, f = floor(c / 10000), (c % 10000)
return m, f, MapMigrationData[m].mapFile
return m, f, MapMigrationData[m].mapFile, MapMigrationData[m]
end
MapMigrationData = {
[4] = { mapFile = "Durotar", [0] = 1, [8] = 2, [12] = 5, [19] = 6, [11] = 4, [10] = 3},
Expand Down

0 comments on commit b24806e

Please sign in to comment.