205 Commits
Author SHA1 Message Date
Brues ad83eb9575 IsMouseButtonDown
Adds the modern (2.0.1+) query function backed by the same
WH_GETMESSAGE hook stream that drives GLOBAL_MOUSE_DOWN/UP — state
flips at the exact same point the events fire. Accepts the 1..5 ID
form, the "LeftButton".."Button5" name form, or no arg for "any
button held".
2026-05-30 22:36:30 -05:00
Brues 94b521881b remove max equipment sets 2026-05-30 21:38:49 -05:00
Brues e8fc583f19 Expand GetQuestDetails: srcItemID, completionText, poi, objective text
Trace SMSG_QUEST_QUERY_RESPONSE serializer at 0x006DBCEC to map the
remaining cache-block field offsets, exposing four new fields plus
per-requirement override text. Empirical dumps across three quests
confirmed the +0x14..+0x24 slots (would-be SuggestedPlayers /
LimitTime / RequiredRaces / RequiredSkill / RequiredSkillValue) are
never populated by the vanilla server — those constraints are
enforced server-side and never broadcast, so addons needing them
must use an external DB.

Also corrects OFF_SORT_PTR -> OFF_ZONE_OR_SORT (int32, positive =
zone areaID, negative = -QuestSort.dbc row).
2026-05-30 17:15:18 -05:00
Brues 6df403444c C_QuestLog.GetQuestDetails 2026-05-30 16:21:12 -05:00
Brues cb7953b503 GameTooltip:SetItemByGUID
Modern method that renders the tooltip for a specific item *instance*
identified by GUID — same string `C_Item.GetItemGUID` returns. Distinct
from `SetItemByID` (which uses base `ItemSparse` data with no
per-instance state): this path goes through the live CGItem, so the
tooltip includes enchant lines, random-suffix-decorated name +
bonuses, and locked/broken state.

Implementation: parse GUID via `Item::Location::ParseGUIDString`,
resolve through the engine's `FUN_OBJECT_RESOLVE_BY_GUID`, then build
the per-instance hyperlink via `Item::Link::FromCGItem`. Strip the
`|cff…|H…|h[…]|h|r` decoration to the bare `item:N:enchant:gem:gem:
gem:gem:suffix:unique` payload (SetHyperlink rejects the decorated
form with "Unknown link type") and dispatch to the engine's existing
SetHyperlink. Closes the loop with `GameTooltip:GetItem()`, which
returns the same dressed link back.
2026-05-30 15:40:06 -05:00
Brues 36e1aa87e4 C_AddOns.IsAddOnLoaded 2026-05-30 14:53:45 -05:00
brues-code 289f82a7e7 Remove IconDataProviderMixin documentation
Removed the `IconDataProviderMixin` section and its details from the API documentation.
2026-05-30 13:53:22 -05:00
Brues 49d09cdf1e Macro Icon functions 2026-05-30 03:54:37 -05:00
Brues 0a901d545d Add GetCursorInfo() backport
Backports the modern WoW global that surfaces whatever's picked up
on the cursor. Reads the engine's cursor-state globals (type tag at
0x00B4D900 + per-type payload slots) and returns one of:

  nil                           empty cursor
  "item", itemID, itemLink      bag item (full per-instance link)
  "item", itemID, itemLink      drag-source item (action bar /
                                equipment / mail) — itemLink
                                recovered by walking equipment+bags
                                for the live CGItem, same trick the
                                action-bar tooltip uses to display
                                enchant info on dragged gear
  "money", copper               gold-split / PickupPlayerMoney
  "spell", slot, type, spellID  spellbook spell
  "macro", index                macro
  "merchant", merchantSlot      merchant-frame item

Also splits the credstore/login offsets back into the same enum
(resolves the lingering merge in Offsets.h) and adds a shared
Item::QualityColor helper that reads the engine's `"|cffRRGGBB"`
color-prefix table at 0x00854124 directly instead of duplicating
the hex palette in cursor/Info.cpp and item/Tooltip.cpp.

