Commit Graph

310 Commits

Author SHA1 Message Date
Xurkon f160570a95 perf: add learner performance controls 2026-06-04 16:37:03 -05:00
Xurkon 305e918525 perf: batch learner pin refreshes 2026-06-04 16:23:43 -05:00
Xurkon 1ae4a21212 refactor: drop redundant learner private assignment 2026-06-04 10:03:26 -05:00
Xurkon 851a0ad6ea fix: capture learner event payload 2026-06-04 08:00:06 -05:00
Xurkon c4d9c2cf21 perf: head-tail quest comms queues 2026-06-04 07:42:31 -05:00
Xurkon bd1dfe7e79 perf: increment quest-list packet sizing 2026-06-04 07:33:47 -05:00
Xurkon 74d2095a72 perf: use head-index queues in learner comms 2026-06-04 07:24:01 -05:00
Xurkon 45357263c1 perf: batch learner merges and guard debug scans 2026-06-04 07:00:38 -05:00
Xurkon 51561b97d8 perf: batch learner updates and remove Turtle support 2026-06-04 06:47:45 -05:00
Azik 581634d199 Fix Ascension tracker line wrapping
Use tracker wrapping helpers that fall back when Ascension font strings do not expose GetNumLines or GetWrappedWidth.

(cherry picked from commit c9b7de2a636ca918c2549a13de87a688861c831f)
2026-06-03 06:50:07 -05:00
Xurkon 31864a467e fix: harden learner spawn suppression 2026-06-03 06:41:23 -05:00
Xurkon 4b7c295210 fix: stabilize minimap range cutoff and update release docs 2026-06-03 06:05:55 -05:00
Xurkon c3b91f3bee fix: finalize arrow asset and docs updates 2026-06-03 00:26:39 -05:00
Xurkon 4fc8d661fd fix: clean faction arrow transparency 2026-06-02 13:03:19 -05:00
Xurkon 339dc1d94e fix: remove faction arrow alpha boxes 2026-06-02 12:52:18 -05:00
Xurkon 02559f70bd feat: add horde and alliance arrow styles 2026-06-02 12:42:53 -05:00
Xurkon 8a41141172 feat: add new waypoint arrow styles 2026-06-02 12:18:48 -05:00
Xurkon fe1f79cd2b chore: release 1.6.3 2026-06-02 11:25:28 -05:00
Xurkon d3c59e0ce8 feat(arrow): restore sprite sheet arrow from v1.6.2-test
- Swap single-frame SetRotation arrow back to 9x12 sprite sheet (512px TGA).
- Recompute cell UVs from bearing each frame via modulo math.
- Keep arrowold.tga on disk; routing to it comes in follow-up commit.
2026-06-01 21:17:31 -05:00
Xurkon 05d74cc432 feat(slash): add /radiusdebug and /terraindebug diagnostics
- Add /radiusdebug slash command. Dumps zoom, shape, size, scale,
  Minimap:GetViewRadius() (3.3.5a), C_Minimap.GetViewRadius()
  (Retail/WoTLK), CVars, fallback radius (outdoor/indoor), active
  pin count, and 8 sample pin metrics (screen offset, normalized
  radius, edge error). Includes an interpretation block.
- Add /terraindebug slash command. Dumps Minimap, MinimapCluster,
  zoom buttons, border, backdrop, north tag, compass texture,
  mask state, MMHolder, and 5 levels of parent chain. Detects
  ElvUI presence and prints interpretation hints.
- All API calls are defensive with pcall/conditional guards and
  tostring() fallbacks. Slash commands lazy-load _G.Questie*Debug
  so they work even if the function table is updated post-load.

These commands were used during the minimap drift investigation
to verify that radius, scale, and frame hierarchy were not the
drift source. They are invaluable for future regression
investigation and have zero runtime cost when not invoked.
2026-06-01 18:35:39 -05:00
Xurkon 8ee8c2516c fix(worldmap): persist button toggle; hook OnShow/OnHide; Mapster offset
- Refactor button positioning and visibility into _PositionMapButton and
  _RefreshMapButtonVisibility helpers. Single source of truth for both.
- WorldMapButton.Initialize now hooks OnShow/OnHide on WorldMapFrame so
  the button self-updates when the user opens/closes the world map.
  No more manual show/hide calls required from elsewhere in the code.
- Toggle(shouldShow) now persists to Questie.db.profile.mapShowHideEnabled
  and calls _RefreshMapButtonVisibility, so the user's choice survives
  /reload and is consistent with the world map's current visibility.
- Special-case Mapster offset: -50, -72.3 vs default -50, -40. Without
  this, the button overlapped Mapster's UI elements when both addons
  were loaded.
- Frame level set to 99 to ensure the button draws above other map
  elements.

All helpers are no-op-safe when mapButton is nil. IsAddOnLoaded
('Mapster') is optional — falls through to default offset if Mapster
is not loaded.
2026-06-01 18:35:39 -05:00
Xurkon 31ddb9a536 fix(quest): require multi-position learned spawns before overriding AscensionDB
- Add local _CountUniqueSpawnPositions helper (counts unique {x, y}
  across all zone buckets in a spawn table).
