Add shift-click links and Take All to mail attachments

Mail attachment icons and names now support shift-click to insert item
links. Item names also show rich tooltips on hover. Adds a "Take All"
button when a mail has multiple attachments.
This commit is contained in:
Kelsi 2026-03-11 21:37:15 -07:00
parent 23cfb9b640
commit 54eae9bffc

View file

@ -10944,8 +10944,30 @@ void GameScreen::renderMailWindow(game::GameHandler& gameHandler) {
ImGui::InvisibleButton("##mailatt", ImVec2(MAIL_SLOT, MAIL_SLOT));
if (ImGui::IsItemHovered() && info && info->valid)
inventoryScreen.renderItemTooltip(*info);
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;
}
}
ImGui::SameLine();
ImGui::TextColored(qc, "%s", name.c_str());
if (ImGui::IsItemHovered() && info && info->valid)
inventoryScreen.renderItemTooltip(*info);
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;
}
}
ImGui::SameLine();
if (ImGui::SmallButton("Take")) {
gameHandler.mailTakeItem(mail.messageId, att.slot);
@ -10953,6 +10975,14 @@ void GameScreen::renderMailWindow(game::GameHandler& gameHandler) {
ImGui::PopID();
}
// "Take All" button when there are multiple attachments
if (mail.attachments.size() > 1) {
if (ImGui::SmallButton("Take All")) {
for (const auto& att2 : mail.attachments) {
gameHandler.mailTakeItem(mail.messageId, att2.slot);
}
}
}
}
ImGui::Spacing();