Skip to content

Commit

Permalink
* Follow up 462b2be, wrong check for itemdb_isstackable(). Thank Napster
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
cydh committed Jul 16, 2014
1 parent 171e2f2 commit 401a716
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 3 deletions.
3 changes: 3 additions & 0 deletions conf/battle/misc.conf
Expand Up @@ -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

Expand Down
3 changes: 2 additions & 1 deletion src/map/atcommand.c
Expand Up @@ -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 ){
Expand Down
1 change: 1 addition & 0 deletions src/map/battle.c
Expand Up @@ -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
/**
Expand Down
1 change: 1 addition & 0 deletions src/map/battle.h
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions src/map/buyingstore.c
Expand Up @@ -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++;
}
Expand Down
4 changes: 2 additions & 2 deletions src/map/vending.c
Expand Up @@ -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;
Expand Down Expand Up @@ -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++;
}
Expand Down

0 comments on commit 401a716

Please sign in to comment.