Fix trade window peer tooltips; add shift-click links in trade and loot roll

Trade window now shows rich item tooltips for both sides (peer items were
missing tooltips). Both trade sides and the loot roll popup now support
shift-click to insert item links into the chat input.
This commit is contained in:
Kelsi 2026-03-11 21:32:54 -07:00
parent 7cfeed1e28
commit 99d1f5778c

View file

@ -6156,9 +6156,19 @@ void GameScreen::renderTradeWindow(game::GameHandler& gameHandler) {
if (isMine && ImGui::IsItemHovered() && ImGui::IsMouseDoubleClicked(ImGuiMouseButton_Left)) {
gameHandler.clearTradeItem(static_cast<uint8_t>(i));
}
if (isMine && ImGui::IsItemHovered()) {
if (ImGui::IsItemHovered()) {
if (info && info->valid) inventoryScreen.renderItemTooltip(*info);
else ImGui::SetTooltip("Double-click to remove");
else if (isMine) ImGui::SetTooltip("Double-click to remove");
}
if (ImGui::IsItemHovered() && ImGui::IsMouseClicked(ImGuiMouseButton_Left) &&
ImGui::GetIO().KeyShift && info && info->valid && !info->name.empty()) {
std::string link = buildItemChatLink(info->entry, info->quality, info->name);
size_t curLen = strlen(chatInputBuffer);
if (curLen + link.size() + 1 < sizeof(chatInputBuffer)) {
strncat(chatInputBuffer, link.c_str(), sizeof(chatInputBuffer) - curLen - 1);
chatInputMoveCursorToEnd = true;
refocusChatInput = true;
}
}
} else {
ImGui::TextDisabled(" %d. (empty)", i + 1);
@ -6285,6 +6295,16 @@ void GameScreen::renderLootRollPopup(game::GameHandler& gameHandler) {
if (ImGui::IsItemHovered() && rollInfo && rollInfo->valid) {
inventoryScreen.renderItemTooltip(*rollInfo);
}
if (ImGui::IsItemHovered() && ImGui::IsMouseClicked(ImGuiMouseButton_Left) &&
ImGui::GetIO().KeyShift && rollInfo && rollInfo->valid && !rollInfo->name.empty()) {
std::string link = buildItemChatLink(rollInfo->entry, rollInfo->quality, rollInfo->name);
size_t curLen = strlen(chatInputBuffer);
if (curLen + link.size() + 1 < sizeof(chatInputBuffer)) {
strncat(chatInputBuffer, link.c_str(), sizeof(chatInputBuffer) - curLen - 1);
chatInputMoveCursorToEnd = true;
refocusChatInput = true;
}
}
ImGui::Spacing();
if (ImGui::Button("Need", ImVec2(80, 30))) {