Beispiel #1
0
//Mob picked item
int log_pick_mob(struct mob_data *md, const char *type, int nameid, int amount, struct item *itm)
{
	char* mapname;

	nullpo_retr(0, md);

	if (!should_log_item(log_config.filter, nameid, amount))
		return 0; //we skip logging this item set - it doesn't meet our logging conditions [Lupus]

	//either PLAYER or MOB (here we get map name and objects ID)
	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
			if (SQL_ERROR == Sql_Query(logmysql_handle, "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) )
			{
				Sql_ShowDebug(logmysql_handle);
				return 0;
			}
		} else {
		//We log Extended item
			if (SQL_ERROR == Sql_Query(logmysql_handle, "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) )
			{
				Sql_ShowDebug(logmysql_handle);
				return 0;
			}
		}
	}
	else
#endif
	{
		FILE *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\n",
				timestring, md->class_, 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);
		}
		fclose(logfp);
	}
	
	return 1; //Logged
}
Beispiel #2
0
/// logs item transactions (generic)
void log_pick(int id, int m, e_log_pick_type type, int amount, struct item* itm)
{
	nullpo_retv(itm);
	if( ( log_config.enable_logs&type ) == 0 )
	{// disabled
		return;
	}

	if( !should_log_item(itm->nameid, amount, itm->refine) )
		return; //we skip logging this item set - it doesn't meet our logging conditions [Lupus]

	if( log_config.sql_logs )
	{
		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, id, log_picktype2char(type), itm->nameid, amount, itm->refine, itm->card[0], itm->card[1], itm->card[2], itm->card[3], map[m].name?map[m].name:"") )
		{
			Sql_ShowDebug(logmysql_handle);
			return;
		}
	}
	else
	{
		char timestring[255];
		time_t curtime;
		FILE* logfp;

		if( ( logfp = fopen(log_config.log_pick, "a") ) == NULL )
			return;
		time(&curtime);
		strftime(timestring, sizeof(timestring), "%m/%d/%Y %H:%M:%S", localtime(&curtime));
		fprintf(logfp,"%s - %d\t%c\t%d,%d,%d,%d,%d,%d,%d,%s\n", timestring, id, log_picktype2char(type), itm->nameid, amount, itm->refine, itm->card[0], itm->card[1], itm->card[2], itm->card[3], map[m].name?map[m].name:"");
		fclose(logfp);
	}
}
Beispiel #3
0
/// logs item transactions (players)
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(nameid, amount, itm ? itm->refine : 0) )
		return; //we skip logging this item set - it doesn't meet our logging conditions [Lupus]

