summaryrefslogtreecommitdiff
path: root/src/map/log.c
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2015-09-18 13:09:16 +0200
committerHaru <haru@dotalux.com>2015-09-25 12:55:36 +0200
commit1aea178ef7cdb76eda5600540b5fbd29fd54ff88 (patch)
tree855d4feafba212d7f36872c1b46814c1f1a85e75 /src/map/log.c
parente99bf73af31a8b1f09b9ce033c16832ee5cac51d (diff)
downloadhercules-1aea178ef7cdb76eda5600540b5fbd29fd54ff88.tar.gz
hercules-1aea178ef7cdb76eda5600540b5fbd29fd54ff88.tar.bz2
hercules-1aea178ef7cdb76eda5600540b5fbd29fd54ff88.tar.xz
hercules-1aea178ef7cdb76eda5600540b5fbd29fd54ff88.zip
More aggressive whitespace cleanup. Follow up to 51329e6
Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/map/log.c')
-rw-r--r--src/map/log.c32
1 files changed, 14 insertions, 18 deletions
diff --git a/src/map/log.c b/src/map/log.c
index 0c5977c05..a74cb27c5 100644
--- a/src/map/log.c
+++ b/src/map/log.c
@@ -54,7 +54,6 @@ char log_picktype2char(e_log_pick_type type) {
return 'X';
}
-
/// obtain log type character for chat logs
char log_chattype2char(e_log_chat_type type) {
switch( type ) {
@@ -70,7 +69,6 @@ char log_chattype2char(e_log_chat_type type) {
return 'O';
}
-
/// check if this item should be logged according the settings
bool should_log_item(int nameid, int amount, int refine, struct item_data *id) {
int filter = logs->config.filter;
@@ -112,7 +110,7 @@ void log_branch_sub_txt(struct map_session_data* sd) {
char timestring[255];
time_t curtime;
FILE* logfp;
-
+
if( ( logfp = fopen(logs->config.log_branch, "a") ) == NULL )
return;
time(&curtime);
@@ -145,7 +143,7 @@ void log_pick_sub_txt(int id, int16 m, e_log_pick_type type, int amount, struct
char timestring[255];
time_t curtime;
FILE* logfp;
-
+
if( ( logfp = fopen(logs->config.log_pick, "a") ) == NULL )
return;
time(&curtime);
@@ -174,7 +172,6 @@ void log_pick_pc(struct map_session_data* sd, e_log_pick_type type, int amount,
log_pick(sd->status.char_id, sd->bl.m, type, amount, itm, data ? data : itemdb->exists(itm->nameid));
}
-
/// logs item transactions (monsters)
void log_pick_mob(struct mob_data* md, e_log_pick_type type, int amount, struct item* itm, struct item_data *data) {
nullpo_retv(md);
@@ -192,7 +189,7 @@ void log_zeny_sub_txt(struct map_session_data* sd, e_log_pick_type type, struct
char timestring[255];
time_t curtime;
FILE* logfp;
-
+
if( ( logfp = fopen(logs->config.log_zeny, "a") ) == NULL )
return;
time(&curtime);
@@ -222,7 +219,7 @@ void log_mvpdrop_sub_txt(struct map_session_data* sd, int monster_id, int* log_m
char timestring[255];
time_t curtime;
FILE* logfp;
-
+
if( ( logfp = fopen(logs->config.log_mvpdrop,"a") ) == NULL )
return;
time(&curtime);
@@ -243,7 +240,7 @@ void log_mvpdrop(struct map_session_data* sd, int monster_id, int* log_mvp)
void log_atcommand_sub_sql(struct map_session_data* sd, const char* message) {
SqlStmt* stmt;
-
+
stmt = SQL->StmtMalloc(logs->mysql_handle);
if( SQL_SUCCESS != SQL->StmtPrepare(stmt, LOG_QUERY " INTO `%s` (`atcommand_date`, `account_id`, `char_id`, `char_name`, `map`, `command`) VALUES (NOW(), '%d', '%d', ?, '%s', ?)", logs->config.log_gm, sd->status.account_id, sd->status.char_id, mapindex_id2name(sd->mapindex) )
|| SQL_SUCCESS != SQL->StmtBindParam(stmt, 0, SQLDT_STRING, sd->status.name, strnlen(sd->status.name, NAME_LENGTH))
@@ -260,7 +257,7 @@ void log_atcommand_sub_txt(struct map_session_data* sd, const char* message) {
char timestring[255];
time_t curtime;
FILE* logfp;
-
+
if( ( logfp = fopen(logs->config.log_gm, "a") ) == NULL )
return;
time(&curtime);
@@ -298,7 +295,7 @@ void log_npc_sub_txt(struct map_session_data *sd, const char *message) {
char timestring[255];
time_t curtime;
FILE* logfp;
-
+
if( ( logfp = fopen(logs->config.log_npc, "a") ) == NULL )
return;
time(&curtime);
@@ -319,7 +316,7 @@ void log_npc(struct map_session_data* sd, const char* message)
void log_chat_sub_sql(e_log_chat_type type, int type_id, int src_charid, int src_accid, const char *mapname, int x, int y, const char* dst_charname, const char* message) {
SqlStmt* stmt;
-
+
stmt = SQL->StmtMalloc(logs->mysql_handle);
if( SQL_SUCCESS != SQL->StmtPrepare(stmt, LOG_QUERY " INTO `%s` (`time`, `type`, `type_id`, `src_charid`, `src_accountid`, `src_map`, `src_map_x`, `src_map_y`, `dst_charname`, `message`) VALUES (NOW(), '%c', '%d', '%d', '%d', '%s', '%d', '%d', ?, ?)", logs->config.log_chat, logs->chattype2char(type), type_id, src_charid, src_accid, mapname, x, y)
|| SQL_SUCCESS != SQL->StmtBindParam(stmt, 0, SQLDT_STRING, (char*)dst_charname, safestrnlen(dst_charname, NAME_LENGTH))
@@ -336,7 +333,7 @@ void log_chat_sub_txt(e_log_chat_type type, int type_id, int src_charid, int src
char timestring[255];
time_t curtime;
FILE* logfp;
-
+
if( ( logfp = fopen(logs->config.log_chat, "a") ) == NULL )
return;
time(&curtime);
@@ -363,12 +360,12 @@ void log_chat(e_log_chat_type type, int type_id, int src_charid, int src_accid,
void log_sql_init(void) {
// log db connection
logs->mysql_handle = SQL->Malloc();
-
+
ShowInfo(""CL_WHITE"[SQL]"CL_RESET": Connecting to the Log Database "CL_WHITE"%s"CL_RESET" At "CL_WHITE"%s"CL_RESET"...\n",logs->db_name,logs->db_ip);
if ( SQL_ERROR == SQL->Connect(logs->mysql_handle, logs->db_id, logs->db_pw, logs->db_ip, logs->db_port, logs->db_name) )
exit(EXIT_FAILURE);
ShowStatus(""CL_WHITE"[SQL]"CL_RESET": Successfully '"CL_GREEN"connected"CL_RESET"' to Database '"CL_WHITE"%s"CL_RESET"'.\n", logs->db_name);
-
+
if (map->default_codepage[0] != '\0')
if ( SQL_ERROR == SQL->SetEncoding(logs->mysql_handle, map->default_codepage) )
Sql_ShowDebug(logs->mysql_handle);
@@ -389,7 +386,6 @@ void log_set_defaults(void) {
logs->config.amount_items_log = 100;
}
-
int log_config_read(const char* cfgName) {
static int count = 0;
char line[1024], w1[1024], w2[1024];
@@ -506,7 +502,7 @@ void log_config_complete(void) {
}
void log_defaults(void) {
logs = &log_s;
-
+
sprintf(logs->db_ip,"127.0.0.1");
sprintf(logs->db_id,"ragnarok");
sprintf(logs->db_pw,"ragnarok");
@@ -515,7 +511,7 @@ void log_defaults(void) {
logs->db_port = 3306;
logs->mysql_handle = NULL;
/* */
-
+
logs->pick_pc = log_pick_pc;
logs->pick_mob = log_pick_mob;
logs->zeny = log_zeny;
@@ -524,7 +520,7 @@ void log_defaults(void) {
logs->atcommand = log_atcommand;
logs->branch = log_branch;
logs->mvpdrop = log_mvpdrop;
-
+
/* will be modified in a few seconds once loading is complete. */
logs->pick_sub = log_pick_sub_txt;
logs->zeny_sub = log_zeny_sub_txt;