summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreathenabot <eathenabot@54d463be-8e91-2dee-dedb-b68131a5f0ec>2011-12-24 14:13:39 +0000
committereathenabot <eathenabot@54d463be-8e91-2dee-dedb-b68131a5f0ec>2011-12-24 14:13:39 +0000
commit373cfe9bee3f297540d09cb0616e2b5da17463f3 (patch)
tree7c525ce072d2ac917fe63ff0ad5805d28acbfd3c
parent4b787eb878c4410512ceffb9f92b6f3cd7975bce (diff)
downloadhercules-373cfe9bee3f297540d09cb0616e2b5da17463f3.tar.gz
hercules-373cfe9bee3f297540d09cb0616e2b5da17463f3.tar.bz2
hercules-373cfe9bee3f297540d09cb0616e2b5da17463f3.tar.xz
hercules-373cfe9bee3f297540d09cb0616e2b5da17463f3.zip
* Merged changes up to eAthena 15040.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@15245 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r--Changelog-Trunk.txt3
-rw-r--r--conf/Changelog.txt4
-rw-r--r--conf/log_athena.conf59
-rw-r--r--src/map/atcommand.c28
-rw-r--r--src/map/buyingstore.c10
-rw-r--r--src/map/clif.c54
-rw-r--r--src/map/log.c126
-rw-r--r--src/map/log.h50
-rw-r--r--src/map/mail.c18
-rw-r--r--src/map/mob.c28
-rw-r--r--src/map/npc.c15
-rw-r--r--src/map/party.c4
-rw-r--r--src/map/pc.c15
-rw-r--r--src/map/pet.c6
-rw-r--r--src/map/script.c53
-rw-r--r--src/map/storage.c18
-rw-r--r--src/map/trade.c22
-rw-r--r--src/map/vending.c9
18 files changed, 261 insertions, 261 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt
index a081b7329..0b826b771 100644
--- a/Changelog-Trunk.txt
+++ b/Changelog-Trunk.txt
@@ -1,6 +1,9 @@
Date (YYYY-MM-DD)
Added
+2011-12-24
+ * Updates to map-server's log system. [Ai4rei]
+ - Moved all logs configuration checks from caller functions into respective log functions, and replaced string log types with an enumeration.
2011-12-22
* Fixed guild aura code not checking, whether the map of guild leader and member is the same (since r15037). [Ai4rei]
* Merged slightly modified guild aura optimization from rAthena (ra:15084, ra:15086). [Ai4rei]
diff --git a/conf/Changelog.txt b/conf/Changelog.txt
index 4b8a7844a..715133a6f 100644
--- a/conf/Changelog.txt
+++ b/conf/Changelog.txt
@@ -1,5 +1,9 @@
Date Added
+2011/12/24
+ * Rev. 15040 Updates to log_athena.conf [Ai4rei]
+ - Setting 'enable_logs' is now a pure bitmask and no longer affects misc-logs (branch, zeny etc). Meaning of most bits changed, revise your log configuration before starting the server.
+ - Where applicable, settings support hexadecimal and boolean values instead of only integers.
2011/12/19
* Rev. 15036 Updates to log_athena.conf [Ai4rei]
- Changed meaning of 'log_chat' bits (shift to right by one, &64 bit removed, 1 no longer means 'all').
diff --git a/conf/log_athena.conf b/conf/log_athena.conf
index c3bc2009a..156fabb17 100644
--- a/conf/log_athena.conf
+++ b/conf/log_athena.conf
@@ -19,28 +19,29 @@
// assume unit types (1: Pc, 2: Mob, 4: Pet, 8: Homun)
//--------------------------------------------------------------
-// Enable Logs?
-// 1 - Log all events.
-// Or, determine what to log by adding up the different events:
-// 0002 - (T) Log trades
-// 0004 - (V) Log vending transactions
-// 0008 - (P) Log items drop/picked by players
-// 0016 - (L) Log items drop/looted by monsters
-// 0032 - (S) Log NPC transactions (buy/sell)
-// 0064 - (N) Log Script transactions (items deleted/acquired through quests)
-// 0128 - (M) Log items stolen from mobs (Steal/Gank)
-// 0256 - (C) Log player-used items
-// 0512 - (M) Log MVP prize items
-// 1024 - (A) Log player created/deleted items (through @/# commands)
-// 2048 - (R) Log items placed/retrieved from storage.
-// 4096 - (G) Log items placed/retrieved from guild storage.
-// 8192 - (E) Log mail system transactions.
-// 16384 - (B) Log buying store transactions
-// Example: Log trades+vending+script items+created items: 2+4+64+1024 = 1094
-enable_logs: 1
-
-// Use MySQL Logs? (SQL Version Only)
-sql_logs: 0
+// Enable Logs? (Note 3)
+// 0x0000 - Don't log at all
+// 0x0001 - (T) Log trades
+// 0x0002 - (V) Log vending transactions
+// 0x0004 - (P) Log items drop/picked by players
+// 0x0008 - (L) Log items drop/looted by monsters
+// 0x0010 - (S) Log NPC transactions (buy/sell)
+// 0x0020 - (N) Log Script transactions (items deleted/acquired through quests)
+// 0x0040 - (D) Log items stolen from mobs (Steal/Gank)
+// 0x0080 - (C) Log player-used items
+// 0x0100 - (O) Log produced/ingredient items
+// 0x0200 - (U) Log MVP prize items
+// 0x0400 - (A) Log player created/deleted items (through @/# commands)
+// 0x0800 - (R) Log items placed/retrieved from storage.
+// 0x1000 - (G) Log items placed/retrieved from guild storage.
+// 0x2000 - (E) Log mail system transactions.
+// 0x4000 - (I) Log auction system transactions.
+// 0x8000 - (B) Log buying store transactions
+// Example: Log trades+vending+script items+created items: 1+2+32+1024 = 1059
+enable_logs: 0xFFFF
+
+// Use MySQL Logs? [SQL Version Only] (Note 1)
+sql_logs: no
// LOGGING FILTERS
// =============================================================
@@ -80,25 +81,25 @@ price_items_log: 1000
amount_items_log: 100
//=============================================================
-// Log Dead Branch Usage
-log_branch: 0
+// Log Dead Branch Usage (Note 1)
+log_branch: no
// Track Zeny Changes
// Filter settings
// 0 - don't log; 1 - log any zeny changes; 2.....1000000 - minimal absolut logging zeny value
log_zeny: 0
-// Log MVP Monster Drops
+// Log MVP Monster Drops (Note 1)
// Outdated. Use Pick_Log instead. But this log could be useful to keep track slayed MVPs
-log_mvpdrop: 0
+log_mvpdrop: no
// Log GM Commands (set to minimum level of Logged Commands)
log_gm: 40
-// Log NPC 'logmes' commands
-log_npc: 0
+// Log NPC 'logmes' commands (Note 1)
+log_npc: no
-// Log CHAT (Global, Whisper, Party, Guild, Main chat)
+// Log CHAT (Global, Whisper, Party, Guild, Main chat) (Note 3)
// LOGGING FILTERS
// =============================================================
// 0 = Don't log at all
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index ef8ad4784..8da3fa296 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -1725,8 +1725,7 @@ ACMD_FUNC(item)
}
//Logs (A)dmins items [Lupus]
- if(log_config.enable_logs & LOG_COMMAND_ITEMS)
- log_pick_pc(sd, "A", item_id, number, NULL);
+ log_pick_pc(sd, LOG_TYPE_COMMAND, item_id, number, NULL);
clif_displaymessage(fd, msg_txt(18)); // Item created.
return 0;
@@ -1800,8 +1799,7 @@ ACMD_FUNC(item2)
}
//Logs (A)dmins items [Lupus]
- if(log_config.enable_logs & LOG_COMMAND_ITEMS)
- log_pick_pc(sd, "A", item_tmp.nameid, number, &item_tmp);
+ log_pick_pc(sd, LOG_TYPE_COMMAND, item_tmp.nameid, number, &item_tmp);
clif_displaymessage(fd, msg_txt(18)); // Item created.
} else {
@@ -1824,8 +1822,7 @@ ACMD_FUNC(itemreset)
if (sd->status.inventory[i].amount && sd->status.inventory[i].equip == 0) {
//Logs (A)dmins items [Lupus]
- if(log_config.enable_logs & LOG_COMMAND_ITEMS)
- log_pick_pc(sd, "A", sd->status.inventory[i].nameid, -sd->status.inventory[i].amount, &sd->status.inventory[i]);
+ log_pick_pc(sd, LOG_TYPE_COMMAND, sd->status.inventory[i].nameid, -sd->status.inventory[i].amount, &sd->status.inventory[i]);
pc_delitem(sd, i, sd->status.inventory[i].amount, 0, 0);
}
@@ -2865,8 +2862,7 @@ ACMD_FUNC(produce)
clif_misceffect(&sd->bl, 3);
//Logs (A)dmins items [Lupus]
- if(log_config.enable_logs & LOG_COMMAND_ITEMS)
- log_pick_pc(sd, "A", tmp_item.nameid, 1, &tmp_item);
+ log_pick_pc(sd, LOG_TYPE_COMMAND, tmp_item.nameid, 1, &tmp_item);
if ((flag = pc_additem(sd, &tmp_item, 1)))
clif_additem(sd, 0, 0, flag);
@@ -5947,8 +5943,7 @@ void getring (struct map_session_data* sd)
item_tmp.card[3] = sd->status.partner_id >> 16;
//Logs (A)dmins items [Lupus]
- if(log_config.enable_logs & LOG_COMMAND_ITEMS)
- log_pick_pc(sd, "A", item_id, 1, &item_tmp);
+ log_pick_pc(sd, LOG_TYPE_COMMAND, item_id, 1, &item_tmp);
if((flag = pc_additem(sd,&item_tmp,1))) {
clif_additem(sd,0,0,flag);
@@ -8726,10 +8721,7 @@ ACMD_FUNC(delitem)
}
//Logs (A)dmins items [Lupus]
- if( log_config.enable_logs & LOG_COMMAND_ITEMS )
- {
- log_pick_pc(sd, "A", nameid, -delamount, &sd->status.inventory[idx]);
- }
+ log_pick_pc(sd, LOG_TYPE_COMMAND, nameid, -delamount, &sd->status.inventory[idx]);
pc_delitem(sd, idx, delamount, 0, 0);
@@ -9276,6 +9268,14 @@ bool is_atcommand(const int fd, struct map_session_data* sd, const char* message
}
if( strcmpi("adjgmlvl",command+1) && ssd ) ssd->gmlevel = lv;
+ //Log atcommands
+ if( *atcmd_msg == atcommand_symbol )
+ log_atcommand(sd, info->level, atcmd_msg);
+
+ //Log Charcommands
+ if( *atcmd_msg == charcommand_symbol && ssd != NULL )
+ log_atcommand(sd, info->level2, message);
+
return true;
}
diff --git a/src/map/buyingstore.c b/src/map/buyingstore.c
index 6d8ed9acb..eddfa0127 100644
--- a/src/map/buyingstore.c
+++ b/src/map/buyingstore.c
@@ -367,13 +367,9 @@ void buyingstore_trade(struct map_session_data* sd, int account_id, unsigned int
zeny = amount*pl_sd->buyingstore.items[listidx].price;
// log
- if( log_config.enable_logs & LOG_BUYING_STORE )
- {
- log_pick_pc(sd, "B", nameid, -((int)amount), &sd->status.inventory[index]);
- log_pick_pc(pl_sd, "B", nameid, amount, &sd->status.inventory[index]);
- }
- if( log_config.zeny )
- log_zeny(sd, "B", pl_sd, zeny);
+ log_pick_pc(sd, LOG_TYPE_BUYING_STORE, nameid, -((int)amount), &sd->status.inventory[index]);
+ log_pick_pc(pl_sd, LOG_TYPE_BUYING_STORE, nameid, amount, &sd->status.inventory[index]);
+ log_zeny(sd, LOG_TYPE_BUYING_STORE, pl_sd, zeny);
// move item
pc_additem(pl_sd, &sd->status.inventory[index], amount);
diff --git a/src/map/clif.c b/src/map/clif.c
index 1f7ab0be4..a8969d38e 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -9158,12 +9158,8 @@ void clif_parse_MapMove(int fd, struct map_session_data *sd)
map_name[MAP_NAME_LENGTH_EXT-1]='\0';
sprintf(output, "%s %d %d", map_name, RFIFOW(fd,18), RFIFOW(fd,20));
atcommand_mapmove(fd, sd, "@mapmove", output);
- if( log_config.gm && get_atcommand_level(atcommand_mapmove) >= log_config.gm )
- {
- sprintf(message, "/mm %s", output);
- log_atcommand(sd, message);
- }
- return;
+ sprintf(message, "/mm %s", output);
+ log_atcommand(sd, get_atcommand_level(atcommand_mapmove), message);
}
/*==========================================
@@ -9528,10 +9524,10 @@ void clif_parse_Broadcast(int fd, struct map_session_data* sd)
intif_broadcast(msg, len, 0);
- if(log_config.gm && lv >= log_config.gm) {
+ {
char logmsg[CHAT_SIZE_MAX+4];
sprintf(logmsg, "/b %s", msg);
- log_atcommand(sd, logmsg);
+ log_atcommand(sd, lv, logmsg);
}
}
@@ -10622,8 +10618,7 @@ void clif_parse_ResetChar(int fd, struct map_session_data *sd)
else
pc_resetstate(sd);
- if( log_config.gm && get_atcommand_level(atcommand_reset) >= log_config.gm )
- log_atcommand(sd, RFIFOW(fd,2) ? "/resetskill" : "/resetstate");
+ log_atcommand(sd, get_atcommand_level(atcommand_reset), RFIFOW(fd,2) ? "/resetskill" : "/resetstate");
}
/*==========================================
@@ -10647,10 +10642,10 @@ void clif_parse_LocalBroadcast(int fd, struct map_session_data* sd)
clif_broadcast(&sd->bl, msg, len, 0, ALL_SAMEMAP);
- if( log_config.gm && lv >= log_config.gm ) {
+ {
char logmsg[CHAT_SIZE_MAX+5];
sprintf(logmsg, "/lb %s", msg);
- log_atcommand(sd, logmsg);
+ log_atcommand(sd, lv, logmsg);
}
}
@@ -11607,10 +11602,10 @@ void clif_parse_GMKick(int fd, struct map_session_data *sd)
return;
}
- if(log_config.gm && lv >= log_config.gm) {
+ {
char message[256];
sprintf(message, "/kick %s (%d)", tsd->status.name, tsd->status.char_id);
- log_atcommand(sd, message);
+ log_atcommand(sd, lv, message);
}
clif_GM_kick(sd, tsd);
@@ -11625,10 +11620,10 @@ void clif_parse_GMKick(int fd, struct map_session_data *sd)
return;
}
- if(log_config.gm && lv >= log_config.gm) {
+ {
char message[256];
sprintf(message, "/kick %s (%d)", status_get_name(target), status_get_class(target));
- log_atcommand(sd, message);
+ log_atcommand(sd, lv, message);
}
status_percent_damage(&sd->bl, target, 100, 0, true); // can invalidate 'target'
@@ -11644,10 +11639,10 @@ void clif_parse_GMKick(int fd, struct map_session_data *sd)
return;
}
- if( log_config.gm && lv >= log_config.gm ) {
+ {
char message[256];
sprintf(message, "/kick %s (%d)", status_get_name(target), status_get_class(target));
- log_atcommand(sd, message);
+ log_atcommand(sd, lv, message);
}
// copy-pasted from atcommand_unloadnpc
@@ -11686,10 +11681,10 @@ void clif_parse_GMShift(int fd, struct map_session_data *sd)
player_name = (char*)RFIFOP(fd,2);
player_name[NAME_LENGTH-1] = '\0';
atcommand_jumpto(fd, sd, "@jumpto", player_name); // as @jumpto
- if( log_config.gm && lv >= log_config.gm ) {
+ {
char message[NAME_LENGTH+7];
sprintf(message, "/shift %s", player_name);
- log_atcommand(sd, message);
+ log_atcommand(sd, lv, message);
}
}
@@ -11718,12 +11713,11 @@ void clif_parse_GMRemove2(int fd, struct map_session_data* sd)
pc_warpto(sd, pl_sd);
}
- if( log_config.gm && lv >= log_config.gm )
{
char message[32];
sprintf(message, "/remove %d", account_id);
- log_atcommand(sd, message);
+ log_atcommand(sd, lv, message);
}
}
@@ -11746,10 +11740,10 @@ void clif_parse_GMRecall(int fd, struct map_session_data *sd)
player_name = (char*)RFIFOP(fd,2);
player_name[NAME_LENGTH-1] = '\0';
atcommand_recall(fd, sd, "@recall", player_name); // as @recall
- if( log_config.gm && lv >= log_config.gm ) {
+ {
char message[NAME_LENGTH+8];
sprintf(message, "/recall %s", player_name);
- log_atcommand(sd, message);
+ log_atcommand(sd, lv, message);
}
}
@@ -11778,12 +11772,11 @@ void clif_parse_GMRecall2(int fd, struct map_session_data* sd)
pc_recall(sd, pl_sd);
}
- if( log_config.gm && lv >= log_config.gm )
{
char message[32];
sprintf(message, "/recall %d", account_id);
- log_atcommand(sd, message);
+ log_atcommand(sd, lv, message);
}
}
@@ -11808,10 +11801,9 @@ void clif_parse_GM_Monster_Item(int fd, struct map_session_data *sd)
if( pc_isGM(sd) < (level=get_atcommand_level(atcommand_monster)) )
return;
atcommand_monster(fd, sd, "@monster", monster_item_name); // as @monster
- if( log_config.gm && level >= log_config.gm )
{ //Log action. [Skotlex]
snprintf(message, sizeof(message)-1, "@spawn %s", monster_item_name);
- log_atcommand(sd, message);
+ log_atcommand(sd, level, message);
}
return;
}
@@ -11820,10 +11812,9 @@ void clif_parse_GM_Monster_Item(int fd, struct map_session_data *sd)
if( pc_isGM(sd) < (level = get_atcommand_level(atcommand_item)) )
return;
atcommand_item(fd, sd, "@item", monster_item_name); // as @item
- if( log_config.gm && level >= log_config.gm )
{ //Log action. [Skotlex]
sprintf(message, "@item %s", monster_item_name);
- log_atcommand(sd, message);
+ log_atcommand(sd, level, message);
}
}
@@ -11849,8 +11840,7 @@ void clif_parse_GMHide(int fd, struct map_session_data *sd)
sd->sc.option |= OPTION_INVISIBLE;
sd->vd.class_ = INVISIBLE_CLASS;
clif_displaymessage(fd, "Invisible: On.");
- if( log_config.gm && get_atcommand_level(atcommand_hide) >= log_config.gm )
- log_atcommand(sd, "/hide");
+ log_atcommand(sd, get_atcommand_level(atcommand_hide), "/hide");
}
clif_changeoption(&sd->bl);
}
diff --git a/src/map/log.c b/src/map/log.c
index 20ef57c34..50d73fe2a 100644
--- a/src/map/log.c
+++ b/src/map/log.c
@@ -29,6 +29,36 @@ struct Log_Config log_config;
#endif
+/// obtain log type character for item/zeny logs
+static char log_picktype2char(e_log_pick_type type)
+{
+ switch( type )
+ {
+ case LOG_TYPE_TRADE: return 'T'; // (T)rade
+ case LOG_TYPE_VENDING: return 'V'; // (V)ending
+ case LOG_TYPE_PICKDROP_PLAYER: return 'P'; // (P)player
+ case LOG_TYPE_PICKDROP_MONSTER: return 'M'; // (M)onster
+ case LOG_TYPE_NPC: return 'S'; // NPC (S)hop
+ case LOG_TYPE_SCRIPT: return 'N'; // (N)PC Script
+ //case LOG_TYPE_STEAL: return 'D'; // Steal/Snatcher
+ case LOG_TYPE_CONSUME: return 'C'; // (C)onsumed
+ //case LOG_TYPE_PRODUCE: return 'O'; // Pr(O)duced/Ingredients
+ //case LOG_TYPE_MVP: return 'U'; // MVP Rewards
+ case LOG_TYPE_COMMAND: return 'A'; // (A)dmin command
+ case LOG_TYPE_STORAGE: return 'R'; // Sto(R)age
+ case LOG_TYPE_GSTORAGE: return 'G'; // (G)uild storage
+ case LOG_TYPE_MAIL: return 'E'; // (E)mail attachment
+ //case LOG_TYPE_AUCTION: return 'I'; // Auct(I)on
+ case LOG_TYPE_BUYING_STORE: return 'B'; // (B)uying Store
+ case LOG_TYPE_LOOT: return 'L'; // (L)oot (consumed monster pick/drop)
+ }
+
+ // should not get here, fallback
+ ShowDebug("log_picktype2char: Unknown pick type %d.\n", type);
+ return 'S';
+}
+
+
/// obtain log type character for chat logs
static char log_chattype2char(e_log_chat_type type)
{
@@ -42,7 +72,7 @@ static char log_chattype2char(e_log_chat_type type)
}
// should not get here, fallback
- ShowError("log_chattype2char: Unknown chat type %d.\n", type);
+ ShowDebug("log_chattype2char: Unknown chat type %d.\n", type);
return 'O';
}
@@ -87,7 +117,7 @@ bool should_log_item(int filter, int nameid, int amount)
void log_branch(struct map_session_data *sd)
{
- if(!log_config.enable_logs)
+ if( !log_config.branch )
return;
nullpo_retv(sd);
@@ -124,10 +154,15 @@ void log_branch(struct map_session_data *sd)
}
-void log_pick_pc(struct map_session_data *sd, const char *type, int nameid, int amount, struct item *itm)
+void log_pick_pc(struct map_session_data *sd, e_log_pick_type type, int nameid, int amount, struct item *itm)
{
nullpo_retv(sd);
+ if( ( log_config.enable_logs&type ) == 0 )
+ {// disabled
+ return;
+ }
+
if (!should_log_item(log_config.filter, nameid, amount))
return; //we skip logging this item set - it doesn't meet our logging conditions [Lupus]
@@ -135,15 +170,15 @@ void log_pick_pc(struct map_session_data *sd, const char *type, int nameid, int
if( log_config.sql_logs )
{
if( itm == NULL ) { //We log common item
- if (SQL_ERROR == Sql_Query(logmysql_handle, LOG_QUERY " INTO `%s` (`time`, `char_id`, `type`, `nameid`, `amount`, `map`) VALUES (NOW(), '%d', '%s', '%d', '%d', '%s')",
- log_config.log_pick_db, sd->status.char_id, type, nameid, amount, mapindex_id2name(sd->mapindex)) )
+ if (SQL_ERROR == Sql_Query(logmysql_handle, LOG_QUERY " INTO `%s` (`time`, `char_id`, `type`, `nameid`, `amount`, `map`) VALUES (NOW(), '%d', '%c', '%d', '%d', '%s')",
+ log_config.log_pick_db, sd->status.char_id, log_picktype2char(type), nameid, amount, mapindex_id2name(sd->mapindex)) )
{
Sql_ShowDebug(logmysql_handle);
return;
}
} else { //We log Extended item
- if (SQL_ERROR == Sql_Query(logmysql_handle, LOG_QUERY " INTO `%s` (`time`, `char_id`, `type`, `nameid`, `amount`, `refine`, `card0`, `card1`, `card2`, `card3`, `map`) VALUES (NOW(), '%d', '%s', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%s')",
- log_config.log_pick_db, sd->status.char_id, type, itm->nameid, amount, itm->refine, itm->card[0], itm->card[1], itm->card[2], itm->card[3], mapindex_id2name(sd->mapindex)) )
+ if (SQL_ERROR == Sql_Query(logmysql_handle, LOG_QUERY " INTO `%s` (`time`, `char_id`, `type`, `nameid`, `amount`, `refine`, `card0`, `card1`, `card2`, `card3`, `map`) VALUES (NOW(), '%d', '%c', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%s')",
+ log_config.log_pick_db, sd->status.char_id, log_picktype2char(type), itm->nameid, amount, itm->refine, itm->card[0], itm->card[1], itm->card[2], itm->card[3], mapindex_id2name(sd->mapindex)) )
{
Sql_ShowDebug(logmysql_handle);
return;
@@ -163,9 +198,9 @@ void log_pick_pc(struct map_session_data *sd, const char *type, int nameid, int
strftime(timestring, sizeof(timestring), "%m/%d/%Y %H:%M:%S", localtime(&curtime));
if( itm == NULL ) { //We log common item
- fprintf(logfp,"%s - %d\t%s\t%d,%d,%s\n", timestring, sd->status.char_id, type, nameid, amount, mapindex_id2name(sd->mapindex));
+ fprintf(logfp,"%s - %d\t%c\t%d,%d,%s\n", timestring, sd->status.char_id, log_picktype2char(type), nameid, amount, mapindex_id2name(sd->mapindex));
} else { //We log Extended item
- fprintf(logfp,"%s - %d\t%s\t%d,%d,%d,%d,%d,%d,%d,%s\n", timestring, sd->status.char_id, type, itm->nameid, amount, itm->refine, itm->card[0], itm->card[1], itm->card[2], itm->card[3], mapindex_id2name(sd->mapindex));
+ fprintf(logfp,"%s - %d\t%c\t%d,%d,%d,%d,%d,%d,%d,%s\n", timestring, sd->status.char_id, log_picktype2char(type), itm->nameid, amount, itm->refine, itm->card[0], itm->card[1], itm->card[2], itm->card[3], mapindex_id2name(sd->mapindex));
}
fclose(logfp);
}
@@ -173,12 +208,17 @@ void log_pick_pc(struct map_session_data *sd, const char *type, int nameid, int
//Mob picked item
-void log_pick_mob(struct mob_data *md, const char *type, int nameid, int amount, struct item *itm)
+void log_pick_mob(struct mob_data *md, e_log_pick_type type, int nameid, int amount, struct item *itm)
{
char* mapname;
nullpo_retv(md);
+ if( ( log_config.enable_logs&type ) == 0 )
+ {// disabled
+ return;
+ }
+
if (!should_log_item(log_config.filter, nameid, amount))
return; //we skip logging this item set - it doesn't meet our logging conditions [Lupus]
@@ -191,15 +231,15 @@ void log_pick_mob(struct mob_data *md, const char *type, int nameid, int amount,
if( log_config.sql_logs )
{
if( itm == NULL ) { //We log common item
- if (SQL_ERROR == Sql_Query(logmysql_handle, LOG_QUERY " INTO `%s` (`time`, `char_id`, `type`, `nameid`, `amount`, `map`) VALUES (NOW(), '%d', '%s', '%d', '%d', '%s')",
- log_config.log_pick_db, md->class_, type, nameid, amount, mapname) )
+ if (SQL_ERROR == Sql_Query(logmysql_handle, LOG_QUERY " INTO `%s` (`time`, `char_id`, `type`, `nameid`, `amount`, `map`) VALUES (NOW(), '%d', '%c', '%d', '%d', '%s')",
+ log_config.log_pick_db, md->class_, log_picktype2char(type), nameid, amount, mapname) )
{
Sql_ShowDebug(logmysql_handle);
return;
}
} else { //We log Extended item
- if (SQL_ERROR == Sql_Query(logmysql_handle, LOG_QUERY " INTO `%s` (`time`, `char_id`, `type`, `nameid`, `amount`, `refine`, `card0`, `card1`, `card2`, `card3`, `map`) VALUES (NOW(), '%d', '%s', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%s')",
- log_config.log_pick_db, md->class_, type, itm->nameid, amount, itm->refine, itm->card[0], itm->card[1], itm->card[2], itm->card[3], mapname) )
+ if (SQL_ERROR == Sql_Query(logmysql_handle, LOG_QUERY " INTO `%s` (`time`, `char_id`, `type`, `nameid`, `amount`, `refine`, `card0`, `card1`, `card2`, `card3`, `map`) VALUES (NOW(), '%d', '%c', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%s')",
+ log_config.log_pick_db, md->class_, log_picktype2char(type), itm->nameid, amount, itm->refine, itm->card[0], itm->card[1], itm->card[2], itm->card[3], mapname) )
{
Sql_ShowDebug(logmysql_handle);
return;
@@ -219,18 +259,34 @@ void log_pick_mob(struct mob_data *md, const char *type, int nameid, int amount,
strftime(timestring, sizeof(timestring), "%m/%d/%Y %H:%M:%S", localtime(&curtime));
if( itm == NULL ) { //We log common item
- fprintf(logfp,"%s - %d\t%s\t%d,%d,%s\n", timestring, md->class_, type, nameid, amount, mapname);
+ fprintf(logfp,"%s - %d\t%c\t%d,%d,%s\n", timestring, md->class_, log_picktype2char(type), nameid, amount, mapname);
} else { //We log Extended item
- fprintf(logfp,"%s - %d\t%s\t%d,%d,%d,%d,%d,%d,%d,%s\n", timestring, md->class_, type, itm->nameid, amount, itm->refine, itm->card[0], itm->card[1], itm->card[2], itm->card[3], mapname);
+ fprintf(logfp,"%s - %d\t%c\t%d,%d,%d,%d,%d,%d,%d,%s\n", timestring, md->class_, log_picktype2char(type), itm->nameid, amount, itm->refine, itm->card[0], itm->card[1], itm->card[2], itm->card[3], mapname);
}
fclose(logfp);
}
}
-void log_zeny(struct map_session_data *sd, char *type, struct map_session_data *src_sd, int amount)
+void log_pick(struct block_list* bl, e_log_pick_type type, int nameid, int amount, struct item* itm)
+{
+ if( bl == NULL )
+ {
+ ShowError("log_pick: bl == NULL\n");
+ }
+ else switch( bl->type )
+ {
+ case BL_PC: log_pick_pc((TBL_PC*)bl, type, nameid, amount, itm); break;
+ case BL_MOB: log_pick_mob((TBL_MOB*)bl, type, nameid, amount, itm); break;
+ default:
+ ShowDebug("log_pick: Unhandled bl type %d.\n", bl->type);
+ }
+}
+
+
+void log_zeny(struct map_session_data *sd, e_log_pick_type type, struct map_session_data *src_sd, int amount)
{
- if(!log_config.enable_logs || (log_config.zeny != 1 && abs(amount) < log_config.zeny))
+ if( !log_config.zeny || ( log_config.zeny != 1 && abs(amount) < log_config.zeny ) )
return;
nullpo_retv(sd);
@@ -238,8 +294,8 @@ void log_zeny(struct map_session_data *sd, char *type, struct map_session_data *
#ifndef TXT_ONLY
if( log_config.sql_logs )
{
- if (SQL_ERROR == Sql_Query(logmysql_handle, LOG_QUERY " INTO `%s` (`time`, `char_id`, `src_id`, `type`, `amount`, `map`) VALUES (NOW(), '%d', '%d', '%s', '%d', '%s')",
- log_config.log_zeny_db, sd->status.char_id, src_sd->status.char_id, type, amount, mapindex_id2name(sd->mapindex)) )
+ if (SQL_ERROR == Sql_Query(logmysql_handle, LOG_QUERY " INTO `%s` (`time`, `char_id`, `src_id`, `type`, `amount`, `map`) VALUES (NOW(), '%d', '%d', '%c', '%d', '%s')",
+ log_config.log_zeny_db, sd->status.char_id, src_sd->status.char_id, log_picktype2char(type), amount, mapindex_id2name(sd->mapindex)) )
{
Sql_ShowDebug(logmysql_handle);
return;
@@ -264,7 +320,7 @@ void log_zeny(struct map_session_data *sd, char *type, struct map_session_data *
void log_mvpdrop(struct map_session_data *sd, int monster_id, int *log_mvp)
{
- if(!log_config.enable_logs)
+ if( !log_config.mvpdrop )
return;
nullpo_retv(sd);
@@ -296,9 +352,9 @@ void log_mvpdrop(struct map_session_data *sd, int monster_id, int *log_mvp)
}
-void log_atcommand(struct map_session_data* sd, const char* message)
+void log_atcommand(struct map_session_data* sd, int cmdlvl, const char* message)
{
- if(!log_config.enable_logs)
+ if( cmdlvl < log_config.gm )
return;
nullpo_retv(sd);
@@ -339,7 +395,7 @@ void log_atcommand(struct map_session_data* sd, const char* message)
void log_npc(struct map_session_data* sd, const char* message)
{
- if(!log_config.enable_logs)
+ if( !log_config.npc )
return;
nullpo_retv(sd);
@@ -428,7 +484,7 @@ void log_set_defaults(void)
memset(&log_config, 0, sizeof(log_config));
//LOG FILTER Default values
- log_config.refine_items_log = 5; //log refined items, with refine >= +7
+ log_config.refine_items_log = 5; //log refined items, with refine >= +5
log_config.rare_items_log = 100; //log rare items. drop chance <= 1%
log_config.price_items_log = 1000; //1000z
log_config.amount_items_log = 100;
@@ -458,11 +514,9 @@ int log_config_read(char *cfgName)
if(sscanf(line, "%[^:]: %[^\r\n]", w1, w2) == 2)
{
if(strcmpi(w1,"enable_logs") == 0) {
- log_config.enable_logs = (log_what)atoi(w2);
- if (log_config.enable_logs & 1) //Log everything.
- log_config.enable_logs = LOG_ALL;
+ log_config.enable_logs = (e_log_pick_type)config_switch(w2);
} else if(strcmpi(w1,"sql_logs") == 0) {
- log_config.sql_logs = (bool)atoi(w2);
+ log_config.sql_logs = (bool)config_switch(w2);
//start of common filter settings
} else if(strcmpi(w1,"rare_items_log") == 0) {
log_config.rare_items_log = (atoi(w2));
@@ -474,19 +528,19 @@ int log_config_read(char *cfgName)
log_config.amount_items_log = (atoi(w2));
//end of common filter settings
} else if(strcmpi(w1,"log_branch") == 0) {
- log_config.branch = (atoi(w2));
+ log_config.branch = config_switch(w2);
} else if(strcmpi(w1,"log_filter") == 0) {
- log_config.filter = (atoi(w2));
+ log_config.filter = config_switch(w2);
} else if(strcmpi(w1,"log_zeny") == 0) {
- log_config.zeny = (atoi(w2));
+ log_config.zeny = config_switch(w2);
} else if(strcmpi(w1,"log_gm") == 0) {
- log_config.gm = (atoi(w2));
+ log_config.gm = config_switch(w2);
} else if(strcmpi(w1,"log_npc") == 0) {
- log_config.npc = (atoi(w2));
+ log_config.npc = config_switch(w2);
} else if(strcmpi(w1, "log_chat") == 0) {
- log_config.chat = (atoi(w2));
+ log_config.chat = config_switch(w2);
} else if(strcmpi(w1,"log_mvpdrop") == 0) {
- log_config.mvpdrop = (atoi(w2));
+ log_config.mvpdrop = config_switch(w2);
} else if(strcmpi(w1,"log_chat_woe_disable") == 0) {
log_config.log_chat_woe_disable = (bool)config_switch(w2);
}
diff --git a/src/map/log.h b/src/map/log.h
index 2b3d82e14..4d726e038 100644
--- a/src/map/log.h
+++ b/src/map/log.h
@@ -17,39 +17,47 @@ typedef enum e_log_chat_type
LOG_CHAT_PARTY = 0x04,
LOG_CHAT_GUILD = 0x08,
LOG_CHAT_MAINCHAT = 0x10,
+ // all
+ LOG_CHAT_ALL = 0xFF,
}
e_log_chat_type;
-typedef enum log_what
+typedef enum e_log_pick_type
{
- LOG_ALL = 0xFFFF,
- LOG_TRADES = 0x0002,
- LOG_VENDING = 0x0004,
- LOG_PLAYER_ITEMS = 0x0008, // dropped/picked
- LOG_MONSTER_ITEMS = 0x0010, // dropped/looted
- LOG_NPC_TRANSACTIONS = 0x0020, // npc shops?
- LOG_SCRIPT_TRANSACTIONS = 0x0040,
- LOG_STOLEN_ITEMS = 0x0080, // stolen from mobs
- LOG_USED_ITEMS = 0x0100, // used by player
- LOG_MVP_PRIZE = 0x0200,
- LOG_COMMAND_ITEMS = 0x0400, // created/deleted through @/# commands
- LOG_STORAGE_ITEMS = 0x0800, // placed/retrieved from storage
- LOG_GSTORAGE_ITEMS = 0x1000, // placed/retrieved from guild storage
- LOG_MAILS = 0x2000, // mail system transactions
- LOG_BUYING_STORE = 0x4000, // buying store transactions
+ LOG_TYPE_TRADE = 0x0001,
+ LOG_TYPE_VENDING = 0x0002,
+ LOG_TYPE_PICKDROP_PLAYER = 0x0004,
+ LOG_TYPE_PICKDROP_MONSTER = 0x0008,
+ LOG_TYPE_NPC = 0x0010,
+ LOG_TYPE_SCRIPT = 0x0020,
+ //LOG_TYPE_STEAL = 0x0040,
+ LOG_TYPE_CONSUME = 0x0080,
+ //LOG_TYPE_PRODUCE = 0x0100,
+ //LOG_TYPE_MVP = 0x0200,
+ LOG_TYPE_COMMAND = 0x0400,
+ LOG_TYPE_STORAGE = 0x0800,
+ LOG_TYPE_GSTORAGE = 0x1000,
+ LOG_TYPE_MAIL = 0x2000,
+ //LOG_TYPE_AUCTION = 0x4000,
+ LOG_TYPE_BUYING_STORE = 0x8000,
+ // combinations
+ LOG_TYPE_LOOT = LOG_TYPE_PICKDROP_MONSTER|LOG_TYPE_CONSUME,
+ // all
+ LOG_TYPE_ALL = 0xFFFF,
}
-log_what;
+e_log_pick_type;
//New logs
-void log_pick_pc(struct map_session_data *sd, const char *type, int nameid, int amount, struct item *itm);
-void log_pick_mob(struct mob_data *md, const char *type, int nameid, int amount, struct item *itm);
-void log_zeny(struct map_session_data *sd, char *type, struct map_session_data *src_sd, int amount);
+void log_pick_pc(struct map_session_data *sd, e_log_pick_type type, int nameid, int amount, struct item *itm);
+void log_pick_mob(struct mob_data *md, e_log_pick_type type, int nameid, int amount, struct item *itm);
+void log_pick(struct block_list* bl, e_log_pick_type type, int nameid, int amount, struct item* itm);
+void log_zeny(struct map_session_data *sd, e_log_pick_type type, struct map_session_data *src_sd, int amount);
void log_npc(struct map_session_data *sd, const char *message);
void log_chat(e_log_chat_type type, int type_id, int src_charid, int src_accid, const char* map, int x, int y, const char* dst_charname, const char* message);
-void log_atcommand(struct map_session_data *sd, const char *message);
+void log_atcommand(struct map_session_data *sd, int cmdlvl, const char *message);
//Old, but useful logs
void log_branch(struct map_session_data *sd);
diff --git a/src/map/mail.c b/src/map/mail.c
index 873788433..3f72fc435 100644
--- a/src/map/mail.c
+++ b/src/map/mail.c
@@ -35,8 +35,7 @@ int mail_removeitem(struct map_session_data *sd, short flag)
{
if (flag)
{ // Item send
- if(log_config.enable_logs & LOG_MAILS)
- log_pick_pc(sd, "E", sd->mail.nameid, -sd->mail.amount, &sd->status.inventory[sd->mail.index]);
+ log_pick_pc(sd, LOG_TYPE_MAIL, sd->mail.nameid, -sd->mail.amount, &sd->status.inventory[sd->mail.index]);
pc_delitem(sd, sd->mail.index, sd->mail.amount, 1, 0);
}
@@ -56,8 +55,7 @@ int mail_removezeny(struct map_session_data *sd, short flag)
if (flag && sd->mail.zeny > 0)
{ //Zeny send
- if(log_config.zeny)
- log_zeny(sd, "E", sd, -sd->mail.zeny);
+ log_zeny(sd, LOG_TYPE_MAIL, sd, -sd->mail.zeny);
sd->status.zeny -= sd->mail.zeny;
}
@@ -144,16 +142,14 @@ void mail_getattachment(struct map_session_data* sd, int zeny, struct item* item
{
pc_additem(sd, item, item->amount);
- if(log_config.enable_logs & LOG_MAILS)
- log_pick_pc(sd, "E", item->nameid, item->amount, item);
+ log_pick_pc(sd, LOG_TYPE_MAIL, item->nameid, item->amount, item);
clif_Mail_getattachment(sd->fd, 0);
}
if( zeny > 0 )
{ //Zeny recieve
- if(log_config.zeny)
- log_zeny(sd, "E", sd, zeny);
+ log_zeny(sd, LOG_TYPE_MAIL, sd, zeny);
pc_getzeny(sd, zeny);
}
}
@@ -178,8 +174,7 @@ void mail_deliveryfail(struct map_session_data *sd, struct mail_message *msg)
if( msg->item.amount > 0 )
{
// Item recieve (due to failure)
- if(log_config.enable_logs & LOG_MAILS)
- log_pick_pc(sd, "E", msg->item.nameid, msg->item.amount, &msg->item);
+ log_pick_pc(sd, LOG_TYPE_MAIL, msg->item.nameid, msg->item.amount, &msg->item);
pc_additem(sd, &msg->item, msg->item.amount);
}
@@ -187,8 +182,7 @@ void mail_deliveryfail(struct map_session_data *sd, struct mail_message *msg)
if( msg->zeny > 0 )
{
//Zeny recieve (due to failure)
- if(log_config.zeny)
- log_zeny(sd, "E", sd, msg->zeny);
+ log_zeny(sd, LOG_TYPE_MAIL, sd, msg->zeny);
sd->status.zeny += msg->zeny;
clif_updatestatus(sd, SP_ZENY);
diff --git a/src/map/mob.c b/src/map/mob.c
index 740f67226..fd5d592c1 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -1470,8 +1470,8 @@ static bool mob_ai_sub_hard(struct mob_data *md, unsigned int tick)
return true; //Busy attacking?
fitem = (struct flooritem_data *)tbl;
- if(log_config.enable_logs & LOG_MONSTER_ITEMS) //Logs items, taken by (L)ooter Mobs [Lupus]
- log_pick_mob(md, "L", fitem->item_data.nameid, fitem->item_data.amount, &fitem->item_data);
+ //Logs items, taken by (L)ooter Mobs [Lupus]
+ log_pick_mob(md, LOG_TYPE_LOOT, fitem->item_data.nameid, fitem->item_data.amount, &fitem->item_data);
if (md->lootitem_count < LOOTITEM_SIZE) {
memcpy (&md->lootitem[md->lootitem_count++], &fitem->item_data, sizeof(md->lootitem[0]));
@@ -1711,13 +1711,11 @@ static void mob_item_drop(struct mob_data *md, struct item_drop_list *dlist, str
{
TBL_PC* sd;
- if(log_config.enable_logs & LOG_MONSTER_ITEMS)
- { //Logs items, dropped by mobs [Lupus]
- if (loot)
- log_pick_mob(md, "L", ditem->item_data.nameid, -ditem->item_data.amount, &ditem->item_data);
- else
- log_pick_mob(md, "M", ditem->item_data.nameid, -ditem->item_data.amount, NULL);
- }
+ //Logs items, dropped by mobs [Lupus]
+ if (loot)
+ log_pick_mob(md, LOG_TYPE_LOOT, ditem->item_data.nameid, -ditem->item_data.amount, &ditem->item_data);
+ else
+ log_pick_mob(md, LOG_TYPE_PICKDROP_MONSTER, ditem->item_data.nameid, -ditem->item_data.amount, NULL);
sd = map_charid2sd(dlist->first_charid);
if( sd == NULL ) sd = map_charid2sd(dlist->second_charid);
@@ -2389,16 +2387,14 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
map_addflooritem(&item,1,mvp_sd->bl.m,mvp_sd->bl.x,mvp_sd->bl.y,mvp_sd->status.char_id,(second_sd?second_sd->status.char_id:0),(third_sd?third_sd->status.char_id:0),1);
}
- if(log_config.enable_logs & LOG_MVP_PRIZE) {//Logs items, MVP prizes [Lupus]
- log_pick_mob(md, "M", item.nameid, -1, NULL);
- if (!temp)
- log_pick_pc(mvp_sd, "P", item.nameid, 1, NULL);
- }
+ //Logs items, MVP prizes [Lupus]
+ log_pick_mob(md, LOG_TYPE_PICKDROP_MONSTER, item.nameid, -1, NULL);
+ if (!temp)
+ log_pick_pc(mvp_sd, LOG_TYPE_PICKDROP_PLAYER, item.nameid, 1, NULL);
break;
}
- if(log_config.mvpdrop > 0)
- log_mvpdrop(mvp_sd, md->class_, log_mvp);
+ log_mvpdrop(mvp_sd, md->class_, log_mvp);
}
if (type&2 && !sd && md->class_ == MOBID_EMPERIUM)
diff --git a/src/map/npc.c b/src/map/npc.c
index 0d4e886ba..0312bb892 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -1376,8 +1376,7 @@ int npc_cashshop_buy(struct map_session_data *sd, int nameid, int amount, int po
pc_additem(sd,&item_tmp, amount);
}
- if(log_config.enable_logs & LOG_NPC_TRANSACTIONS)
- log_pick_pc(sd, "S", nameid, amount, NULL);
+ log_pick_pc(sd, LOG_TYPE_NPC, nameid, amount, NULL);
return 0;
}
@@ -1467,8 +1466,7 @@ int npc_buylist(struct map_session_data* sd, int n, unsigned short* item_list)
return 3; // Not enough space to store items
//Logs (S)hopping Zeny [Lupus]
- if( log_config.zeny > 0 )
- log_zeny(sd, "S", sd, -(int)z);
+ log_zeny(sd, LOG_TYPE_NPC, sd, -(int)z);
//Logs
pc_payzeny(sd,(int)z);
@@ -1486,8 +1484,7 @@ int npc_buylist(struct map_session_data* sd, int n, unsigned short* item_list)
pc_additem(sd,&item_tmp,amount);
//Logs items, Bought in NPC (S)hop [Lupus]
- if( log_config.enable_logs & LOG_NPC_TRANSACTIONS )
- log_pick_pc(sd, "S", item_tmp.nameid, amount, NULL);
+ log_pick_pc(sd, LOG_TYPE_NPC, item_tmp.nameid, amount, NULL);
//Logs
}
@@ -1630,8 +1627,7 @@ int npc_selllist(struct map_session_data* sd, int n, unsigned short* item_list)
nameid = sd->status.inventory[idx].nameid;
//Logs items, Sold to NPC (S)hop [Lupus]
- if( log_config.enable_logs & LOG_NPC_TRANSACTIONS )
- log_pick_pc(sd, "S", nameid, -amount, &sd->status.inventory[idx]);
+ log_pick_pc(sd, LOG_TYPE_NPC, nameid, -amount, &sd->status.inventory[idx]);
//Logs
if( sd->inventory_data[idx]->type == IT_PETEGG && sd->status.inventory[idx].card[0] == CARD0_PET )
@@ -1649,8 +1645,7 @@ int npc_selllist(struct map_session_data* sd, int n, unsigned short* item_list)
z = MAX_ZENY;
//Logs (S)hopping Zeny [Lupus]
- if( log_config.zeny )
- log_zeny(sd, "S", sd, (int)z);
+ log_zeny(sd, LOG_TYPE_NPC, sd, (int)z);
//Logs
pc_getzeny(sd, (int)z);
diff --git a/src/map/party.c b/src/map/party.c
index 15f1e4794..624fdc489 100644
--- a/src/map/party.c
+++ b/src/map/party.c
@@ -1071,8 +1071,8 @@ int party_share_loot(struct party_data* p, struct map_session_data* sd, struct i
return i;
}
- if(log_config.enable_logs & LOG_PLAYER_ITEMS) //Logs items, taken by (P)layers [Lupus]
- log_pick_pc(target, "P", item_data->nameid, item_data->amount, item_data);
+ //Logs items, taken by (P)layers [Lupus]
+ log_pick_pc(target, LOG_TYPE_PICKDROP_PLAYER, item_data->nameid, item_data->amount, item_data);
if( p && battle_config.party_show_share_picker && battle_config.show_picker_item_type&(1<<itemdb_type(item_data->nameid)) )
clif_party_show_picker(target, item_data);
diff --git a/src/map/pc.c b/src/map/pc.c
index 0cc3adae6..aea604223 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -3512,8 +3512,7 @@ int pc_dropitem(struct map_session_data *sd,int n,int amount)
}
//Logs items, dropped by (P)layers [Lupus]
- if(log_config.enable_logs & LOG_PLAYER_ITEMS)
- log_pick_pc(sd, "P", sd->status.inventory[n].nameid, -amount, (struct item*)&sd->status.inventory[n]);
+ log_pick_pc(sd, LOG_TYPE_PICKDROP_PLAYER, sd->status.inventory[n].nameid, -amount, (struct item*)&sd->status.inventory[n]);
//Logs
if (!map_addflooritem(&sd->status.inventory[n], amount, sd->bl.m, sd->bl.x, sd->bl.y, 0, 0, 0, 2))
@@ -3738,7 +3737,8 @@ int pc_isUseitem(struct map_session_data *sd,int n)
}
//Dead Branch & Bloody Branch & Porings Box
- if((log_config.branch > 0) && (nameid == 604 || nameid == 12103 || nameid == 12109))
+ // FIXME: outdated, use constants or database
+ if( nameid == 604 || nameid == 12103 || nameid == 12109 )
log_branch(sd);
return 1;
@@ -3824,8 +3824,7 @@ int pc_useitem(struct map_session_data *sd,int n)
clif_useitemack(sd,n,amount-1,1);
//Logs (C)onsumable items [Lupus]
- if( log_config.enable_logs & LOG_USED_ITEMS )
- log_pick_pc(sd, "C", sd->status.inventory[n].nameid, -1, &sd->status.inventory[n]);
+ log_pick_pc(sd, LOG_TYPE_CONSUME, sd->status.inventory[n].nameid, -1, &sd->status.inventory[n]);
pc_delitem(sd,n,1,1,0); // Rental Usable Items are not deleted until expiration
}
@@ -4086,10 +4085,8 @@ int pc_steal_item(struct map_session_data *sd,struct block_list *bl, int lv)
party_foreachsamemap(pc_show_steal,sd,AREA_SIZE,sd,tmp_item.nameid);
//Logs items, Stolen from mobs [Lupus]
- if(log_config.enable_logs & LOG_STOLEN_ITEMS) {
- log_pick_mob(md, "M", itemid, -1, NULL);
- log_pick_pc(sd, "P", itemid, 1, NULL);
- }
+ log_pick_mob(md, LOG_TYPE_PICKDROP_MONSTER, itemid, -1, NULL);
+ log_pick_pc(sd, LOG_TYPE_PICKDROP_PLAYER, itemid, 1, NULL);
//A Rare Steal Global Announce by Lupus
if(md->db->dropitem[i].p<=battle_config.rare_drop_announce) {
diff --git a/src/map/pet.c b/src/map/pet.c
index dba16f881..ef4750310 100644
--- a/src/map/pet.c
+++ b/src/map/pet.c
@@ -1013,10 +1013,8 @@ int pet_lootitem_drop(struct pet_data *pd,struct map_session_data *sd)
memcpy(&ditem->item_data, it, sizeof(struct item));
ditem->next = dlist->item;
dlist->item = ditem;
- } else {
- if (log_config.enable_logs & LOG_PLAYER_ITEMS)
- log_pick_pc(sd, "P", it->nameid, it->amount, it);
- }
+ } else
+ log_pick_pc(sd, LOG_TYPE_PICKDROP_PLAYER, it->nameid, it->amount, it);
}
else {
ditem = ers_alloc(item_drop_ers, struct item_drop);
diff --git a/src/map/script.c b/src/map/script.c
index faab3c1db..4ce9e380e 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -5699,8 +5699,7 @@ BUILDIN_FUNC(getitem)
}
//Logs items, got from (N)PC scripts [Lupus]
- if(log_config.enable_logs & LOG_SCRIPT_TRANSACTIONS)
- log_pick_pc(sd, "N", nameid, amount, NULL);
+ log_pick_pc(sd, LOG_TYPE_SCRIPT, nameid, amount, NULL);
return 0;
}
@@ -5801,8 +5800,7 @@ BUILDIN_FUNC(getitem2)
}
//Logs items, got from (N)PC scripts [Lupus]
- if(log_config.enable_logs & LOG_SCRIPT_TRANSACTIONS)
- log_pick_pc(sd, "N", nameid, amount, &item_tmp);
+ log_pick_pc(sd, LOG_TYPE_SCRIPT, nameid, amount, &item_tmp);
}
return 0;
@@ -5867,8 +5865,7 @@ BUILDIN_FUNC(rentitem)
clif_rental_time(sd->fd, nameid, seconds);
pc_inventory_rental_add(sd, seconds);
- if( log_config.enable_logs & LOG_SCRIPT_TRANSACTIONS )
- log_pick_pc(sd, "N", nameid, 1, NULL);
+ log_pick_pc(sd, LOG_TYPE_SCRIPT, nameid, 1, NULL);
return 0;
}
@@ -5939,8 +5936,7 @@ BUILDIN_FUNC(getnameditem)
}
//Logs items, got from (N)PC scripts [Lupus]
- if(log_config.enable_logs & LOG_SCRIPT_TRANSACTIONS)
- log_pick_pc(sd, "N", item_tmp.nameid, item_tmp.amount, &item_tmp);
+ log_pick_pc(sd, LOG_TYPE_SCRIPT, item_tmp.nameid, item_tmp.amount, &item_tmp);
script_pushint(st,1);
return 0;
@@ -6034,10 +6030,7 @@ static void buildin_delitem_delete(struct map_session_data* sd, int idx, int* am
}
//Logs items, got from (N)PC scripts [Lupus]
- if( log_config.enable_logs & LOG_SCRIPT_TRANSACTIONS )
- {
- log_pick_pc(sd, "N", inv->nameid, -delamount, inv);
- }
+ log_pick_pc(sd, LOG_TYPE_SCRIPT, inv->nameid, -delamount, inv);
//Logs
pc_delitem(sd, idx, delamount, 0, 0);
@@ -6933,8 +6926,7 @@ BUILDIN_FUNC(successrefitem)
ep=sd->status.inventory[i].equip;
//Logs items, got from (N)PC scripts [Lupus]
- if(log_config.enable_logs & LOG_SCRIPT_TRANSACTIONS)
- log_pick_pc(sd, "N", sd->status.inventory[i].nameid, -1, &sd->status.inventory[i]);
+ log_pick_pc(sd, LOG_TYPE_SCRIPT, sd->status.inventory[i].nameid, -1, &sd->status.inventory[i]);
sd->status.inventory[i].refine++;
pc_unequipitem(sd,i,2); // status calc will happen in pc_equipitem() below
@@ -6943,8 +6935,7 @@ BUILDIN_FUNC(successrefitem)
clif_delitem(sd,i,1,3);
//Logs items, got from (N)PC scripts [Lupus]
- if(log_config.enable_logs & LOG_SCRIPT_TRANSACTIONS)
- log_pick_pc(sd, "N", sd->status.inventory[i].nameid, 1, &sd->status.inventory[i]);
+ log_pick_pc(sd, LOG_TYPE_SCRIPT, sd->status.inventory[i].nameid, 1, &sd->status.inventory[i]);
clif_additem(sd,i,1,0);
pc_equipitem(sd,i,ep);
@@ -6987,8 +6978,7 @@ BUILDIN_FUNC(failedrefitem)
i=pc_checkequip(sd,equip[num-1]);
if(i >= 0) {
//Logs items, got from (N)PC scripts [Lupus]
- if(log_config.enable_logs & LOG_SCRIPT_TRANSACTIONS)
- log_pick_pc(sd, "N", sd->status.inventory[i].nameid, -1, &sd->status.inventory[i]);
+ log_pick_pc(sd, LOG_TYPE_SCRIPT, sd->status.inventory[i].nameid, -1, &sd->status.inventory[i]);
sd->status.inventory[i].refine = 0;
pc_unequipitem(sd,i,3);
@@ -10341,8 +10331,7 @@ BUILDIN_FUNC(successremovecards)
item_tmp.card[j]=0;
//Logs items, got from (N)PC scripts [Lupus]
- if(log_config.enable_logs & LOG_SCRIPT_TRANSACTIONS)
- log_pick_pc(sd, "N", item_tmp.nameid, 1, NULL);
+ log_pick_pc(sd, LOG_TYPE_SCRIPT, item_tmp.nameid, 1, NULL);
if((flag=pc_additem(sd,&item_tmp,1))){ // 持てないならドロップ
clif_additem(sd,0,0,flag);
@@ -10364,14 +10353,12 @@ BUILDIN_FUNC(successremovecards)
item_tmp.card[j]=sd->status.inventory[i].card[j];
//Logs items, got from (N)PC scripts [Lupus]
- if(log_config.enable_logs & LOG_SCRIPT_TRANSACTIONS)
- log_pick_pc(sd, "N", sd->status.inventory[i].nameid, -1, &sd->status.inventory[i]);
+ log_pick_pc(sd, LOG_TYPE_SCRIPT, sd->status.inventory[i].nameid, -1, &sd->status.inventory[i]);
pc_delitem(sd,i,1,0,3);
//Logs items, got from (N)PC scripts [Lupus]
- if(log_config.enable_logs & LOG_SCRIPT_TRANSACTIONS)
- log_pick_pc(sd, "N", item_tmp.nameid, 1, &item_tmp);
+ log_pick_pc(sd, LOG_TYPE_SCRIPT, item_tmp.nameid, 1, &item_tmp);
if((flag=pc_additem(sd,&item_tmp,1))){ // もてないならドロップ
clif_additem(sd,0,0,flag);
@@ -10423,8 +10410,7 @@ BUILDIN_FUNC(failedremovecards)
item_tmp.card[j]=0;
//Logs items, got from (N)PC scripts [Lupus]
- if(log_config.enable_logs & LOG_SCRIPT_TRANSACTIONS)
- log_pick_pc(sd, "N", item_tmp.nameid, 1, NULL);
+ log_pick_pc(sd, LOG_TYPE_SCRIPT, item_tmp.nameid, 1, NULL);
if((flag=pc_additem(sd,&item_tmp,1))){
clif_additem(sd,0,0,flag);
@@ -10438,8 +10424,7 @@ BUILDIN_FUNC(failedremovecards)
{
if(typefail == 0 || typefail == 2){ // 武具損失
//Logs items, got from (N)PC scripts [Lupus]
- if(log_config.enable_logs & LOG_SCRIPT_TRANSACTIONS)
- log_pick_pc(sd, "N", sd->status.inventory[i].nameid, -1, &sd->status.inventory[i]);
+ log_pick_pc(sd, LOG_TYPE_SCRIPT, sd->status.inventory[i].nameid, -1, &sd->status.inventory[i]);
pc_delitem(sd,i,1,0,2);
}
@@ -10451,8 +10436,7 @@ BUILDIN_FUNC(failedremovecards)
item_tmp.attribute=sd->status.inventory[i].attribute,item_tmp.expire_time=sd->status.inventory[i].expire_time;
//Logs items, got from (N)PC scripts [Lupus]
- if(log_config.enable_logs & LOG_SCRIPT_TRANSACTIONS)
- log_pick_pc(sd, "N", sd->status.inventory[i].nameid, -1, &sd->status.inventory[i]);
+ log_pick_pc(sd, LOG_TYPE_SCRIPT, sd->status.inventory[i].nameid, -1, &sd->status.inventory[i]);
for (j = 0; j < sd->inventory_data[i]->slot; j++)
item_tmp.card[j]=0;
@@ -10461,8 +10445,7 @@ BUILDIN_FUNC(failedremovecards)
pc_delitem(sd,i,1,0,2);
//Logs items, got from (N)PC scripts [Lupus]
- if(log_config.enable_logs & LOG_SCRIPT_TRANSACTIONS)
- log_pick_pc(sd, "N", item_tmp.nameid, 1, &item_tmp);
+ log_pick_pc(sd, LOG_TYPE_SCRIPT, item_tmp.nameid, 1, &item_tmp);
if((flag=pc_additem(sd,&item_tmp,1))){
clif_additem(sd,0,0,flag);
@@ -11131,8 +11114,7 @@ BUILDIN_FUNC(clearitem)
if (sd->status.inventory[i].amount) {
//Logs items, got from (N)PC scripts [Lupus]
- if(log_config.enable_logs & LOG_SCRIPT_TRANSACTIONS)
- log_pick_pc(sd, "N", sd->status.inventory[i].nameid, -sd->status.inventory[i].amount, &sd->status.inventory[i]);
+ log_pick_pc(sd, LOG_TYPE_SCRIPT, sd->status.inventory[i].nameid, -sd->status.inventory[i].amount, &sd->status.inventory[i]);
pc_delitem(sd, i, sd->status.inventory[i].amount, 0, 0);
}
@@ -12264,9 +12246,6 @@ BUILDIN_FUNC(logmes)
const char *str;
TBL_PC* sd;
- if( log_config.npc <= 0 )
- return 0;
-
sd = script_rid2sd(st);
if( sd == NULL )
return 1;
diff --git a/src/map/storage.c b/src/map/storage.c
index c11ef0993..dd14acfda 100644
--- a/src/map/storage.c
+++ b/src/map/storage.c
@@ -154,8 +154,7 @@ static int storage_additem(struct map_session_data* sd, struct item* item_data,
return 1;
stor->items[i].amount += amount;
clif_storageitemadded(sd,&stor->items[i],i,amount);
- if(log_config.enable_logs & LOG_STORAGE_ITEMS)
- log_pick_pc(sd, "R", item_data->nameid, -amount, item_data);
+ log_pick_pc(sd, LOG_TYPE_STORAGE, item_data->nameid, -amount, item_data);
return 0;
}
}
@@ -172,8 +171,7 @@ static int storage_additem(struct map_session_data* sd, struct item* item_data,
stor->items[i].amount = amount;
clif_storageitemadded(sd,&stor->items[i],i,amount);
clif_updatestorageamount(sd,stor->storage_amount);
- if(log_config.enable_logs & LOG_STORAGE_ITEMS)
- log_pick_pc(sd, "R", item_data->nameid, -amount, item_data);
+ log_pick_pc(sd, LOG_TYPE_STORAGE, item_data->nameid, -amount, item_data);
return 0;
}
@@ -188,8 +186,7 @@ int storage_delitem(struct map_session_data* sd, int n, int amount)
sd->status.storage.items[n].amount -= amount;
- if(log_config.enable_logs & LOG_STORAGE_ITEMS)
- log_pick_pc(sd, "R", sd->status.storage.items[n].nameid, amount, &sd->status.storage.items[n]);
+ log_pick_pc(sd, LOG_TYPE_STORAGE, sd->status.storage.items[n].nameid, amount, &sd->status.storage.items[n]);
if( sd->status.storage.items[n].amount == 0 )
{
@@ -413,8 +410,7 @@ int guild_storage_additem(struct map_session_data* sd, struct guild_storage* sto
stor->items[i].amount+=amount;
clif_storageitemadded(sd,&stor->items[i],i,amount);
stor->dirty = 1;
- if(log_config.enable_logs & LOG_GSTORAGE_ITEMS)
- log_pick_pc(sd, "G", item_data->nameid, -amount, item_data);
+ log_pick_pc(sd, LOG_TYPE_GSTORAGE, item_data->nameid, -amount, item_data);
return 0;
}
}
@@ -431,8 +427,7 @@ int guild_storage_additem(struct map_session_data* sd, struct guild_storage* sto
clif_storageitemadded(sd,&stor->items[i],i,amount);
clif_updateguildstorageamount(sd,stor->storage_amount);
stor->dirty = 1;
- if(log_config.enable_logs & LOG_GSTORAGE_ITEMS)
- log_pick_pc(sd, "G", item_data->nameid, -amount, item_data);
+ log_pick_pc(sd, LOG_TYPE_GSTORAGE, item_data->nameid, -amount, item_data);
return 0;
}
@@ -445,8 +440,7 @@ int guild_storage_delitem(struct map_session_data* sd, struct guild_storage* sto
return 1;
stor->items[n].amount-=amount;
- if(log_config.enable_logs & LOG_GSTORAGE_ITEMS)
- log_pick_pc(sd, "G", stor->items[n].nameid, amount, &stor->items[n]);
+ log_pick_pc(sd, LOG_TYPE_GSTORAGE, stor->items[n].nameid, amount, &stor->items[n]);
if(stor->items[n].amount==0){
memset(&stor->items[n],0,sizeof(stor->items[0]));
stor->storage_amount--;
diff --git a/src/map/trade.c b/src/map/trade.c
index 53b884cef..3b882307d 100644
--- a/src/map/trade.c
+++ b/src/map/trade.c
@@ -554,11 +554,8 @@ void trade_tradecommit(struct map_session_data *sd)
if (flag == 0)
{
//Logs (T)rade [Lupus]
- if(log_config.enable_logs & LOG_TRADES)
- {
- log_pick_pc(sd, "T", sd->status.inventory[n].nameid, -(sd->deal.item[trade_i].amount), &sd->status.inventory[n]);
- log_pick_pc(tsd, "T", sd->status.inventory[n].nameid, sd->deal.item[trade_i].amount, &sd->status.inventory[n]);
- }
+ log_pick_pc(sd, LOG_TYPE_TRADE, sd->status.inventory[n].nameid, -(sd->deal.item[trade_i].amount), &sd->status.inventory[n]);
+ log_pick_pc(tsd, LOG_TYPE_TRADE, sd->status.inventory[n].nameid, sd->deal.item[trade_i].amount, &sd->status.inventory[n]);
pc_delitem(sd, n, sd->deal.item[trade_i].amount, 1, 6);
} else
clif_additem(sd, n, sd->deal.item[trade_i].amount, 0);
@@ -573,11 +570,8 @@ void trade_tradecommit(struct map_session_data *sd)
if (flag == 0)
{
//Logs (T)rade [Lupus]
- if(log_config.enable_logs & LOG_TRADES)
- {
- log_pick_pc(tsd, "T", tsd->status.inventory[n].nameid, -(tsd->deal.item[trade_i].amount), &tsd->status.inventory[n]);
- log_pick_pc(sd, "T", tsd->status.inventory[n].nameid, tsd->deal.item[trade_i].amount, &tsd->status.inventory[n]);
- }
+ log_pick_pc(tsd, LOG_TYPE_TRADE, tsd->status.inventory[n].nameid, -(tsd->deal.item[trade_i].amount), &tsd->status.inventory[n]);
+ log_pick_pc(sd, LOG_TYPE_TRADE, tsd->status.inventory[n].nameid, tsd->deal.item[trade_i].amount, &tsd->status.inventory[n]);
pc_delitem(tsd, n, tsd->deal.item[trade_i].amount, 1, 6);
} else
clif_additem(tsd, n, tsd->deal.item[trade_i].amount, 0);
@@ -592,10 +586,10 @@ void trade_tradecommit(struct map_session_data *sd)
tsd->status.zeny += sd->deal.zeny - tsd->deal.zeny;
//Logs Zeny (T)rade [Lupus]
- if( sd->deal.zeny && log_config.zeny )
- log_zeny(tsd, "T", sd, sd->deal.zeny);
- if( tsd->deal.zeny && log_config.zeny )
- log_zeny(sd, "T", tsd, tsd->deal.zeny);
+ if( sd->deal.zeny )
+ log_zeny(tsd, LOG_TYPE_TRADE, sd, sd->deal.zeny);
+ if( tsd->deal.zeny )
+ log_zeny(sd, LOG_TYPE_TRADE, tsd, tsd->deal.zeny);
sd->deal.zeny = 0;
tsd->deal.zeny = 0;
diff --git a/src/map/vending.c b/src/map/vending.c
index af7a402a9..0d97cf2fc 100644
--- a/src/map/vending.c
+++ b/src/map/vending.c
@@ -168,8 +168,7 @@ void vending_purchasereq(struct map_session_data* sd, int aid, int uid, const ui
}
//Logs (V)ending Zeny [Lupus]
- if( log_config.zeny > 0 )
- log_zeny(vsd, "V", sd, (int)z);
+ log_zeny(vsd, LOG_TYPE_VENDING, sd, (int)z);
pc_payzeny(sd, (int)z);
if( battle_config.vending_tax )
@@ -183,10 +182,8 @@ void vending_purchasereq(struct map_session_data* sd, int aid, int uid, const ui
idx -= 2;
//Logs sold (V)ending items [Lupus]
- if(log_config.enable_logs & LOG_VENDING) {
- log_pick_pc(vsd, "V", vsd->status.cart[idx].nameid, -amount, &vsd->status.cart[idx]);
- log_pick_pc( sd, "V", vsd->status.cart[idx].nameid, amount, &vsd->status.cart[idx]);
- }
+ log_pick_pc(vsd, LOG_TYPE_VENDING, vsd->status.cart[idx].nameid, -amount, &vsd->status.cart[idx]);
+ log_pick_pc( sd, LOG_TYPE_VENDING, vsd->status.cart[idx].nameid, amount, &vsd->status.cart[idx]);
// vending item
pc_additem(sd, &vsd->status.cart[idx], amount);