mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-23 07:40:14 +00:00
Shift-click bag items to insert item links into chat input
This commit is contained in:
parent
e415451f89
commit
43c239ee2f
3 changed files with 45 additions and 0 deletions
|
|
@ -1737,6 +1737,28 @@ void InventoryScreen::renderItemSlot(game::Inventory& inventory, const game::Ite
|
|||
}
|
||||
}
|
||||
|
||||
// Shift+left-click: insert item link into chat input
|
||||
if (ImGui::IsItemHovered() && !holdingItem &&
|
||||
ImGui::IsMouseClicked(ImGuiMouseButton_Left) &&
|
||||
ImGui::GetIO().KeyShift &&
|
||||
item.itemId != 0 && !item.name.empty()) {
|
||||
// Build WoW item link: |cff<qualHex>|Hitem:<id>:0:0:0:0:0:0:0:0|h[<name>]|h|r
|
||||
const char* qualHex = "9d9d9d";
|
||||
switch (item.quality) {
|
||||
case game::ItemQuality::COMMON: qualHex = "ffffff"; break;
|
||||
case game::ItemQuality::UNCOMMON: qualHex = "1eff00"; break;
|
||||
case game::ItemQuality::RARE: qualHex = "0070dd"; break;
|
||||
case game::ItemQuality::EPIC: qualHex = "a335ee"; break;
|
||||
case game::ItemQuality::LEGENDARY: qualHex = "ff8000"; break;
|
||||
default: break;
|
||||
}
|
||||
char linkBuf[512];
|
||||
snprintf(linkBuf, sizeof(linkBuf),
|
||||
"|cff%s|Hitem:%u:0:0:0:0:0:0:0:0|h[%s]|h|r",
|
||||
qualHex, item.itemId, item.name.c_str());
|
||||
pendingChatItemLink_ = linkBuf;
|
||||
}
|
||||
|
||||
if (ImGui::IsItemHovered() && !holdingItem) {
|
||||
// Pass inventory for backpack/bag items only; equipped items compare against themselves otherwise
|
||||
const game::Inventory* tooltipInv = (kind == SlotKind::EQUIPMENT) ? nullptr : &inventory;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue