Jump to content

Continuation of @deleteall


Recommended Posts

Posted (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 by Dastgir Pojee
  • Upvote 1
Posted

/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!

Posted

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).

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...