#ifndef TXT_ONLY
	if( log_config.sql_logs )
	{
		if( itm == NULL )
		{//We log common item
			if( SQL_ERROR == Sql_Query(logmysql_handle, "INSERT DELAYED INTO `%s` (`time`, `char_id`, `type`, `nameid`, `amount`, `map`) VALUES (NOW(), '%d', '%c', '%d', '%d', '%s')",
				log_config.log_pick, 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, "INSERT DELAYED 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, 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;
			}
		}
	}
	else
#endif
	{
		char timestring[255];
		time_t curtime;
		FILE* logfp;

		if( ( logfp = fopen(log_config.log_pick, "a") ) == NULL )
			return;
		time(&curtime);
		strftime(timestring, sizeof(timestring), "%m/%d/%Y %H:%M:%S", localtime(&curtime));

		if( itm == NULL )
		{//We log common item
			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%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);
	}
}
Beispiel #4
0
int log_pick_pc(struct map_session_data *sd, const char *type, int nameid, int amount, struct item *itm)
{
    FILE *logfp;
    char *mapname;

    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]

    mapname = (char*)mapindex_id2name(sd->mapindex);

    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, sd->status.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, sd->status.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;
        }
        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, sd->status.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->status.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
}
Beispiel #5
0
/// logs item transactions (generic)
void log_pick(int id, int16 m, e_log_pick_type type, int amount, struct item* itm, struct item_data *data) {
	nullpo_retv(itm);
	if( ( logs->config.enable_logs&type ) == 0 ) {// disabled
		return;
	}

	if( !should_log_item(itm->nameid, amount, itm->refine, data) )
		return; //we skip logging this item set - it doesn't meet our logging conditions [Lupus]

	logs->pick_sub(id,m,type,amount,itm,data);
}
Beispiel #6
0
int log_pick_pc(struct map_session_data *sd, const char *type, int nameid, int amount, struct item *itm)
{
	nullpo_retr(0, sd);

	if (!should_log_item(log_config.filter, nameid, amount))
		return 0; //we skip logging this item set - it doesn't meet our logging conditions [Lupus]

#ifndef TXT_ONLY
	if(log_config.sql_logs > 0)
	{
		if (itm == NULL) {
			//We log common item
			if (SQL_ERROR == Sql_Query(logmysql_handle, "INSERT DELAYED 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)) )
			{
				Sql_ShowDebug(logmysql_handle);
				return 0;
			}
		} else {
			//We log Extended item
			if (SQL_ERROR == Sql_Query(logmysql_handle, "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, 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)) )
			{
				Sql_ShowDebug(logmysql_handle);
				return 0;
			}
		}
	}
	else
#endif
	{
		FILE* 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\n",
				timestring, sd->status.char_id, 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));
		}
		fclose(logfp);
	}
	
	return 1; //Logged
}
Beispiel #7
0
/// logs item transactions (generic)
void log_pick(int id, int16 m, e_log_pick_type type, int amount, struct item* itm)
{
	nullpo_retv(itm);
	if( ( log_config.enable_logs&type ) == 0 )
	{// disabled
		return;
	}

	if( !should_log_item(itm->nameid, amount, itm->refine) )
		return; //we skip logging this item set - it doesn't meet our logging conditions [Lupus]

	if( log_config.sql_logs )
	{
#ifdef BETA_THREAD_TEST
		char entry[512];
		int e_length = 0;
		e_length = sprintf(entry, LOG_QUERY " INTO `%s` (`time`, `char_id`, `type`, `nameid`, `amount`, `refine`, `card0`, `card1`, `card2`, `card3`, `map`, `unique_id`, `bound`) VALUES (NOW(), '%d', '%c', '%hu', '%d', '%d', '%hu', '%hu', '%hu', '%hu', '%s', '%"PRIu64"', '%d')",
				log_config.log_pick, id, log_picktype2char(type), itm->nameid, amount, itm->refine, itm->card[0], itm->card[1], itm->card[2], itm->card[3], map[m].name?map[m].name:"", itm->unique_id, itm->bound);
		queryThread_log(entry,e_length);
#else
		if( SQL_ERROR == Sql_Query(logmysql_handle, LOG_QUERY " INTO `%s` (`time`, `char_id`, `type`, `nameid`, `amount`, `refine`, `card0`, `card1`, `card2`, `card3`, `map`, `unique_id`, `bound`) VALUES (NOW(), '%d', '%c', '%hu', '%d', '%d', '%hu', '%hu', '%hu', '%hu', '%s', '%"PRIu64"', '%d')",
			log_config.log_pick, id, log_picktype2char(type), itm->nameid, amount, itm->refine, itm->card[0], itm->card[1], itm->card[2], itm->card[3], map[m].name?map[m].name:"", itm->unique_id, itm->bound) )
		{
			Sql_ShowDebug(logmysql_handle);
			return;
		}
#endif
	}
	else
	{
		char timestring[255];
		time_t curtime;
		FILE* logfp;

		if( ( logfp = fopen(log_config.log_pick, "a") ) == NULL )
			return;
		time(&curtime);
		strftime(timestring, sizeof(timestring), "%m/%d/%Y %H:%M:%S", localtime(&curtime));
		fprintf(logfp,"%s - %d\t%c\t%hu,%d,%d,%hu,%hu,%hu,%hu,%s,'%"PRIu64"',%d\n", timestring, id, log_picktype2char(type), itm->nameid, amount, itm->refine, itm->card[0], itm->card[1], itm->card[2], itm->card[3], map[m].name?map[m].name:"", itm->unique_id, itm->bound);
		fclose(logfp);
	}
}
Beispiel #8
0
/// logs item transactions (generic)
void log_pick(struct block_list* bl, int16 m, e_log_pick_type type, int amount, struct item* itm)
{
	const char* mapname;
	int id = 0, account_id = 0;
	char esc_name[NAME_LENGTH*2+1] = "";
	nullpo_retv(itm);

	if( ( log_config.enable_logs&type ) == 0 )
	{// disabled
		return;
	}

	if( !should_log_item(itm->nameid, amount, itm->refine) )
		return; //we skip logging this item set - it doesn't meet our logging conditions [Lupus]

	//either PLAYER or MOB (here we get map name and objects ID)
	if( bl == NULL )
	{
		ShowError("log_pick: bl == NULL\n");
	}
	else switch( bl->type )
	{
		case BL_PC:
			id = ((TBL_PC*)bl)->status.char_id;
			account_id = ((TBL_PC*)bl)->status.account_id;
			Sql_EscapeStringLen(logmysql_handle, esc_name, ((TBL_PC*)bl)->status.name, NAME_LENGTH);
			break;
		case BL_MOB:
			id = ((TBL_MOB*)bl)->mob_id;
			account_id = 0;
			Sql_EscapeStringLen(logmysql_handle, esc_name, ((TBL_MOB*)bl)->name, NAME_LENGTH);
			break;
		default:
			ShowDebug("log_pick: Unhandled bl type %d.\n", bl->type);
	}

	mapname = map[bl->m].name;

	if( log_config.sql_logs )
	{
#ifdef BETA_THREAD_TEST
		char entry[512];
		int e_length = 0;
		e_length = sprintf(entry, LOG_QUERY " INTO `%s` (`time`, `account_id`, `char_id`, `name`, `type`, `nameid`, `amount`, `refine`, `card0`, `card1`, `card2`, `card3`, `map`, `unique_id`, `bound`) VALUES (NOW(), '%d', '%d', '%s', '%c', '%hu', '%d', '%d', '%hu', '%hu', '%hu', '%hu', '%s', '%"PRIu64"', '%d')",
				log_config.log_pick, account_id, id, esc_name, log_picktype2char(type), itm->nameid, amount, itm->refine, itm->card[0], itm->card[1], itm->card[2], itm->card[3], mapname, itm->unique_id, itm->bound);
		queryThread_log(entry,e_length);
#else
		if( SQL_ERROR == Sql_Query(logmysql_handle, LOG_QUERY " INTO `%s` (`time`, `account_id`, `char_id`, `name`, `type`, `nameid`, `amount`, `refine`, `card0`, `card1`, `card2`, `card3`, `map`, `unique_id`, `bound`) VALUES (NOW(), '%d', '%d', '%s', '%c', '%hu', '%d', '%d', '%hu', '%hu', '%hu', '%hu', '%s', '%"PRIu64"', '%d')",
			log_config.log_pick, account_id, id, esc_name, log_picktype2char(type), itm->nameid, amount, itm->refine, itm->card[0], itm->card[1], itm->card[2], itm->card[3], mapname, itm->unique_id, itm->bound) )
		{
			Sql_ShowDebug(logmysql_handle);
			return;
		}
#endif
	}
	else
	{
		char timestring[255];
		time_t curtime;
		FILE* logfp;

		if( ( logfp = fopen(log_config.log_pick, "a") ) == NULL )
			return;
		time(&curtime);
		strftime(timestring, sizeof(timestring), "%m/%d/%Y %H:%M:%S", localtime(&curtime));
		fprintf(logfp,"%s - %d\t%c\t%hu,%d,%d,%hu,%hu,%hu,%hu,%s,'%"PRIu64"',%d\n", timestring, id, log_picktype2char(type), itm->nameid, amount, itm->refine, itm->card[0], itm->card[1], itm->card[2], itm->card[3], mapname, itm->unique_id, itm->bound);
		fclose(logfp);
	}
}
Beispiel #9
0
/// logs item transactions
void log_pick(struct block_list* bl, e_log_pick_type type, int nameid, int amount, struct item* itm)
{
	const char* mapname;
	int id = 0, account_id = 0;
	char esc_name[NAME_LENGTH*2+1] = "";

	if( ( log_config.enable_logs&type ) == 0 )
	{// disabled
		return;
	}

	if( !should_log_item(nameid, amount, itm ? itm->refine : 0) )
		return; //we skip logging this item set - it doesn't meet our logging conditions [Lupus]

	//either PLAYER or MOB (here we get map name and objects ID)
	if( bl == NULL )
	{
		ShowError("log_pick: bl == NULL\n");
	}
	else switch( bl->type )
	{
		case BL_PC:
			id = ((TBL_PC*)bl)->status.char_id;
			account_id = ((TBL_PC*)bl)->status.account_id;
			Sql_EscapeStringLen(logmysql_handle, esc_name, ((TBL_PC*)bl)->status.name, NAME_LENGTH);
			break;
		case BL_MOB:
			id = ((TBL_MOB*)bl)->class_;
			account_id = 0;
			Sql_EscapeStringLen(logmysql_handle, esc_name, ((TBL_MOB*)bl)->name, NAME_LENGTH);
			break;
		default:
			ShowDebug("log_pick: Unhandled bl type %d.\n", bl->type);
	}

	mapname = map[bl->m].name;

#ifndef TXT_ONLY
	if( log_config.sql_logs )
	{
		if( itm == NULL )
		{//We log common item
			if (type == LOG_TYPE_NPC && amount < 0) {
				if( SQL_ERROR == Sql_Query(logmysql_handle, "INSERT DELAYED INTO `%s` (`char_id`, `nameid`, `amount`) VALUES ('%d', '%d', '%d')",
					"sell_log", id, nameid, (amount*-1)) )
				{
					Sql_ShowDebug(logmysql_handle);
				}
			}
			if( SQL_ERROR == Sql_Query(logmysql_handle, "INSERT DELAYED INTO `%s` (`time`, `account_id`, `char_id`, `name`, `type`, `nameid`, `amount`, `map`) VALUES (NOW(), '%d', '%d', '%s', '%c', '%d', '%d', '%s')",
				log_config.log_pick, account_id, id, esc_name, log_picktype2char(type), nameid, amount, mapname) )
			{
				Sql_ShowDebug(logmysql_handle);
				return;
			}
		}
		else
		{//We log Extended item
			if (type == LOG_TYPE_NPC && amount < 0) {
				if( SQL_ERROR == Sql_Query(logmysql_handle, "INSERT DELAYED INTO `%s` (`char_id`, `nameid`, `amount`, `attribute`, `refine`, `card0`, `card1`, `card2`, `card3`) VALUES ('%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d')",
					"sell_log", id, nameid, (amount*-1), itm->attribute, itm->refine, itm->card[0], itm->card[1], itm->card[2], itm->card[3]) )
				{
					Sql_ShowDebug(logmysql_handle);
				}
			}			
			if( SQL_ERROR == Sql_Query(logmysql_handle, "INSERT DELAYED INTO `%s` (`time`, `account_id`, `char_id`, `name`, `type`, `nameid`, `amount`, `refine`, `card0`, `card1`, `card2`, `card3`, `map`, `serial`) VALUES (NOW(), '%d', '%d', '%s', '%c', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%s', '%u')",
				log_config.log_pick, account_id, id, esc_name, log_picktype2char(type), itm->nameid, amount, itm->refine, itm->card[0], itm->card[1], itm->card[2], itm->card[3], mapname, itm->serial) )
			{
				Sql_ShowDebug(logmysql_handle);
				return;
			}
		}
	}
	else
#endif
	{
		char timestring[255];
		time_t curtime;
		FILE* logfp;

		if( ( logfp = fopen(log_config.log_pick, "a") ) == NULL )
			return;
		time(&curtime);
		strftime(timestring, sizeof(timestring), "%m/%d/%Y %H:%M:%S", localtime(&curtime));

		if( itm == NULL )
		{//We log common item
			fprintf(logfp,"%s - %d\t%c\t%d,%d,%s\n", timestring, id, log_picktype2char(type), nameid, amount, mapname);
		}
		else
		{//We log Extended item
			fprintf(logfp,"%s - %d\t%c\t%d,%d,%d,%d,%d,%d,%d,%s\n", timestring, id, log_picktype2char(type), itm->nameid, amount, itm->refine, itm->card[0], itm->card[1], itm->card[2], itm->card[3], mapname);
		}
		fclose(logfp);
	}
}
Beispiel #10
0
/// logs item transactions (monsters)
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 (nameid, amount, itm ? itm->refine : 0))
		return; //we skip logging this item set - it doesn't meet our logging conditions [Lupus]

	//either PLAYER or MOB (here we get map name and objects ID)
	mapname = map[md->bl.m].name;

	if (mapname == NULL)
		mapname = "";

	if (log_config.sql_logs)
	{
		if (itm == NULL)
		{
			//We log common item
			if (SQL_ERROR == Sql_Query (logmysql_handle, "INSERT DELAYED INTO `%s` (`time`, `char_id`, `type`, `nameid`, `amount`, `map`) VALUES (NOW(), '%d', '%c', '%d', '%d', '%s')",
										log_config.log_pick, 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, "INSERT DELAYED 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, 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;
			}
		}
	}
	else
	{
		char timestring[255];
		time_t curtime;
		FILE *logfp;

		if ( (logfp = fopen (log_config.log_pick, "a")) == NULL)
			return;

		time (&curtime);
		strftime (timestring, sizeof (timestring), "%m/%d/%Y %H:%M:%S", localtime (&curtime));

		if (itm == NULL)
		{
			//We log common item
			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%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);
	}
}