Browse Source

- 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://svn.code.sf.net/p/rathena/svn/trunk@9017 54d463be-8e91-2dee-dedb-b68131a5f0ec

skotlex 18 years ago
parent
commit
2b44fd5db4
12 changed files with 194 additions and 153 deletions
  1. 4 0
      Changelog-Trunk.txt
  2. 6 6
      src/map/atcommand.c
  3. 2 2
      src/map/charcommand.c
  4. 142 106
      src/map/log.c
  5. 2 1
      src/map/log.h
  6. 5 5
      src/map/mob.c
  7. 2 2
      src/map/npc.c
  8. 1 1
      src/map/party.c
  9. 4 4
      src/map/pc.c
  10. 20 20
      src/map/script.c
  11. 4 4
      src/map/trade.c
  12. 2 2
      src/map/vending.c

+ 4 - 0
Changelog-Trunk.txt

@@ -4,6 +4,10 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK.  ALL UNTESTED BUGFIXES/FEATURES GO
 IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
 IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
 
 
 2006/10/19
 2006/10/19
+	* Cleaned up the log.c file. [Skotlex]
+	* 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)
+	  [Skotlex]
 	* Fixed SG_FRIEND, it should be triggering when Monks do Combo Finish (not
 	* Fixed SG_FRIEND, it should be triggering when Monks do Combo Finish (not
 	  triple blows), and the trigger rate increase should be based on your known
 	  triple blows), and the trigger rate increase should be based on your known
 	  level of SG_FRIEND, not TK_COUNTER. [Skotlex]
 	  level of SG_FRIEND, not TK_COUNTER. [Skotlex]

+ 6 - 6
src/map/atcommand.c

@@ -2639,7 +2639,7 @@ int atcommand_item(
 
 
 	//Logs (A)dmins items [Lupus]
 	//Logs (A)dmins items [Lupus]
 	if(log_config.enable_logs&0x400)
 	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.
 	clif_displaymessage(fd, msg_txt(18)); // Item created.
 	return 0;
 	return 0;
@@ -2714,7 +2714,7 @@ int atcommand_item2(
 
 
 		//Logs (A)dmins items [Lupus]
 		//Logs (A)dmins items [Lupus]
 		if(log_config.enable_logs&0x400)
 		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.
 		clif_displaymessage(fd, msg_txt(18)); // Item created.
 	} else {
 	} else {
@@ -2741,7 +2741,7 @@ int atcommand_itemreset(
 
 
 			//Logs (A)dmins items [Lupus]
 			//Logs (A)dmins items [Lupus]
 			if(log_config.enable_logs&0x400)
 			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);
 			pc_delitem(sd, i, sd->status.inventory[i].amount, 0);
 		}
 		}
@@ -3892,7 +3892,7 @@ int atcommand_produce(
 
 
 		//Logs (A)dmins items [Lupus]
 		//Logs (A)dmins items [Lupus]
 		if(log_config.enable_logs&0x400)
 		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)))
 		if ((flag = pc_additem(sd, &tmp_item, 1)))
 			clif_additem(sd, 0, 0, flag);
 			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]
 						//Logs (A)dmins items [Lupus]
 						if(log_config.enable_logs&0x400)
 						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);
 						pc_delitem(pl_sd, item_position, 1, 0);
 						count++;
 						count++;
@@ -7704,7 +7704,7 @@ void getring (struct map_session_data *sd)
 
 
 	//Logs (A)dmins items [Lupus]
 	//Logs (A)dmins items [Lupus]
 	if(log_config.enable_logs&0x400)
 	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))) {
 	if((flag = pc_additem(sd,&item_tmp,1))) {
 		clif_additem(sd,0,0,flag);
 		clif_additem(sd,0,0,flag);

+ 2 - 2
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]
 		//Logs (A)dmins items [Lupus]
 		if(log_config.enable_logs&0x400)
 		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]
 				//Logs (A)dmins items [Lupus]
 				if(log_config.enable_logs&0x400)
 				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.
 				clif_displaymessage(fd, msg_table[18]); // Item created.
 			} else {
 			} else {

+ 142 - 106
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)
 int log_branch(struct map_session_data *sd)
 {
 {
 #ifndef TXT_ONLY
 #ifndef TXT_ONLY
-		char t_name[NAME_LENGTH*2];
+	char t_name[NAME_LENGTH*2];
 #endif
 #endif
 	FILE *logfp;
 	FILE *logfp;
 
 
@@ -84,42 +84,33 @@ int log_branch(struct map_session_data *sd)
 		{
 		{
 			ShowSQL("DB error - %s\n",mysql_error(&logmysql_handle));
 			ShowSQL("DB error - %s\n",mysql_error(&logmysql_handle));
 			ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
 			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
 #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;
 	FILE *logfp;
 	char *mapname;
 	char *mapname;
-	int obj_id;
 
 
 	nullpo_retr(0, sd);
 	nullpo_retr(0, sd);
 	//Should we log this item? [Lupus]
 	//Should we log this item? [Lupus]
 	if (!should_log_item(log_config.filter,nameid, amount))
 	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]
 		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)
 	if(mapname==NULL)
 		mapname="";
 		mapname="";
 
 
@@ -129,43 +120,99 @@ int log_pick(struct map_session_data *sd, char *type, int mob_id, int nameid, in
 		if (itm==NULL) {
 		if (itm==NULL) {
 		//We log common item
 		//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')",
 			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 {
 		} else {
 		//We log Extended item
 		//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')",
 			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))
 		if(mysql_query(&logmysql_handle, tmp_sql))
 		{
 		{
 			ShowSQL("DB error - %s\n",mysql_error(&logmysql_handle));
 			ShowSQL("DB error - %s\n",mysql_error(&logmysql_handle));
 			ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
 			ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
+			return 0;
 		}
 		}
-	} else {
+		return 1;
+	}
 #endif
 #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
 #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
 #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
 	return 1; //Logged
 }
 }
 
 
+
 int log_zeny(struct map_session_data *sd, char *type, struct map_session_data *src_sd, int amount)
 int log_zeny(struct map_session_data *sd, char *type, struct map_session_data *src_sd, int amount)
 {
 {
 //	FILE *logfp;
 //	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));
 			ShowSQL("DB error - %s\n",mysql_error(&logmysql_handle));
 			ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
 			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
 #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;
 	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));
 			ShowSQL("DB error - %s\n",mysql_error(&logmysql_handle));
 			ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
 			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
 #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;
 	return 0;
 }
 }
 
 
@@ -232,8 +278,8 @@ int log_atcommand(struct map_session_data *sd, const char *message)
 {
 {
 	FILE *logfp;
 	FILE *logfp;
 #ifndef TXT_ONLY
 #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
 #endif
 
 
 	if(!log_config.enable_logs)
 	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));
 			ShowSQL("DB error - %s\n",mysql_error(&logmysql_handle));
 			ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
 			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
 #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)
 int log_npc(struct map_session_data *sd, const char *message)
 {	//[Lupus]
 {	//[Lupus]
 	FILE *logfp;
 	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)
 	if(!log_config.enable_logs)
 		return 0;
 		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));
 			ShowSQL("DB error - %s\n",mysql_error(&logmysql_handle));
 			ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
 			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
 #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
 //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
 //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){
 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
 #ifndef TXT_ONLY
 	char t_charname[NAME_LENGTH*2];
 	char t_charname[NAME_LENGTH*2];
 	char t_msg[MESSAGE_SIZE*2+1]; //Chat line fully escaped, with an extra space just in case.
 	char t_msg[MESSAGE_SIZE*2+1]; //Chat line fully escaped, with an extra space just in case.
-#else
-	FILE *logfp;
 #endif
 #endif
 	
 	
 	//Check ON/OFF
 	//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)){
 		if(mysql_query(&logmysql_handle, tmp_sql)){
 			ShowSQL("DB error - %s\n",mysql_error(&logmysql_handle));
 			ShowSQL("DB error - %s\n",mysql_error(&logmysql_handle));
 			ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
 			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
 #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;
 }
 }
 
 
 
 

+ 2 - 1
src/map/log.h

@@ -13,7 +13,8 @@ extern char db_server_logdb[32];
 #endif //NOT TXT_ONLY
 #endif //NOT TXT_ONLY
 
 
 //New logs
 //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_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);
 int log_npc(struct map_session_data *sd, const char *message);

+ 5 - 5
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) {
 			if (md->lootitem_count < LOOTITEM_SIZE) {
 				memcpy (&md->lootitem[md->lootitem_count++], &fitem->item_data, sizeof(md->lootitem[0]));
 				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]
 				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...
 			} else {	//Destroy first looted item...
 				if (md->lootitem[0].card[0] == (short)0xff00)
 				if (md->lootitem[0].card[0] == (short)0xff00)
 					intif_delete_petdata( MakeDWord(md->lootitem[0].card[1],md->lootitem[0].card[2]) );
 					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)
 	if(log_config.enable_logs&0x10)
 	{	//Logs items, dropped by mobs [Lupus]
 	{	//Logs items, dropped by mobs [Lupus]
 		if (loot)
 		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
 		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 &&
 	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]
 			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;
 			break;
 		}
 		}

