mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-22 23:30:14 +00:00
feat: fire MERCHANT_SHOW and MERCHANT_CLOSED events for vendor addons
Fire MERCHANT_SHOW when vendor window opens (SMSG_LIST_INVENTORY) and MERCHANT_CLOSED when vendor is closed. Used by vendor price addons and auto-sell addons that need to detect vendor interaction state.
This commit is contained in:
parent
37a5b4c9d9
commit
8cc90a69e8
1 changed files with 3 additions and 0 deletions
|
|
@ -21643,6 +21643,7 @@ void GameHandler::openVendor(uint64_t npcGuid) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameHandler::closeVendor() {
|
void GameHandler::closeVendor() {
|
||||||
|
bool wasOpen = vendorWindowOpen;
|
||||||
vendorWindowOpen = false;
|
vendorWindowOpen = false;
|
||||||
currentVendorItems = ListInventoryData{};
|
currentVendorItems = ListInventoryData{};
|
||||||
buybackItems_.clear();
|
buybackItems_.clear();
|
||||||
|
|
@ -21651,6 +21652,7 @@ void GameHandler::closeVendor() {
|
||||||
pendingBuybackWireSlot_ = 0;
|
pendingBuybackWireSlot_ = 0;
|
||||||
pendingBuyItemId_ = 0;
|
pendingBuyItemId_ = 0;
|
||||||
pendingBuyItemSlot_ = 0;
|
pendingBuyItemSlot_ = 0;
|
||||||
|
if (wasOpen && addonEventCallback_) addonEventCallback_("MERCHANT_CLOSED", {});
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameHandler::buyItem(uint64_t vendorGuid, uint32_t itemId, uint32_t slot, uint32_t count) {
|
void GameHandler::buyItem(uint64_t vendorGuid, uint32_t itemId, uint32_t slot, uint32_t count) {
|
||||||
|
|
@ -22372,6 +22374,7 @@ void GameHandler::handleListInventory(network::Packet& packet) {
|
||||||
currentVendorItems.canRepair = savedCanRepair;
|
currentVendorItems.canRepair = savedCanRepair;
|
||||||
vendorWindowOpen = true;
|
vendorWindowOpen = true;
|
||||||
gossipWindowOpen = false; // Close gossip if vendor opens
|
gossipWindowOpen = false; // Close gossip if vendor opens
|
||||||
|
if (addonEventCallback_) addonEventCallback_("MERCHANT_SHOW", {});
|
||||||
|
|
||||||
// Auto-sell grey items if enabled
|
// Auto-sell grey items if enabled
|
||||||
if (autoSellGrey_ && currentVendorItems.vendorGuid != 0) {
|
if (autoSellGrey_ && currentVendorItems.vendorGuid != 0) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue