mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-22 23:30:14 +00:00
fix: show repair button when vendor has NPC_FLAG_REPAIR (0x40) set
Vendors that open directly (without gossip menu) never triggered the armorer gossip path, so canRepair was always false and the Repair button was hidden. Now also check the NPC's unit flags for NPC_FLAG_REPAIR when the vendor list arrives, fixing armorers accessed directly.
This commit is contained in:
parent
8f3f1b21af
commit
64439673ce
1 changed files with 13 additions and 1 deletions
|
|
@ -18741,8 +18741,20 @@ void GameHandler::handleGossipComplete(network::Packet& packet) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameHandler::handleListInventory(network::Packet& packet) {
|
void GameHandler::handleListInventory(network::Packet& packet) {
|
||||||
bool savedCanRepair = currentVendorItems.canRepair; // preserve armorer flag set before openVendor()
|
bool savedCanRepair = currentVendorItems.canRepair; // preserve armorer flag set via gossip path
|
||||||
if (!ListInventoryParser::parse(packet, currentVendorItems)) return;
|
if (!ListInventoryParser::parse(packet, currentVendorItems)) return;
|
||||||
|
|
||||||
|
// Check NPC_FLAG_REPAIR (0x40) on the vendor entity — this handles vendors that open
|
||||||
|
// directly without going through the gossip armorer option.
|
||||||
|
if (!savedCanRepair && currentVendorItems.vendorGuid != 0) {
|
||||||
|
auto entity = entityManager.getEntity(currentVendorItems.vendorGuid);
|
||||||
|
if (entity && entity->getType() == ObjectType::UNIT) {
|
||||||
|
auto unit = std::static_pointer_cast<Unit>(entity);
|
||||||
|
if (unit->getNpcFlags() & 0x40) { // NPC_FLAG_REPAIR
|
||||||
|
savedCanRepair = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
currentVendorItems.canRepair = savedCanRepair;
|
currentVendorItems.canRepair = savedCanRepair;
|
||||||
vendorWindowOpen = true;
|
vendorWindowOpen = true;
|
||||||
gossipWindowOpen = false; // Close gossip if vendor opens
|
gossipWindowOpen = false; // Close gossip if vendor opens
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue