Commit Graph

539 Commits

Author SHA1 Message Date
Xurkon 27c1bd6889 fix(minimap): enable floatOnEdge for all 1241 pins
Previously DrawWorldIcon and DrawManualIcon both set floatOnEdge=false
for uiMapId 1241, forcing icons to always show regardless of distance.
This caused pins to render at minimap center when near a spawn, making
them appear to orbit/follow the player as they rotated.

The zone->world coordinate pipeline was verified correct: zoneW matches
dataW exactly for 1241 icons, and playerW is in the same coordinate
space. The problem was purely the floatOnEdge=false behavior combined
with the icon being essentially at the minimap center (1% of radius).

Enabling floatOnEdge=true lets the standard edge-floating path handle
1241 pins like every other zone: icons clamp to the edge when far,
slide along the rim when approaching, and occupy their correct angular
bearing from the player rather than sitting at dead center.
2026-06-01 18:35:39 -05:00
Xurkon 0c034d0ff4 debug(minimap): trace zone->world roundtrip for all pins including 1241 2026-06-01 18:35:39 -05:00
Xurkon 039bdf3627 fix(minimap): remove 1241 special-case overlay from drawMinimapPin
The uiMapID==1241 branch in drawMinimapPin was an experimental overlay
that ran BEFORE the standard minimap projection and rotation transforms.
It duplicated the projection math while bypassing the rotation matrix,
used a different edge-clamp path, and is the primary suspect for why
pins visually follow the player on Sunstrider Isle.

The standard minimap path (handle rotation -> adapt delta to mapRadius
-> apply shape mask -> float-on-edge or clamp) already handles all
pins uniformly regardless of zone. Removing this experimental branch
lets 1241 pins use the same proven path as every other zone.

Also cleaned up:
- stale lastInstanceId reference in throttled PIN debug trace
- unnecessary data.uiMapID guard in QuestieDebugMinimapPin gate
- Sunstrider-specific minimap debug block in UpdateMinimapPins
2026-06-01 18:35:39 -05:00
Xurkon 72b924c514 wip: preserve Sunstrider minimap debugging state 2026-06-01 18:35:39 -05:00
Xurkon 1311ee6fd3 debug(minimap): add /qdrift slash command and throttled PIN debug for drift diagnosis
- /qdrift: one-shot diagnostic that traces the full player-position chain
  (GetCurrentPlayerPosition -> GetWorldCoordinatesFromZone), checks
  mapIdToUiMapId entries, shows pin world coords vs player world coords,
  and verifies zone center bounds
- Throttled [QD] PIN debug in drawMinimapPin (1/sec) showing pinWorld,
  playerWorld, distance, mapRadius, and diff values
- Enhanced [QD] CONV/CONV2 debug in GetCurrentPlayerPosition showing
  raw coords, world coords after conversion, and zone coords after
  back-conversion

Purpose: diagnose why minimap pins follow the player after the areaId fix
2026-06-01 18:35:39 -05:00
Xurkon 4336166d95 fix(minimap): add Ascension areaId mappings to mapIdToUiMapId
Root cause of minimap pin drift on Sunstrider Isle: on Ascension,
GetCurrentMapAreaID() returns 3430 for Eversong, but mapIdToUiMapId only
had the WotLK mapping (463→1941). This meant actualUiMapId was nil in
GetCurrentPlayerPosition(), causing the parent→child zone conversion to
be skipped entirely. Eversong-zone coords passed through tagged as
uiMapID 1241, producing wrong world positions and pin drift.

Fix: add Ascension areaId→uiMapId mappings (3430→1941, 3431→1241) to
mapIdToUiMapId after UiMapData init. Now the conversion path triggers
correctly: Eversong coords → world coords (via 1941 bounds) →
Sunstrider zone coords (via 1241 bounds).

One-line fix in Compat.lua. No changes to HBD.lua or projection logic.
2026-06-01 18:35:20 -05:00
Xurkon efbc0da736 Revert "fix(minimap): zone-space projection for child-map pins (Sunstrider 1241)"
This reverts commit cd65e77af5cafd1ca03fdb4efbafb983dc6d919c.
2026-06-01 18:35:04 -05:00
Xurkon c6436c486d fix(quest): guard against malformed waypoint data in _DrawObjectiveWaypoints
Error: attempt to index field '?' (a number value) at line 1932.
waypoints[1] was a bare number instead of a coordinate pair {x,y}.
Added type(waypoints[1]) ~= 'table' guard alongside existing type(waypoints)
check. Also simplified firstWaypoint access since the guard ensures it's a table.

The underlying data issue (flat numbers vs coordinate pairs) is in the DB
and should be tracked separately — this fix prevents the crash only.
2026-06-01 18:35:04 -05:00
Xurkon e5d7d42201 fix(minimap): zone-space projection for child-map pins (Sunstrider 1241)
Adds _ComputeZoneSpaceDiff to HBD.lua that computes minimap pin
projection in the parent zone's coordinate space (Eversong 1941) instead
of using the world-coordinate delta. On Ascension, GetPlayerMapPosition
returns Eversong-relative coords for players on Sunstrider, but
GetWorldCoordinatesFromZone(1241) treats them as Sunstrider-relative,
producing a wrong player world position and causing pins to drift or
move opposite to the player.

Fix: (1) Store original zone coords on minimap pins at registration
(AddMinimapIconMap). (2) In drawMinimapPin, recover player's actual
Eversong zone coords by reversing the 1241-bounds conversion. (3)
Convert pin's 1241 zone coord to Eversong zone coord via 1241-world.
(4) Delta in Eversong zone-space, scale to pixels using parent-width/mapRadius.

Falls back to existing world-space math for pins without zone coords.
2026-06-01 18:34:28 -05:00
Xurkon 7dce3b3769 removing more bloat 2026-06-01 18:00:41 -05:00
Xurkon 6793805ebe remove staged bloat 2026-06-01 18:00:06 -05:00
Xurkon 164584ca87 fix: Sunstrider pin regression, ghost pins, and learner zone normalization
- Fix: isSunstrider block in _MergeSpawnEvidence now checks IsAscensionProtected
  before writing learner data to npcDataOverrides. Without this guard, each Mana
  Wyrm kill overwrote AscensionDB's z1241=5 data with learner z3431 coords.

- Fix: Clustering disabled for zone 1241 (Sunstrider Isle) in _DrawObjectiveIcons
  so all 5 AscensionDB spawn pins display individually instead of collapsing to 2.

- Fix: Ghost pin loop in AvailableQuests.lua -- 'while frames[i]' was iterating a
  string-keyed table with a numeric index (never iterated). Changed to pairs().

- Fix: NormalizeSpawnZoneKey now uses ZoneDB.areaIdToUiMapId for all zones so
  learner evidence is stored under map IDs (e.g. 1241) not area IDs (e.g. 3431),
  matching AscensionDB's key space. Applied in LearnNPC and _StoreGuidSpawnEvidence.

- Fix: isSunstrider detection in _MergeSpawnEvidence updated from hardcoded
  zoneId==3431 check to IsSunstriderNativeZone() since zone IDs are now normalized
  to map IDs at storage time.
2026-05-25 19:02:56 -05:00
Xurkon 7a7b1eb727 docs: correct Phase 2-5 status — implemented, awaiting in-game test verification
- Phase 2: marked ⚠️ with known spec test failures (quarantined)
- Phase 3-5: marked ⚠️ as implemented, not in-game verified
- Removed  COMPLETE claims that overstate test coverage
2026-05-24 00:44:34 -05:00
Xurkon 7ea4061959 fix(quest): Phase 1 compat — guard quest-log-aware frame unload
Prevent premature frame unloading for completed-but-logged quests:
- AvailableQuests: UnloadUndoable() guard on currentQuestlog
- DailyQuests: HandleDailyQuests() guard on currentQuestlog
- QuestieQuest: IsSafeToUnloadQuestFrames() helper + HideQuest() guard
- TooltipHandler: IsQuestFlaggedCompleted gated by currentQuestlog
- TrackerUtils: fallback IsComplete gated by currentQuestlog

