Maki Posted December 19, 2012 Share Posted December 19, 2012 Original topic: http://rathena.org/board/topic/70764-deleteall/page__pid__158461#entry158461 @clear all | storage | gstorage | inventory | cart i.e. @clear storage would clear all items in your Kafra Storage. Suggestion: Would it not be easier/more user-friendly to just have one dominant '@clear' command with additional/optional variables for more specific clearing of items? 1 Link to comment Share on other sites More sharing options...
Sneaky Posted December 20, 2012 Share Posted December 20, 2012 this would definitely be more efficient. +1 maki Link to comment Share on other sites More sharing options...
Dastgir Posted December 21, 2012 Share Posted December 21, 2012 (edited) Add this in atcommand.c ACMD_FUNC(clear) { int i; if(!message || !*message) { clif_displaymessage(fd,"Usage: @clear inventory|cart|storage|gstorage"); return 0; } if (sd->state.storage_flag == 1) { clif_displaymessage(fd, msg_txt(250)); return -1; } if (strcmp (message,"cart") == 0){ nullpo_retr(-1,sd); if (pc_iscarton(sd) == 0) { clif_displaymessage(fd, msg_txt(1396)); // You do not have a cart to be cleaned. return -1; } if (sd->state.vending == 1) { //Somehow... return -1; } for( i = 0; i < MAX_CART; i++ ){ if(sd->status.cart[i].nameid > 0){ pc_cart_delitem(sd, i, sd->status.cart[i].amount, 1, LOG_TYPE_OTHER); } } clif_clearcart(fd); clif_updatestatus(sd,SP_CARTINFO); clif_displaymessage(fd, msg_txt(1397)); // Your cart was cleaned. return 0; } else if (strcmp (message,"storage") == 0){ int j; nullpo_retr(-1,sd); j = sd->status.storage.storage_amount; for (i = 0; i < j; ++i) { storage_delitem(sd, i, sd->status.storage.items[i].amount); } storage_storageclose(sd); clif_displaymessage(fd, msg_txt(1394)); // Your storage was cleaned. return 0; } else if (strcmp (message,"gstorage") == 0){ int j; struct guild *g; struct guild_storage *gstorage; nullpo_retr(-1,sd); g = guild_search(sd->status.guild_id); if (g == NULL) { clif_displaymessage(fd, msg_txt(43)); return -1; } if (sd->state.storage_flag == 2) { clif_displaymessage(fd, msg_txt(251)); return -1; } gstorage = guild2storage2(sd->status.guild_id); if (gstorage == NULL) {// Doesn't have opened @gstorage yet, so we skip the deletion return -1; } j = gstorage->storage_amount; gstorage->lock = 1; // Lock @gstorage: do not allow any item to be retrieved or stored for (i = 0; i < j; ++i) { guild_storage_delitem(sd, gstorage, i, gstorage->items[i].amount); } storage_guild_storageclose(sd); gstorage->lock = 0; // Cleaning done, release lock clif_displaymessage(fd, msg_txt(1395)); // Your guild storage was cleaned. return 0; } else if (strcmp (message,"inventory") == 0){ nullpo_retr(-1, sd); for (i = 0; i < MAX_INVENTORY; i++) { if (sd->status.inventory[i].amount && sd->status.inventory[i].equip == 0) { pc_delitem(sd, i, sd->status.inventory[i].amount, 0, 0, LOG_TYPE_COMMAND); } } clif_displaymessage(fd, msg_txt(20)); // All of your items have been removed. return 0; } else{ clif_displaymessage(fd, "Command Usage: @clear inventory|cart|storage|gstorage"); return 0; } } and Add this, ACMD_DEF(clear), Hope you know where to put it.! I won't suggest "all" option. Edited December 21, 2012 by Dastgir Pojee 1 Link to comment Share on other sites More sharing options...
lekkereten Posted December 23, 2012 Share Posted December 23, 2012 Why you always suggest stuff AFTER we implement it But yeah this way looks good too 1 Link to comment Share on other sites More sharing options...
Maki Posted December 26, 2012 Author Share Posted December 26, 2012 /me would like more input on this D: I believe it would be a lot more user-friendly to go with the method I suggested unless someone has a better idea! Link to comment Share on other sites More sharing options...
Aleos Posted December 26, 2012 Share Posted December 26, 2012 +1 I like the idea of a unified command. Link to comment Share on other sites More sharing options...
Euphy Posted December 27, 2012 Share Posted December 27, 2012 Dec 26 22:13:22 <Euphy> do any of you care? Dec 26 22:13:25 <mkbu95> no Dec 26 22:13:36 <MarkZD> maybe it's easier to read Dec 26 22:13:38 <Flaid> I don't see a big difference in it And I don't really like the idea either, so 4-3 against. Edit: To clarify, the reasons for not implementing this include -- We don't merge other commands, so why merge this? This isn't commonly used (admin-level, generally), so this doesn't affect many users. It's easier typing commands without a space (not a large point, but a point nonetheless). Link to comment Share on other sites More sharing options...