summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreathenabot <eathenabot@54d463be-8e91-2dee-dedb-b68131a5f0ec>2011-12-24 22:41:07 +0000
committereathenabot <eathenabot@54d463be-8e91-2dee-dedb-b68131a5f0ec>2011-12-24 22:41:07 +0000
commit6757e97093fb9b9266a561675a7269cd92afef38 (patch)
treefab702671080d5d08aa83d21dbaf0151cfd447d1
parent5d147faa8d9699e057d0d2f7fe4df6fdbe9521eb (diff)
downloadhercules-6757e97093fb9b9266a561675a7269cd92afef38.tar.gz
hercules-6757e97093fb9b9266a561675a7269cd92afef38.tar.bz2
hercules-6757e97093fb9b9266a561675a7269cd92afef38.tar.xz
hercules-6757e97093fb9b9266a561675a7269cd92afef38.zip
* Merged changes up to eAthena 15045.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@15256 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r--Changelog-Trunk.txt2
-rw-r--r--src/map/log.c23
2 files changed, 14 insertions, 11 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt
index f6c984a6c..a944383e0 100644
--- a/Changelog-Trunk.txt
+++ b/Changelog-Trunk.txt
@@ -2,6 +2,8 @@ Date (YYYY-MM-DD)
Added
2011-12-24
+ * Re-implemented item refine level filter for logging (since r1416, removed r6510, related r3283). [Ai4rei]
+ * Fixed TXT logs being opened as 'append+read', rather than just 'append' (since r197). [Ai4rei]
* Merged log settings for SQL tables and TXT flat files (meaning depends on sql_logs setting). [Ai4rei]
- Added a warning when attempting to use SQL logs on TXT.
- Information about enabled logs is now displayed after all log config is read instead of per-hit.
diff --git a/src/map/log.c b/src/map/log.c
index 1ed54efa9..4325d50fe 100644
--- a/src/map/log.c
+++ b/src/map/log.c
@@ -100,7 +100,7 @@ static char log_chattype2char(e_log_chat_type type)
/// check if this item should be logged according the settings
-static bool should_log_item(int nameid, int amount)
+static bool should_log_item(int nameid, int amount, int refine)
{
int filter = log_config.filter;
struct item_data* id;
@@ -118,6 +118,7 @@ static bool should_log_item(int nameid, int amount)
( filter&LOG_FILTER_PETITEM && ( id->type == IT_PETEGG || id->type == IT_PETARMOR ) ) ||
( filter&LOG_FILTER_PRICE && id->value_buy >= log_config.price_items_log ) ||
( filter&LOG_FILTER_AMOUNT && abs(amount) >= log_config.amount_items_log ) ||
+ ( filter&LOG_FILTER_REFINE && refine >= log_config.refine_items_log ) ||
( filter&LOG_FILTER_CHANCE && ( ( id->maxchance != -1 && id->maxchance <= log_config.rare_items_log ) || id->nameid == ITEMID_EMPERIUM ) )
)
return true;
@@ -156,7 +157,7 @@ void log_branch(struct map_session_data* sd)
time_t curtime;
FILE* logfp;
- if( ( logfp = fopen(log_config.log_branch, "a+") ) == NULL )
+ if( ( logfp = fopen(log_config.log_branch, "a") ) == NULL )
return;
time(&curtime);
strftime(timestring, sizeof(timestring), "%m/%d/%Y %H:%M:%S", localtime(&curtime));
@@ -176,7 +177,7 @@ void log_pick_pc(struct map_session_data* sd, e_log_pick_type type, int nameid,
return;
}
- if( !should_log_item(nameid, amount) )
+ if( !should_log_item(nameid, amount, itm ? itm->refine : 0) )
return; //we skip logging this item set - it doesn't meet our logging conditions [Lupus]
#ifndef TXT_ONLY
@@ -208,7 +209,7 @@ void log_pick_pc(struct map_session_data* sd, e_log_pick_type type, int nameid,
time_t curtime;
FILE* logfp;
- if( ( logfp = fopen(log_config.log_pick, "a+") ) == NULL )
+ if( ( logfp = fopen(log_config.log_pick, "a") ) == NULL )
return;
time(&curtime);
strftime(timestring, sizeof(timestring), "%m/%d/%Y %H:%M:%S", localtime(&curtime));
@@ -238,7 +239,7 @@ void log_pick_mob(struct mob_data* md, e_log_pick_type type, int nameid, int amo
return;
}
- if( !should_log_item(nameid, amount) )
+ if( !should_log_item(nameid, amount, itm ? itm->refine : 0) )
return; //we skip logging this item set - it doesn't meet our logging conditions [Lupus]
//either PLAYER or MOB (here we get map name and objects ID)
@@ -275,7 +276,7 @@ void log_pick_mob(struct mob_data* md, e_log_pick_type type, int nameid, int amo
time_t curtime;
FILE *logfp;
- if( ( logfp = fopen(log_config.log_pick, "a+") ) == NULL )
+ if( ( logfp = fopen(log_config.log_pick, "a") ) == NULL )
return;
time(&curtime);
strftime(timestring, sizeof(timestring), "%m/%d/%Y %H:%M:%S", localtime(&curtime));
@@ -335,7 +336,7 @@ void log_zeny(struct map_session_data* sd, e_log_pick_type type, struct map_sess
time_t curtime;
FILE* logfp;
- if( ( logfp = fopen(log_config.log_zeny, "a+") ) == NULL )
+ if( ( logfp = fopen(log_config.log_zeny, "a") ) == NULL )
return;
time(&curtime);
strftime(timestring, sizeof(timestring), "%m/%d/%Y %H:%M:%S", localtime(&curtime));
@@ -370,7 +371,7 @@ void log_mvpdrop(struct map_session_data* sd, int monster_id, int* log_mvp)
time_t curtime;
FILE* logfp;
- if( ( logfp = fopen(log_config.log_mvpdrop,"a+") ) == NULL )
+ if( ( logfp = fopen(log_config.log_mvpdrop,"a") ) == NULL )
return;
time(&curtime);
strftime(timestring, sizeof(timestring), "%m/%d/%Y %H:%M:%S", localtime(&curtime));
@@ -412,7 +413,7 @@ void log_atcommand(struct map_session_data* sd, int cmdlvl, const char* message)
time_t curtime;
FILE* logfp;
- if( ( logfp = fopen(log_config.log_gm, "a+") ) == NULL )
+ if( ( logfp = fopen(log_config.log_gm, "a") ) == NULL )
return;
time(&curtime);
strftime(timestring, sizeof(timestring), "%m/%d/%Y %H:%M:%S", localtime(&curtime));
@@ -453,7 +454,7 @@ void log_npc(struct map_session_data* sd, const char* message)
time_t curtime;
FILE* logfp;
- if( ( logfp = fopen(log_config.log_npc, "a+") ) == NULL )
+ if( ( logfp = fopen(log_config.log_npc, "a") ) == NULL )
return;
time(&curtime);
strftime(timestring, sizeof(timestring), "%m/%d/%Y %H:%M:%S", localtime(&curtime));
@@ -500,7 +501,7 @@ void log_chat(e_log_chat_type type, int type_id, int src_charid, int src_accid,
time_t curtime;
FILE* logfp;
- if( ( logfp = fopen(log_config.log_chat, "a+") ) == NULL )
+ if( ( logfp = fopen(log_config.log_chat, "a") ) == NULL )
return;
time(&curtime);
strftime(timestring, sizeof(timestring), "%m/%d/%Y %H:%M:%S", localtime(&curtime));