Commit Graph
7 Commits
Author SHA1 Message Date
brues-codeandBrues 96b0cf6075 FocusUnit / ClearFocus + focus unit token (#2)
* FocusUnit

* UnitTokenFromGUID: place focus after target, not after mouseover

Retail's documented scan order is
  player -> vehicle -> pet -> party -> partypet -> raid -> raidpet
        -> nameplate -> arena -> arenapet -> boss -> target -> focus
        -> npc -> mouseover -> softenemy -> softfriend -> softinteract

Earlier commit placed focus at the very end. Moves it into the
target-adjacent slot so a focused unit reverse-resolves to "focus"
the moment it isn't also "target", matching retail.

---------

Co-authored-by: Brues <5278969+brues-code@users.noreply.github.com>
2026-05-27 19:34:12 -05:00
Brues a0df98750b UnitTokenFromGUID: scan nameplateN between raidpet and target
Now that the engine recognizes `nameplateN` tokens (via the resolver
hook in nameplate/TokenResolver.cpp), they belong in the reverse-
lookup walk too. Iterates the dense ordered list directly via
NamePlate::Events::GetGUIDByIndex — bails on the first zero return,
skipping the token-resolver + SStrCmpI cost per index.
2026-05-26 16:32:08 -05:00
Brues 5354b78e8f UnitGUID("player"): bypass object-manager gate
FUN_TOKEN_TO_GUID gates "player" on the object-manager lookup, which
drops out transiently during zone transitions / brief CGPlayer rebuilds
even though [VAR_LOCAL_PLAYER_PTR + 0xC0] still holds a valid GUID.
Short-circuit the bare "player" token to read the canonical pointer
directly so we match modern WoW's semantics. Suffixed tokens still go
through the engine so the chained `.target` walk works.

Doesn't help at addon file-load on first login — the GUID isn't
populated anywhere in the engine until SMSG_UPDATE_OBJECT runs in the
main loop after FrameScript_Initialize returns. Addons that need it at
boot have to wait for PLAYER_LOGIN.
2026-05-21 03:06:09 -05:00
Brues fc2010340e UnitTokenFromGUID 2026-05-20 22:40:19 -05:00
Brues e7c72b124e DBC/GUID cleanup 2026-05-14 14:24:11 -05:00
Brues 2eea13ce59 GetPlayerInfoByGUID(guid) 2026-05-11 11:26:21 -05:00
Brues 22dda39e0e UnitGUID(unit) 2026-05-08 01:06:30 -05:00