summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-10-19 21:25:56 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-10-19 21:25:56 +0000
commit0a98391b9dba8f27a0c285fcdafc564d93a37e23 (patch)
tree06157117643325a15f5fd570767897856184e96b /src
parentebed223aec7badf0b6ca7cf6e3341a5c81e7174d (diff)
downloadhercules-0a98391b9dba8f27a0c285fcdafc564d93a37e23.tar.gz
hercules-0a98391b9dba8f27a0c285fcdafc564d93a37e23.tar.bz2
hercules-0a98391b9dba8f27a0c285fcdafc564d93a37e23.tar.xz
hercules-0a98391b9dba8f27a0c285fcdafc564d93a37e23.zip
- Cleaned up the log.c file.
- Splitted log_pick into log_pick_pc and log_pick_mob to avoid ugly type-casting. - Fixed log_chat not recording anything if the server is compiled in SQL mode and sql_logs is turned off (it should then record to a plain txt file) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@9017 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-rw-r--r--src/map/atcommand.c12
-rw-r--r--src/map/charcommand.c4
-rw-r--r--src/map/log.c248
-rw-r--r--src/map/log.h3
-rw-r--r--src/map/mob.c10
-rw-r--r--src/map/npc.c4
-rw-r--r--src/map/party.c2
-rw-r--r--src/map/pc.c8
-rw-r--r--src/map/script.c40
-rw-r--r--src/map/trade.c8
-rw-r--r--src/map/vending.c4
11 files changed, 190 insertions, 153 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index 71b7fca74..82d1b4c9a 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -2639,7 +2639,7 @@ int atcommand_item(
//Logs (A)dmins items [Lupus]
if(log_config.enable_logs&0x400)
- log_pick(sd, "A", 0, item_id, number, NULL);
+ log_pick_pc(sd, "A", item_id, number, NULL);
clif_displaymessage(fd, msg_txt(18)); // Item created.
return 0;
@@ -2714,7 +2714,7 @@ int atcommand_item2(
//Logs (A)dmins items [Lupus]
if(log_config.enable_logs&0x400)
- log_pick(sd, "A", 0, item_tmp.nameid, number, &item_tmp);
+ log_pick_pc(sd, "A", item_tmp.nameid, number, &item_tmp);
clif_displaymessage(fd, msg_txt(18)); // Item created.
} else {
@@ -2741,7 +2741,7 @@ int atcommand_itemreset(
//Logs (A)dmins items [Lupus]
if(log_config.enable_logs&0x400)
- log_pick(sd, "A", 0, sd->status.inventory[i].nameid, -sd->status.inventory[i].amount, &sd->status.inventory[i]);
+ log_pick_pc(sd, "A", sd->status.inventory[i].nameid, -sd->status.inventory[i].amount, &sd->status.inventory[i]);
pc_delitem(sd, i, sd->status.inventory[i].amount, 0);
}
@@ -3892,7 +3892,7 @@ int atcommand_produce(
//Logs (A)dmins items [Lupus]
if(log_config.enable_logs&0x400)
- log_pick(sd, "A", 0, tmp_item.nameid, 1, &tmp_item);
+ log_pick_pc(sd, "A", tmp_item.nameid, 1, &tmp_item);
if ((flag = pc_additem(sd, &tmp_item, 1)))
clif_additem(sd, 0, 0, flag);
@@ -6399,7 +6399,7 @@ int atcommand_chardelitem(const int fd, struct map_session_data* sd,
//Logs (A)dmins items [Lupus]
if(log_config.enable_logs&0x400)
- log_pick(pl_sd, "A", 0, pl_sd->status.inventory[item_position].nameid, -1, &pl_sd->status.inventory[item_position]);
+ log_pick_pc(pl_sd, "A", pl_sd->status.inventory[item_position].nameid, -1, &pl_sd->status.inventory[item_position]);
pc_delitem(pl_sd, item_position, 1, 0);
count++;
@@ -7704,7 +7704,7 @@ void getring (struct map_session_data *sd)
//Logs (A)dmins items [Lupus]
if(log_config.enable_logs&0x400)
- log_pick(sd, "A", 0, item_id, 1, &item_tmp);
+ log_pick_pc(sd, "A", item_id, 1, &item_tmp);
if((flag = pc_additem(sd,&item_tmp,1))) {
clif_additem(sd,0,0,flag);
diff --git a/src/map/charcommand.c b/src/map/charcommand.c
index c638bffa3..8264aa6ef 100644
--- a/src/map/charcommand.c
+++ b/src/map/charcommand.c
@@ -1008,7 +1008,7 @@ charcommand_giveitem_sub(struct map_session_data *sd,struct item_data *item_data
}
//Logs (A)dmins items [Lupus]
if(log_config.enable_logs&0x400)
- log_pick(sd, "A", 0, item_tmp.nameid, number, &item_tmp);
+ log_pick_pc(sd, "A", item_tmp.nameid, number, &item_tmp);
}
}
@@ -1077,7 +1077,7 @@ int charcommand_item(
//Logs (A)dmins items [Lupus]
if(log_config.enable_logs&0x400)
- log_pick(sd, "A", 0, item_tmp.nameid, number, &item_tmp);
+ log_pick_pc(sd, "A", item_tmp.nameid, number, &item_tmp);
clif_displaymessage(fd, msg_table[18]); // Item created.
} else {
diff --git a/src/map/log.c b/src/map/log.c
index 09505d9ea..bb061a062 100644
--- a/src/map/log.c
+++ b/src/map/log.c
@@ -68,7 +68,7 @@ int should_log_item(int filter, int nameid, int amount) {
int log_branch(struct map_session_data *sd)
{
#ifndef TXT_ONLY
- char t_name[NAME_LENGTH*2];
+ char t_name[NAME_LENGTH*2];
#endif
FILE *logfp;
@@ -84,42 +84,33 @@ int log_branch(struct map_session_data *sd)
{
ShowSQL("DB error - %s\n",mysql_error(&logmysql_handle));
ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
+ return 0;
}
- } else {
-#endif
- if((logfp=fopen(log_config.log_branch,"a+")) != NULL) {
- time(&curtime);
- strftime(timestring, 254, "%m/%d/%Y %H:%M:%S", localtime(&curtime));
- fprintf(logfp,"%s - %s[%d:%d]\t%s%s", timestring, sd->status.name, sd->status.account_id, sd->status.char_id, mapindex_id2name(sd->mapindex), RETCODE);
- fclose(logfp);
- }
-#ifndef TXT_ONLY
+ return 1;
}
#endif
- return 0;
+ if((logfp=fopen(log_config.log_branch,"a+")) == NULL)
+ return 0;
+ time(&curtime);
+ strftime(timestring, 254, "%m/%d/%Y %H:%M:%S", localtime(&curtime));
+ fprintf(logfp,"%s - %s[%d:%d]\t%s%s", timestring, sd->status.name, sd->status.account_id, sd->status.char_id, mapindex_id2name(sd->mapindex), RETCODE);
+ fclose(logfp);
+ return 1;
}
-int log_pick(struct map_session_data *sd, char *type, int mob_id, int nameid, int amount, struct item *itm)
+int log_pick_pc(struct map_session_data *sd, const char *type, int nameid, int amount, struct item *itm)
{
FILE *logfp;
char *mapname;
- int obj_id;
nullpo_retr(0, sd);
//Should we log this item? [Lupus]
if (!should_log_item(log_config.filter,nameid, amount))
return 0; //we skip logging this items set - they doesn't met our logging conditions [Lupus]
- //either PLAYER or MOB (here we get map name and objects ID)
- if(mob_id) {
- struct mob_data *md = (struct mob_data*)sd;
- obj_id = mob_id;
- mapname = map[md->bl.m].name;
- } else {
- obj_id = sd->char_id;
- mapname = (char*)mapindex_id2name(sd->mapindex);
- }
+ mapname = (char*)mapindex_id2name(sd->mapindex);
+
if(mapname==NULL)
mapname="";
@@ -129,43 +120,99 @@ int log_pick(struct map_session_data *sd, char *type, int mob_id, int nameid, in
if (itm==NULL) {
//We log common item
sprintf(tmp_sql, "INSERT DELAYED INTO `%s` (`time`, `char_id`, `type`, `nameid`, `amount`, `map`) VALUES (NOW(), '%d', '%s', '%d', '%d', '%s')",
- log_config.log_pick_db, obj_id, type, nameid, amount, mapname);
+ log_config.log_pick_db, sd->char_id, type, nameid, amount, mapname);
} else {
//We log Extended item
sprintf(tmp_sql, "INSERT DELAYED 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, obj_id, type, itm->nameid, amount, itm->refine, itm->card[0], itm->card[1], itm->card[2], itm->card[3], mapname);
+ log_config.log_pick_db, sd->char_id, type, itm->nameid, amount, itm->refine, itm->card[0], itm->card[1], itm->card[2], itm->card[3], mapname);
}
if(mysql_query(&logmysql_handle, tmp_sql))
{
ShowSQL("DB error - %s\n",mysql_error(&logmysql_handle));
ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
+ return 0;
}
- } else {
+ return 1;
+ }
#endif
- if((logfp=fopen(log_config.log_pick,"a+")) != NULL) {
- time_t curtime;
- time(&curtime);
- strftime(timestring, 254, "%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%s",
- timestring, obj_id, type, nameid, amount, mapname, RETCODE);
-
- } else {
- //We log Extended item
- fprintf(logfp,"%s - %d\t%s\t%d,%d,%d,%d,%d,%d,%d,%s%s",
- timestring, obj_id, type, itm->nameid, amount, itm->refine, itm->card[0], itm->card[1], itm->card[2], itm->card[3], mapname, RETCODE);
- }
- fclose(logfp);
- }
+ if((logfp=fopen(log_config.log_pick,"a+")) == NULL)
+ return 0;
+ time(&curtime);
+ strftime(timestring, 254, "%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%s",
+ timestring, sd->char_id, type, nameid, amount, mapname, RETCODE);
+
+ } else {
+ //We log Extended item
+ fprintf(logfp,"%s - %d\t%s\t%d,%d,%d,%d,%d,%d,%d,%s%s",
+ timestring, sd->char_id, type, itm->nameid, amount, itm->refine, itm->card[0], itm->card[1], itm->card[2], itm->card[3], mapname, RETCODE);
+ }
+ fclose(logfp);
+ return 1; //Logged
+}
+
+//Mob picked item
+int log_pick_mob(struct mob_data *md, const char *type, int nameid, int amount, struct item *itm)
+{
+ FILE *logfp;
+ char *mapname;
+
+ nullpo_retr(0, md);
+ //Should we log this item? [Lupus]
+ if (!should_log_item(log_config.filter,nameid, amount))
+ return 0; //we skip logging this items set - they doesn't met our logging conditions [Lupus]
+
+ //either PLAYER or MOB (here we get map name and objects ID)
+ mapname = map[md->bl.m].name;
+ if(mapname==NULL)
+ mapname="";
+
#ifndef TXT_ONLY
+ if(log_config.sql_logs > 0)
+ {
+ if (itm==NULL) {
+ //We log common item
+ sprintf(tmp_sql, "INSERT DELAYED 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);
+ } else {
+ //We log Extended item
+ sprintf(tmp_sql, "INSERT DELAYED 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(mysql_query(&logmysql_handle, tmp_sql))
+ {
+ ShowSQL("DB error - %s\n",mysql_error(&logmysql_handle));
+ ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
+ return 0;
+ }
+ return 1;
}
#endif
+ if((logfp=fopen(log_config.log_pick,"a+")) == NULL)
+ return 0;
+ time(&curtime);
+ strftime(timestring, 254, "%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%s",
+ timestring, md->class_, type, nameid, amount, mapname, RETCODE);
+
+ } else {
+ //We log Extended item
+ fprintf(logfp,"%s - %d\t%s\t%d,%d,%d,%d,%d,%d,%d,%s%s",
+ timestring, md->class_, type, itm->nameid, amount, itm->refine, itm->card[0], itm->card[1], itm->card[2], itm->card[3], mapname, RETCODE);
+ }
+ fclose(logfp);
return 1; //Logged
}
+
int log_zeny(struct map_session_data *sd, char *type, struct map_session_data *src_sd, int amount)
{
// FILE *logfp;
@@ -182,18 +229,18 @@ int log_zeny(struct map_session_data *sd, char *type, struct map_session_data *s
{
ShowSQL("DB error - %s\n",mysql_error(&logmysql_handle));
ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
+ return 0;
}
- } else {
-#endif
-// if((logfp=fopen(log_config.log_zeny,"a+")) != NULL) {
-// time(&curtime);
-// strftime(timestring, 254, "%m/%d/%Y %H:%M:%S", localtime(&curtime));
-// fprintf(logfp,"%s - %s[%d]\t%s[%d]\t%d\t%s", timestring, sd->status.name, sd->status.account_id, target_sd->status.name, target_sd->status.account_id, sd->deal.zeny, RETCODE);
-// fclose(logfp);
-// }
-#ifndef TXT_ONLY
+ return 1;
}
#endif
+// if((logfp=fopen(log_config.log_zeny,"a+")) == NULL)
+// return 0;
+// time(&curtime);
+// strftime(timestring, 254, "%m/%d/%Y %H:%M:%S", localtime(&curtime));
+// fprintf(logfp,"%s - %s[%d]\t%s[%d]\t%d\t%s", timestring, sd->status.name, sd->status.account_id, target_sd->status.name, target_sd->status.account_id, sd->deal.zeny, RETCODE);
+// fclose(logfp);
+// return 1;
return 0;
}
@@ -212,18 +259,17 @@ int log_mvpdrop(struct map_session_data *sd, int monster_id, int *log_mvp)
{
ShowSQL("DB error - %s\n",mysql_error(&logmysql_handle));
ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
+ return 0;
}
- } else {
-#endif
- if((logfp=fopen(log_config.log_mvpdrop,"a+")) != NULL) {
- time(&curtime);
- strftime(timestring, 254, "%m/%d/%Y %H:%M:%S", localtime(&curtime));
- fprintf(logfp,"%s - %s[%d:%d]\t%d\t%d,%d%s", timestring, sd->status.name, sd->status.account_id, sd->status.char_id, monster_id, log_mvp[0], log_mvp[1], RETCODE);
- fclose(logfp);
- }
-#ifndef TXT_ONLY
+ return 1;
}
#endif
+ if((logfp=fopen(log_config.log_mvpdrop,"a+")) == NULL)
+ return 0;
+ time(&curtime);
+ strftime(timestring, 254, "%m/%d/%Y %H:%M:%S", localtime(&curtime));
+ fprintf(logfp,"%s - %s[%d:%d]\t%d\t%d,%d%s", timestring, sd->status.name, sd->status.account_id, sd->status.char_id, monster_id, log_mvp[0], log_mvp[1], RETCODE);
+ fclose(logfp);
return 0;
}
@@ -232,8 +278,8 @@ int log_atcommand(struct map_session_data *sd, const char *message)
{
FILE *logfp;
#ifndef TXT_ONLY
- char t_name[NAME_LENGTH*2];
- char t_msg[MESSAGE_SIZE*2+1]; //These are the contents of an @ call, so there shouldn't be overflow danger here?
+ char t_name[NAME_LENGTH*2];
+ char t_msg[MESSAGE_SIZE*2+1]; //These are the contents of an @ call, so there shouldn't be overflow danger here?
#endif
if(!log_config.enable_logs)
@@ -248,28 +294,27 @@ int log_atcommand(struct map_session_data *sd, const char *message)
{
ShowSQL("DB error - %s\n",mysql_error(&logmysql_handle));
ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
+ return 0;
}
- } else {
-#endif
- if((logfp=fopen(log_config.log_gm,"a+")) != NULL) {
- time(&curtime);
- strftime(timestring, 254, "%m/%d/%Y %H:%M:%S", localtime(&curtime));
- fprintf(logfp,"%s - %s[%d]: %s%s",timestring,sd->status.name,sd->status.account_id,message,RETCODE);
- fclose(logfp);
- }
-#ifndef TXT_ONLY
+ return 1;
}
#endif
- return 0;
+ if((logfp=fopen(log_config.log_gm,"a+")) == NULL)
+ return 0;
+ time(&curtime);
+ strftime(timestring, 254, "%m/%d/%Y %H:%M:%S", localtime(&curtime));
+ fprintf(logfp,"%s - %s[%d]: %s%s",timestring,sd->status.name,sd->status.account_id,message,RETCODE);
+ fclose(logfp);
+ return 1;
}
int log_npc(struct map_session_data *sd, const char *message)
{ //[Lupus]
FILE *logfp;
- #ifndef TXT_ONLY
- char t_name[NAME_LENGTH*2];
- char t_msg[255+1]; //it's 255 chars MAX.
- #endif
+#ifndef TXT_ONLY
+ char t_name[NAME_LENGTH*2];
+ char t_msg[255+1]; //it's 255 chars MAX.
+#endif
if(!log_config.enable_logs)
return 0;
@@ -283,19 +328,18 @@ int log_npc(struct map_session_data *sd, const char *message)
{
ShowSQL("DB error - %s\n",mysql_error(&logmysql_handle));
ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
+ return 0;
}
- } else {
-#endif
- if((logfp=fopen(log_config.log_npc,"a+")) != NULL) {
- time(&curtime);
- strftime(timestring, 254, "%m/%d/%Y %H:%M:%S", localtime(&curtime));
- fprintf(logfp,"%s - %s[%d]: %s%s",timestring,sd->status.name,sd->status.account_id,message,RETCODE);
- fclose(logfp);
- }
-#ifndef TXT_ONLY
+ return 1;
}
#endif
- return 0;
+ if((logfp=fopen(log_config.log_npc,"a+")) == NULL)
+ return 0;
+ time(&curtime);
+ strftime(timestring, 254, "%m/%d/%Y %H:%M:%S", localtime(&curtime));
+ fprintf(logfp,"%s - %s[%d]: %s%s",timestring,sd->status.name,sd->status.account_id,message,RETCODE);
+ fclose(logfp);
+ return 1;
}
//ChatLogging
@@ -317,11 +361,10 @@ int log_npc(struct map_session_data *sd, const char *message)
//log_chat: 18 = logs only Whisper, when WOE is off
int log_chat(char *type, int type_id, int src_charid, int src_accid, char *map, int x, int y, char *dst_charname, char *message){
+ FILE *logfp;
#ifndef TXT_ONLY
char t_charname[NAME_LENGTH*2];
char t_msg[MESSAGE_SIZE*2+1]; //Chat line fully escaped, with an extra space just in case.
-#else
- FILE *logfp;
#endif
//Check ON/OFF
@@ -336,27 +379,20 @@ int log_chat(char *type, int type_id, int src_charid, int src_accid, char *map,
if(mysql_query(&logmysql_handle, tmp_sql)){
ShowSQL("DB error - %s\n",mysql_error(&logmysql_handle));
ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
- return -1;
- }else{
- return 0;
+ return 0;
}
- }
-#endif
-
-#ifdef TXT_ONLY
- if((logfp = fopen(log_config.log_chat, "a+")) != NULL){
- time(&curtime);
- strftime(timestring, 254, "%m/%d/%Y %H:%M:%S", localtime(&curtime));
- //DATE - type,type_id,src_charid,src_accountid,src_map,src_x,src_y,dst_charname,message
- fprintf(logfp, "%s - %s,%d,%d,%d,%s,%d,%d,%s,%s%s",
- timestring, type, type_id, src_charid, src_accid, map, x, y, dst_charname, message, RETCODE);
- fclose(logfp);
- return 0;
- }else{
- return -1;
+ return 1;
}
#endif
-return -1;
+ if((logfp = fopen(log_config.log_chat, "a+")) == NULL)
+ return 0;
+ time(&curtime);
+ strftime(timestring, 254, "%m/%d/%Y %H:%M:%S", localtime(&curtime));
+ //DATE - type,type_id,src_charid,src_accountid,src_map,src_x,src_y,dst_charname,message
+ fprintf(logfp, "%s - %s,%d,%d,%d,%s,%d,%d,%s,%s%s",
+ timestring, type, type_id, src_charid, src_accid, map, x, y, dst_charname, message, RETCODE);
+ fclose(logfp);
+ return 1;
}
diff --git a/src/map/log.h b/src/map/log.h
index 05de892f4..32f3853ef 100644
--- a/src/map/log.h
+++ b/src/map/log.h
@@ -13,7 +13,8 @@ extern char db_server_logdb[32];
#endif //NOT TXT_ONLY
//New logs
-int log_pick(struct map_session_data *sd, char *type, int mob_id, int nameid, int amount, struct item *itm);
+int log_pick_pc(struct map_session_data *sd, const char *type, int nameid, int amount, struct item *itm);
+int log_pick_mob(struct mob_data *md, const char *type, int nameid, int amount, struct item *itm);
int log_zeny(struct map_session_data *sd, char *type, struct map_session_data *src_sd, int amount);
int log_npc(struct map_session_data *sd, const char *message);
diff --git a/src/map/mob.c b/src/map/mob.c
index f27370587..fa0d0f135 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -1280,7 +1280,7 @@ static int mob_ai_sub_hard(struct block_list *bl,va_list ap)
if (md->lootitem_count < LOOTITEM_SIZE) {
memcpy (&md->lootitem[md->lootitem_count++], &fitem->item_data, sizeof(md->lootitem[0]));
if(log_config.enable_logs&0x10) //Logs items, taken by (L)ooter Mobs [Lupus]
- log_pick((struct map_session_data*)md, "L", md->class_, md->lootitem[md->lootitem_count-1].nameid, md->lootitem[md->lootitem_count-1].amount, &md->lootitem[md->lootitem_count-1]);
+ log_pick_mob(md, "L", md->lootitem[md->lootitem_count-1].nameid, md->lootitem[md->lootitem_count-1].amount, &md->lootitem[md->lootitem_count-1]);
} else { //Destroy first looted item...
if (md->lootitem[0].card[0] == (short)0xff00)
intif_delete_petdata( MakeDWord(md->lootitem[0].card[1],md->lootitem[0].card[2]) );
@@ -1487,9 +1487,9 @@ static void mob_item_drop(struct mob_data *md, struct item_drop_list *dlist, str
if(log_config.enable_logs&0x10)
{ //Logs items, dropped by mobs [Lupus]
if (loot)
- log_pick((struct map_session_data*)md, "L", md->class_, ditem->item_data.nameid, -ditem->item_data.amount, &ditem->item_data);
+ log_pick_mob(md, "L", ditem->item_data.nameid, -ditem->item_data.amount, &ditem->item_data);
else
- log_pick((struct map_session_data*)md, "M", md->class_, ditem->item_data.nameid, -ditem->item_data.amount, NULL);
+ log_pick_mob(md, "M", ditem->item_data.nameid, -ditem->item_data.amount, NULL);
}
if (dlist->first_sd && dlist->first_sd->state.autoloot &&
@@ -2102,8 +2102,8 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
}
if(log_config.enable_logs&0x200) {//Logs items, MVP prizes [Lupus]
- log_pick((struct map_session_data*)md, "M", md->class_, item.nameid, -1, NULL);
- log_pick(mvp_sd, "P", 0, item.nameid, 1, NULL);
+ log_pick_mob(md, "M", item.nameid, -1, NULL);
+ log_pick_pc(mvp_sd, "P", item.nameid, 1, NULL);
}
break;
}
diff --git a/src/map/npc.c b/src/map/npc.c
index 7724a2b8a..89538052d 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -1260,7 +1260,7 @@ int npc_buylist(struct map_session_data *sd,int n,unsigned short *item_list)
//Logs items, Bought in NPC (S)hop [Lupus]
if(log_config.enable_logs&0x20)
- log_pick(sd, "S", 0, item_tmp.nameid, item_list[i*2], NULL);
+ log_pick_pc(sd, "S", item_tmp.nameid, item_list[i*2], NULL);
//Logs
}
@@ -1321,7 +1321,7 @@ int npc_selllist(struct map_session_data *sd,int n,unsigned short *item_list)
}
if(log_config.enable_logs&0x20) //Logs items, Sold to NPC (S)hop [Lupus]
- log_pick(sd, "S", 0, nameid, -qty, &sd->status.inventory[idx]);
+ log_pick_pc(sd, "S", nameid, -qty, &sd->status.inventory[idx]);
if(nd) {
pc_setreg(sd,add_str("@sold_nameid")+(i<<24),(int)sd->status.inventory[idx].nameid);
diff --git a/src/map/party.c b/src/map/party.c
index 13cafc922..a119d5287 100644
--- a/src/map/party.c
+++ b/src/map/party.c
@@ -808,7 +808,7 @@ int party_share_loot(struct party_data *p, TBL_PC *sd, struct item *item_data, i
}
if(log_config.enable_logs&0x8) //Logs items, taken by (P)layers [Lupus]
- log_pick(target, "P", 0, item_data->nameid, item_data->amount, item_data);
+ log_pick_pc(target, "P", item_data->nameid, item_data->amount, item_data);
//Logs
if(battle_config.party_show_share_picker && target != sd){
char output[80];
diff --git a/src/map/pc.c b/src/map/pc.c
index e7d47a2c6..f83b032cf 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -2766,7 +2766,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&0x8)
- log_pick(sd, "P", 0, sd->status.inventory[n].nameid, -amount, (struct item*)&sd->status.inventory[n]);
+ log_pick_pc(sd, "P", 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, NULL, NULL, NULL, 2))
@@ -2969,7 +2969,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&0x100)
- log_pick(sd, "C", 0, sd->status.inventory[n].nameid, -1, &sd->status.inventory[n]);
+ log_pick_pc(sd, "C", sd->status.inventory[n].nameid, -1, &sd->status.inventory[n]);
//Logs
pc_delitem(sd,n,1,1);
}
@@ -3249,8 +3249,8 @@ int pc_steal_item(struct map_session_data *sd,struct block_list *bl, int lv)
{ //Only invoke logs if item was successfully added (otherwise logs lie about actual item transaction)
//Logs items, Stolen from mobs [Lupus]
if(log_config.enable_logs&0x80) {
- log_pick((struct map_session_data*)md, "M", md->class_, itemid, -1, NULL);
- log_pick(sd, "P", 0, itemid, 1, NULL);
+ log_pick_mob(md, "M", itemid, -1, NULL);
+ log_pick_pc(sd, "P", itemid, 1, NULL);
}
//A Rare Steal Global Announce by Lupus
diff --git a/src/map/script.c b/src/map/script.c
index c8319fb4b..a8fbf454c 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -5165,7 +5165,7 @@ int buildin_getitem(struct script_state *st)
//Logs items, got from (N)PC scripts [Lupus]
if(log_config.enable_logs&0x40)
- log_pick(sd, "N", 0, nameid, amount, NULL);
+ log_pick_pc(sd, "N", nameid, amount, NULL);
return 0;
}
@@ -5249,7 +5249,7 @@ int buildin_getitem2(struct script_state *st)
//Logs items, got from (N)PC scripts [Lupus]
if(log_config.enable_logs&0x40)
- log_pick(sd, "N", 0, nameid, amount, &item_tmp);
+ log_pick_pc(sd, "N", nameid, amount, &item_tmp);
}
return 0;
@@ -5323,7 +5323,7 @@ int buildin_getnameditem(struct script_state *st)
//Logs items, got from (N)PC scripts [Lupus]
if(log_config.enable_logs&0x40)
- log_pick(sd, "N", 0, item_tmp.nameid, item_tmp.amount, &item_tmp);
+ log_pick_pc(sd, "N", item_tmp.nameid, item_tmp.amount, &item_tmp);
push_val(st->stack,C_INT,1);
return 0;
@@ -5455,7 +5455,7 @@ int buildin_delitem(struct script_state *st)
//Logs items, got from (N)PC scripts [Lupus]
if(log_config.enable_logs&0x40)
- log_pick(sd, "N", 0, sd->status.inventory[i].nameid, -amount, &sd->status.inventory[i]);
+ log_pick_pc(sd, "N", sd->status.inventory[i].nameid, -amount, &sd->status.inventory[i]);
pc_delitem(sd,i,amount,0);
return 0; //we deleted exact amount of items. now exit
@@ -5464,7 +5464,7 @@ int buildin_delitem(struct script_state *st)
//Logs items, got from (N)PC scripts [Lupus]
if(log_config.enable_logs&0x40) {
- log_pick(sd, "N", 0, sd->status.inventory[i].nameid, -sd->status.inventory[i].amount, &sd->status.inventory[i]);
+ log_pick_pc(sd, "N", sd->status.inventory[i].nameid, -sd->status.inventory[i].amount, &sd->status.inventory[i]);
}
//Logs
@@ -5484,7 +5484,7 @@ int buildin_delitem(struct script_state *st)
//Logs items, got from (N)PC scripts [Lupus]
if(log_config.enable_logs&0x40)
- log_pick(sd, "N", 0, sd->status.inventory[i].nameid, -amount, &sd->status.inventory[i]);
+ log_pick_pc(sd, "N", sd->status.inventory[i].nameid, -amount, &sd->status.inventory[i]);
pc_delitem(sd,i,amount,0);
return 0; //we deleted exact amount of items. now exit
@@ -5493,7 +5493,7 @@ int buildin_delitem(struct script_state *st)
//Logs items, got from (N)PC scripts [Lupus]
if(log_config.enable_logs&0x40)
- log_pick(sd, "N", 0, sd->status.inventory[i].nameid, -sd->status.inventory[i].amount, &sd->status.inventory[i]);
+ log_pick_pc(sd, "N", sd->status.inventory[i].nameid, -sd->status.inventory[i].amount, &sd->status.inventory[i]);
pc_delitem(sd,i,sd->status.inventory[i].amount,0);
}
@@ -5560,7 +5560,7 @@ int buildin_delitem2(struct script_state *st)
//Logs items, got from (N)PC scripts [Lupus]
if(log_config.enable_logs&0x40)
- log_pick(sd, "N", 0, sd->status.inventory[i].nameid, -amount, &sd->status.inventory[i]);
+ log_pick_pc(sd, "N", sd->status.inventory[i].nameid, -amount, &sd->status.inventory[i]);
pc_delitem(sd,i,amount,0);
return 0; //we deleted exact amount of items. now exit
@@ -5569,7 +5569,7 @@ int buildin_delitem2(struct script_state *st)
//Logs items, got from (N)PC scripts [Lupus]
if(log_config.enable_logs&0x40)
- log_pick(sd, "N", 0, sd->status.inventory[i].nameid, -sd->status.inventory[i].amount, &sd->status.inventory[i]);
+ log_pick_pc(sd, "N", sd->status.inventory[i].nameid, -sd->status.inventory[i].amount, &sd->status.inventory[i]);
pc_delitem(sd,i,sd->status.inventory[i].amount,0);
}
@@ -6154,7 +6154,7 @@ int buildin_successrefitem(struct script_state *st)
//Logs items, got from (N)PC scripts [Lupus]
if(log_config.enable_logs&0x40)
- log_pick(sd, "N", 0, sd->status.inventory[i].nameid, -1, &sd->status.inventory[i]);
+ log_pick_pc(sd, "N", sd->status.inventory[i].nameid, -1, &sd->status.inventory[i]);
sd->status.inventory[i].refine++;
pc_unequipitem(sd,i,2);
@@ -6164,7 +6164,7 @@ int buildin_successrefitem(struct script_state *st)
//Logs items, got from (N)PC scripts [Lupus]
if(log_config.enable_logs&0x40)
- log_pick(sd, "N", 0, sd->status.inventory[i].nameid, 1, &sd->status.inventory[i]);
+ log_pick_pc(sd, "N", sd->status.inventory[i].nameid, 1, &sd->status.inventory[i]);
clif_additem(sd,i,1,0);
pc_equipitem(sd,i,ep);
@@ -6205,7 +6205,7 @@ int buildin_failedrefitem(struct script_state *st)
if(i >= 0) {
//Logs items, got from (N)PC scripts [Lupus]
if(log_config.enable_logs&0x40)
- log_pick(sd, "N", 0, sd->status.inventory[i].nameid, -1, &sd->status.inventory[i]);
+ log_pick_pc(sd, "N", sd->status.inventory[i].nameid, -1, &sd->status.inventory[i]);
sd->status.inventory[i].refine = 0;
pc_unequipitem(sd,i,3);
@@ -8931,7 +8931,7 @@ int buildin_successremovecards(struct script_state *st)
//Logs items, got from (N)PC scripts [Lupus]
if(log_config.enable_logs&0x40)
- log_pick(sd, "N", 0, item_tmp.nameid, 1, NULL);
+ log_pick_pc(sd, "N", item_tmp.nameid, 1, NULL);
if((flag=pc_additem(sd,&item_tmp,1))){ // 持てないならドロップ
clif_additem(sd,0,0,flag);
@@ -8948,7 +8948,7 @@ int buildin_successremovecards(struct script_state *st)
//Logs items, got from (N)PC scripts [Lupus]
if(log_config.enable_logs&0x40)
- log_pick(sd, "N", 0, sd->status.inventory[i].nameid, -1, &sd->status.inventory[i]);
+ log_pick_pc(sd, "N", sd->status.inventory[i].nameid, -1, &sd->status.inventory[i]);
for (j = 0; j < MAX_SLOTS; j++)
item_tmp.card[j]=0;
@@ -8956,7 +8956,7 @@ int buildin_successremovecards(struct script_state *st)
//Logs items, got from (N)PC scripts [Lupus]
if(log_config.enable_logs&0x40)
- log_pick(sd, "N", 0, item_tmp.nameid, 1, &item_tmp);
+ log_pick_pc(sd, "N", item_tmp.nameid, 1, &item_tmp);
if((flag=pc_additem(sd,&item_tmp,1))){ // もてないならドロップ
clif_additem(sd,0,0,flag);
@@ -9002,7 +9002,7 @@ int buildin_failedremovecards(struct script_state *st)
//Logs items, got from (N)PC scripts [Lupus]
if(log_config.enable_logs&0x40)
- log_pick(sd, "N", 0, item_tmp.nameid, 1, NULL);
+ log_pick_pc(sd, "N", item_tmp.nameid, 1, NULL);
if((flag=pc_additem(sd,&item_tmp,1))){
clif_additem(sd,0,0,flag);
@@ -9017,7 +9017,7 @@ int buildin_failedremovecards(struct script_state *st)
if(typefail == 0 || typefail == 2){ // 武具損失
//Logs items, got from (N)PC scripts [Lupus]
if(log_config.enable_logs&0x40)
- log_pick(sd, "N", 0, sd->status.inventory[i].nameid, -1, &sd->status.inventory[i]);
+ log_pick_pc(sd, "N", sd->status.inventory[i].nameid, -1, &sd->status.inventory[i]);
pc_delitem(sd,i,1,0);
clif_misceffect(&sd->bl,2);
@@ -9031,7 +9031,7 @@ int buildin_failedremovecards(struct script_state *st)
//Logs items, got from (N)PC scripts [Lupus]
if(log_config.enable_logs&0x40)
- log_pick(sd, "N", 0, sd->status.inventory[i].nameid, -1, &sd->status.inventory[i]);
+ log_pick_pc(sd, "N", sd->status.inventory[i].nameid, -1, &sd->status.inventory[i]);
for (j = 0; j < MAX_SLOTS; j++)
item_tmp.card[j]=0;
@@ -9039,7 +9039,7 @@ int buildin_failedremovecards(struct script_state *st)
//Logs items, got from (N)PC scripts [Lupus]
if(log_config.enable_logs&0x40)
- log_pick(sd, "N", 0, item_tmp.nameid, 1, &item_tmp);
+ log_pick_pc(sd, "N", item_tmp.nameid, 1, &item_tmp);
if((flag=pc_additem(sd,&item_tmp,1))){
clif_additem(sd,0,0,flag);
@@ -9600,7 +9600,7 @@ int buildin_clearitem(struct script_state *st)
//Logs items, got from (N)PC scripts [Lupus]
if(log_config.enable_logs&0x40)
- log_pick(sd, "N", 0, sd->status.inventory[i].nameid, -sd->status.inventory[i].amount, &sd->status.inventory[i]);
+ log_pick_pc(sd, "N", sd->status.inventory[i].nameid, -sd->status.inventory[i].amount, &sd->status.inventory[i]);
pc_delitem(sd, i, sd->status.inventory[i].amount, 0);
}
diff --git a/src/map/trade.c b/src/map/trade.c
index 442566e49..78c630a32 100644
--- a/src/map/trade.c
+++ b/src/map/trade.c
@@ -478,8 +478,8 @@ void trade_tradecommit(struct map_session_data *sd) {
if (flag == 0) {
//Logs (T)rade [Lupus]
if(log_config.enable_logs&0x2) {
- log_pick(sd, "T", 0, sd->status.inventory[n].nameid, -(sd->deal.item[trade_i].amount), &sd->status.inventory[n]);
- log_pick(tsd, "T", 0, sd->status.inventory[n].nameid, sd->deal.item[trade_i].amount, &sd->status.inventory[n]);
+ 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]);
}
//Logs
pc_delitem(sd, n, sd->deal.item[trade_i].amount, 1);
@@ -495,8 +495,8 @@ void trade_tradecommit(struct map_session_data *sd) {
if (flag == 0) {
//Logs (T)rade [Lupus]
if(log_config.enable_logs&0x2) {
- log_pick(tsd, "T", 0, tsd->status.inventory[n].nameid, -(tsd->deal.item[trade_i].amount), &tsd->status.inventory[n]);
- log_pick(sd, "T", 0, tsd->status.inventory[n].nameid, tsd->deal.item[trade_i].amount, &tsd->status.inventory[n]);
+ 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]);
}
//Logs
pc_delitem(tsd, n, tsd->deal.item[trade_i].amount, 1);
diff --git a/src/map/vending.c b/src/map/vending.c
index bb518babf..0f8ceaa30 100644
--- a/src/map/vending.c
+++ b/src/map/vending.c
@@ -160,8 +160,8 @@ void vending_purchasereq(struct map_session_data *sd,int len,int id,unsigned cha
//Logs sold (V)ending items [Lupus]
if(log_config.enable_logs&0x4) {
- log_pick(vsd, "V", 0, vsd->status.cart[idx].nameid, -amount, (struct item*)&vsd->status.cart[idx]);
- log_pick( sd, "V", 0, vsd->status.cart[idx].nameid, amount, (struct item*)&vsd->status.cart[idx]);
+ log_pick_pc(vsd, "V", vsd->status.cart[idx].nameid, -amount, (struct item*)&vsd->status.cart[idx]);
+ log_pick_pc( sd, "V", vsd->status.cart[idx].nameid, amount, (struct item*)&vsd->status.cart[idx]);
}
//Logs