New Item::Location::FindByItemID walks equipment then bags looking
for the first CGItem matching an itemID — used by the drag-source
link recovery.
2026-05-29 03:54:17 -05:00
brues-codeandBrues ffd208a578 Windows Credentialed Autologin (GlueXML) (#3)
* Windows Credentialed Autologin

* documentation

* share last modified info with client

---------

Co-authored-by: Brues <5278969+brues-code@users.noreply.github.com>
2026-05-29 02:40:29 -05:00
Brues ec73652b67 2nd arg "canOpen" for IsItemOpenable
removed IsItemOpenableByID
2026-05-28 23:26:04 -05:00
brues-code fbe81b7f01 Simplify API documentation for combat check
Removed redundant explanation for UnitAffectingCombat.
2026-05-28 15:30:44 -05:00
Brues 1242f1dd9f Openable: return nil for uncached items 2026-05-28 14:37:43 -05:00
Brues de0c41dd1d IsItemOpenable 2026-05-28 14:33:41 -05:00
Brues beb9dec6e1 max out CLASSICAPI_VERSION_VALUE for dev build 2026-05-28 00:52:17 -05:00
Brues e760d5f07e Drop focus when out of render distance 2026-05-27 23:44:22 -05:00
Brues d0b6a7c0f3 C_Container.GetContainerItemCharges 2026-05-27 23:43:28 -05:00
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 c0c14c6947 C_Container.SwapItems / MoveItem: accept bank slot IDs
Extend EncodeBagSlot with two new branches matching vanilla's bagID
conventions:

- bagID = -1  -> main bank (24 slots at linear 39..62, container =
  player GUID; same shape as backpack with a +38 offset instead of
  +22).
- bagID = 5..10 -> equipped bank bags (containers at equipment slots
  64..69; same shape as equipped bags with the index range shifted).

Both paths require the bank window to be open in the current
session — the engine doesn't sync bank-side CGContainers or bank
inventory entries before then, so ResolveEquipmentSlot returns null
and EncodeBagSlot bails cleanly. Same constraint
GetContainerItemInfo has on bank IDs.
2026-05-26 19:11:55 -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-codeandBrues da8454c7c2 C_NamePlate API + nameplateN unit tokens (#1)
* C_NamePlate.GetNamePlateGUIDs

* fixed NameCache header

* C_NamePlate.GetNamePlates

* GetNamePlates will show blizzard nameplates as well

* C_NamePlate.GetNamePlateForUnit

* nameplate events

* C_NamePlate.GetNamePlateForGUID

* NAME_PLATE_CREATED now sends frame as argument

* document verification provenance for nameplate-adjacent offsets

- Offsets.h: annotate LUA_REF_REF / LUA_REF_UNREF with their Ghidra
  decompile shapes (FREELIST_REF chain + LUA_REFNIL/NOREF sentinels)
  so the next maintainer doesn't have to re-derive whether these are
  really luaL_ref/unref.
- Walk.h: warn that the 0x00B41414 player global overlays multiple
  sub-objects; reading +0x1C/+0x24 here is safe, feeding it to the
  inventory path crashes.

* harden nameplate frame push against stale registry refs

PushNamePlateFrame now type-checks the rawgeti'd value; on a stale
slot (post-/reload windows, freed slot, etc.) it pops and falls back
to a fresh wrapper instead of returning whatever the registry happens
to hold at that index in the new Lua state. Script_GetNamePlates now
routes through the same helper so it inherits the guard.

Also document the bound on g_seenPlates: pool reuse via DAT_00c4d920
caps it at the session's peak simultaneous-plate count.

* support nameplateN unit tokens

Hook FUN_TOKEN_TO_GUID so every Script_Unit* (UnitName, UnitGUID,
UnitHealth, UnitClass, UnitExists, ...) accepts `nameplateN` tokens
and their `target`-suffix chains (`nameplate1target`,
`nameplate1targettarget`) — modern WoW semantics on the vanilla
engine. Hook is gated by an SStrCmpI prefix check; non-nameplate
tokens fall straight through to the original resolver.

- Ordered GUID list is maintained alongside the existing
  NAME_PLATE_UNIT_ADDED / _REMOVED diff. Append on ADDED, erase on
  REMOVED — creation-order, stable for a plate's lifetime, modern
  semantics.
- Suffix walker mirrors the engine's own LAB_005159d3 walker
  instruction-for-instruction: SStrCmpI "target" + ObjectByGUID +
  read UNIT_FIELD_TARGET (m_objectFields + 0x28).
- SStrCmpI typedef is __stdcall, not __cdecl. The function ends with
  ret 0xc; declaring it cdecl makes MSVC emit a redundant add esp, 12
  on top of the callee cleanup, drifting ESP +12 per call and
  crashing somewhere deep in Lua once L gets read from a poisoned
  stack slot.
- m_objectFields is a *pointer* at obj+0x110, not an inline byte
  offset. Two dereferences (mov eax, [obj+0x110]; mov edi, [eax+0x28]),
  not one — earlier version mistook the inline-vs-pointer shape and
  read instruction bytes as GUIDs.

* document nameplateN unit-token support

- API.md NamePlate section: replace the "scope vs. modern (deferred)"
  callout with a pointer to the new Unit tokens subsection; update
  the events table and "modern divergence" callout to explain why
  the GUID payload remains (engine dispatcher can't carry Lua values
  through %s/%d/%u/%f format codes) even though the token form now
  works.
- New "Unit tokens (`nameplateN`)" subsection covering the resolved
  ~30 UnitX functions, creation-order semantics, suffix chains
  (`nameplate1target`, `targettarget`), and the SStrCmpI prefix-gate
  implementation detail.
- UnitTokenFromGUID's "post-1.12 omitted" list: nameplateN is no
  longer engine-unsupported (we hook the resolver) but it's still
  not used as a reverse-lookup key — indices can be reassigned
  during a session, so it'd be unstable.
- README: new Unit tokens table row pointing to the API.md anchor.

* return stable nameplate wrapper across calls

PushNamePlateFrame was building a fresh Lua table on every call for
unregistered (default vanilla) nameplates — so fields addons set on
the wrapper they received in NAME_PLATE_CREATED were lost on the
next GetNamePlateForUnit lookup. pfUI specifically writes
`plate.nameplate = styledButton` on the CREATED-delivered table to
hand its overlay back through our API, and that field was
disappearing.

Fix: pin the first wrapper for each nameplate pointer in the Lua
registry via luaL_ref, cache the refkey in g_wrapperRefkeys, and
rawgeti on every subsequent push. Same table identity for the life
of the engine plate. Bound by the CGNamePlateFrame pool size (~80).

Cleared on /reload via a new NamePlate::Info::PrepareForReload()
wired into FrameScript_Initialize_h next to the existing
Event::Custom and NameCache reload hooks — stale refkeys would
otherwise point into the freed registry.

* NAME_PLATE_UNIT events now fire token

* nameplate events: ship "nameplateN" tokens, delegate wrappers to engine

Two intertwined changes that together make nameplate-mod addons
(pfUI) survive pool recycle.

1. NAME_PLATE_UNIT_ADDED / _REMOVED arg1 is now the "nameplateN"
   unit token, matching modern WoW exactly. For REMOVED we compute
   the token before erasing from g_orderedGUIDs so the handler can
   still resolve the leaving unit. Addons that want a stable hash
   key call UnitGUID(arg1) to convert.

2. PushNamePlateFrame now delegates to the engine's own
   FrameScript_Object::ScriptRegister (0x00701BD0) instead of
   maintaining our own luaL_ref'd wrapper cache. Per-pointer the
   engine builds a wrapper table once, refs it into the registry,
   and stores the refkey at nameplate+0x08 - every code path
   (ours, addons' CreateFrame(parent) extraction, the engine's own
   internal pushers) then funnels through
   rawgeti(REGISTRY, nameplate+0x08) and gets the same Lua table.

The prior approach kept our own wrapper alongside the engine's
once pfUI's CreateFrame inside NAME_PLATE_CREATED caused the
engine to register the underlying frame itself - fields set on
our wrapper (plate.nameplate = decoratedButton) disappeared from
the API surface even though they still existed on the orphaned
table. Single-source-of-truth fixes it. The refcount-pinning
caveat CLAUDE.md warned about is benign for pool-managed
nameplates (never destroyed during a session).

Also clear seenPlates / lastTickPlates / orderedGUIDs on
FrameScript_Initialize so currently-visible plates refire CREATED
+ UNIT_ADDED after /reload - re-presents them to the freshly
reloaded UI, matching modern WoW.

---------

Co-authored-by: Brues <5278969+brues-code@users.noreply.github.com>
2026-05-26 16:23:09 -05:00
Brues a51225cb84 ranged auto-attack: detect via SPELL_ATTR_AUTO_REPEAT bit
Drop the hardcoded {75, 5019} ID list in favor of testing
Spell.dbc.Attributes bit 1. Auto Shot (Attr=0x00050012) and Shoot
wand (Attr=0x00000012) share that bit; on-next-swing Heroic Strike
and other ranged spells don't. Future-proofs against private
servers adding new auto-repeating spells.
2026-05-26 00:34:11 -05:00
Brues 6969fa77d1 create spellbook section 2026-05-26 00:24:10 -05:00
Brues 74b3765683 auto attack check spells 2026-05-26 00:19:28 -05:00
Brues 10df3f11c2 C_Spell.SpellHasRange 2026-05-26 00:12:47 -05:00
Brues e2d7b0f555 C_Spell.IsSelfBuff 2026-05-26 00:05:43 -05:00
Brues 209a57a8d6 C_Spell.GetSpellSubtext 2026-05-26 00:02:04 -05:00
Brues acb0456610 C_Spell.GetSchoolString 2026-05-25 23:58:10 -05:00
Brues e47f3aacb2 C_Spell.DoesSpellExist 2026-05-25 23:49:29 -05:00
Brues d718530a7a GetItemUniquenessByID 2026-05-25 23:42:10 -05:00
Brues 55d4e1856f GetStackCount/GetItemUniqueness 2026-05-25 23:37:39 -05:00
Brues 68771506a8 IsInRaid/IsInGroup 2026-05-25 23:37:14 -05:00
Brues 54e503d1dd InCombatLockdown just returns false now 2026-05-25 14:59:00 -05:00
Brues 0d5c392c20 C_Map.GetBestMapForUnit 2026-05-25 00:20:53 -05:00
Brues da183c3f9a Update API.md 2026-05-24 19:38:27 -05:00
Brues f61c014973 GetInstanceInfo 2026-05-24 19:33:54 -05:00
Brues b066aec1e9 LockItem/UnlockItem 2026-05-24 16:38:13 -05:00
Brues 9fd85287fa C_Container.MoveItem 2026-05-24 15:51:37 -05:00
Brues 08494b1a48 C_Container.SwapItems 2026-05-24 15:26:54 -05:00
Brues 38f1be96ff GameTooltip:GetOwner() 2026-05-24 01:38:28 -05:00
Brues 49b2bd8829 UnitPower / UnitPowerMax / UnitPowerType + Enum.PowerType 2026-05-22 21:26:47 -05:00
Brues 74aa23480b GetAverageItemLevel 2026-05-22 20:38:21 -05:00
Brues 2b19de518b C_UnitAuras.GetAuraDataBySpellName 2026-05-22 19:14:17 -05:00
Brues 889116c6b0 QUEST_TURNED_IN 2026-05-22 16:41:06 -05:00
Brues 8734030ebe C_QuestLog.IsQuestDataCachedByID 2026-05-22 01:40:03 -05:00
Brues dabb65a220 HEARTHSTONE_BOUND event 2026-05-22 01:20:31 -05:00
Brues 07aaf283e3 GetQuestLogLeaderBoardID 2026-05-22 01:17:56 -05:00
Brues 85f5023f3d GameTooltip:GetGameObject / HasGameObject 2026-05-22 00:12:38 -05:00
Brues 6feb62f884 GetInventoryItemsForSlot
Modern accessor for "all items in inventory that can equip in
slot N". Walks equipment 1..19 + bags 0..4; for each item whose
m_inventoryType passes the slot-compatibility check, inserts
returnTable[packedLocation] = itemLink. Uses the same packed
ItemLocation encoding as C_EquipmentSet.GetItemLocations.

Compatibility check is a single bitwise AND against a static
invType → slotMask table — same shape and values as 3.3.5's at
DAT_00A2D288 (decoded from its Script_GetInventoryItemsForSlot
chain via FUN_007082B0). Two adjustments for vanilla:

  INVTYPE_2HWEAPON       → mainhand only (no titanic grip)
  INVTYPE_WEAPONMAINHAND → mainhand only
  INVTYPE_WEAPONOFFHAND  → offhand only

3.3.5's table allowed either-hand for those three because of
later-expansion mechanics.

Implementation gotcha: Item::Location::ResolveBag does
SetTop(L, 0) internally (it needs to set up the engine's
PackBagSlot expected stack shape), which clobbers our returnTable
at slot 2. Fix: anchor the table in the Lua registry under a
private key, collect items into a std::vector during the walk,
then rebuild the stack and populate. Registry slot is cleaned up
before return.

Bank items aren't included — vanilla's GetItemBySlot gates bank
slots on a banker GUID that's only set while the bank window is
open; modern WoW behaves the same way.

The transmogrify arg is accepted and ignored. Stock 1.12 has no
transmog system to query, and the modern flag's effect (broader
cross-eligibility for visual swaps) reduces to the regular equip
check. Private servers (Turtle WoW etc.) layer their own transmog
systems on top of vanilla; if any of those exposes its rules
through addon-readable engine state we'd plumb the flag through,
but we don't know of any such hook today.
2026-05-21 22:08:15 -05:00
Brues 8b5c670963 C_Item.GetItemSetID / GetItemSetIDByID / GetItemSetInfo
Three new accessors for the equipment-set system that vanilla
exposes only partially:

  GetItemSetIDByID(itemID)       — modern's 16th GetItemInfo return.
  GetItemSetID(itemLocation)     — same, by ItemLocation table.
  GetItemSetInfo(setID)          — full ItemSet.dbc row as a table.

The "what set is this item in" path reads ItemStats_C::m_itemSet
at +0x1C0 (field position derived from VanillaHelpers's struct +
verified-offset arithmetic against the already-confirmed
m_bagFamily at +0x1D0). Cache-miss-warm pattern matches the other
*ByID readers (RequestLoadItemDataByID + listen for
GET_ITEM_INFO_RECEIVED).

GetItemSetInfo reads ItemSet.dbc directly — record layout decoded
from the per-record loader at FUN_0057BBA0:

  +0x00 ID                      +0x6C  SetSpellID[8]
  +0x04 Name[8]  (8 locales!)   +0x8C  SetThreshold[8]
  +0x24 unknown                 +0xAC  RequiredSkill
  +0x28 ItemID[17]              +0xB0  RequiredSkillRank

180-byte stride, 45 columns. ItemSet has only 8 locale slots (vs
Spell.dbc / ChrRaces.dbc's 9), so the name read clamps the global
VAR_LOCALE_INDEX to [0..7] to avoid reading past the locale array
into the unrelated +0x24 field.

Return table: { setID, name, items[], bonuses[{spellID, threshold}],
requiredSkill, requiredSkillRank }. Verified against Magister's
Regalia (setID 181): 8 items, 4 bonuses at thresholds 2/4/6/8.
2026-05-21 17:47:46 -05:00