Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved atCommand(iteminfo) #3329

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion conf/messages.conf
Original file line number Diff line number Diff line change
Expand Up @@ -1323,7 +1323,7 @@

// @iteminfo
1276: Please enter an item name/ID (usage: @ii/@iteminfo <item name/ID>).
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
Expand Down
13 changes: 11 additions & 2 deletions src/map/atcommand.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Venseer marked this conversation as resolved.
Show resolved Hide resolved
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
Expand All @@ -7741,6 +7749,7 @@ ACMD(iteminfo)
clif->message(fd, atcmd_output);
}
}
StrBuf->Destroy(&buf);
return true;
}

Expand Down
Loading