summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoreathenabot <eathenabot@54d463be-8e91-2dee-dedb-b68131a5f0ec>2011-12-24 15:17:49 +0000
committereathenabot <eathenabot@54d463be-8e91-2dee-dedb-b68131a5f0ec>2011-12-24 15:17:49 +0000
commit7157ce9ba626dd87fd63937d13b0a0ac6368afb9 (patch)
tree11744c84b1700f2475a70c61d2c7853ca7d81f4a /src
parent68d8ee552a2b39cd0c5b2fc75c1335d221f68010 (diff)
downloadhercules-7157ce9ba626dd87fd63937d13b0a0ac6368afb9.tar.gz
hercules-7157ce9ba626dd87fd63937d13b0a0ac6368afb9.tar.bz2
hercules-7157ce9ba626dd87fd63937d13b0a0ac6368afb9.tar.xz
hercules-7157ce9ba626dd87fd63937d13b0a0ac6368afb9.zip
* Merged changes up to eAthena 15041.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@15249 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-rw-r--r--src/map/itemdb.h1
-rw-r--r--src/map/log.c65
-rw-r--r--src/map/log.h2
3 files changed, 37 insertions, 31 deletions
diff --git a/src/map/itemdb.h b/src/map/itemdb.h
index 7238bb181..0ea5574ad 100644
--- a/src/map/itemdb.h
+++ b/src/map/itemdb.h
@@ -19,6 +19,7 @@
**/
#define ITEMID_ANCILLA 12333
+#define ITEMID_EMPERIUM 714
#define ITEMID_YELLOW_GEMSTONE 715
#define ITEMID_RED_GEMSTONE 716
#define ITEMID_BLUE_GEMSTONE 717
diff --git a/src/map/log.c b/src/map/log.c
index 50d73fe2a..62b80a6c0 100644
--- a/src/map/log.c
+++ b/src/map/log.c
@@ -17,6 +17,26 @@
#include <string.h>
+typedef enum e_log_filter
+{
+ LOG_FILTER_NONE = 0x000,
+ LOG_FILTER_ALL = 0x001,
+ // bits
+ LOG_FILTER_HEALING = 0x002, // Healing items (0)
+ LOG_FILTER_ETC_AMMO = 0x004, // Etc Items(3) + Arrows (10)
+ LOG_FILTER_USABLE = 0x008, // Usable Items(2) + Scrolls, Lures(11) + Usable Cash Items(18)
+ LOG_FILTER_WEAPON = 0x010, // Weapons(4)
+ LOG_FILTER_ARMOR = 0x020, // Shields, Armors, Headgears, Accessories, Garments and Shoes(5)
+ LOG_FILTER_CARD = 0x040, // Cards(6)
+ LOG_FILTER_PETITEM = 0x080, // Pet Accessories(8) + Eggs(7) (well, monsters don't drop 'em but we'll use the same system for ALL logs)
+ LOG_FILTER_PRICE = 0x100, // Log expensive items ( >= price_log )
+ LOG_FILTER_AMOUNT = 0x200, // Log large amount of items ( >= amount_log )
+ LOG_FILTER_REFINE = 0x400, // Log refined items ( refine >= refine_log ) [not implemented]
+ LOG_FILTER_CHANCE = 0x800, // Log rare items and Emperium ( drop chance <= rare_log )
+}
+e_log_filter;
+
+
struct Log_Config log_config;
@@ -77,38 +97,23 @@ static char log_chattype2char(e_log_chat_type type)
}
-//FILTER OPTIONS
-//0 = Don't log
-//1 = Log any item
-//Bits: ||
-//2 - Healing items (0)
-//3 - Etc Items(3) + Arrows (10)
-//4 - Usable Items(2) + Scrolls,Lures(11) + Usable Cash Items(18)
-//5 - Weapon(4)
-//6 - Shields,Armor,Headgears,Accessories,etc(5)
-//7 - Cards(6)
-//8 - Pet Accessories(8) + Eggs(7) (well, monsters don't drop 'em but we'll use the same system for ALL logs)
-//9 - Log expensive items ( >= price_log)
-//10 - Log big amount of items ( >= amount_log)
-//11 - Log refined items (if their refine >= refine_log )
-//12 - Log rare items (if their drop chance <= rare_log )
-
//check if this item should be logged according the settings
-bool should_log_item(int filter, int nameid, int amount)
+static bool should_log_item(int nameid, int amount)
{
+ int filter = log_config.filter;
struct item_data *item_data;
if ((item_data= itemdb_exists(nameid)) == NULL) return false;
- if ((filter&1) || // Filter = 1, we log any item
- (filter&2 && item_data->type == IT_HEALING ) ||
- (filter&4 && (item_data->type == IT_ETC || item_data->type == IT_AMMO) ) ||
- (filter&8 && (item_data->type == IT_USABLE || item_data->type == IT_CASH) ) ||
- (filter&16 && item_data->type == IT_WEAPON ) ||
- (filter&32 && item_data->type == IT_ARMOR ) ||
- (filter&64 && item_data->type == IT_CARD ) ||
- (filter&128 && (item_data->type == IT_PETEGG || item_data->type == IT_PETARMOR) ) ||
- (filter&256 && item_data->value_buy >= log_config.price_items_log ) || //expensive items
- (filter&512 && abs(amount) >= log_config.amount_items_log ) || //big amount of items
- (filter&2048 && ((item_data->maxchance != -1 && item_data->maxchance <= log_config.rare_items_log) || item_data->nameid == 714) ) //Rare items or Emperium
+ if ((filter&LOG_FILTER_ALL) ||
+ (filter&LOG_FILTER_HEALING && item_data->type == IT_HEALING ) ||
+ (filter&LOG_FILTER_ETC_AMMO && (item_data->type == IT_ETC || item_data->type == IT_AMMO) ) ||
+ (filter&LOG_FILTER_USABLE && (item_data->type == IT_USABLE || item_data->type == IT_CASH) ) ||
+ (filter&LOG_FILTER_WEAPON && item_data->type == IT_WEAPON ) ||
+ (filter&LOG_FILTER_ARMOR && item_data->type == IT_ARMOR ) ||
+ (filter&LOG_FILTER_CARD && item_data->type == IT_CARD ) ||
+ (filter&LOG_FILTER_PETITEM && (item_data->type == IT_PETEGG || item_data->type == IT_PETARMOR) ) ||
+ (filter&LOG_FILTER_PRICE && item_data->value_buy >= log_config.price_items_log ) ||
+ (filter&LOG_FILTER_AMOUNT && abs(amount) >= log_config.amount_items_log ) ||
+ (filter&LOG_FILTER_CHANCE && ((item_data->maxchance != -1 && item_data->maxchance <= log_config.rare_items_log) || item_data->nameid == ITEMID_EMPERIUM) )
) return true;
return false;
@@ -163,7 +168,7 @@ void log_pick_pc(struct map_session_data *sd, e_log_pick_type type, int nameid,
return;
}
- if (!should_log_item(log_config.filter, nameid, amount))
+ if (!should_log_item(nameid, amount))
return; //we skip logging this item set - it doesn't meet our logging conditions [Lupus]
#ifndef TXT_ONLY
@@ -219,7 +224,7 @@ void log_pick_mob(struct mob_data *md, e_log_pick_type type, int nameid, int amo
return;
}
- if (!should_log_item(log_config.filter, nameid, amount))
+ if (!should_log_item(nameid, amount))
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)
diff --git a/src/map/log.h b/src/map/log.h
index 89869c2b4..25a5ebf24 100644
--- a/src/map/log.h
+++ b/src/map/log.h
@@ -68,7 +68,7 @@ int log_config_read(char *cfgName);
extern struct Log_Config
{
- enum e_log_pick_type enable_logs;
+ e_log_pick_type enable_logs;
int filter;
bool sql_logs;
bool log_chat_woe_disable;