浏览代码

* Follow up 462b2be, wrong check for itemdb_isstackable(). Thank Napster
* Follow up 171e2f2, added battle config 'at_monsterignore' at conf/battle/misc.conf to makes autotrader cannot be attacked. Thank @Lemongrass3110

Signed-off-by: Cydh Ramdh <house.bad@gmail.com>

Cydh Ramdh 11 年之前
父节点
当前提交
401a7161ce
共有 6 个文件被更改,包括 10 次插入3 次删除
  1. 3 0
      conf/battle/misc.conf
  2. 2 1
      src/map/atcommand.c
  3. 1 0
      src/map/battle.c
  4. 1 0
      src/map/battle.h
  5. 1 0
      src/map/buyingstore.c
  6. 2 2
      src/map/vending.c

+ 3 - 0
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
 

+ 2 - 1
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 ){

+ 1 - 0
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
 /**

+ 1 - 0
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);

+ 1 - 0
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++;
 			}

+ 2 - 2
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++;
 			}