diff --git a/conf/battle/misc.conf b/conf/battle/misc.conf index b1f4c7a3a1..0ecbfc2e57 100644 --- a/conf/battle/misc.conf +++ b/conf/battle/misc.conf @@ -101,6 +101,9 @@ at_mapflag: no // Set this to the amount of minutes autotrade chars will be kicked from the server. at_timeout: 0 +// Makes player cannot be attacked when autotrade? (turns player's state.monster_ignore) (Note 1) +at_monsterignore: no + // Auction system, fee per hour. Default is 12000 auction_feeperhour: 12000 diff --git a/src/map/atcommand.c b/src/map/atcommand.c index e5dc8e4da1..f36122ec4d 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -5752,7 +5752,8 @@ ACMD_FUNC(autotrade) { } sd->state.autotrade = 1; - sd->state.monster_ignore = 1; + if (battle_config.autotrade_monsterignore) + sd->state.monster_ignore = 1; if( sd->state.vending ){ if( Sql_Query( mmysql_handle, "UPDATE `%s` SET `autotrade` = 1 WHERE `id` = %d;", vendings_db, sd->vender_id ) != SQL_SUCCESS ){ diff --git a/src/map/battle.c b/src/map/battle.c index e972575528..d0fbf7869a 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -7778,6 +7778,7 @@ static const struct _battle_data { { "fame_pharmacy_7", &battle_config.fame_pharmacy_7, 10, 0, INT_MAX, }, { "fame_pharmacy_10", &battle_config.fame_pharmacy_10, 50, 0, INT_MAX, }, { "mail_delay", &battle_config.mail_delay, 1000, 1000, INT_MAX, }, + { "at_monsterignore", &battle_config.autotrade_monsterignore, 0, 0, 1, }, }; #ifndef STATS_OPT_OUT /** diff --git a/src/map/battle.h b/src/map/battle.h index 8188d72cbb..a140553af2 100644 --- a/src/map/battle.h +++ b/src/map/battle.h @@ -563,6 +563,7 @@ extern struct Battle_Config int taekwon_ranker_min_lv; int revive_onwarp; int mail_delay; + int autotrade_monsterignore; } battle_config; void do_init_battle(void); diff --git a/src/map/buyingstore.c b/src/map/buyingstore.c index ea41f15051..3e1d8c5f30 100644 --- a/src/map/buyingstore.c +++ b/src/map/buyingstore.c @@ -692,6 +692,7 @@ void do_init_buyingstore_autotrade( void ) { pc_setnewpc(autotraders[i]->sd, autotraders[i]->account_id, autotraders[i]->char_id, 0, gettick(), autotraders[i]->sex, 0); autotraders[i]->sd->state.autotrade = 1; + autotraders[i]->sd->state.monster_ignore = (battle_config.autotrade_monsterignore); chrif_authreq(autotraders[i]->sd, true); i++; } diff --git a/src/map/vending.c b/src/map/vending.c index 4c5f2268b2..294d427589 100755 --- a/src/map/vending.c +++ b/src/map/vending.c @@ -510,7 +510,7 @@ void vending_reopen( struct map_session_data* sd ){ } *index = entry->index + 2; - *amount = itemdb_isstackable(sd->status.cart[entry->index].id) ? entry->amount : 1; + *amount = itemdb_isstackable(sd->status.cart[entry->index].nameid) ? entry->amount : 1; *value = entry->price; p += 8; @@ -609,7 +609,7 @@ void do_init_vending_autotrade( void ) { pc_setnewpc(autotraders[i]->sd, autotraders[i]->account_id, autotraders[i]->char_id, 0, gettick(), autotraders[i]->sex, 0); autotraders[i]->sd->state.autotrade = 1; - autotraders[i]->sd->state.monster_ignore = 1; + autotraders[i]->sd->state.monster_ignore = (battle_config.autotrade_monsterignore); chrif_authreq(autotraders[i]->sd, true); i++; }