diff --git a/CHANGELOG.md b/CHANGELOG.md index bcf8bdf..df5ea66 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ - **[Fix — Townsfolk POI Map IDs]** Fixed some Townsfolk POIs not appearing in custom zones. Removed the `uiMapId > 1000` restriction in `ZoneDB:ApplyCustomZones()` that was preventing custom zone IDs below 1000 from being registered as self-mappings. This caused some Townsfolk NPCs with zone IDs < 1000 to fail UiMapId lookups and not display on the map. +- **[Fix — Townsfolk DataOverrides Lookup]** Fixed Townsfolk initialization to properly check both `QuestieDB.npcData` and `QuestieDB.npcDataOverrides` / `QuestieDB.objectDataOverrides`. On custom servers (Ebonhold, Ascension), the database is loaded via plugins into overrides tables, but `Townsfolk.Initialize()` was only checking the base database tables which are empty until Stage 3 compilation. This affected Flight Masters, Auctioneers, Innkeepers, Repair Vendors, Class Trainers, and Mailboxes. + - **[Fix — Custom Zone Map Pins]** Fixed map icons not appearing in Ascension custom zones (e.g., Valley of Trials, Northshire Valley). The issue was that custom zone UiMapData was not properly injected into `QuestieCompat.UiMapData` before HBD initialized its map cache. Added `ApplyCustomZones()` function in `ZoneDB` that hooks `ZoneDB.Initialize` to inject custom zones BEFORE the original initialization runs, ensuring HBD's `mapData` table contains custom zone entries like 1244 (Valley of Trials). - **[Fix — Zone Name Fallback]** Fixed "Unknown Zone" display for custom zones in the tracker. When `GetZoneNameByID` fails for custom zone IDs, the system now falls back to `GetQuestLogZoneName` which reads the zone header directly from the quest log where custom zone names are properly displayed. diff --git a/Modules/QuestieMenu/Townsfolk.lua b/Modules/QuestieMenu/Townsfolk.lua index aabfa91..46f2ada 100644 --- a/Modules/QuestieMenu/Townsfolk.lua +++ b/Modules/QuestieMenu/Townsfolk.lua @@ -24,7 +24,7 @@ end ---@param folkTypes table local function _PopulateTownsfolkTypes(folkTypes) -- populate the table with all npc ids based on the given bitmask local count = 0 - for id, npcData in pairs(QuestieDB.npcData) do + local function ProcessNPC(id, npcData) local flags = npcData[QuestieDB.npcKeys.npcFlags] for name, folkType in pairs(folkTypes) do if flags and bitband(flags, folkType.mask) == folkType.mask then @@ -37,11 +37,29 @@ local function _PopulateTownsfolkTypes(folkTypes) -- populate the table with all end end end - if count > 700 then -- 700 seems like a good number - count = 0 - coroutine.yield() + end + if QuestieDB.npcData then + for id, npcData in pairs(QuestieDB.npcData) do + ProcessNPC(id, npcData) + if count > 700 then + count = 0 + coroutine.yield() + end + count = count + 1 + end + end + if QuestieDB.npcDataOverrides then + for id, npcData in pairs(QuestieDB.npcDataOverrides) do + local numericId = tonumber(id) + if numericId and (not QuestieDB.npcData or not QuestieDB.npcData[numericId]) then + ProcessNPC(numericId, npcData) + end + if count > 700 then + count = 0 + coroutine.yield() + end + count = count + 1 end - count = count + 1 end return folkTypes end @@ -135,8 +153,15 @@ function Townsfolk.Initialize() local validProfessionTrainers = Townsfolk.GetProfessionTrainers() for i=1, #validProfessionTrainers do local id = validProfessionTrainers[i] - if QuestieDB.npcData[id] then - local subName = QuestieDB.npcData[id][QuestieDB.npcKeys.subName] + local npcData = nil + if QuestieDB.npcData then + npcData = QuestieDB.npcData[id] + end + if not npcData and QuestieDB.npcDataOverrides then + npcData = QuestieDB.npcDataOverrides[id] or QuestieDB.npcDataOverrides[tostring(id)] + end + if npcData then + local subName = npcData[QuestieDB.npcKeys.subName] if subName then if townfolk[subName] then -- weapon master, tinsert(townfolk[subName], id) @@ -188,8 +213,15 @@ function Townsfolk.Initialize() for class, trainers in pairs(classTrainers) do local newTrainers = {} for _, trainer in pairs(trainers) do - if QuestieDB.npcData[trainer] then - local subName = QuestieDB.npcData[trainer][QuestieDB.npcKeys.subName] + local npcData = nil + if QuestieDB.npcData then + npcData = QuestieDB.npcData[trainer] + end + if not npcData and QuestieDB.npcDataOverrides then + npcData = QuestieDB.npcDataOverrides[trainer] or QuestieDB.npcDataOverrides[tostring(trainer)] + end + if npcData then + local subName = npcData[QuestieDB.npcKeys.subName] if subName and string.len(subName) > 0 then tinsert(newTrainers, trainer) end @@ -212,8 +244,15 @@ function Townsfolk.Initialize() local mailboxes = Townsfolk.GetMailboxes() for i=1, #mailboxes do local id = mailboxes[i] - if QuestieDB.objectData[id] then - local factionID = QuestieDB.objectData[id][QuestieDB.objectKeys.factionID] + local objectData = nil + if QuestieDB.objectData then + objectData = QuestieDB.objectData[id] + end + if not objectData and QuestieDB.objectDataOverrides then + objectData = QuestieDB.objectDataOverrides[id] or QuestieDB.objectDataOverrides[tostring(id)] + end + if objectData then + local factionID = objectData[QuestieDB.objectKeys.factionID] if factionID == 0 then tinsert(factionSpecificTownsfolk["Horde"]["Mailbox"], id) diff --git a/docs/changelog.html b/docs/changelog.html index dc37c5e..5cd6f82 100644 --- a/docs/changelog.html +++ b/docs/changelog.html @@ -194,6 +194,9 @@
  • [Fix — Tracker Objective Nil Check] Added defensive nil check for objective.Description when rendering quest objectives in QuestieTracker.lua. Custom server quests may have objectives without a Description field, which would previously cause "attempt to index field 'Description' (a nil value)" crash.
  • [Fix — InjectUiMapData Registration] Fixed QuestiePluginAPI:InjectUiMapData() to call ZoneDB:ApplyCustomZones() after injecting custom zone data, ensuring the zone mappings are properly registered with both ZoneDB and QuestieCompat.UiMapData.
  • [Fix — Realm Name Matching] Fixed Ascension realm detection in AscensionUiMapData.lua (Questie-X-AscensionDB) to use string.find() instead of exact string comparison. Realms like "Bronzebeard - Warcraft Reborn" now properly match the "Bronzebeard" pattern, allowing custom zone data to load on all Ascension server variants.
  • +
  • [Fix — PrintDifficultyColor Nil Text] Fixed crash in PrintDifficultyColor when quest name is nil. Added defensive nil check in GetColoredQuestName to return early if QuestieDB.QueryQuestSingle returns nil for a quest, preventing "attempt to concatenate local 'text' (a nil value)" errors.
  • +
  • [Fix — Townsfolk POI Map IDs] Fixed some Townsfolk POIs not appearing in custom zones. Removed the uiMapId > 1000 restriction in ZoneDB:ApplyCustomZones() that was preventing custom zone IDs below 1000 from being registered as self-mappings. This caused some Townsfolk NPCs with zone IDs < 1000 to fail UiMapId lookups and not display on the map.
  • +
  • [Fix — Townsfolk DataOverrides Lookup] Fixed Townsfolk initialization to properly check both QuestieDB.npcData and QuestieDB.npcDataOverrides / QuestieDB.objectDataOverrides. On custom servers (Ebonhold, Ascension), the database is loaded via plugins into overrides tables, but Townsfolk.Initialize() was only checking the base database tables which are empty until Stage 3 compilation. This affected Flight Masters, Auctioneers, Innkeepers, Repair Vendors, Class Trainers, and Mailboxes.