- Gate the prioritizeMyData check on ld.settings.enabled, matching the
  Database/QuestieDB.lua fix — when the learner is fully disabled,
  the override lookup is skipped entirely.
- Replace the NPC-15274-specific debug print in the monster() spawn
  selector with a universal reliability check: the learner data is
  only used when CountUniqueSpawnPositions(learnedSpawns) > 1.

This is the consumer-side enforcement of the QuestieLearner cleanup
(commit e71e072). Singleton-position spawn entries are typically the
player's current position captured during quest dialog (accept/turn-in)
rather than real kill evidence. By requiring at least 2 unique
positions, we avoid letting that pollution clobber AscensionDB curated
spawn data.

The NPC-15274-specific debug print was removed — the universal check
replaces it, and the diagnostic it provided is now expressed through
the Questie DEBUG_DEVELOP log line (which still emits when the new
condition is met).
2026-06-01 18:35:39 -05:00
Xurkon 515b1b2b33 fix(available): clean up pin and tooltip when quest enters quest log
In _CalculateAvailableQuests, when a quest is found in the quest log
(IsComplete ~= -1), explicitly unload any available-quest pin frame
for that questId, remove its tooltip, and clear the cached entry
before returning.

Previously the early-return left stale state behind: the pin frame
and tooltip would persist until the next sweep, causing a brief window
where the same quest was visible as both 'available' (yellow !) on
the map and 'in log' (yellow ?) in the quest log.

The cleanup order is correct: unload frame, then remove tooltip,
then clear cache. narrow scope (only 'available' data type) — does
not affect other pin categories.
2026-06-01 18:35:39 -05:00
Xurkon df7b5cff3e debug(map): add gated [QD] trace in SetDrawOrder
Adds a print() block in QuestieMap.utils:SetDrawOrder, gated by
_G.QuestieDebugPins. Dumps frame name, parent (QuestieFrameGroup or
Minimap), frame level, strata, shown/hidden state, and anchor point.

Used to diagnose why minimap pins appear on the wrong layer (behind
border or terrain texture) — the trace fires before SetParent /
SetFrameStrata / SetFrameLevel so the post-call result can be compared
to the pre-call printed values.

Default state: GATE IS OFF. Zero runtime cost in production. All API
calls defensive with tostring() and parent.GetName fallbacks.
2026-06-01 18:35:39 -05:00
Xurkon b7b6280e9d debug(framepool): add gated [QD] trace for FakeHide/FakeShow
Adds a print() block in _Qframe:FakeHide and _Qframe:FakeShow, gated by
_G.QuestieDebugPins. Dumps frame name, shown/hidden state, parent, and
anchor point. Used to diagnose why minimap pins reappear or fail to hide
after zone transitions or anchor re-registration.

Default state: GATE IS OFF. The block is a no-op unless the user
explicitly sets _G.QuestieDebugPins = true. Zero runtime cost in
production. All API calls defensive with tostring() and parent.GetName
fallbacks.
2026-06-01 18:35:39 -05:00
Xurkon 7ce0cdcf99 fix(learner): correct spawn iteration, gate AscensionDB overrides, clean fallback pollution
Real bug fixes (no behavior additions that risk regressions):

- LearnNPC: require both spawnX/spawnY AND x/y before accepting a spawn
  entry. Previously quest-giver/finisher dialog polluted spawn lists
  with the player's current position.
- _MergeSpawnEvidence: respect IsAscensionProtected ownership gate
  unconditionally. The 'test mode' comment-out is removed; AscensionDB
  curated spawn data is now protected from learner overwrite (fixes
  the Sunstrider Mana Wyrm pin regression).
- _PruneSpawnOutliers and PruneLearnedSpawnOutliers: fix broken
  next() iteration. The old code used 'coord = next(spawnTable); while
  coord do ... coord = next(spawnTable, coord)' which treated the
  KEY as the value. For numeric spawn arrays this returned indices
  (1, 2, ...) but the code did coord[1] and coord[2] on those indices,
  which are nil. The outlier pruning was effectively dead code. Now
  iterates with 'coordKey, coord = next(spawnTable)' correctly, sorts
  toRemove keys descending for safe table.remove, and compacts numeric
  arrays.
- InjectLearnedData: early-exit when learner disabled, strip [7] on
  initial npcDataOverrides creation (only _MergeSpawnEvidence should
  populate spawns), versioned cleanup that retroactively clears
  singleton-position spawn entries (≤1 unique position) from pollution
  caused by the prior LearnNPC bug.

Supporting utilities added: CopyWithoutField, CountUniqueSpawnPositions,
NormalizeCoordPair reuse (replaces inline floor(x*100+0.5)/100).
2026-06-01 18:35:39 -05:00
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 72b924c514 wip: preserve Sunstrider minimap debugging state 2026-06-01 18:35:39 -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 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 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 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 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 021d1b942b feat(learner): Phase 3 — weighted spawn merge 2026-05-24 00:33:09 -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 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 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