Revert: git revert HEAD --no-edit
2026-05-24 00:43:41 -05:00
Xurkon 7863985974 docs: mark Phase 5 COMPLETE in PROGRESS.md 2026-05-24 00:37:53 -05:00
Xurkon a0c827f6b1 test(learner): Phase 5 unit tests for comms data validation 2026-05-24 00:37:41 -05:00
Xurkon 598f7d3652 feat(learner): Phase 5 — comms data validation 2026-05-24 00:37:27 -05:00
Xurkon 0de46e653f docs: mark Phase 4 COMPLETE in PROGRESS.md 2026-05-24 00:36:53 -05:00
Xurkon 6eaa67277f test(learner): Phase 4 unit tests for tooltip population 2026-05-24 00:36:40 -05:00
Xurkon c5d8c5ffe5 feat(learner): Phase 4 — real-time tooltip for learned spawns 2026-05-24 00:36:19 -05:00
Xurkon dd0640b574 docs: mark Phase 3 COMPLETE with commit hashes 2026-05-24 00:34:15 -05:00
Xurkon 0c6f8fa975 test(learner): Phase 3 unit tests for spawn merge 2026-05-24 00:33:55 -05:00
Xurkon 021d1b942b feat(learner): Phase 3 — weighted spawn merge 2026-05-24 00:33:09 -05:00
Xurkon 5113b28361 docs: mark Phase 2 COMPLETE with commit hashes 2026-05-24 00:30:27 -05:00
Xurkon 59b58ae46a test(learner): Phase 2 unit tests for spawn evidence and pruning 2026-05-24 00:30:03 -05:00
Xurkon 6c121e7bc4 feat(learner): Phase 2 — GUID-based spawn evidence and outlier pruning 2026-05-24 00:29:47 -05:00
Xurkon 44244f504f debug(Arrow): show spawnList coords and world coords for target
- PrintTargetCoords: add world coords computed from zone coord + uiMapId
- _CollectObjective debug: show spawnList[id] zone, firstCoord, isLearned per entry
2026-05-22 20:46:29 -05:00
Xurkon 085a49b15e fix(Arrow): correct Felendren arrow coordinates on Sunstrider
- _ResolveArrowUiMapId: stop redirecting 1241→1941. With zoneDB now
  mapping areaId 3431→uiMapId 1241, and player on uiMapId 1241, keeping
  1241 as 1241 ensures both player and target world coords are computed
  through the same ASCENSION_ZONE_BOUNDS[1241] calibration (1600x1066.67,
  -2721, 8433.94). This gives correct ~169yd distance and bearing.
2026-05-22 19:47:06 -05:00
Xurkon 415b924199 fix(Sunstrider): correct map pins, override check, nil guards
- zoneDB: remap areaId 3431 → uiMapId 1241 (Sunstrider Isle) so quest 8335
  pins render on correct map instead of Eversong Woods (1941)
- compat/HBD: remove 1241→1941 redirect (Sunstrider pins now handled by zoneDB)
- compiler: QuerySingle override check skips empty tables (next() guard) so
  spawn data overrides don't fall through to nil base DB values
