From b0340cd3ab6b8a327c4a955171137382559bcdb1 Mon Sep 17 00:00:00 2001 From: Venseer Date: Tue, 29 Oct 2024 19:09:45 -0300 Subject: [PATCH] Improved atCommand(iteminfo) --- conf/messages.conf | 2 +- src/map/atcommand.c | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/conf/messages.conf b/conf/messages.conf index c096fb2f931..c1ca477a39a 100644 --- a/conf/messages.conf +++ b/conf/messages.conf @@ -1323,7 +1323,7 @@ // @iteminfo 1276: Please enter an item name/ID (usage: @ii/@iteminfo ). -1277: Item: '%s'/'%s'[%d] (%d) Type: %s | Extra Effect: %s +1277: Item: '%s'/'%s' (%d) Type: %s | Extra Effect: %s 1278: None 1279: With script 1280: NPC Buy:%dz, Sell:%dz | Weight: %.1f diff --git a/src/map/atcommand.c b/src/map/atcommand.c index e3fc633d86f..13f989f49b9 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -7717,14 +7717,22 @@ ACMD(iteminfo) clif->message(fd, atcmd_output); count = MAX_SEARCH; } + StringBuf buf; + StrBuf->Init(&buf); for (i = 0; i < count; i++) { struct item_data *item_data = item_array[i]; if (item_data != NULL) { - snprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd, MSGTBL_ITEMINFO_DETAILS), // Item: '%s'/'%s'[%d] (%d) Type: %s | Extra Effect: %s - item_data->name, item_data->jname, item_data->slot, item_data->nameid, + + struct item link_item = { 0 }; + link_item.nameid = item_data->nameid; + clif->format_itemlink(&buf, &link_item); + + snprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd, MSGTBL_ITEMINFO_DETAILS), // Item: '%s'/'%s' (%d) Type: %s | Extra Effect: %s + item_data->name, StrBuf->Value(&buf), item_data->nameid, itemdb->typename(item_data->type), (item_data->script == NULL) ? msg_fd(fd, MSGTBL_ITEMINFO_NONE) : msg_fd(fd, MSGTBL_ITEMINFO_WITH_SCRIPT) // None / With script ); + StrBuf->Clear(&buf); clif->message(fd, atcmd_output); snprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd, MSGTBL_ITEMINFO_NPC_DETAILS), item_data->value_buy, item_data->value_sell, item_data->weight / 10.); // NPC Buy:%dz, Sell:%dz | Weight: %.1f @@ -7741,6 +7749,7 @@ ACMD(iteminfo) clif->message(fd, atcmd_output); } } + StrBuf->Destroy(&buf); return true; }