mirror of
https://github.com/brues-code/ClassicAPI.git
synced 2026-11-16 16:10:36 +00:00
Backport the modern C_NewItems system - IsNewItem / RemoveNewItem / ClearAll - flagging items freshly added to bags as "new", cleared once acknowledged. Vanilla has none of the machinery (no DBC, no server data), so it is pure client-side bookkeeping, done entirely in C++ like retail. Newness is keyed on each item's instance GUID (read off the CGItem), so a flag survives the item being moved between slots - impossible for a Lua addon, which can only track by (bag, slot). Bags 0..4 only; equipment and bank are out of scope, matching retail. The feed is event-driven, not polled: it subscribes to Bag::UpdateDelayed (which co-hooks the engine's three BAG_UPDATE fire sites), so a bag rescan runs only on frames where a bag actually changed. A one-time baseline taken ~1.5s after login (re-armed on character switch) keeps items owned at login from being flagged. BAG_NEW_ITEMS_UPDATED fires when the set changes. Consolidations along the way: - New Bag::UpdateDelayed::AutoSubscribe exposes the authoritative "a bag changed this frame" signal as a C++ subscription. - New Item::Location::ContainerInventory factors the CGContainer -> its inventory (vtable +0x10) dispatch hand-rolled in item/Count, item/AverageLevel, and equipmentset/Locations; all now share it. - New Item::Location::EquippedBagInventory (equipped bag -> inventory) plus the FUN_GET_EQUIPPED_BAG_GUID / OFF_CONTAINER_GET_INVENTORY offsets. - NewItems resolves the player via the shared Unit::Identity::PlayerObject.