removed old logs

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@6510 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
Lupus 2006-05-07 09:50:37 +00:00
parent dacea0478a
commit a866920e15
12 changed files with 21 additions and 705 deletions

View File

@ -3,6 +3,9 @@ Date Added
AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK.
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
2006/05/07
* Removed old logs. [Lupus]
TODO: 1. Add produce logging into PICKLOG 2. Replace map names with map index
2006/05/05
* Optimized clif.c clif_scriptmenu/input/inputstr to check for sd->state.using_fake_npc
before sending one (as it's not required to send twice).

View File

@ -57,35 +57,10 @@ log_pick: 0
// 0 - don't log; 1 - log any zeny changes; 2.....1000000 - minimal absolut logging zeny value
log_zeny: 0
// Log Monster Drops (You can use a filter)
//Outdated. Use Pick_Log instead
log_drop: 0
// Log Stolen Items (You can use a filter)
//Outdated. Use Pick_Log instead
log_steal: 0
// Log MVP Monster Drops
//Outdated. Use Pick_Log instead. But this log could be useful to keep track slayed MVPs
log_mvpdrop: 0
// Log Present Items (Old Blue Box, etc.) (You can use a filter)
log_present: 0
// Log Produced Items (You can use a filter)
log_produce: 0
// Log Refining (You can use a filter)
log_refine: 0
// Log Trading (You can use a filter)
//Outdated. Use Pick_Log instead
log_trade: 0
// Log Vending (You can use a filter)
//Outdated. Use Pick_Log instead
log_vend: 0
// Log GM Commands (set to minimum level of Logged Commands)
log_gm: 40
@ -120,27 +95,9 @@ log_pick_db: picklog
// Zeny Table
log_zeny_db: zenylog
// Drop & Steal Log Table
log_drop_db: droplog
// MVP Drop Table
log_mvpdrop_db: mvplog
// Present Drop Table
log_present_db: presentlog
// Produce Log Table
log_produce_db: producelog
// Refine Log Table
log_refine_db: refinelog
// Trade Log Table
log_trade_db: tradelog
// Vend Log Table
log_vend_db: vendlog
// GM Log Table
log_gm_db: atcommandlog
@ -160,27 +117,9 @@ log_pick_file: log/picklog.log
// Zeny Log File
log_zeny_file: log/zenylog.log
// Drop & Steal Log File
log_drop_file: log/droplog.log
// MVP Drop File
log_mvpdrop_file: log/mvplog.log
// Present Drop File
log_present_file: log/presentlog.log
// Produce Log File
log_produce_file: log/producelog.log
// Refine Log File
log_refine_file: log/refinelog.log
// Trade Log File
log_trade_file: log/tradelog.log
// Vend Log File
log_vend_file: log/vendlog.log
// GM Log File
log_gm_file: log/atcommandlog.log

View File

@ -46,27 +46,6 @@ CREATE TABLE `branchlog` (
PRIMARY KEY (`branch_id`)
) TYPE=MyISAM AUTO_INCREMENT=1 ;
#Database: log
#Table: droplog
CREATE TABLE `droplog` (
`drop_id` mediumint(9) unsigned NOT NULL auto_increment,
`drop_date` datetime NOT NULL default '0000-00-00 00:00:00',
`kill_char_id` int(11) NOT NULL default '0',
`monster_id` smallint(6) NOT NULL default '0',
`item1` int(11) NOT NULL default '0',
`item2` int(11) NOT NULL default '0',
`item3` int(11) NOT NULL default '0',
`item4` int(11) NOT NULL default '0',
`item5` int(11) NOT NULL default '0',
`item6` int(11) NOT NULL default '0',
`item7` int(11) NOT NULL default '0',
`item8` int(11) NOT NULL default '0',
`item9` int(11) NOT NULL default '0',
`itemCard` int(11) NOT NULL default '0',
`map` varchar(20) NOT NULL default 'prontera.gat',
PRIMARY KEY (`drop_id`)
) TYPE=MyISAM AUTO_INCREMENT=1 ;
#Database: log
#Table: mvplog
CREATE TABLE `mvplog` (
@ -80,104 +59,6 @@ CREATE TABLE `mvplog` (
PRIMARY KEY (`mvp_id`)
) TYPE=MyISAM AUTO_INCREMENT=1 ;
#Database: log
#Table: presentlog
CREATE TABLE `presentlog` (
`present_id` mediumint(9) unsigned NOT NULL auto_increment,
`present_date` datetime NOT NULL default '0000-00-00 00:00:00',
`src_id` tinyint(1) NOT NULL default '0',
`account_id` int(11) NOT NULL default '0',
`char_id` int(11) NOT NULL default '0',
`char_name` varchar(30) NOT NULL default '',
`nameid` int(11) NOT NULL default '0',
`map` varchar(20) NOT NULL default 'prontera.gat',
PRIMARY KEY (`present_id`)
) TYPE=MyISAM AUTO_INCREMENT=1 ;
#Database: log
#Table: producelog
CREATE TABLE `producelog` (
`produce_id` mediumint(9) unsigned NOT NULL auto_increment,
`produce_date` datetime NOT NULL default '0000-00-00 00:00:00',
`account_id` int(11) NOT NULL default '0',
`char_id` int(11) NOT NULL default '0',
`char_name` varchar(30) NOT NULL default '',
`nameid` int(11) NOT NULL default '0',
`slot1` int(11) NOT NULL default '0',
`slot2` int(11) NOT NULL default '0',
`slot3` int(11) NOT NULL default '0',
`map` varchar(20) NOT NULL default 'prontera.gat',
`success` tinyint(1) NOT NULL default '0',
PRIMARY KEY (`produce_id`)
) TYPE=MyISAM AUTO_INCREMENT=1 ;
#Database: log
#Table: refinelog
CREATE TABLE `refinelog` (
`refine_id` mediumint(9) unsigned NOT NULL auto_increment,
`refine_date` datetime NOT NULL default '0000-00-00 00:00:00',
`account_id` int(11) NOT NULL default '0',
`char_id` int(11) NOT NULL default '0',
`char_name` varchar(30) NOT NULL default '',
`nameid` int(11) NOT NULL default '0',
`refine` tinyint(2) NOT NULL default '0',
`card0` int(11) NOT NULL default '0',
`card1` int(11) NOT NULL default '0',
`card2` int(11) NOT NULL default '0',
`card3` int(11) NOT NULL default '0',
`map` varchar(20) NOT NULL default 'prontera.gat',
`success` tinyint(1) NOT NULL default '0',
`item_level` tinyint(2) NOT NULL default '0',
PRIMARY KEY (`refine_id`)
) TYPE=MyISAM AUTO_INCREMENT=1 ;
#Database: log
#Table: tradelog
CREATE TABLE `tradelog` (
`trade_id` mediumint(9) unsigned NOT NULL auto_increment,
`trade_date` datetime NOT NULL default '0000-00-00 00:00:00',
`src_account_id` int(11) NOT NULL default '0',
`src_char_id` int(11) NOT NULL default '0',
`src_char_name` varchar(30) NOT NULL default '',
`des_account_id` int(11) NOT NULL default '0',
`des_char_id` int(11) NOT NULL default '0',
`des_char_name` varchar(30) NOT NULL default '',
`nameid` int(11) NOT NULL default '0',
`amount` int(11) NOT NULL default '1',
`refine` tinyint(4) NOT NULL default '0',
`card0` int(11) NOT NULL default '0',
`card1` int(11) NOT NULL default '0',
`card2` int(11) NOT NULL default '0',
`card3` int(11) NOT NULL default '0',
`map` varchar(20) NOT NULL default 'prontera.gat',
`zeny` int(11) NOT NULL default '0',
PRIMARY KEY (`trade_id`)
) TYPE=MyISAM AUTO_INCREMENT=1 ;
#Database: log
#Table: vendlog
CREATE TABLE `vendlog` (
`vend_id` mediumint(9) unsigned NOT NULL auto_increment,
`vend_date` datetime NOT NULL default '0000-00-00 00:00:00',
`vend_account_id` int(11) NOT NULL default '0',
`vend_char_id` int(11) NOT NULL default '0',
`vend_char_name` varchar(30) NOT NULL default '',
`buy_account_id` int(11) NOT NULL default '0',
`buy_char_id` int(11) NOT NULL default '0',
`buy_char_name` varchar(30) NOT NULL default '',
`nameid` int(11) NOT NULL default '0',
`amount` int(11) NOT NULL default '1',
`refine` tinyint(4) NOT NULL default '0',
`card0` int(11) NOT NULL default '0',
`card1` int(11) NOT NULL default '0',
`card2` int(11) NOT NULL default '0',
`card3` int(11) NOT NULL default '0',
`map` varchar(20) NOT NULL default 'prontera.gat',
`zeny` int(11) NOT NULL default '0',
KEY `vend_id` (`vend_id`)
) TYPE=MyISAM AUTO_INCREMENT=1 ;
#Database: log
#Table: atcommandlog
CREATE TABLE `atcommandlog` (
@ -204,7 +85,6 @@ CREATE TABLE `npclog` (
PRIMARY KEY (`npc_id`)
) TYPE=MyISAM AUTO_INCREMENT=1 ;
#ChatLOG
CREATE TABLE `chatlog` (
`id` bigint(20) NOT NULL auto_increment,

View File

@ -198,46 +198,6 @@ int log_zeny(struct map_session_data *sd, char *type, struct map_session_data *s
return 0;
}
int log_drop(struct map_session_data *sd, int monster_id, int *log_drop)
{
FILE *logfp;
int i,flag = 0;
if(log_config.enable_logs <= 0)
return 0;
nullpo_retr(0, sd);
for (i = 0; i<10; i++) { //Should we log these items? [Lupus]
flag += should_log_item(log_config.drop,log_drop[i],1);
}
if (flag==0) return 0; //we skip logging this items set - they doesn't met our logging conditions [Lupus]
#ifndef TXT_ONLY
if(log_config.sql_logs > 0)
{
sprintf(tmp_sql, "INSERT DELAYED INTO `%s` (`drop_date`, `kill_char_id`, `monster_id`, `item1`, `item2`, `item3`, `item4`, `item5`, `item6`, `item7`, `item8`, `item9`, `itemCard`, `map`) VALUES (NOW(), '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%s') ", log_config.log_drop_db, sd->status.char_id, monster_id, log_drop[0], log_drop[1], log_drop[2], log_drop[3], log_drop[4], log_drop[5], log_drop[6], log_drop[7], log_drop[8], log_drop[9], mapindex_id2name(sd->mapindex));
if(mysql_query(&logmysql_handle, tmp_sql))
{
ShowSQL("DB error - %s\n",mysql_error(&logmysql_handle));
ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
}
} else {
#endif
if((logfp=fopen(log_config.log_drop,"a+")) != NULL) {
time_t curtime;
time(&curtime);
strftime(timestring, 254, "%m/%d/%Y %H:%M:%S", localtime(&curtime));
fprintf(logfp,"%s - %s[%d:%d]\t%d\t%d,%d,%d,%d,%d,%d,%d,%d,%d,%d%s", timestring, sd->status.name, sd->status.account_id, sd->status.char_id, monster_id, log_drop[0], log_drop[1], log_drop[2], log_drop[3], log_drop[4], log_drop[5], log_drop[6], log_drop[7], log_drop[8], log_drop[9], RETCODE);
fclose(logfp);
}
#ifndef TXT_ONLY
}
#endif
return 1; //Logged
}
int log_mvpdrop(struct map_session_data *sd, int monster_id, int *log_mvp)
{
FILE *logfp;
@ -268,352 +228,6 @@ int log_mvpdrop(struct map_session_data *sd, int monster_id, int *log_mvp)
return 0;
}
int log_present(struct map_session_data *sd, int source_type, int nameid)
{
FILE *logfp;
#ifndef TXT_ONLY
char t_name[NAME_LENGTH*2];
#endif
if(log_config.enable_logs <= 0)
return 0;
nullpo_retr(0, sd);
if(!should_log_item(log_config.present,nameid,1)) return 0; //filter [Lupus]
#ifndef TXT_ONLY
if(log_config.sql_logs > 0)
{
sprintf(tmp_sql, "INSERT DELAYED INTO `%s` (`present_date`, `src_id`, `account_id`, `char_id`, `char_name`, `nameid`, `map`) VALUES (NOW(), '%d', '%d', '%d', '%s', '%d', '%s') ",
log_config.log_present_db, source_type, sd->status.account_id, sd->status.char_id, jstrescapecpy(t_name, sd->status.name), nameid, mapindex_id2name(sd->mapindex));
if(mysql_query(&logmysql_handle, tmp_sql))
{
ShowSQL("DB error - %s\n",mysql_error(&logmysql_handle));
ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
}
} else {
#endif
if((logfp=fopen(log_config.log_present,"a+")) != NULL) {
time(&curtime);
strftime(timestring, 254, "%m/%d/%Y %H:%M:%S", localtime(&curtime));
fprintf(logfp,"%s - %s[%d:%d]\t%d\t%d%s", timestring, sd->status.name, sd->status.account_id, sd->status.char_id, source_type, nameid, RETCODE);
fclose(logfp);
}
#ifndef TXT_ONLY
}
#endif
return 0;
}
int log_produce(struct map_session_data *sd, int nameid, int slot1, int slot2, int slot3, int success)
{
FILE *logfp;
#ifndef TXT_ONLY
char t_name[NAME_LENGTH*2];
#endif
if(log_config.enable_logs <= 0)
return 0;
nullpo_retr(0, sd);
if(!should_log_item(log_config.produce,nameid,1)) return 0; //filter [Lupus]
#ifndef TXT_ONLY
if(log_config.sql_logs > 0)
{
sprintf(tmp_sql, "INSERT DELAYED INTO `%s` (`produce_date`, `account_id`, `char_id`, `char_name`, `nameid`, `slot1`, `slot2`, `slot3`, `map`, `success`) VALUES (NOW(), '%d', '%d', '%s', '%d', '%d', '%d', '%d', '%s', '%d') ",
log_config.log_produce_db, sd->status.account_id, sd->status.char_id, jstrescapecpy(t_name, sd->status.name), nameid, slot1, slot2, slot3, mapindex_id2name(sd->mapindex), success);
if(mysql_query(&logmysql_handle, tmp_sql))
{
ShowSQL("DB error - %s\n",mysql_error(&logmysql_handle));
ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
}
} else {
#endif
if((logfp=fopen(log_config.log_produce,"a+")) != NULL) {
time(&curtime);
strftime(timestring, 254, "%m/%d/%Y %H:%M:%S", localtime(&curtime));
fprintf(logfp,"%s - %s[%d:%d]\t%d\t%d,%d,%d\t%d%s", timestring, sd->status.name, sd->status.account_id, sd->status.char_id, nameid, slot1, slot2, slot3, success, RETCODE);
fclose(logfp);
}
#ifndef TXT_ONLY
}
#endif
return 0;
}
int log_refine(struct map_session_data *sd, int n, int success)
{
FILE *logfp;
int log_card[MAX_SLOTS];
int item_level;
int i;
#ifndef TXT_ONLY
char t_name[NAME_LENGTH*2];
#endif
if(log_config.enable_logs <= 0)
return 0;
nullpo_retr(0, sd);
if(success == 0)
item_level = sd->status.inventory[n].refine; //leaving there 0 wasn't informative! we have SUCCESS field anyways
else
item_level = sd->status.inventory[n].refine + 1;
if(!should_log_item(log_config.refine,sd->status.inventory[n].nameid,1) || log_config.refine_items_log>item_level) return 0; //filter [Lupus]
for(i=0;i<MAX_SLOTS;i++)
log_card[i] = sd->status.inventory[n].card[i];
#ifndef TXT_ONLY
if(log_config.sql_logs > 0)
{
char *str_p = tmp_sql;
str_p += sprintf(str_p, "INSERT DELAYED INTO `%s` (`refine_date`, `account_id`, `char_id`, `char_name`, `nameid`, `refine`"
", `map`, `success`, `item_level`", log_config.log_refine_db);
for (i=0; i < MAX_SLOTS; i++)
str_p += sprintf(str_p, ", `card%d`", i);
str_p += sprintf(str_p, ") VALUES (NOW(), '%d', '%d', '%s', '%d', '%d', '%s', '%d', '%d'",
sd->status.account_id, sd->status.char_id, jstrescapecpy(t_name, sd->status.name),
sd->status.inventory[n].nameid, sd->status.inventory[n].refine, mapindex_id2name(sd->mapindex), success, item_level);
for(i=0; i<MAX_SLOTS; i++)
str_p += sprintf(str_p, ", '%d'", log_card[i]);
strcat(tmp_sql,")");
if(mysql_query(&logmysql_handle, tmp_sql))
{
ShowSQL("DB error - %s\n",mysql_error(&logmysql_handle));
ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
}
} else {
#endif
if((logfp=fopen(log_config.log_refine,"a+")) != NULL) {
time(&curtime);
strftime(timestring, 254, "%m/%d/%Y %H:%M:%S", localtime(&curtime));
fprintf(logfp,"%s - %s[%d:%d]\t%d,%d\t",
timestring, sd->status.name, sd->status.account_id, sd->status.char_id,
sd->status.inventory[n].nameid, sd->status.inventory[n].refine);
for (i=0; i<MAX_SLOTS; i++)
fprintf(logfp,"%d,",log_card[i]);
fprintf(logfp,"\t%d,%d%s", success, item_level, RETCODE);
fclose(logfp);
}
#ifndef TXT_ONLY
}
#endif
return 0;
}
int log_tostorage(struct map_session_data *sd,int n, int guild)
{
FILE *logfp;
int i;
if(log_config.enable_logs <= 0 || log_config.storage == 0 || log_config.log_storage[0] == '\0')
return 0;
nullpo_retr(0, sd);
if(sd->status.inventory[n].nameid==0 || sd->inventory_data[n] == NULL)
return 1;
if(sd->status.inventory[n].amount < 0)
return 1;
if((logfp=fopen(log_config.log_trade,"a+")) != NULL) {
time(&curtime);
strftime(timestring, 254, "%m/%d/%Y %H:%M:%S", localtime(&curtime));
fprintf(logfp,"%s - to %s: %s[%d:%d]\t%d\t%d\t%d\t",
timestring, guild ? "guild_storage": "storage", sd->status.name, sd->status.account_id, sd->status.char_id,
sd->status.inventory[n].nameid, sd->status.inventory[n].amount, sd->status.inventory[n].refine);
for (i=0; i<MAX_SLOTS; i++)
fprintf(logfp, "%d,", sd->status.inventory[n].card[i]);
fprintf(logfp, "%s", RETCODE);
fclose(logfp);
}
return 0;
}
int log_fromstorage(struct map_session_data *sd,int n, int guild)
{
FILE *logfp;
int i;
if(log_config.enable_logs <= 0 || log_config.storage == 0 || log_config.log_storage[0] == '\0')
return 0;
nullpo_retr(0, sd);
if(sd->status.inventory[n].nameid==0 || sd->inventory_data[n] == NULL)
return 1;
if(sd->status.inventory[n].amount < 0)
return 1;
if((logfp=fopen(log_config.log_trade,"a+")) != NULL) {
time(&curtime);
fprintf(logfp,"%s - from %s: %s[%d:%d]\t%d\t%d\t%d\t",
timestring, guild ? "guild_storage": "storage", sd->status.name, sd->status.account_id, sd->status.char_id,
sd->status.inventory[n].nameid, sd->status.inventory[n].amount, sd->status.inventory[n].refine);
for (i=0; i<MAX_SLOTS; i++)
fprintf(logfp, "%d,", sd->status.inventory[n].card[i]);
fprintf(logfp, "%s", RETCODE);
fclose(logfp);
}
return 0;
}
int log_trade(struct map_session_data *sd, struct map_session_data *target_sd, int n,int amount)
{
FILE *logfp;
int log_nameid, log_amount, log_refine, log_card[MAX_SLOTS];
int i;
#ifndef TXT_ONLY
char t_name[NAME_LENGTH*2],t_name2[NAME_LENGTH*2];
#endif
if(log_config.enable_logs <= 0)
return 0;
nullpo_retr(0, sd);
if(sd->status.inventory[n].nameid==0 || amount <= 0 || sd->status.inventory[n].amount<amount || sd->inventory_data[n] == NULL)
return 1;
if(sd->status.inventory[n].amount < 0)
return 1;
if(!should_log_item(log_config.trade,sd->status.inventory[n].nameid,sd->status.inventory[n].amount)) return 0; //filter [Lupus]
log_nameid = sd->status.inventory[n].nameid;
log_amount = sd->status.inventory[n].amount;
log_refine = sd->status.inventory[n].refine;
for(i=0;i<MAX_SLOTS;i++)
log_card[i] = sd->status.inventory[n].card[i];
#ifndef TXT_ONLY
if(log_config.sql_logs > 0)
{
char *str_p = tmp_sql;
str_p += sprintf(str_p, "INSERT DELAYED INTO `%s` (`trade_date`, `src_account_id`, `src_char_id`, `src_char_name`, `des_account_id`, `des_char_id`, `des_char_name`, `nameid`, `amount`, `refine`, `map`",
log_config.log_trade_db);
for (i=0; i < MAX_SLOTS; i++)
str_p += sprintf(str_p, ", `card%d`", i);
str_p += sprintf(str_p, ") VALUES (NOW(), '%d', '%d', '%s', '%d', '%d', '%s', '%d', '%d', '%d', '%s'",
sd->status.account_id, sd->status.char_id, jstrescapecpy(t_name, sd->status.name),
target_sd->status.account_id, target_sd->status.char_id, jstrescapecpy(t_name2, target_sd->status.name),
log_nameid, log_amount, log_refine, mapindex_id2name(sd->mapindex));
for(i=0; i<MAX_SLOTS; i++)
str_p += sprintf(str_p, ", '%d'", log_card[i]);
strcat(tmp_sql, ")");
if(mysql_query(&logmysql_handle, tmp_sql))
{
ShowSQL("DB error - %s\n",mysql_error(&logmysql_handle));
ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
}
} else {
#endif
if((logfp=fopen(log_config.log_trade,"a+")) != NULL) {
time(&curtime);
strftime(timestring, 254, "%m/%d/%Y %H:%M:%S", localtime(&curtime));
fprintf(logfp,"%s - %s[%d:%d]\t%s[%d:%d]\t%d\t%d\t%d\t",
timestring, sd->status.name, sd->status.account_id, sd->status.char_id,
target_sd->status.name, target_sd->status.account_id, target_sd->status.char_id,
log_nameid, log_amount, log_refine);
for (i=0; i<MAX_SLOTS; i++)
fprintf(logfp, "%d,", sd->status.inventory[n].card[i]);
fprintf(logfp, "%s", RETCODE);
fclose(logfp);
}
#ifndef TXT_ONLY
}
#endif
return 0;
}
int log_vend(struct map_session_data *sd,struct map_session_data *vsd,int n,int amount, int zeny)
{
FILE *logfp;
int log_nameid, log_amount, log_refine, log_card[MAX_SLOTS];
int i;
#ifndef TXT_ONLY
char t_name[NAME_LENGTH*2],t_name2[NAME_LENGTH*2];
#endif
if(log_config.enable_logs <= 0)
return 0;
nullpo_retr(0, sd);
if(sd->status.inventory[n].nameid==0 || amount <= 0 || sd->status.inventory[n].amount<amount || sd->inventory_data[n] == NULL)
return 1;
if(sd->status.inventory[n].amount< 0)
return 1;
if(!should_log_item(log_config.vend,sd->status.inventory[n].nameid,sd->status.inventory[n].amount)) return 0; //filter [Lupus]
log_nameid = sd->status.inventory[n].nameid;
log_amount = sd->status.inventory[n].amount;
log_refine = sd->status.inventory[n].refine;
for(i=0;i<MAX_SLOTS;i++)
log_card[i] = sd->status.inventory[n].card[i];
#ifndef TXT_ONLY
if(log_config.sql_logs > 0)
{
char *str_p = tmp_sql;
str_p += sprintf(str_p, "INSERT DELAYED INTO `%s` (`vend_date`, `vend_account_id`, `vend_char_id`, `vend_char_name`, `buy_account_id`, `buy_char_id`, `buy_char_name`, `nameid`, `amount`, `refine`, `map`, `zeny`",
log_config.log_vend_db);
for (i=0; i < MAX_SLOTS; i++)
str_p += sprintf(str_p, ", `card%d`", i);
str_p += sprintf(str_p, ") VALUES (NOW(), '%d', '%d', '%s', '%d', '%d', '%s', '%d', '%d', '%d', '%s', '%d'",
sd->status.account_id, sd->status.char_id, jstrescapecpy(t_name, sd->status.name),
vsd->status.account_id, vsd->status.char_id, jstrescapecpy(t_name2, vsd->status.name),
log_nameid, log_amount, log_refine, mapindex_id2name(sd->mapindex), zeny);
for(i=0; i<MAX_SLOTS; i++)
str_p += sprintf(str_p, ", '%d'", log_card[i]);
strcat(tmp_sql, ")");
if(mysql_query(&logmysql_handle, tmp_sql))
{
ShowSQL("DB error - %s\n",mysql_error(&logmysql_handle));
ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
}
} else {
#endif
if((logfp=fopen(log_config.log_vend,"a+")) != NULL) {
time(&curtime);
strftime(timestring, 254, "%m/%d/%Y %H:%M:%S", localtime(&curtime));
fprintf(logfp,"%s - %s[%d:%d]\t%s[%d:%d]\t%d\t%d\t%d\t",
timestring, sd->status.name, sd->status.account_id, sd->status.char_id,
vsd->status.name, vsd->status.account_id, vsd->status.char_id,
log_nameid, log_amount, log_refine);
for(i=0; i<MAX_SLOTS; i++)
fprintf(logfp, "%d,", sd->status.inventory[n].card[i]);
fprintf(logfp, "\t%d%s", zeny, RETCODE);
fclose(logfp);
}
#ifndef TXT_ONLY
}
#endif
return 0;
}
int log_atcommand(struct map_session_data *sd, const char *message)
{
@ -798,24 +412,6 @@ int log_config_read(char *cfgName)
log_config.branch = (atoi(w2));
} else if(strcmpi(w1,"log_pick") == 0) {
log_config.pick = (atoi(w2));
} else if(strcmpi(w1,"log_drop") == 0) {
log_config.drop = (atoi(w2));
} else if(strcmpi(w1,"log_steal") == 0) {
log_config.steal = (atoi(w2));
} else if(strcmpi(w1,"log_mvpdrop") == 0) {
log_config.mvpdrop = (atoi(w2));
} else if(strcmpi(w1,"log_present") == 0) {
log_config.present = (atoi(w2));
} else if(strcmpi(w1,"log_produce") == 0) {
log_config.produce = (atoi(w2));
} else if(strcmpi(w1,"log_refine") == 0) {
log_config.refine = (atoi(w2));
} else if(strcmpi(w1,"log_trade") == 0) {
log_config.trade = (atoi(w2));
} else if(strcmpi(w1,"log_storage") == 0) {
log_config.storage = (atoi(w2));
} else if(strcmpi(w1,"log_vend") == 0) {
log_config.vend = (atoi(w2));
} else if(strcmpi(w1,"log_zeny") == 0) {
log_config.zeny = (atoi(w2));
} else if(strcmpi(w1,"log_gm") == 0) {
@ -824,6 +420,8 @@ int log_config_read(char *cfgName)
log_config.npc = (atoi(w2));
} else if(strcmpi(w1, "log_chat") == 0) {
log_config.chat = (atoi(w2));
} else if(strcmpi(w1,"log_mvpdrop") == 0) {
log_config.mvpdrop = (atoi(w2));
}
#ifndef TXT_ONLY
@ -839,41 +437,10 @@ int log_config_read(char *cfgName)
strcpy(log_config.log_zeny_db, w2);
if(log_config.zeny == 1)
ShowNotice("Logging Zeny to table `%s`\n", w2);
} else if(strcmpi(w1, "log_drop_db") == 0) {
strcpy(log_config.log_drop_db, w2);
if(log_config.drop == 1)
ShowNotice("Logging Item Drops to table `%s`\n", w2);
} else if(strcmpi(w1, "log_mvpdrop_db") == 0) {
strcpy(log_config.log_mvpdrop_db, w2);
if(log_config.mvpdrop == 1)
ShowNotice("Logging MVP Drops to table `%s`\n", w2);
} else if(strcmpi(w1, "log_present_db") == 0) {
strcpy(log_config.log_present_db, w2);
if(log_config.present == 1)
ShowNotice("Logging Present Usage & Results to table `%s`\n", w2);
} else if(strcmpi(w1, "log_produce_db") == 0) {
strcpy(log_config.log_produce_db, w2);
if(log_config.produce == 1)
ShowNotice("Logging Producing to table `%s`\n", w2);
} else if(strcmpi(w1, "log_refine_db") == 0) {
strcpy(log_config.log_refine_db, w2);
if(log_config.refine == 1)
ShowNotice("Logging Refining to table `%s`\n", w2);
} else if(strcmpi(w1, "log_trade_db") == 0) {
strcpy(log_config.log_trade_db, w2);
if(log_config.trade == 1)
ShowNotice("Logging Item Trades to table `%s`\n", w2);
// } else if(strcmpi(w1, "log_storage_db") == 0) {
// strcpy(log_config.log_storage_db, w2);
// if(log_config.storage == 1)
// {
// printf("Logging Item Storages");
// printf(" to table `%s`\n", w2);
// }
} else if(strcmpi(w1, "log_vend_db") == 0) {
strcpy(log_config.log_vend_db, w2);
if(log_config.vend == 1)
ShowNotice("Logging Vending to table `%s`\n", w2);
} else if(strcmpi(w1, "log_gm_db") == 0) {
strcpy(log_config.log_gm_db, w2);
if(log_config.gm > 0)
@ -893,10 +460,6 @@ int log_config_read(char *cfgName)
strcpy(log_config.log_branch, w2);
if(log_config.branch > 0 && log_config.sql_logs < 1)
ShowNotice("Logging Dead Branch Usage to file `%s`.txt\n", w2);
} else if(strcmpi(w1, "log_drop_file") == 0) {
strcpy(log_config.log_drop, w2);
if(log_config.drop > 0 && log_config.sql_logs < 1)
ShowNotice("Logging Item Drops to file `%s`.txt\n", w2);
} else if(strcmpi(w1, "log_pick_file") == 0) {
strcpy(log_config.log_pick, w2);
if(log_config.pick > 0 && log_config.sql_logs < 1)
@ -909,30 +472,6 @@ int log_config_read(char *cfgName)
strcpy(log_config.log_mvpdrop, w2);
if(log_config.mvpdrop > 0 && log_config.sql_logs < 1)
ShowNotice("Logging MVP Drops to file `%s`.txt\n", w2);
} else if(strcmpi(w1, "log_present_file") == 0) {
strcpy(log_config.log_present, w2);
if(log_config.present > 0 && log_config.sql_logs < 1)
ShowNotice("Logging Present Usage & Results to file `%s`.txt\n", w2);
} else if(strcmpi(w1, "log_produce_file") == 0) {
strcpy(log_config.log_produce, w2);
if(log_config.produce > 0 && log_config.sql_logs < 1)
ShowNotice("Logging Producing to file `%s`.txt\n", w2);
} else if(strcmpi(w1, "log_refine_file") == 0) {
strcpy(log_config.log_refine, w2);
if(log_config.refine > 0 && log_config.sql_logs < 1)
ShowNotice("Logging Refining to file `%s`.txt\n", w2);
} else if(strcmpi(w1, "log_trade_file") == 0) {
strcpy(log_config.log_trade, w2);
if(log_config.trade > 0 && log_config.sql_logs < 1)
ShowNotice("Logging Item Trades to file `%s`.txt\n", w2);
} else if(strcmpi(w1, "log_storage_file") == 0) {
strcpy(log_config.log_storage, w2);
if(log_config.storage > 0 && log_config.sql_logs < 1)
ShowNotice("Logging Item Storages to file `%s`.txt\n", w2);
} else if(strcmpi(w1, "log_vend_file") == 0) {
strcpy(log_config.log_vend, w2);
if(log_config.vend > 0 && log_config.sql_logs < 1)
ShowNotice("Logging Vending to file `%s`.txt\n", w2);
} else if(strcmpi(w1, "log_gm_file") == 0) {
strcpy(log_config.log_gm, w2);
if(log_config.gm > 0 && log_config.sql_logs < 1)

View File

@ -12,22 +12,17 @@ extern char db_server_logdb[32];
#endif //NOT TXT_ONLY
int log_branch(struct map_session_data *sd);
//New logs
int log_pick(struct map_session_data *sd, char *type, int mob_id, int nameid, int amount, struct item *itm);
int log_zeny(struct map_session_data *sd, char *type, struct map_session_data *src_sd, int amount);
int log_drop(struct map_session_data *sd, int monster_id, int *log_drop);
int log_mvpdrop(struct map_session_data *sd, int monster_id, int *log_mvp);
int log_present(struct map_session_data *sd, int source_type, int nameid);
int log_produce(struct map_session_data *sd, int nameid, int slot1, int slot2, int slot3, int success);
int log_refine(struct map_session_data *sd, int n, int success);
int log_trade(struct map_session_data *sd,struct map_session_data *target_sd,int n,int amount);
int log_tostorage(struct map_session_data *sd,int n, int guild);
int log_fromstorage(struct map_session_data *sd,int n, int guild);
int log_vend(struct map_session_data *sd,struct map_session_data *vsd,int n,int amount,int zeny);
int log_atcommand(struct map_session_data *sd, const char *message);
int log_npc(struct map_session_data *sd, const char *message);
int log_chat(char *type, int type_id, int src_charid, int src_accid, char *map, int x, int y, char *dst_charname, char *message);
int log_atcommand(struct map_session_data *sd, const char *message);
//Old, but useful logs
int log_branch(struct map_session_data *sd);
int log_mvpdrop(struct map_session_data *sd, int monster_id, int *log_mvp);
int log_config_read(char *cfgName);
@ -36,10 +31,10 @@ int should_log_item(int filter, int nameid, int amount); //log filter check
extern struct Log_Config {
int enable_logs;
int sql_logs;
int rare_items_log,refine_items_log,price_items_log,amount_items_log;
int branch, pick, drop, steal, mvpdrop, present, produce, refine, trade, vend, zeny, gm, npc, storage, chat;
char log_branch[32], log_pick[32], log_zeny[32], log_drop[32], log_mvpdrop[32], log_present[32], log_produce[32], log_refine[32], log_trade[32], log_vend[32], log_gm[32], log_npc[32], log_storage[32], log_chat[32];
char log_branch_db[32], log_pick_db[32], log_zeny_db[32], log_drop_db[32], log_mvpdrop_db[32], log_present_db[32], log_produce_db[32], log_refine_db[32], log_trade_db[32], log_vend_db[32], log_gm_db[32], log_npc_db[32], log_chat_db[32];
int rare_items_log,refine_items_log,price_items_log,amount_items_log; //for filter
int branch, pick, drop, mvpdrop, zeny, gm, npc, chat;
char log_branch[32], log_pick[32], log_zeny[32], log_mvpdrop[32], log_gm[32], log_npc[32], log_chat[32];
char log_branch_db[32], log_pick_db[32], log_zeny_db[32], log_mvpdrop_db[32], log_gm_db[32], log_npc_db[32], log_chat_db[32];
int uptime;
char log_uptime[32];
} log_config;

View File

@ -3556,9 +3556,6 @@ int map_sql_close(void){
ShowStatus("Close Map DB Connection....\n");
if (log_config.sql_logs)
//Updating this if each time there's a log_config addition is too much of a hassle. [Skotlex]
/*&& (log_config.branch || log_config.drop || log_config.mvpdrop ||
log_config.present || log_config.produce || log_config.refine || log_config.trade))*/
{
mysql_close(&logmysql_handle);
ShowStatus("Close Log DB Connection....\n");

View File

@ -1912,9 +1912,6 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type)
if (!(type&1)) {
struct item_drop_list *dlist = ers_alloc(item_drop_list_ers, struct item_drop_list);
struct item_drop *ditem;
int drop_ore = -1, drop_items = 0; //slot N for DROP LOG, number of dropped items
int log_item[MAX_MOB_DROP];
memset(&log_item,0,sizeof(log_item));
dlist->m = md->bl.m;
dlist->x = md->bl.x;
dlist->y = md->bl.y;
@ -1952,13 +1949,10 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type)
// if (10000 < rand()%10000+drop_rate) { //May be better if MAX_RAND is too low?
if (drop_rate < rand() % 10000 + 1) { //fixed 0.01% impossible drops bug [Lupus]
drop_ore = i; //we remember an empty slot to put there ORE DISCOVERY drop later.
continue;
}
drop_items++; //we count if there were any drops
ditem = mob_setdropitem(md->db->dropitem[i].nameid, 1);
log_item[i] = ditem->item_data.nameid;
//A Rare Drop Global Announce by Lupus
if(drop_rate<=battle_config.rare_drop_announce) {
@ -1977,16 +1971,9 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type)
// Ore Discovery [Celest]
if (sd == mvp_sd && !map[md->bl.m].flag.nomobloot && pc_checkskill(sd,BS_FINDINGORE)>0 && battle_config.finding_ore_rate/10 >= rand()%10000) {
ditem = mob_setdropitem(itemdb_searchrandomid(IG_FINDINGORE), 1);
if (drop_ore<0) drop_ore=8; //we have only 10 slots in LOG, there's a check to not overflow (9th item usually a card, so we use 8th slot)
log_item[drop_ore] = ditem->item_data.nameid; //it's for logging only
drop_items++; //we count if there were any drops
mob_item_drop(md, dlist, ditem, 0, battle_config.finding_ore_rate/10);
}
//this drop log contains ALL dropped items + ORE (if there was ORE Recovery) [Lupus]
if(sd && log_config.drop > 0 && drop_items) //we check were there any drops.. and if not - don't write the log
log_drop(sd, md->class_, log_item); //mvp_sd
if(sd) {
int itemid = 0;
for (i = 0; i < sd->add_drop_count; i++) {

View File

@ -2961,13 +2961,6 @@ int pc_steal_item(struct map_session_data *sd,struct block_list *bl)
log_pick(sd, "P", 0, itemid, 1, NULL);
}
if(log_config.steal) { //this drop log contains ALL stolen items [Lupus]
int log_item[MAX_MOB_DROP]; //for stolen items logging Lupus
memset(&log_item,0,sizeof(log_item));
log_item[i] = itemid; //i == monster's drop slot
log_drop(sd, md->class_, log_item);
}
//A Rare Steal Global Announce by Lupus
if(md->db->dropitem[i].p<=battle_config.rare_drop_announce) {
struct item_data *i_data;

View File

@ -3737,9 +3737,6 @@ int buildin_getitem(struct script_state *st)
if((nameidsrc = nameid)<0) { // Save real ID of the source Box [Lupus]
nameid=itemdb_searchrandomid(-nameid);
if(log_config.present > 0)
log_present(sd, -nameidsrc, nameid); //fixed missing ID by Lupus
flag = 1;
}
@ -4718,9 +4715,6 @@ int buildin_successrefitem(struct script_state *st)
if(i >= 0) {
ep=sd->status.inventory[i].equip;
if(log_config.refine > 0)
log_refine(sd, i, 1);
//Logs items, got from (N)PC scripts [Lupus]
if(log_config.pick > 0 ) {
log_pick(sd, "N", 0, sd->status.inventory[i].nameid, -1, &sd->status.inventory[i]);
@ -4773,9 +4767,6 @@ int buildin_failedrefitem(struct script_state *st)
sd=script_rid2sd(st);
i=pc_checkequip(sd,equip[num-1]);
if(i >= 0) {
if(log_config.refine > 0)
log_refine(sd, i, 0);
//Logs items, got from (N)PC scripts [Lupus]
if(log_config.pick > 0 ) {
log_pick(sd, "N", 0, sd->status.inventory[i].nameid, -1, &sd->status.inventory[i]);

View File

@ -10180,8 +10180,9 @@ int skill_produce_mix( struct map_session_data *sd, int skill_id,
}
}
if(log_config.produce > 0)
log_produce(sd,nameid,slot1,slot2,slot3,1);
// if(log_config.produce > 0)
// log_produce(sd,nameid,slot1,slot2,slot3,1);
//TODO update PICKLOG
if(equip){
clif_produceeffect(sd,0,nameid);
@ -10255,8 +10256,9 @@ int skill_produce_mix( struct map_session_data *sd, int skill_id,
}
}
//Failure
if(log_config.produce)
log_produce(sd,nameid,slot1,slot2,slot3,0);
// if(log_config.produce)
// log_produce(sd,nameid,slot1,slot2,slot3,0);
//TODO update PICKLOG
if(equip){
clif_produceeffect(sd,1,nameid);

View File

@ -484,7 +484,6 @@ void trade_tradecommit(struct map_session_data *sd) {
if (sd->status.inventory[n].amount < sd->deal.item[trade_i].amount)
sd->deal.item[trade_i].amount = sd->status.inventory[n].amount;
log_trade(sd, target_sd, n, sd->deal.item[trade_i].amount);
flag = pc_additem(target_sd, &sd->status.inventory[n], sd->deal.item[trade_i].amount);
if (flag == 0) {
@ -507,8 +506,6 @@ void trade_tradecommit(struct map_session_data *sd) {
if (target_sd->status.inventory[n].amount < target_sd->deal.item[trade_i].amount)
target_sd->deal.item[trade_i].amount = target_sd->status.inventory[n].amount;
log_trade(target_sd, sd, n, target_sd->deal.item[trade_i].amount);
flag = pc_additem(sd, &target_sd->status.inventory[n], target_sd->deal.item[trade_i].amount);
if (flag == 0) {
//Logs (T)rade [Lupus]

View File

@ -165,13 +165,6 @@ void vending_purchasereq(struct map_session_data *sd,int len,int id,unsigned cha
}
//Logs
//Old VENDING log added by Lupus
if(log_config.vend > 0) {
log_vend(sd,vsd, idx, amount, (int)z); // for Item + Zeny. log.
//we log ZENY only with the 1st item. Then zero it for the rest items
z = 0;
}
// vending item
pc_additem(sd, &vsd->status.cart[idx], amount);
vsd->vending[vend_list[i]].amount -= amount;