+ 2 - 2
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]
 		//Logs items, Bought in NPC (S)hop [Lupus]
 		if(log_config.enable_logs&0x20)
 		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
 		//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]
 		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) {
 		if(nd) {
 			pc_setreg(sd,add_str("@sold_nameid")+(i<<24),(int)sd->status.inventory[idx].nameid);
 			pc_setreg(sd,add_str("@sold_nameid")+(i<<24),(int)sd->status.inventory[idx].nameid);

+ 1 - 1
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]
 	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
 	//Logs
 	if(battle_config.party_show_share_picker && target != sd){
 	if(battle_config.party_show_share_picker && target != sd){
 		char output[80];
 		char output[80];

+ 4 - 4
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]
 	//Logs items, dropped by (P)layers [Lupus]
 	if(log_config.enable_logs&0x8)
 	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
 	//Logs
 
 
 	if (!map_addflooritem(&sd->status.inventory[n], amount, sd->bl.m, sd->bl.x, sd->bl.y, NULL, NULL, NULL, 2))
 	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);
 		clif_useitemack(sd,n,amount-1,1);
 		//Logs (C)onsumable items [Lupus]
 		//Logs (C)onsumable items [Lupus]
 		if(log_config.enable_logs&0x100)
 		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
 		//Logs
 		pc_delitem(sd,n,1,1);
 		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)
 	{	//Only invoke logs if item was successfully added (otherwise logs lie about actual item transaction)
 		//Logs items, Stolen from mobs [Lupus]
 		//Logs items, Stolen from mobs [Lupus]
 		if(log_config.enable_logs&0x80) {
 		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
 		//A Rare Steal Global Announce by Lupus

+ 20 - 20
src/map/script.c

@@ -5165,7 +5165,7 @@ int buildin_getitem(struct script_state *st)
 
 
 	//Logs items, got from (N)PC scripts [Lupus]
 	//Logs items, got from (N)PC scripts [Lupus]
 	if(log_config.enable_logs&0x40)
 	if(log_config.enable_logs&0x40)
-		log_pick(sd, "N", 0, nameid, amount, NULL);
+		log_pick_pc(sd, "N", nameid, amount, NULL);
 
 
 	return 0;
 	return 0;
 }
 }
@@ -5249,7 +5249,7 @@ int buildin_getitem2(struct script_state *st)
 
 
 		//Logs items, got from (N)PC scripts [Lupus]
 		//Logs items, got from (N)PC scripts [Lupus]
 		if(log_config.enable_logs&0x40)
 		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;
 	return 0;
@@ -5323,7 +5323,7 @@ int buildin_getnameditem(struct script_state *st)
 
 
 	//Logs items, got from (N)PC scripts [Lupus]
 	//Logs items, got from (N)PC scripts [Lupus]
 	if(log_config.enable_logs&0x40)
 	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);
 	push_val(st->stack,C_INT,1);
 	return 0;
 	return 0;
@@ -5455,7 +5455,7 @@ int buildin_delitem(struct script_state *st)
 
 
 			//Logs items, got from (N)PC scripts [Lupus]
 			//Logs items, got from (N)PC scripts [Lupus]
 			if(log_config.enable_logs&0x40)
 			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);
 			pc_delitem(sd,i,amount,0);
 			return 0; //we deleted exact amount of items. now exit
 			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]
 			//Logs items, got from (N)PC scripts [Lupus]
 			if(log_config.enable_logs&0x40) {
 			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
 			//Logs
 
 
@@ -5484,7 +5484,7 @@ int buildin_delitem(struct script_state *st)
 
 
 				//Logs items, got from (N)PC scripts [Lupus]
 				//Logs items, got from (N)PC scripts [Lupus]
 				if(log_config.enable_logs&0x40)
 				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);
 				pc_delitem(sd,i,amount,0);
 				return 0; //we deleted exact amount of items. now exit
 				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]
 				//Logs items, got from (N)PC scripts [Lupus]
 				if(log_config.enable_logs&0x40)
 				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);
 				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]
 			//Logs items, got from (N)PC scripts [Lupus]
 			if(log_config.enable_logs&0x40)
 			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);
 			pc_delitem(sd,i,amount,0);
 			return 0; //we deleted exact amount of items. now exit
 			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]
 			//Logs items, got from (N)PC scripts [Lupus]
 			if(log_config.enable_logs&0x40)
 			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);
 			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]
 		//Logs items, got from (N)PC scripts [Lupus]
 		if(log_config.enable_logs&0x40) 
 		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++;
 		sd->status.inventory[i].refine++;
 		pc_unequipitem(sd,i,2);
 		pc_unequipitem(sd,i,2);
@@ -6164,7 +6164,7 @@ int buildin_successrefitem(struct script_state *st)
 
 
 		//Logs items, got from (N)PC scripts [Lupus]
 		//Logs items, got from (N)PC scripts [Lupus]
 		if(log_config.enable_logs&0x40)
 		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);
 		clif_additem(sd,i,1,0);
 		pc_equipitem(sd,i,ep);
 		pc_equipitem(sd,i,ep);