- MapIconTooltip: nil guards for minLevel/maxLevel to prevent crashes
- Map/QuestieMap: remove stale 1241→1941 redirect comment
2026-05-22 19:31:47 -05:00
Xurkon 8ab14db3a3 fix(quest): map pins disappear after first kill
AlreadySpawned kept stale entries after UnloadQuestFrames ran.
The draw path for incomplete objectives never cleared it — only
completed objectives called _UnloadAlreadySpawnedIcons. Added
clear at the start of the spawnList draw path so _DetermineIconsToDraw
sees an empty AlreadySpawned and recreates icons each update cycle.
2026-05-21 19:46:17 -05:00
Xurkon afb58e1c2f fix(quest): learned spawns suppressed after quest re-accept
The monster handler replaced spawns with learned data when
prioritizeMyData was enabled but didn't set isLearned=true on
monsterData. The prioritizeMyData filter in PopulateObjective
checked 'if not spawnData.isLearned' and suppressed the spawn,
causing pins to not render after quest abandon+re-accept cycle.
2026-05-21 19:41:03 -05:00
Xurkon 24ed0f48b3 fix(arrow): Sunstrider zoneId 3431, rotation CW, collection distance, native map pins
- zoneId detection: accept 3430 OR 3431 OR uiMapId 1241 (4 locations)
- SetRotation is CW-positive: rotAngle=relative (was -relative)
- Collection functions: override target->1241 when player on Sunstrider
- NPC 15281: spawn zone 1241 (not 3430) for correct coord space
- _ResolveMapUiMapId: removed 1241->1941 redirect
- zoneDB: added areaIdToUiMapId[1241]=1241
- Updated CHANGELOG, README, docs
2026-05-21 19:22:40 -05:00
Xurkon 7f99e7228d fix: clear QuestieDB entity caches on live override injection
QuestieDB:GetNPC and GetObject cache results in _QuestieDB.npcCache /
_QuestieDB.objectCache. When LearnNPC / LearnObject injects new spawn
coordinates into npcDataOverrides / objectDataOverrides, the cached
objects still hold stale (empty) spawn data. PopulateObjective rebuilds
spawnList by calling GetNPC/GetObject, but gets the cached empty data.

Fix: clear the relevant cache entry immediately after live injection so
the next GetNPC/GetObject call rebuilds with fresh override data.

This is the root cause of 'pins not showing on kill' — the spawnList
was rebuilt, but from a stale cache that didn't include the new learned
coordinates.
2026-05-16 09:37:38 -05:00
Xurkon 810ea7f802 fix: real-time minimap pins + defensive GetAchievementNumCriteria shim
1. _InvalidateSpawnListsForNPC was setting objective.AlreadySpawned = nil,
   causing _DetermineIconsToDraw to crash on nil-index when trying to draw
   updated pins. The xpcall wrapper in UpdateObjectiveNotes swallowed the
   error silently, so no icons appeared.

   Fix: unload existing map/minimap icons explicitly, then set
   AlreadySpawned = {} (empty table) instead of nil. Also clear
   hasRegisteredTooltips so tooltips refresh.

2. Added GetAchievementNumCriteria defensive shim for Ascension servers
   with incomplete achievement databases. Returns 0 for invalid IDs
   instead of hard-erroring in Blizzard's WorldMapFrame.
2026-05-16 08:54:52 -05:00
Xurkon d3bcb6da49 fix: empty override tables no longer wipe base DB spawns; real-time pin refresh on NPC learn
Two fixes for QuestieLearner real-time pin rendering:

1. _MergeOverride now skips empty tables (IsEmptyTable guard).
   QuestieLearner stores spawns={} before any coords are captured.
   Previously _MergeOverride treated {} as valid data and replaced the
   base DB's real spawn coordinates with an empty table, breaking pins
   for all NPCs that had been seen but not killed (mouseovers, etc.).

2. _InvalidateSpawnListsForNPC triggers after LearnNPC adds new spawn data.
   The quest objective system caches spawnList once per objective.
   When a kill adds new coordinates, the cached list is stale.
   The new helper:
   - Scans all active quest objectives for references to the NPC
   - Clears objective.spawnList and objective.AlreadySpawned
   - Calls QuestieQuest:UpdateQuest to rebuild pins with fresh data
   This makes learned pins appear in real-time without /reload.
