Skip to content

Commit 5accb4b

Browse files
Merge pull request #3329 from Venseer/improved-atcommand-iteminfo
Improved atCommand(iteminfo)
2 parents 2615a40 + b0340cd commit 5accb4b

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

conf/messages.conf

+1-1
Original file line numberDiff line numberDiff line change
@@ -1323,7 +1323,7 @@
13231323

13241324
// @iteminfo
13251325
1276: Please enter an item name/ID (usage: @ii/@iteminfo <item name/ID>).
1326-
1277: Item: '%s'/'%s'[%d] (%d) Type: %s | Extra Effect: %s
1326+
1277: Item: '%s'/'%s' (%d) Type: %s | Extra Effect: %s
13271327
1278: None
13281328
1279: With script
13291329
1280: NPC Buy:%dz, Sell:%dz | Weight: %.1f

src/map/atcommand.c

+11-2
Original file line numberDiff line numberDiff line change
@@ -7718,14 +7718,22 @@ ACMD(iteminfo)
77187718
clif->message(fd, atcmd_output);
77197719
count = MAX_SEARCH;
77207720
}
7721+
StringBuf buf;
7722+
StrBuf->Init(&buf);
77217723
for (i = 0; i < count; i++) {
77227724
struct item_data *item_data = item_array[i];
77237725
if (item_data != NULL) {
7724-
snprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd, MSGTBL_ITEMINFO_DETAILS), // Item: '%s'/'%s'[%d] (%d) Type: %s | Extra Effect: %s
7725-
item_data->name, item_data->jname, item_data->slot, item_data->nameid,
7726+
7727+
struct item link_item = { 0 };
7728+
link_item.nameid = item_data->nameid;
7729+
clif->format_itemlink(&buf, &link_item);
7730+
7731+
snprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd, MSGTBL_ITEMINFO_DETAILS), // Item: '%s'/'%s' (%d) Type: %s | Extra Effect: %s
7732+
item_data->name, StrBuf->Value(&buf), item_data->nameid,
77267733
itemdb->typename(item_data->type),
77277734
(item_data->script == NULL) ? msg_fd(fd, MSGTBL_ITEMINFO_NONE) : msg_fd(fd, MSGTBL_ITEMINFO_WITH_SCRIPT) // None / With script
77287735
);
7736+
StrBuf->Clear(&buf);
77297737
clif->message(fd, atcmd_output);
77307738

77317739
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
@@ -7742,6 +7750,7 @@ ACMD(iteminfo)
77427750
clif->message(fd, atcmd_output);
77437751
}
77447752
}
7753+
StrBuf->Destroy(&buf);
77457754
return true;
77467755
}
77477756

0 commit comments

Comments
 (0)