From b20054a678fc5a2786819e879f085e5dcf02c052 Mon Sep 17 00:00:00 2001 From: Guilherme Menaldo Date: Sat, 1 Jun 2019 14:47:24 -0300 Subject: Add identifyall atcommand Signed-off-by: Haru --- doc/atcommands.txt | 6 ++++++ src/map/atcommand.c | 28 ++++++++++++++++++++-------- 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/doc/atcommands.txt b/doc/atcommands.txt index 4acc30ae6..c909440a7 100644 --- a/doc/atcommands.txt +++ b/doc/atcommands.txt @@ -584,6 +584,12 @@ Opens the Identification window if any unappraised items are in your inventory. --------------------------------------- +@identifyall + +Identifies all unappraised items in your inventory. + +--------------------------------------- + @trade Opens the trade window with the specified player. diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 3c454011f..a2db15f6c 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -6769,23 +6769,34 @@ ACMD(refreshall) } /*========================================== - * @identify + * @identify / @identifyall * => GM's magnifier. *------------------------------------------*/ ACMD(identify) { int num = 0; + bool identifyall = (strcmpi(info->command, "identifyall") == 0); - for (int i = 0; i < sd->status.inventorySize; i++) { - if(sd->status.inventory[i].nameid > 0 && sd->status.inventory[i].identify!=1){ - num++; + if (!identifyall) { + for (int i = 0; i < sd->status.inventorySize; i++) { + if (sd->status.inventory[i].nameid > 0 && sd->status.inventory[i].identify != 1) { + num++; + } } - } - if (num > 0) { - clif->item_identify_list(sd); } else { - clif->message(fd,msg_fd(fd,1238)); // There are no items to appraise. + for (int i = 0; i < sd->status.inventorySize; i++) { + if (sd->status.inventory[i].nameid > 0 && sd->status.inventory[i].identify != 1) { + skill->identify(sd, i); + num++; + } + } } + + if (num == 0) + clif->message(fd,msg_fd(fd,1238)); // There are no items to appraise. + else if (!identifyall) + clif->item_identify_list(sd); + return true; } @@ -10061,6 +10072,7 @@ static void atcommand_basecommands(void) ACMD_DEF(refresh), ACMD_DEF(refreshall), ACMD_DEF(identify), + ACMD_DEF2("identifyall", identify), ACMD_DEF(misceffect), ACMD_DEF(mobsearch), ACMD_DEF(cleanmap), -- cgit v1.2.3-60-g2f50