2026-05-16 08:36:47 -05:00
Xurkon 3fff65b66f gitignore: remove Makefile from tracking 2026-05-16 07:59:57 -05:00
Xurkon d0d000cf3f gitignore: re-add dev test files and tooling configs
Tests/, .busted, selene.toml, and wow_classic.yml are dev-only
files — not part of the release artifact.
2026-05-16 07:54:19 -05:00
Xurkon db91ec9fd4 docs: add QuestieLearner in-game testing macros
7 macros for manual in-game testing: stats, target/mouseover dump,
zone info, debug toggle, force learn, and data re-injection.
Each fits within WoW's 255-char macro limit.
2026-05-16 07:33:51 -05:00
Xurkon bf6ecaedbe v1.6.3-unreleased: Sunstrider zone fixes, QuestieLearner icon preservation, migration, and Busted test suite
Code changes (13 files, +916/-171):
- ZoneDB integration: GetZoneId() converts uiMapId→areaId via ZoneDB reverse lookup
- MIN_CONFIDENCE_PINS reduced to 1 for Ascension (incomplete NPC DBs)
- QuestieLearner icon preservation: objective Icon passed to RegisterObjectiveTooltip
- InjectLearnedData zone migration: converts old uiMapId spawn keys to areaId
- areaId passed through all LearnNPC call sites (OnMouseoverUnit, OnQuestDetail,
  OnQuestComplete, OnQuestAccepted, OnQuestTurnedIn, OnGossipShow)
- Compat/Compat.lua: C_Map.GetPlayerMapPosition UiMapData support
- Compat/HBD.lua: Sunstrider mapData aliases and fallback loading
- Sunstrider arrow fix (QuestieArrow.lua), resolved pin rendering (QuestieMap.lua)
- _MergeOverride helper for string/numeric key compatibility
- Northshire Valley UiMapData registration

Testing infrastructure:
- .busted config pointing to tests/ directory
- Tests/wow_api_mock.lua: WoW API mocks (ZoneDB, C_Map, QuestLogCache, etc.)
- Tests/QuestieLearner_spec.lua: 12 tests covering coordinate scaling, spell cast
  learning, zone migration (NPC/objects), icon preservation, settings defaults,
  and LearnNPC spawn zone tracking
- selene.toml + wow_classic.yml: linter configuration

Documentation:
- Makefile with test/lint/ci targets
- sunstrider-coordinate-collection.md: coordinate data reference
- sunstrider-pin-fix.md: root cause analysis and fix documentation
2026-05-16 07:32:47 -05:00
Xurkon 306fb2ac89 Fix learned tooltip quest-start schema in Stormwind 2026-05-13 21:54:09 -05:00
Xurkon a5e3d545a6 Add areaIdToUiMapId[3430]=1241 for Sunstrider Isle reverse mapping 2026-05-10 13:08:26 -05:00
Xurkon 99d090ad2b Remove [946]=668 from UiMapIdOverrides - both Sunstrider and Northshire use 946 as ghost map, cache handles per-zone resolution 2026-05-10 13:03:45 -05:00
Xurkon 151b2ac679 Fix Sunstrider Isle areaId override for GetAreaIdByUiMapId
When UpdateNearestTargets uses ZoneDB:GetAreaIdByUiMapId(946) to verify
player zone, it returns 668 (Northshire) instead of 3430 (Sunstrider).
UiMapIdOverrides[946] was set to 668 for Northshire, so 946 always
resolves to Northshire's areaId even on Sunstrider Isle.

