summaryrefslogtreecommitdiff
path: root/src/map/atcommand.c
diff options
context:
space:
mode:
authorEmistry Haoyan <equinox1991@gmail.com>2019-04-13 23:35:50 +0800
committerEmistry Haoyan <equinox1991@gmail.com>2019-04-29 21:55:42 +0800
commit4e089c3c8e3c000e8dad67f8b0a54c714e9256d7 (patch)
tree7e1f97156d805a897a1e9444c18db64489baf50a /src/map/atcommand.c
parentab81d4012eac5c2c00c485971fc9b89bf69761be (diff)
downloadhercules-4e089c3c8e3c000e8dad67f8b0a54c714e9256d7.tar.gz
hercules-4e089c3c8e3c000e8dad67f8b0a54c714e9256d7.tar.bz2
hercules-4e089c3c8e3c000e8dad67f8b0a54c714e9256d7.tar.xz
hercules-4e089c3c8e3c000e8dad67f8b0a54c714e9256d7.zip
Update dropall atcommand drop item based on type.
- Enable to drop items based on item type.
Diffstat (limited to 'src/map/atcommand.c')
-rw-r--r--src/map/atcommand.c35
1 files changed, 30 insertions, 5 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index a9bbff7bd..9ed56545c 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -5277,18 +5277,43 @@ ACMD(follow)
}
/*==========================================
- * @dropall by [MouseJstr]
- * Drop all your possession on the ground
+ * @dropall by [MouseJstr] and [Xantara]
+ * Drop all your possession on the ground based on item type
*------------------------------------------*/
ACMD(dropall)
{
+ int type = -1;
+ int count = 0;
+
+ if (message[0] != '\0') {
+ type = atoi(message);
+ if (!((type >= IT_HEALING && type <= IT_DELAYCONSUME) || type == IT_CASH || type == -1)) {
+ clif->message(fd, msg_fd(fd, 1500));
+ clif->message(fd, msg_fd(fd, 1501));
+ return false;
+ }
+ }
+
for (int i = 0; i < sd->status.inventorySize; i++) {
if (sd->status.inventory[i].amount) {
- if(sd->status.inventory[i].equip != 0)
- pc->unequipitem(sd, i, PCUNEQUIPITEM_RECALC|PCUNEQUIPITEM_FORCE);
- pc->dropitem(sd, i, sd->status.inventory[i].amount);
+ struct item_data *item_data = itemdb->exists(sd->status.inventory[i].nameid);
+ if (item_data == NULL) {
+ ShowWarning("Non-existant item %d on dropall list (account_id: %d, char_id: %d)\n", sd->status.inventory[i].nameid, sd->status.account_id, sd->status.char_id);
+ continue;
+ }
+ if (!pc->candrop(sd, &sd->status.inventory[i]))
+ continue;
+ if (type == -1 || type == item_data->type) {
+ if (sd->status.inventory[i].equip != 0)
+ pc->unequipitem(sd, i, PCUNEQUIPITEM_RECALC | PCUNEQUIPITEM_FORCE);
+ count += sd->status.inventory[i].amount;
+ pc->dropitem(sd, i, sd->status.inventory[i].amount);
+ }
}
}
+
+ sprintf(atcmd_output, msg_fd(fd, 1502), count); // %d items are dropped!
+ clif->message(fd, atcmd_output);
return true;
}