Jump to content

Continuation of @deleteall


Maki

Recommended Posts


  • Group:  Members
  • Topic Count:  146
  • Topics Per Day:  0.03
  • Content Count:  1195
  • Reputation:   467
  • Joined:  11/15/11
  • Last Seen:  

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?

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  392
  • Reputation:   47
  • Joined:  11/18/11
  • Last Seen:  

this would definitely be more efficient. +1 maki

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  26
  • Topics Per Day:  0.01
  • Content Count:  331
  • Reputation:   63
  • Joined:  11/29/11
  • Last Seen:  

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 by Dastgir Pojee
  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  148
  • Reputation:   46
  • Joined:  11/02/11
  • Last Seen:  

Why you always suggest stuff AFTER we implement it -_-

But yeah this way looks good too

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  146
  • Topics Per Day:  0.03
  • Content Count:  1195
  • Reputation:   467
  • Joined:  11/15/11
  • Last Seen:  

/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


  • Group:  Development Manager
  • Topic Count:  56
  • Topics Per Day:  0.01
  • Content Count:  732
  • Reputation:   525
  • Joined:  12/13/11
  • Last Seen:  

+1

I like the idea of a unified command.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  72
  • Topics Per Day:  0.02
  • Content Count:  2997
  • Reputation:   1130
  • Joined:  05/27/12
  • Last Seen:  

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

×
×
  • Create New...