diff options
author | momacabu <momacabu@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2012-12-19 21:01:03 +0000 |
---|---|---|
committer | momacabu <momacabu@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2012-12-19 21:01:03 +0000 |
commit | 6b5b18378c89aa875c98e8323082856ec49c127f (patch) | |
tree | f6666c1b1c8616d55607033a5103b87e7db70474 /src/map/atcommand.c | |
parent | 3e909f3c4a25d5f550dccf1b7a98922c80a90416 (diff) | |
download | hercules-6b5b18378c89aa875c98e8323082856ec49c127f.tar.gz hercules-6b5b18378c89aa875c98e8323082856ec49c127f.tar.bz2 hercules-6b5b18378c89aa875c98e8323082856ec49c127f.tar.xz hercules-6b5b18378c89aa875c98e8323082856ec49c127f.zip |
Implemented @clearstorage, @cleargstorage, @clearcart, @clearinventory (alias for @itemreset) as suggested in tid:70764.
For further details read the documentation in doc/atcommands.txt
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@17029 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/atcommand.c')
-rw-r--r-- | src/map/atcommand.c | 86 |
1 files changed, 85 insertions, 1 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c index d115fdffa..2e2ec658f 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -52,7 +52,7 @@ #define ATCOMMAND_LENGTH 50 #define ACMD_FUNC(x) static int atcommand_ ## x (const int fd, struct map_session_data* sd, const char* command, const char* message) -#define MAX_MSG 1400 +#define MAX_MSG 1500 typedef struct AtCommandInfo AtCommandInfo; @@ -5258,6 +5258,86 @@ ACMD_FUNC(storeall) return 0; } +ACMD_FUNC(clearstorage) +{ + int i, j; + nullpo_retr(-1, sd); + + if (sd->state.storage_flag == 1) { + clif_displaymessage(fd, msg_txt(250)); + return -1; + } + + 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; +} + +ACMD_FUNC(cleargstorage) +{ + int i, 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 == 1) { + clif_displaymessage(fd, msg_txt(250)); + 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 since *shouldn't* have any item there. + return -1; + } + + j = gstorage->storage_amount; + gstorage->lock = 1; // Lock @gstorage: do not allow any item to be retrieved or stored from any guild member + 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; +} + +ACMD_FUNC(clearcart) +{ + 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; + } + + clif_clearcart(fd); + + clif_displaymessage(fd, msg_txt(1397)); // Your cart was cleaned. + return 0; +} + /*========================================== * @skillid by [MouseJstr] * lookup a skill by name @@ -8739,6 +8819,10 @@ void atcommand_basecommands(void) { ACMD_DEF(item), ACMD_DEF(item2), ACMD_DEF(itemreset), + ACMD_DEF2("clearinventory", itemreset), + ACMD_DEF(clearstorage), + ACMD_DEF(cleargstorage), + ACMD_DEF(clearcart), ACMD_DEF2("blvl", baselevelup), ACMD_DEF2("jlvl", joblevelup), ACMD_DEF(help), |