From a625c96cd44bc95bdc1d8bc9e2143372fb28c56e Mon Sep 17 00:00:00 2001 From: celest Date: Fri, 18 Mar 2005 10:04:41 +0000 Subject: * Don't log SQL char actions if log_char is not enabled in char_athena.conf * Updated shop_exp's calculation to give more exp * Some item and mob DB updates * Added Einbech/Einbroch warps git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@1249 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/char_sql/char.c | 44 +++++++++++++++++++++++++------------------- src/map/npc.c | 4 ++-- 2 files changed, 27 insertions(+), 21 deletions(-) (limited to 'src') diff --git a/src/char_sql/char.c b/src/char_sql/char.c index 65e388e3e..78467b579 100644 --- a/src/char_sql/char.c +++ b/src/char_sql/char.c @@ -1143,17 +1143,19 @@ int make_new_char_sql(int fd, unsigned char *dat) { // check individual stat value for(i = 24; i <= 29; i++) { if (dat[i] < 1 || dat[i] > 9) { - printf("fail (aid: %d), stats error(bot cheat?!)\n", sd->account_id); + printf("fail (aid: %d), stats error(bot cheat?!)\n", sd->account_id); return -2; } } - // char.log to charlog - sprintf(tmp_sql,"INSERT INTO `%s` (`time`, `char_msg`,`account_id`,`char_num`,`name`,`str`,`agi`,`vit`,`int`,`dex`,`luk`,`hair`,`hair_color`)" - "VALUES (NOW(), '%s', '%d', '%d', '%s', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d')", - charlog_db,"make new char error", sd->account_id, dat[30], dat, dat[24], dat[25], dat[26], dat[27], dat[28], dat[29], dat[33], dat[31]); - //query - mysql_query(&mysql_handle, tmp_sql); + if (log_char) { + // char.log to charlog + sprintf(tmp_sql,"INSERT INTO `%s` (`time`, `char_msg`,`account_id`,`char_num`,`name`,`str`,`agi`,`vit`,`int`,`dex`,`luk`,`hair`,`hair_color`)" + "VALUES (NOW(), '%s', '%d', '%d', '%s', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d')", + charlog_db,"make new char error", sd->account_id, dat[30], dat, dat[24], dat[25], dat[26], dat[27], dat[28], dat[29], dat[33], dat[31]); + //query + mysql_query(&mysql_handle, tmp_sql); + } //printf("make new char error %d-%d %s %d, %d, %d, %d, %d, %d %d, %d" RETCODE, // fd, dat[30], dat, dat[24], dat[25], dat[26], dat[27], dat[28], dat[29], dat[33], dat[31]); @@ -1161,13 +1163,15 @@ int make_new_char_sql(int fd, unsigned char *dat) { return -2; } - // char.log to charlog - sprintf(tmp_sql,"INSERT INTO `%s`(`time`, `char_msg`,`account_id`,`char_num`,`name`,`str`,`agi`,`vit`,`int`,`dex`,`luk`,`hair`,`hair_color`)" - "VALUES (NOW(), '%s', '%d', '%d', '%s', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d')", - charlog_db,"make new char", sd->account_id, dat[30], dat, dat[24], dat[25], dat[26], dat[27], dat[28], dat[29], dat[33], dat[31]); - //query - if (mysql_query(&mysql_handle, tmp_sql)) { - printf("fail(log error), SQL error: %s\n", mysql_error(&mysql_handle)); + if (log_char) { + // char.log to charlog + sprintf(tmp_sql,"INSERT INTO `%s`(`time`, `char_msg`,`account_id`,`char_num`,`name`,`str`,`agi`,`vit`,`int`,`dex`,`luk`,`hair`,`hair_color`)" + "VALUES (NOW(), '%s', '%d', '%d', '%s', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d')", + charlog_db,"make new char", sd->account_id, dat[30], dat, dat[24], dat[25], dat[26], dat[27], dat[28], dat[29], dat[33], dat[31]); + //query + if (mysql_query(&mysql_handle, tmp_sql)) { + printf("fail(log error), SQL error: %s\n", mysql_error(&mysql_handle)); + } } //printf("make new char %d-%d %s %d, %d, %d, %d, %d, %d - %d, %d" RETCODE, // fd, dat[30], dat, dat[24], dat[25], dat[26], dat[27], dat[28], dat[29], dat[33], dat[31]); @@ -2534,11 +2538,13 @@ int parse_char(int fd) { break; } - sprintf(tmp_sql,"INSERT INTO `%s`(`time`, `account_id`,`char_num`,`name`) VALUES (NOW(), '%d', '%d', '%s')", - charlog_db, sd->account_id, RFIFOB(fd, 2), char_dat[0].name); - //query - if(mysql_query(&mysql_handle, tmp_sql)) { - printf("DB server Error - %s\n", mysql_error(&mysql_handle)); + if (log_char) { + sprintf(tmp_sql,"INSERT INTO `%s`(`time`, `account_id`,`char_num`,`name`) VALUES (NOW(), '%d', '%d', '%s')", + charlog_db, sd->account_id, RFIFOB(fd, 2), char_dat[0].name); + //query + if(mysql_query(&mysql_handle, tmp_sql)) { + printf("DB server Error - %s\n", mysql_error(&mysql_handle)); + } } printf("(\033[1;64m%d\033[0m) char selected (\033[1;32m%d\033[0m) \033[1;32m%s\033[0m" RETCODE, sd->account_id, RFIFOB(fd, 2), char_dat[0].name); diff --git a/src/map/npc.c b/src/map/npc.c index 409695996..018ceae01 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -1106,7 +1106,7 @@ int npc_buylist(struct map_session_data *sd,int n,unsigned short *item_list) if (sd->status.skill[MC_DISCOUNT].flag != 0) skill = sd->status.skill[MC_DISCOUNT].flag - 2; if (skill > 0) { - z = (log(z * (double)skill) * (double)battle_config.shop_exp/100.); + z = z * (double)skill * (double)battle_config.shop_exp/100.; if (z < 1) z = 1; pc_gainexp(sd,0,(int)z); @@ -1166,7 +1166,7 @@ int npc_selllist(struct map_session_data *sd,int n,unsigned short *item_list) if (sd->status.skill[MC_OVERCHARGE].flag != 0) skill = sd->status.skill[MC_OVERCHARGE].flag - 2; if (skill > 0) { - z = (log(z * (double)skill) * (double)battle_config.shop_exp/100.); + z = z * (double)skill * (double)battle_config.shop_exp/100.; if (z < 1) z = 1; pc_gainexp(sd,0,(int)z); -- cgit v1.2.3-70-g09d2