From 4cdccb7430550ae31ae3d0774133eb84b8a52f5e Mon Sep 17 00:00:00 2001 From: Kelsi Date: Fri, 20 Mar 2026 16:38:57 -0700 Subject: [PATCH] feat: fire BAG_UPDATE and PLAYER_EQUIPMENT_CHANGED events for addons Fire BAG_UPDATE and UNIT_INVENTORY_CHANGED when item stack/durability fields change in UPDATE_OBJECT VALUES path. Fire PLAYER_EQUIPMENT_CHANGED when equipment slot fields change. Enables bag addons (Bagnon, OneBag) and gear tracking addons to react to inventory changes. --- src/game/game_handler.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/game/game_handler.cpp b/src/game/game_handler.cpp index 99b8edc3..eb6208fb 100644 --- a/src/game/game_handler.cpp +++ b/src/game/game_handler.cpp @@ -12648,7 +12648,11 @@ void GameHandler::applyUpdateObjectBlock(const UpdateBlock& block, bool& newItem // Do not auto-create quests from VALUES quest-log slot fields for the // same reason as CREATE_OBJECT2 above (can be misaligned per realm). if (applyInventoryFields(block.fields)) slotsChanged = true; - if (slotsChanged) rebuildOnlineInventory(); + if (slotsChanged) { + rebuildOnlineInventory(); + if (addonEventCallback_) + addonEventCallback_("PLAYER_EQUIPMENT_CHANGED", {}); + } extractSkillFields(lastPlayerFields_); extractExploredZoneFields(lastPlayerFields_); applyQuestStateFromFields(lastPlayerFields_); @@ -12753,6 +12757,10 @@ void GameHandler::applyUpdateObjectBlock(const UpdateBlock& block, bool& newItem } if (inventoryChanged) { rebuildOnlineInventory(); + if (addonEventCallback_) { + addonEventCallback_("BAG_UPDATE", {}); + addonEventCallback_("UNIT_INVENTORY_CHANGED", {"player"}); + } } } if (block.hasMovement && entity->getType() == ObjectType::GAMEOBJECT) {