mirror of
https://github.com/brues-code/ClassicAPI.git
synced 2026-11-16 16:10:36 +00:00
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.