Mythic Dungeon Tools - MDT

Mythic Dungeon Tools - MDT

77M Downloads

Bug: Importing Routes in MDT Doesn't Update Existing Routes

chatterchats opened this issue ยท 0 comments

commented

Bug: Importing Routes in MDT Doesn't Update Existing Routes

Description

When importing a route in the Mythic Dungeon Tools (MDT) addon, it never prompts to update an existing route if the route already exists. Instead, it imports the route as a new one every time.

Steps to Reproduce

  1. Import a route in MDT.
  2. Attempt to import the same route again.
  3. Notice that instead of updating the existing route, a new duplicate route is created.

Expected Behavior

If a route already exists with the same name or unique identifier (UID), MDT should prompt to update the existing route rather than importing it as a new one.

Actual Behavior

MDT always imports the route as a new one, even if a duplicate route exists.

Cause

The issue seems to stem from the following code blocks in MythicDungeonTools.lua and Modules/Transmission.lua:

if fromLiveSession then
if duplicatePreset then duplicatePreset.uid = nil end
else
preset.uid = nil
MDT:SetUniqueID(preset)
end

function MDT:SetUniqueID(preset)
if not preset.uid then
local newUid = MDT:GenerateUniqueID(11)
-- collision check
local inUse = false
local presets = MDT:GetDB().presets
for _, dungeon in pairs(presets) do
for _, pres in pairs(dungeon) do
if pres.uid and pres.uid == newUid then
inUse = true
break
end
end
end
if not inUse then
preset.uid = newUid
else
MDT:SetUniqueID(preset)
end
end
end

This logic always assigns a new unique ID (uid) during the first import. As a result, subsequent imports can never find a duplicate in the following check in MDT:ImportPreset():

for k, v in pairs(db.presets[db.currentDungeonIdx]) do
if v.uid and v.uid == preset.uid then
updateIndex = k
duplicatePreset = v
break
end
end

Because a new uid is assigned, the duplicate detection mechanism fails, and the route is treated as a new one rather than updating the existing one.

Suggested Fix

Consider adjusting the logic to retain the uid when importing, so that subsequent imports can correctly identify and update the existing route.

Additional Information

  • MDT Version: 5.1.2 & (after updating) 5.1.5
  • WoW Version: 11.0.2
  • Addons Installed:
    • Custom AddOn I'm working on, that can batch import to MDT
    • ElvUI (with and without)
    • MDT