diff options
author | eathenabot <eathenabot@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2011-12-24 15:17:49 +0000 |
---|---|---|
committer | eathenabot <eathenabot@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2011-12-24 15:17:49 +0000 |
commit | 7157ce9ba626dd87fd63937d13b0a0ac6368afb9 (patch) | |
tree | 11744c84b1700f2475a70c61d2c7853ca7d81f4a /src/map/log.c | |
parent | 68d8ee552a2b39cd0c5b2fc75c1335d221f68010 (diff) | |
download | hercules-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/map/log.c')
-rw-r--r-- | src/map/log.c | 65 |
1 files changed, 35 insertions, 30 deletions
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) |