Added direct cache entries for both 1241→3430 and 946→3430 in the
uiMapIdToAreaIdCache (the fast-path lookup table) so GetAreaIdByUiMapId
returns the correct Sunstrider Isle areaId regardless of which map ID
the game returns.
2026-05-10 12:56:45 -05:00
Xurkon b6f4e08880 Revert Tooltip.lua to v1.6.1 (3f8563c) - fixing nameplate icon regression 2026-05-10 10:19:30 -05:00
Xurkon a885faa364 area lookup fixes 2026-05-09 23:53:44 -05:00
Xurkon 9caef46c2b Update docs: MapIconTooltip _GetLevelString guard added to CHANGELOG.md, changelog.html, README.md 2026-05-09 08:26:12 -05:00
Xurkon 01b7f07c41 Fix MapIconTooltip _GetLevelString nil level crash
Root cause: creatureLevels entry for 'Uneasy Citizen' was {} (empty table)
instead of {minLevel, maxLevel, rank}, so creatureLevels[name][1] was nil.
Added early-return guard in _GetLevelString: if creatureLevels[name] is
falsy or has no numeric level at index [1], return name unchanged.

Also updated CHANGELOG.md [Unreleased] section with this fix.
2026-05-09 08:23:54 -05:00
Xurkon 5d56944907 Update version to v1.6.2, document Sunstrider Isle arrow, Tooltip guard, QuestData string safety fixes
[Unreleased] section added to CHANGELOG.md covering:
- Tooltip NPC/Object type guard crash fix (Tooltip.lua)
- InsertMissingQuestIds string guard for questData (tbcQuestFixes.lua, wotlkQuestFixes.lua)
- Sunstrider Isle arrow / UiMapId 946 override fix (zoneDB.lua, QuestieArrow.lua)

README.md:
- Bumped shield to v1.6.2
- Added Sunstrider Isle arrow fix to Quest Arrow section
- Added tooltip crash fix to Tooltips section

docs/changelog.html:
- Added [Unreleased] section at top of changelog

docs/index.html:
- Bumped version badge to v1.6.2
2026-05-09 07:12:37 -05:00
Xurkon 6738027e4d Fix Sunstrider Isle arrow, Tooltip type guard, mapId 946 override
- zoneDB.lua: Add [946] = 3430 to UiMapIdOverrides so GetCurrentZoneId()
  returns 3430 (Sunstrider Isle areaId) even when the game returns uiMapId 946
  (ghost/loading map). Previously 946 had no override, causing zone lookups to
  fall through and return 946 instead of the real zone, breaking arrow distance
  calculation and target filtering.

- QuestieArrow.lua: UpdateNearestTargets uses QuestiePlayer:GetCurrentUiMapId()
  (backed by C_Map.GetBestMapForUnit) for player position. When that returns an
  invalid/ghost map (946/947/0), fall back to ZoneDB lookup via the actual
  zoneId. This ensures the arrow gets real world coordinates regardless of
  whether the world map is open or closed.

  Also includes per-frame debug output when debugArrow profile is enabled.

- Tooltip.lua: Add type guard 'if type(objList) ~= table then break end'
  before iterating learnedNpc[10] and learnedObj[10] in both m_/NPC and o_/object
  paths. Prevents 'attempt to index field questData (a string value)' error
  when the questData field is unexpectedly a string instead of a table.

  The original loop used 'for questId, objList in next, learnedNpc[10]' which
  iterates key-value pairs in insertion order. The _AddToArray helper stores
  values as sequential array elements (tbl[key]=value via table.insert), but
  the iteration was treating it as a questId->objList map. Fixed to use
  ipairs-style iteration with a type check for robustness.
2026-05-09 06:48:59 -05:00
Xurkon 98b4010352 fix: silence QuestLogCache error spam in normal chat
Demote GetQuest/GetQuestObjectives 'quest doesn't exist in QuestLogCache'
messages from Questie:Error to Questie:Debug(DEBUG_DEVELOP). These were
firing repeatedly in chat for quest IDs like 595, 959, 254048 during normal
play. Messages are now only visible when developer debug mode is active.
2026-05-04 21:14:22 -05:00