From 3410b900c6a31d04f75b4e527b2656117029edc7 Mon Sep 17 00:00:00 2001 From: Paradox924X Date: Mon, 31 May 2010 23:54:48 +0000 Subject: Rewrote and reorganized checks in @autotrade to check and display most useful information first (bugreport:4253). git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14317 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/atcommand.c | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) (limited to 'src/map/atcommand.c') diff --git a/src/map/atcommand.c b/src/map/atcommand.c index e5567aa2a..035cc5fe1 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -5873,36 +5873,36 @@ int atcommand_changelook(const int fd, struct map_session_data* sd, const char* } /*========================================== - * @autotrade by durf (changed by Lupus) + * @autotrade by durf [Lupus] [Paradox924X] * Turns on/off Autotrade for a specific player *------------------------------------------*/ int atcommand_autotrade(const int fd, struct map_session_data* sd, const char* command, const char* message) { nullpo_retr(-1, sd); - if( sd->vender_id ) //check if player's vending - { - if( pc_isdead(sd) ) - { - clif_displaymessage(fd, "Cannot Autotrade if you are dead."); - return -1; - } - - if( map[sd->bl.m].flag.autotrade == battle_config.autotrade_mapflag ) - { - sd->state.autotrade = 1; - if( battle_config.at_timeout ) - { - int timeout = atoi(message); - status_change_start(&sd->bl, SC_AUTOTRADE, 10000, 0, 0, 0, 0, ((timeout > 0) ? min(timeout,battle_config.at_timeout) : battle_config.at_timeout) * 60000, 0); - } + + if( map[sd->bl.m].flag.autotrade != battle_config.autotrade_mapflag ) { + clif_displaymessage(fd, "Autotrade is not allowed on this map."); + return -1; + } - clif_authfail_fd(fd, 15); - } else - clif_displaymessage(fd, "Autotrade is not allowed on this map."); + if( pc_isdead(sd) ) { + clif_displaymessage(fd, "Cannot Autotrade if you are dead."); + return -1; } - else + + if( !sd->vender_id ) { //check if player is vending clif_displaymessage(fd, msg_txt(549)); // You should be vending to use @Autotrade. - + return -1; + } + + sd->state.autotrade = 1; + if( battle_config.at_timeout ) + { + int timeout = atoi(message); + status_change_start(&sd->bl, SC_AUTOTRADE, 10000, 0, 0, 0, 0, ((timeout > 0) ? min(timeout,battle_config.at_timeout) : battle_config.at_timeout) * 60000, 0); + } + clif_authfail_fd(fd, 15); + return 0; } -- cgit v1.2.3-70-g09d2