@@ -6205,7 +6205,7 @@ int buildin_failedrefitem(struct script_state *st)
 	if(i >= 0) {
 	if(i >= 0) {
 		//Logs items, got from (N)PC scripts [Lupus]
 		//Logs items, got from (N)PC scripts [Lupus]
 		if(log_config.enable_logs&0x40)
 		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;
 		sd->status.inventory[i].refine = 0;
 		pc_unequipitem(sd,i,3);
 		pc_unequipitem(sd,i,3);
@@ -8931,7 +8931,7 @@ int buildin_successremovecards(struct script_state *st)
 
 
 			//Logs items, got from (N)PC scripts [Lupus]
 			//Logs items, got from (N)PC scripts [Lupus]
 			if(log_config.enable_logs&0x40)
 			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))){	// 持てないならドロップ
 			if((flag=pc_additem(sd,&item_tmp,1))){	// 持てないならドロップ
 				clif_additem(sd,0,0,flag);
 				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]
 		//Logs items, got from (N)PC scripts [Lupus]
 		if(log_config.enable_logs&0x40)
 		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++)
 		for (j = 0; j < MAX_SLOTS; j++)
 			item_tmp.card[j]=0;
 			item_tmp.card[j]=0;
@@ -8956,7 +8956,7 @@ int buildin_successremovecards(struct script_state *st)
 
 
 		//Logs items, got from (N)PC scripts [Lupus]
 		//Logs items, got from (N)PC scripts [Lupus]
 		if(log_config.enable_logs&0x40)
 		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))){	// もてないならドロップ
 		if((flag=pc_additem(sd,&item_tmp,1))){	// もてないならドロップ
 			clif_additem(sd,0,0,flag);
 			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]
 				//Logs items, got from (N)PC scripts [Lupus]
 				if(log_config.enable_logs&0x40)
 				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))){
 				if((flag=pc_additem(sd,&item_tmp,1))){
 					clif_additem(sd,0,0,flag);
 					clif_additem(sd,0,0,flag);
@@ -9017,7 +9017,7 @@ int buildin_failedremovecards(struct script_state *st)
 		if(typefail == 0 || typefail == 2){	// 武具損失
 		if(typefail == 0 || typefail == 2){	// 武具損失
 			//Logs items, got from (N)PC scripts [Lupus]
 			//Logs items, got from (N)PC scripts [Lupus]
 			if(log_config.enable_logs&0x40)
 			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);
 			pc_delitem(sd,i,1,0);
 			clif_misceffect(&sd->bl,2);
 			clif_misceffect(&sd->bl,2);
@@ -9031,7 +9031,7 @@ int buildin_failedremovecards(struct script_state *st)
 
 
 			//Logs items, got from (N)PC scripts [Lupus]
 			//Logs items, got from (N)PC scripts [Lupus]
 			if(log_config.enable_logs&0x40)
 			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++)
 			for (j = 0; j < MAX_SLOTS; j++)
 				item_tmp.card[j]=0;
 				item_tmp.card[j]=0;
@@ -9039,7 +9039,7 @@ int buildin_failedremovecards(struct script_state *st)
 
 
 			//Logs items, got from (N)PC scripts [Lupus]
 			//Logs items, got from (N)PC scripts [Lupus]
 			if(log_config.enable_logs&0x40)
 			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))){
 			if((flag=pc_additem(sd,&item_tmp,1))){
 				clif_additem(sd,0,0,flag);
 				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]
 			//Logs items, got from (N)PC scripts [Lupus]
 			if(log_config.enable_logs&0x40)
 			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);
 			pc_delitem(sd, i, sd->status.inventory[i].amount, 0);
 		}
 		}

+ 4 - 4
src/map/trade.c

@@ -478,8 +478,8 @@ void trade_tradecommit(struct map_session_data *sd) {
 			if (flag == 0) {
 			if (flag == 0) {
 				//Logs (T)rade [Lupus]
 				//Logs (T)rade [Lupus]
 				if(log_config.enable_logs&0x2) {
 				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
 				//Logs
 				pc_delitem(sd, n, sd->deal.item[trade_i].amount, 1);
 				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) {
 			if (flag == 0) {
 				//Logs (T)rade [Lupus]
 				//Logs (T)rade [Lupus]
 				if(log_config.enable_logs&0x2) {
 				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
 				//Logs
 				pc_delitem(tsd, n, tsd->deal.item[trade_i].amount, 1);
 				pc_delitem(tsd, n, tsd->deal.item[trade_i].amount, 1);

+ 2 - 2
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]
 		//Logs sold (V)ending items [Lupus]
 		if(log_config.enable_logs&0x4) {
 		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
 		//Logs