Example #1
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
}
Example #2
0
File: log.c Project: Gubio/brAthena
void log_buyingstore_sub_sql (struct map_session_data* bsd,struct map_session_data* vsd,struct item *itm, int zeny,int amount){
	char ip_bsd[20] ="AutoTrade", ip_vsd[20];
	struct item_data *idata = itemdb->search(itm->nameid);

	if(!logs->should_log_item(itm->nameid, amount, itm->refine, idata))
		return;
	
	pc->get_ip(vsd,ip_vsd);
	if(!bsd->state.autotrade)
		pc->get_ip(bsd,ip_bsd);

	if( SQL_ERROR == SQL->Query(logs->mysql_handle, LOG_QUERY " INTO `buyingstore_log`"
	"(`Date`, `Mapname`,`Shop_Name`,"
	"`Buyer_CharID`,`Buyer_Name`,`Buyer_IP`,`Buyer_PosX`,`Buyer_PosY`,"
	"`Vendor_CharID`,`Vendor_Name`,`Vendor_IP`,"
	"`ItemID`,`ItemName`,`Amount`,`Unit_Cost`,`Total_Cost`,`ItemSerial`,`ItemSlot1`,`ItemSlot2`,`ItemSlot3`,`ItemSlot4`,`ItemRefiningLevel`)"
	"VALUES (NOW(),'%s','%s', '%d','%s','%s','%d','%d',"
					"'%d','%s','%s',"
	"'%d','%s','%d','%d','%d','%"PRIu64"','%d','%d','%d','%d','%d')",
	mapindex_id2name(vsd->mapindex),bsd->message,bsd->status.char_id,bsd->status.name,ip_bsd,bsd->bl.x, bsd->bl.y,
	vsd->status.char_id,vsd->status.name,ip_vsd,
	itm->nameid,idata->name,amount,zeny,zeny*amount,itm->unique_id,
	itm->card[0],itm->card[1],itm->card[2],itm->card[3],itm->refine))
	
	{
		Sql_ShowDebug(logs->mysql_handle);
		return;
	}	
}
Example #3
0
File: log.c Project: Gubio/brAthena
void log_item_getrem_sub_sql  (int tp,struct map_session_data* sd,struct item* itm,int amount,char * type){
	char ip_sd[20],type_[4];
	struct item_data *idata = itemdb->search(itm->nameid);
	
	if(!logs->should_log_item(itm->nameid, amount, itm->refine, idata))
		return;	
	
	pc->get_ip(sd,ip_sd);
	switch(tp){
		case 0:
			strcpy(type_,"Del");
			break;
		case 1:
			strcpy(type_,"Get");
			break;
		default:
			return;
	}
	if( SQL_ERROR == SQL->Query(logs->mysql_handle, LOG_QUERY " INTO `item_get_removelog`"
	"(`Date`,`Type_`,`Source`, `Mapname`,`PosX`,`PosY`,`AccountID`,`CharID`,`CharName`,`CharIP`,"
	"`ItemID`,`ItemName`,`Amount`,`ItemSerial`,`ItemSlot1`,`ItemSlot2`,`ItemSlot3`,`ItemSlot4`,`ItemRefiningLevel`)"
	"VALUES (NOW(),'%s','%s', '%s','%d','%d','%d','%d','%s','%s',"
	"'%d','%s','%d','%"PRIu64"','%d','%d','%d','%d','%d')",
	type_,type,mapindex_id2name(sd->mapindex),sd->bl.x,sd->bl.y,sd->status.account_id,sd->status.char_id,sd->status.name,ip_sd,
	itm->nameid,idata->name,amount,itm->unique_id,itm->card[0],itm->card[1],itm->card[2],itm->card[3],itm->refine))	
	{
		Sql_ShowDebug(logs->mysql_handle);
		return;
	}	
	
}
Example #4
0
File: log.c Project: Gubio/brAthena
void log_trade_sub_sql(int zeny, struct map_session_data* sd1, struct map_session_data* sd2,struct item *itm,int amount){
	char last_ip1[20], last_ip2[20];
	struct item_data *idata = (itm)? itemdb->search(itm->nameid) : NULL;
	
	if(itm && !logs->should_log_item(itm->nameid, amount, itm->refine, idata))
		return;
	
	pc->get_ip(sd1,last_ip1);
	pc->get_ip(sd2,last_ip2);
	
	if( SQL_ERROR == SQL->Query(logs->mysql_handle, LOG_QUERY " INTO `trade_log`"
	"(`Date`, `Mapname`,"
	"`P1_CharID`,`P1_Name`,`P1_PosX`,`P1_PosY`,`P1_IP`,"
	"`P2_CharID`,`P2_Name`,`P2_PosX`,`P2_PosY`,`P2_IP`,"
	"`Zeny`,`ItemID`,`ItemCount`,`ItemName`,`ItemSerial`,`ItemSlot1`,`ItemSlot2`,`ItemSlot3`,`ItemSlot4`,`ItemRefiningLevel`)"
	"VALUES (NOW(),'%s', '%d','%s','%d','%d','%s',"
					"'%d','%s','%d','%d','%s',"
	"'%d','%d','%d','%s','%"PRIu64"','%d','%d','%d','%d','%d')",
	mapindex_id2name(sd1->mapindex), sd1->status.char_id,sd1->status.name, sd1->bl.x, sd1->bl.y,last_ip1,
	sd2->status.char_id,sd2->status.name, sd2->bl.x, sd2->bl.y,last_ip2,
	zeny,(itm)? itm->nameid : 0,amount,(itm)? idata->name:"",(itm)? itm->unique_id :0,
	(itm)? itm->card[0] : 0,(itm)? itm->card[1] : 0,(itm)? itm->card[2] : 0,(itm)? itm->card[3] : 0,(itm)? itm->refine : 0))
	
	{
		Sql_ShowDebug(logs->mysql_handle);
		return;
	}
	
}
Example #5
0
File: log.c Project: Gubio/brAthena
void log_cash_buy_sub_sql (struct map_session_data* sd,char * type,char * npc_name,struct item* itm , int amount,int price){
	struct item_data *i_data;
	int tcost= price * amount;
	char* sql_data,account_name[23], last_ip[20];
	i_data = itemdb->exists(itm->nameid);
	
	if(i_data == NULL)
		return;
	
	// Time to get Acc Name and Ip Info from login table.
	if( SQL_ERROR == SQL->Query(map->mysql_handle,"SELECT `userid` ,`last_ip` FROM `login`  WHERE `account_id` ='%d'",sd->status.account_id)){
		Sql_ShowDebug(map->mysql_handle);
		return;		
	}
	if( SQL_SUCCESS != SQL->NextRow(map->mysql_handle) )
	{	
        Sql_ShowDebug(map->mysql_handle);
		return;
	}

	SQL->GetData(map->mysql_handle,  0, &sql_data, NULL); 
	safestrncpy(account_name,sql_data,sizeof(account_name));
	SQL->GetData(map->mysql_handle,  1, &sql_data, NULL); 
	safestrncpy(last_ip,sql_data,sizeof(last_ip));
	
	if( SQL_ERROR == SQL->Query(logs->mysql_handle, LOG_QUERY " INTO `cashitemshop` (`Date`, `Mapname`, `AccountID`, `AccountName`,`CharacterID`,`CharacterIPaddr`,`Type`,`PosX`,`PosY`,`NpcName`,`ItemID`,`ItemName`,`ItemCount`,`ItemSerial`,`ItemSlot1`,`ItemSlot2`,`ItemSlot3`,`ItemSlot4`,`ItemRefiningLevel`,`Cash_Price`,`Cash_View`,`Cash_Before`,`Cash_After`)"
	"VALUES (NOW(), '%s','%d','%s','%d','%s','%s','%d','%d','%s','%d','%s','%d','%"PRIu64"','%d','%d','%d','%d','%d','%d','%d','%d','%d')",
	mapindex_id2name(sd->mapindex), sd->status.account_id, account_name, sd->status.char_id, last_ip, type, sd->bl.x, sd->bl.y, npc_name, itm->nameid, i_data->name, amount, itm->unique_id, itm->card[0], itm->card[1], itm->card[2], itm->card[3], itm->refine, price, tcost, sd->cashPoints + tcost, sd->cashPoints))
	{
		Sql_ShowDebug(logs->mysql_handle);
		return;
	}

	
}
Example #6
0
File: log.c Project: Gubio/brAthena
void log_gstorage_sub_sql (struct map_session_data* sd,struct item* itm, int amount,char type){
	char ip_sd[20];
	struct item_data *idata = itemdb->search(itm->nameid);

	if(!logs->should_log_item(itm->nameid, amount, itm->refine, idata))
		return;
	
	pc->get_ip(sd,ip_sd);
	if( SQL_ERROR == SQL->Query(logs->mysql_handle, LOG_QUERY " INTO `guild_storage_log`"
	"(`Date`,`Type_`,`Mapname`,`PosX`,`PosY`,`GuildID`,`GuildName`,`AccountID`,`CharacterID`,`CharName`,"
	"`CharacterIPaddr`,`ItemID`,`ItemName`,`ItemSerial`,`Amount`,`ItemSlot1`,"
	"`ItemSlot2`,`ItemSlot3`,`ItemSlot4`,`ItemRefiningLevel`)"
	"VALUES (NOW(),'%c','%s', '%d','%d','%d','%s','%d','%d','%s',"
	"'%s','%d','%s','%"PRIu64"','%d','%d','%d','%d','%d','%d')",
	type,mapindex_id2name(sd->mapindex),sd->bl.x, sd->bl.y,	sd->guild->guild_id,
	sd->guild->name,sd->status.account_id,
	sd->status.char_id,sd->status.name,ip_sd,
	itm->nameid,idata->name,itm->unique_id,amount,itm->card[0],itm->card[1],
	itm->card[2],itm->card[3],itm->refine))
	{
		Sql_ShowDebug(logs->mysql_handle);
		return;
	}		
	return;	
}
Example #7
0
/// logs MVP monster rewards
void log_mvpdrop(struct map_session_data* sd, int monster_id, int* log_mvp)
{
	nullpo_retv(sd);

	if( !log_config.mvpdrop )
		return;

#ifndef TXT_ONLY
	if( log_config.sql_logs )
	{
		if( SQL_ERROR == Sql_Query(logmysql_handle, "INSERT DELAYED INTO `%s` (`mvp_date`, `kill_char_id`, `monster_id`, `prize`, `mvpexp`, `map`) VALUES (NOW(), '%d', '%d', '%d', '%d', '%s') ",
			log_config.log_mvpdrop, sd->status.char_id, monster_id, log_mvp[0], log_mvp[1], 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_mvpdrop,"a") ) == NULL )
			return;
		time(&curtime);
		strftime(timestring, sizeof(timestring), "%m/%d/%Y %H:%M:%S", localtime(&curtime));
		fprintf(logfp,"%s - %s[%d:%d]\t%d\t%d,%d\n", timestring, sd->status.name, sd->status.account_id, sd->status.char_id, monster_id, log_mvp[0], log_mvp[1]);
		fclose(logfp);
	}
}
Example #8
0
/** Open buyingstore for Autotrader
 * @param sd Player as autotrader
 */
void buyingstore_reopen(struct map_session_data* sd) {
	// Ready to open buyingstore for this char
	if( sd && autotrader_count > 0 && autotraders ) {
		uint16 i;
		uint8 *data, *p;
		uint16 j, count;

		ARR_FIND(0, autotrader_count, i, autotraders[i] && autotraders[i]->char_id == sd->status.char_id);
		if( i >= autotrader_count )
			return;

		// Init buyingstore data for autotrader
		CREATE(data, uint8, autotraders[i]->count * 8);

		for( j = 0, p = data, count = autotraders[i]->count; j < autotraders[i]->count; j++ ) {
			struct s_autotrade_entry *entry = autotraders[i]->entries[j];
			uint16 *item_id = (uint16*)(p + 0);
			uint16 *amount = (uint16*)(p + 2);
			uint32 *price = (uint32*)(p + 4);

			*item_id = entry->item_id;
			*amount = entry->amount;
			*price = entry->price;

			p += 8;
		}

		// Open the buyingstore again
		if( buyingstore_setup(sd, (unsigned char)autotraders[i]->count) &&
			buyingstore_create(sd, autotraders[i]->limit, 1, autotraders[i]->title, data, autotraders[i]->count) )
		{
			ShowInfo("Loaded autotrade buyingstore data for '"CL_WHITE"%s"CL_RESET"' with '"CL_WHITE"%d"CL_RESET"' items at "CL_WHITE"%s (%d,%d)"CL_RESET"\n",
				sd->status.name, count, mapindex_id2name(sd->mapindex), sd->bl.x, sd->bl.y);

			// Set him to autotrade
			if( Sql_Query(mmysql_handle, "UPDATE `%s` SET `autotrade` = 1 WHERE `id` = %d;",
				buyingstore_db, sd->buyer_id) != SQL_SUCCESS )
				Sql_ShowDebug(mmysql_handle);

			// Make him look perfect
			unit_setdir(&sd->bl, battle_config.feature_autotrade_direction);

			if( battle_config.feature_autotrade_sit )
				pc_setsit(sd);
		} else {
			// Failed to open the buyingstore, set him offline
			ShowWarning("Failed to load autotrade buyingstore data for '"CL_WHITE"%s"CL_RESET"' with '"CL_WHITE"%d"CL_RESET"' items\n", sd->status.name, count);
			map_quit(sd);
		}

		aFree(data);

		// If the last autotrade is loaded, clear autotraders [Cydh]
		if( i + 1 >= autotrader_count )
			do_final_buyingstore_autotrade();
	}
}
Example #9
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
}
Example #10
0
struct guild_castle *guild_mapindex2gc(short mapname)
{
	int i;
	struct guild_castle *gc=NULL;
	for(i=0;i<MAX_GUILDCASTLE;i++){
		gc=guild_castle_search(i);
		if(!gc) continue;
		if(strcmp(gc->map_name,mapindex_id2name(mapname))==0) return gc;
	}
	return NULL;
}
Example #11
0
int party_send_message(struct map_session_data *sd,const char *mes,int len)
{
	if(sd->status.party_id==0)
		return 0;
	intif_party_message(sd->status.party_id,sd->status.account_id,mes,len);
	party_recv_message(sd->status.party_id,sd->status.account_id,mes,len);

	// Chat logging type 'P' / Party Chat
	if( log_config.chat&1 || (log_config.chat&8 && !(agit_flag && log_config.chat&64)) )
		log_chat("P", sd->status.party_id, sd->status.char_id, sd->status.account_id, mapindex_id2name(sd->mapindex), sd->bl.x, sd->bl.y, NULL, mes);

	return 0;
}
Example #12
0
File: log.c Project: Gubio/brAthena
void log_produce_sub_sql (struct map_session_data* sd,struct item* itm, int amount,char * type){
	char ip_sd[20], type_inf[20];
	pc->get_ip(sd,ip_sd);
	safestrncpy(type_inf,type,20);
	

	if(!itm){
		if( SQL_ERROR == SQL->Query(logs->mysql_handle, LOG_QUERY " INTO `itemproduce_log`"
		"(`Date`, `Mapname`,`PosX`,`PosY`,`CharacterID`,`CharName`,"
		"`CharacterIPaddr`,`Type_`)"
		"VALUES (NOW(),'%s','%d', '%d','%d','%s',"
						"'%s','%s')",
		mapindex_id2name(sd->mapindex),sd->bl.x, sd->bl.y,sd->status.char_id,sd->status.name,
		ip_sd,type_inf))
		{
			Sql_ShowDebug(logs->mysql_handle);
			return;
		}		
	}
	else{
		struct item_data* idata = itemdb->exists(itm->nameid);

		if (!logs->should_log_item(itm->nameid, amount, itm->refine, idata))
			return;

		if( SQL_ERROR == SQL->Query(logs->mysql_handle, LOG_QUERY " INTO `itemproduce_log`"
		"(`Date`, `Mapname`,`PosX`,`PosY`,`CharacterID`,`CharName`,"
		"`CharacterIPaddr`,`ItemID`,`ItemName`,`ItemSerial`,`Amount`,`Type_`)"
		"VALUES (NOW(),'%s','%d', '%d','%d','%s',"
						"'%s','%d','%s','%"PRIu64"','%d','%s')",
		mapindex_id2name(sd->mapindex),sd->bl.x, sd->bl.y,sd->status.char_id,sd->status.name,
		ip_sd,itm->nameid,idata->name,itm->unique_id,amount,type_inf))
		{
			Sql_ShowDebug(logs->mysql_handle);
			return;
		}
	}
}
Example #13
0
// ギルド会話送信
int guild_send_message(struct map_session_data *sd,const char *mes,int len)
{
	nullpo_retr(0, sd);

	if(sd->status.guild_id==0)
		return 0;
	intif_guild_message(sd->status.guild_id,sd->status.account_id,mes,len);
	guild_recv_message(sd->status.guild_id,sd->status.account_id,mes,len);

	// Chat logging type 'G' / Guild Chat
	if( log_config.chat&1 || (log_config.chat&16 && !((agit_flag || agit2_flag) && log_config.chat&64)) )
		log_chat("G", sd->status.guild_id, sd->status.char_id, sd->status.account_id, mapindex_id2name(sd->mapindex), sd->bl.x, sd->bl.y, NULL, mes);

	return 0;
}
Example #14
0
File: log.c Project: Gubio/brAthena
void log_card_sub_sql( struct map_session_data* sd,int slot,char * type, struct item* itm){
	char last_ip[20];
	struct item_data *data = itemdb->exists(itm->nameid);
	struct item_data *cd_data = itemdb->exists(itm->card[slot]);

	if( !logs->should_log_item(itm->nameid, 1, itm->refine, data) && !logs->should_log_item(itm->card[slot], 1,0,cd_data))
		return; 
	
	pc->get_ip(sd,last_ip);
	
	if( SQL_ERROR == SQL->Query(logs->mysql_handle, LOG_QUERY " INTO `card_log` (`Date`, `Mapname`,`PosX`,`PosY`, `AccountID`,`CharacterID`,`CharName`,`CharacterIPaddr`,`ItemID`,`ItemName`,`ItemSerial`,`Type`,`Slot`,`Card_ID`,`CardName`,`ItemSlot1`,`ItemSlot2`,`ItemSlot3`,`ItemSlot4`,`ItemRefiningLevel`)"
	"VALUES (NOW(), '%s','%d','%d','%d','%d','%s','%s','%d','%s','%"PRIu64"','%s','%d','%d','%s','%d','%d','%d','%d','%d')",
	mapindex_id2name(sd->mapindex), sd->bl.x, sd->bl.y, sd->status.account_id, sd->status.char_id,sd->status.name,last_ip,itm->nameid,
	data->name,itm->unique_id,type,slot, itm->card[slot],cd_data->name, itm->card[0], itm->card[1], itm->card[2], itm->card[3], itm->refine))
	{
		Sql_ShowDebug(logs->mysql_handle);
		return;
	}
}
Example #15
0
/// logs MVP monster rewards
void log_mvpdrop(struct map_session_data* sd, int monster_id, int* log_mvp)
{
	nullpo_retv(sd);

	if( !log_config.mvpdrop )
		return;

	if( log_config.sql_logs )
	{
#ifdef BETA_THREAD_TEST
		char entry[512];
		int e_length = 0;
		e_length = sprintf(entry,  LOG_QUERY " INTO `%s` (`mvp_date`, `kill_char_id`, `monster_id`, `prize`, `mvpexp`, `map`) VALUES (NOW(), '%d', '%d', '%d', '%d', '%s') ",
						   log_config.log_mvpdrop, sd->status.char_id, monster_id, log_mvp[0], log_mvp[1], mapindex_id2name(sd->mapindex));
		queryThread_log(entry,e_length);
#else
		if( SQL_ERROR == Sql_Query(logmysql_handle, LOG_QUERY " INTO `%s` (`mvp_date`, `kill_char_id`, `monster_id`, `prize`, `mvpexp`, `map`) VALUES (NOW(), '%d', '%d', '%d', '%d', '%s') ",
			log_config.log_mvpdrop, sd->status.char_id, monster_id, log_mvp[0], log_mvp[1], mapindex_id2name(sd->mapindex)) )
		{
			Sql_ShowDebug(logmysql_handle);
			return;
		}
#endif
	}
	else
	{
		char timestring[255];
		time_t curtime;
		FILE* logfp;

		if( ( logfp = fopen(log_config.log_mvpdrop,"a") ) == NULL )
			return;
		time(&curtime);
		strftime(timestring, sizeof(timestring), "%m/%d/%Y %H:%M:%S", localtime(&curtime));
		fprintf(logfp,"%s - %s[%d:%d]\t%d\t%d,%d\n", timestring, sd->status.name, sd->status.account_id, sd->status.char_id, monster_id, log_mvp[0], log_mvp[1]);
		fclose(logfp);
	}
}
Example #16
0
File: log.c Project: Gubio/brAthena
void log_npc_shop_sub_sql (struct map_session_data* sd,char * name, struct item* itm , int unit_cost, int amount, int type){
	char ip_sd[20], action[5];
	struct item_data* idata = itemdb->exists(itm->nameid);
	nullpo_retv(idata);
	pc->get_ip(sd,ip_sd);
	
	if(!logs->should_log_item(itm->nameid, amount, itm->refine, idata))
		return;
	
	switch(type){
		case LOG_ACTION_GET:
			strcpy(action,"Buy");
			break;
		case LOG_ACTION_DROP:
			strcpy(action,"Sell");
			break;		
		default:
			strcpy(action,"Unknown");
			break;
	}
	if( SQL_ERROR == SQL->Query(logs->mysql_handle, LOG_QUERY " INTO `npcshop_log`"
	"(`Date`, `Mapname`,"
	"`NPC_Name`,`Player_CharID`,`Player_Name`,`Player_IP`,`Player_PosX`,`Player_PosY`,`Player_Action`,"
	"`ItemID`,`ItemName`,`Amount`,`Unit_Cost`,`Total_Cost`,`ItemSerial`,"
	"`Slots`,`ItemRefiningLevel`)"
	"VALUES (NOW(),'%s','%s', '%d','%s','%s','%d','%d','%s',"
	"'%d','%s','%d','%d','%d','%"PRIu64"',"
	"'%d','%d')",
	mapindex_id2name(sd->mapindex),name, sd->status.char_id,sd->status.name,ip_sd,sd->bl.x, sd->bl.y,action,
	itm->nameid,idata->name,amount,unit_cost,amount*unit_cost,itm->unique_id,
	idata->slot,itm->refine))	
	{
		Sql_ShowDebug(logs->mysql_handle);
		return;
	}
	
}
Example #17
0
int party_send_message(struct map_session_data *sd,const char *mes,int len)
{
	if(sd->status.party_id == 0)
		return 0;
	intif_party_message(sd->status.party_id,sd->status.account_id,mes,len);
	party_recv_message(sd->status.party_id,sd->status.account_id,mes,len);

	// Chat logging type 'P' / Party Chat
	log_chat(LOG_CHAT_PARTY, sd->status.party_id, sd->status.char_id, sd->status.account_id, mapindex_id2name(sd->mapindex), sd->bl.x, sd->bl.y, NULL, mes);

	return 0;
}
Example #18
0
/**
* Open buyingstore for Autotrader
* @param sd Player as autotrader
*/
void buyingstore_reopen( struct map_session_data* sd ){
	nullpo_retv(sd);

	// Ready to open buyingstore for this char
	if ( autotrader_count > 0 && autotraders){
		uint16 i;
		uint8 *data, *p, fail = 0;
		uint16 j, count;

		ARR_FIND(0,autotrader_count,i,autotraders[i] && autotraders[i]->char_id == sd->status.char_id);
		if (i >= autotrader_count) {
			return;
		}
		
		// Init buyingstore data for autotrader
		CREATE(data, uint8, autotraders[i]->count * 8);

		for (j = 0, p = data, count = autotraders[i]->count; j < autotraders[i]->count; j++) {
			struct s_autotrade_entry *entry = autotraders[i]->entries[j];
			unsigned short *item_id = (uint16*)(p + 0);
			uint16 *amount = (uint16*)(p + 2);
			uint32 *price = (uint32*)(p + 4);

			*item_id = entry->item_id;
			*amount = entry->amount;
			*price = entry->price;

			p += 8;
		}

		// Make sure abort all NPCs
		npc_event_dequeue(sd);
		pc_cleareventtimer(sd);

		// Open the buyingstore again
		if( (fail = buyingstore_setup( sd, (unsigned char)autotraders[i]->count )) == 0 &&
			(fail = buyingstore_create( sd, autotraders[i]->limit, 1, autotraders[i]->title, data, autotraders[i]->count )) == 0 )
		{
			ShowInfo("Loaded buyingstore for '"CL_WHITE"%s"CL_RESET"' with '"CL_WHITE"%d"CL_RESET"' items at "CL_WHITE"%s (%d,%d)"CL_RESET"\n",
				sd->status.name, count, mapindex_id2name(sd->mapindex), sd->bl.x, sd->bl.y);

			// Set him to autotrade
			if (Sql_Query( mmysql_handle, "UPDATE `%s` SET `autotrade` = 1, `body_direction` = '%d', `head_direction` = '%d', `sit` = '%d' "
				"WHERE `id` = %d;",
				buyingstores_db, autotraders[i]->dir, autotraders[i]->head_dir, autotraders[i]->sit, sd->buyer_id ) != SQL_SUCCESS )
			{
				Sql_ShowDebug( mmysql_handle );
			}

			// Make buyer look perfect
			pc_setdir(sd, autotraders[i]->dir, autotraders[i]->head_dir);
			clif_changed_dir(&sd->bl, AREA_WOS);
			if( autotraders[i]->sit ) {
				pc_setsit(sd);
				skill_sit(sd, 1);
				clif_sitting(&sd->bl);
			}

			// Immediate save
			chrif_save(sd, 3);
		}else{
			// Failed to open the buyingstore, set him offline
			ShowError("Failed (%d) to load autotrade buyingstore data for '"CL_WHITE"%s"CL_RESET"' with '"CL_WHITE"%d"CL_RESET"' items\n", fail, sd->status.name, count );

			map_quit( sd );
		}

		aFree(data);

		//If the last autotrade is loaded, clear autotraders [Cydh]
		if (++autotrader_loaded_count >= autotrader_count)
			do_final_buyingstore_autotrade();
	}
}
Example #19
0
/**
* Open buyingstore for Autotrader
* @param sd Player as autotrader
*/
void buyingstore_reopen( struct map_session_data* sd ){
	struct s_autotrader *at = NULL;
	int8 fail = -1;

	nullpo_retv(sd);

	// Ready to open buyingstore for this char
	if ((at = (struct s_autotrader *)uidb_get(buyingstore_autotrader_db, sd->status.char_id)) && at->count && at->entries) {
		uint8 *data, *p;
		uint16 j, count;

		// Init buyingstore data for autotrader
		CREATE(data, uint8, at->count * 8);

		for (j = 0, p = data, count = at->count; j < at->count; j++) {
			struct s_autotrade_entry *entry = at->entries[j];
			unsigned short *item_id = (uint16*)(p + 0);
			uint16 *amount = (uint16*)(p + 2);
			uint32 *price = (uint32*)(p + 4);

			*item_id = entry->item_id;
			*amount = entry->amount;
			*price = entry->price;

			p += 8;
		}

		sd->state.autotrade = 1;

		// Make sure abort all NPCs
		npc_event_dequeue(sd);
		pc_cleareventtimer(sd);

		// Open the buyingstore again
		if( (fail = buyingstore_setup( sd, (unsigned char)at->count )) == 0 &&
			(fail = buyingstore_create( sd, at->limit, 1, at->title, data, at->count, at )) == 0 )
		{
			// Make buyer look perfect
			pc_setdir(sd, at->dir, at->head_dir);
			clif_changed_dir(&sd->bl, AREA_WOS);
			if( at->sit ) {
				pc_setsit(sd);
				skill_sit(sd, 1);
				clif_sitting(&sd->bl);
			}

			// Immediate save
			chrif_save(sd, CSAVE_AUTOTRADE);

			ShowInfo("Buyingstore loaded for '"CL_WHITE"%s"CL_RESET"' with '"CL_WHITE"%d"CL_RESET"' items at "CL_WHITE"%s (%d,%d)"CL_RESET"\n",
				sd->status.name, count, mapindex_id2name(sd->mapindex), sd->bl.x, sd->bl.y);
		}
		aFree(data);
	}

	if (at) {
		buyingstore_autotrader_remove(at, true);
		if (db_size(buyingstore_autotrader_db) == 0)
			buyingstore_autotrader_db->clear(buyingstore_autotrader_db, buyingstore_autotrader_free);
	}

	if (fail != 0) {
		ShowError("buyingstore_reopen: (Error:%d) Load failed for autotrader '"CL_WHITE"%s"CL_RESET"' (CID=%/AID=%d)\n", fail, sd->status.name, sd->status.char_id, sd->status.account_id);
		map_quit(sd);
	}
}
Example #20
0
void log_branch_sub_sql(struct map_session_data* sd) {
	SqlStmt* stmt;
	stmt = SQL->StmtMalloc(logs->mysql_handle);
	if( SQL_SUCCESS != SQL->StmtPrepare(stmt, LOG_QUERY " INTO `%s` (`branch_date`, `account_id`, `char_id`, `char_name`, `map`) VALUES (NOW(), '%d', '%d', ?, '%s')", logs->config.log_branch, sd->status.account_id, sd->status.char_id, mapindex_id2name(sd->mapindex) )
	   ||  SQL_SUCCESS != SQL->StmtBindParam(stmt, 0, SQLDT_STRING, sd->status.name, strnlen(sd->status.name, NAME_LENGTH))
	   ||  SQL_SUCCESS != SQL->StmtExecute(stmt) )
	{
		SqlStmt_ShowDebug(stmt);
		SQL->StmtFree(stmt);
		return;
	}
	SQL->StmtFree(stmt);
}
Example #21
0
void log_mvpdrop_sub_sql(struct map_session_data* sd, int monster_id, int* log_mvp) {
	if( SQL_ERROR == SQL->Query(logs->mysql_handle, LOG_QUERY " INTO `%s` (`mvp_date`, `kill_char_id`, `monster_id`, `prize`, `mvpexp`, `map`) VALUES (NOW(), '%d', '%d', '%d', '%d', '%s') ",
							   logs->config.log_mvpdrop, sd->status.char_id, monster_id, log_mvp[0], log_mvp[1], mapindex_id2name(sd->mapindex)) )
	{
		Sql_ShowDebug(logs->mysql_handle);
		return;
	}
}
Example #22
0
void log_zeny_sub_sql(struct map_session_data* sd, e_log_pick_type type, struct map_session_data* src_sd, int amount) {
	if( SQL_ERROR == SQL->Query(logs->mysql_handle, LOG_QUERY " INTO `%s` (`time`, `char_id`, `src_id`, `type`, `amount`, `map`) VALUES (NOW(), '%d', '%d', '%c', '%d', '%s')",
							   logs->config.log_zeny, sd->status.char_id, src_sd->status.char_id, logs->picktype2char(type), amount, mapindex_id2name(sd->mapindex)) )
	{
		Sql_ShowDebug(logs->mysql_handle);
		return;
	}
}
Example #23
0
/// logs cash transactions
void log_cash( struct map_session_data* sd, e_log_pick_type type, e_log_cash_type cash_type, int amount ){
	nullpo_retv( sd );

	if( !log_config.cash )
		return;

	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`, `cash_type`, `amount`, `map` ) VALUES ( NOW(), '%d', '%c', '%c', '%d', '%s' )",
			log_config.log_cash, sd->status.char_id, log_picktype2char( type ), log_cashtype2char( cash_type ), amount, mapindex_id2name( sd->mapindex ) );
		queryThread_log( entry, e_length );
#else
		if( SQL_ERROR == Sql_Query( logmysql_handle, LOG_QUERY " INTO `%s` ( `time`, `char_id`, `type`, `cash_type`, `amount`, `map` ) VALUES ( NOW(), '%d', '%c', '%c', '%d', '%s' )",
			log_config.log_cash, sd->status.char_id, log_picktype2char( type ), log_cashtype2char( cash_type ), amount, mapindex_id2name( sd->mapindex ) ) )
		{
			Sql_ShowDebug( logmysql_handle );
			return;
		}
#endif
	}else{
		char timestring[255];
		time_t curtime;
		FILE* logfp;

		if( ( logfp = fopen( log_config.log_cash, "a" ) ) == NULL )
			return;
		time( &curtime );
		strftime( timestring, sizeof( timestring ), "%m/%d/%Y %H:%M:%S", localtime( &curtime ) );
		fprintf( logfp, "%s - %s[%d]\t%d(%c)\t\n", timestring, sd->status.name, sd->status.account_id, amount, log_cashtype2char( cash_type ) );
		fclose( logfp );
	}
}
Example #24
0
/**
* Open vending for Autotrader
* @param sd Player as autotrader
*/
void vending_reopen( struct map_session_data* sd ){
	nullpo_retv(sd);

	// Ready to open vending for this char
	if ( autotrader_count > 0 && autotraders){
		uint16 i;
		uint8 *data, *p, fail = 0;
		uint16 j, count;

		ARR_FIND(0,autotrader_count,i,autotraders[i] && autotraders[i]->char_id == sd->status.char_id);
		if (i >= autotrader_count) {
			return;
		}
		
		// Init vending data for autotrader
		CREATE(data, uint8, autotraders[i]->count * 8);

		for (j = 0, p = data, count = autotraders[i]->count; j < autotraders[i]->count; j++) {
			struct s_autotrade_entry *entry = autotraders[i]->entries[j];
			uint16 *index = (uint16*)(p + 0);
			uint16 *amount = (uint16*)(p + 2);
			uint32 *value = (uint32*)(p + 4);

			// Find item position in cart
			ARR_FIND(0, MAX_CART, entry->index, sd->status.cart[entry->index].id == entry->cartinventory_id);

			if (entry->index == MAX_CART) {
				count--;
				continue;
			}

			*index = entry->index + 2;
			*amount = itemdb_isstackable(sd->status.cart[entry->index].nameid) ? entry->amount : 1;
			*value = entry->price;

			p += 8;
		}

		// Set him into a hacked prevend state
		sd->state.prevend = 1;

		// Make sure abort all NPCs
		npc_event_dequeue(sd);
		pc_cleareventtimer(sd);

		// Open the vending again
		if( (fail = vending_openvending(sd, autotraders[i]->title, data, count)) == 0 ){
			// Set him to autotrade
			if (Sql_Query( mmysql_handle, "UPDATE `%s` SET `autotrade` = 1, `body_direction` = '%d', `head_direction` = '%d', `sit` = '%d' "
				"WHERE `id` = %d;",
				vendings_db, autotraders[i]->dir, autotraders[i]->head_dir, autotraders[i]->sit, sd->vender_id ) != SQL_SUCCESS )
			{
				Sql_ShowDebug( mmysql_handle );
			}

			// Make vendor look perfect
			pc_setdir(sd, autotraders[i]->dir, autotraders[i]->head_dir);
			clif_changed_dir(&sd->bl, AREA_WOS);
			if( autotraders[i]->sit ) {
				pc_setsit(sd);
				skill_sit(sd, 1);
				clif_sitting(&sd->bl);
			}

			// Immediate save
			chrif_save(sd, 3);

			ShowInfo("Loaded vending for '"CL_WHITE"%s"CL_RESET"' with '"CL_WHITE"%d"CL_RESET"' items at "CL_WHITE"%s (%d,%d)"CL_RESET"\n",
				sd->status.name, count, mapindex_id2name(sd->mapindex), sd->bl.x, sd->bl.y);
		}else{
			// Failed to open the vending, set him offline
			ShowError("Failed (%d) to load autotrade vending data for '"CL_WHITE"%s"CL_RESET"' with '"CL_WHITE"%d"CL_RESET"' items\n", fail, sd->status.name, count );

			map_quit( sd );
		}

		aFree(data);

		//If the last autotrade is loaded, clear autotraders [Cydh]
		if (++autotrader_loaded_count >= autotrader_count)
			do_final_vending_autotrade();
	}
}
Example #25
0
/**
 * Log feeding activity
 * @param sd Player, feeder
 * @param type Log type, @see e_log_feeding_type
 * @param nameid Item used as food
 **/
void log_feeding(struct map_session_data *sd, e_log_feeding_type type, unsigned short nameid) {
	unsigned int target_id = 0, intimacy = 0;
	unsigned short target_class = 0;

	nullpo_retv( sd );

	if (!(log_config.feeding&type))
		return;

	switch (type) {
		case LOG_FEED_HOMUNCULUS:
			if (sd->hd) {
				target_id = sd->hd->homunculus.hom_id;
				target_class = sd->hd->homunculus.class_;
				intimacy = sd->hd->homunculus.intimacy;
			}
			break;
		case LOG_FEED_PET:
			if (sd->pd) {
				target_id = sd->pd->pet.pet_id;
				target_class = sd->pd->pet.class_;
				intimacy = sd->pd->pet.intimate;
			}
			break;
	}

	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`, `target_id`, `target_class`, `type`, `intimacy`, `item_id`, `map`, `x`, `y`) VALUES ( NOW(), '%"PRIu32"', '%"PRIu32"', '%hu', '%c', '%"PRIu32"', '%hu', '%s', '%hu', '%hu' )",
			log_config.log_feeding, sd->status.char_id, target_id, target_class, log_feedingtype2char(type), intimacy, nameid, mapindex_id2name(sd->mapindex), sd->bl.x, sd->bl.y);
		queryThread_log(entry, e_length);
#else
		if (SQL_ERROR == Sql_Query(logmysql_handle, LOG_QUERY " INTO `%s` (`time`, `char_id`, `target_id`, `target_class`, `type`, `intimacy`, `item_id`, `map`, `x`, `y`) VALUES ( NOW(), '%"PRIu32"', '%"PRIu32"', '%hu', '%c', '%"PRIu32"', '%hu', '%s', '%hu', '%hu' )",
			log_config.log_feeding, sd->status.char_id, target_id, target_class, log_feedingtype2char(type), intimacy, nameid, mapindex_id2name(sd->mapindex), sd->bl.x, sd->bl.y))
		{
			Sql_ShowDebug(logmysql_handle);
			return;
		}
#endif
	} else {
		char timestring[255];
		time_t curtime;
		FILE* logfp;

		if ((logfp = fopen(log_config.log_feeding, "a")) == NULL)
			return;
		time(&curtime);
		strftime(timestring, sizeof(timestring), log_timestamp_format, localtime(&curtime));
		fprintf(logfp, "%s - %s[%d]\t%d\t%d(%c)\t%d\t%hu\t%s\t%hu,%hu\n", timestring, sd->status.name, sd->status.char_id, target_id, target_class, log_feedingtype2char(type), intimacy, nameid, mapindex_id2name(sd->mapindex), sd->bl.x, sd->bl.y);
		fclose(logfp);
	}
}
Example #26
0
int log_branch(struct map_session_data *sd)
{
	if(!log_config.enable_logs)
		return 0;

	nullpo_ret(sd);

#ifndef TXT_ONLY
	if( log_config.sql_logs )
	{
		SqlStmt* stmt;
		stmt = SqlStmt_Malloc(logmysql_handle);
		if( SQL_SUCCESS != SqlStmt_Prepare(stmt, "INSERT DELAYED INTO `%s` (`branch_date`, `account_id`, `char_id`, `char_name`, `map`) VALUES (NOW(), '%d', '%d', ?, '%s')", log_config.log_branch_db, sd->status.account_id, sd->status.char_id, mapindex_id2name(sd->mapindex) )
		||  SQL_SUCCESS != SqlStmt_BindParam(stmt, 0, SQLDT_STRING, sd->status.name, strnlen(sd->status.name, NAME_LENGTH))
		||  SQL_SUCCESS != SqlStmt_Execute(stmt) )
		{
			SqlStmt_ShowDebug(stmt);
			SqlStmt_Free(stmt);
			return 0;
		}
		SqlStmt_Free(stmt);
	}
	else
#endif
	{
		FILE* logfp;
		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\n", timestring, sd->status.name, sd->status.account_id, sd->status.char_id, mapindex_id2name(sd->mapindex));
		fclose(logfp);
	}

	return 1;
}
Example #27
0
/// logs messages passed to script command 'logmes'
void log_npc(struct map_session_data* sd, const char* message)
{
	nullpo_retv(sd);

	if( !log_config.npc )
		return;

	if( log_config.sql_logs )
	{
#ifdef BETA_THREAD_TEST
		char entry[512];
		int e_length = 0;
		e_length = sprintf(entry, LOG_QUERY " INTO `%s` (`npc_date`, `account_id`, `char_id`, `char_name`, `map`, `mes`) VALUES (NOW(), '%d', '%d', '%s', '%s', '%s')", log_config.log_npc, sd->status.account_id, sd->status.char_id, sd->status.name, mapindex_id2name(sd->mapindex), message );
		queryThread_log(entry,e_length);
#else
		SqlStmt* stmt;
		stmt = SqlStmt_Malloc(logmysql_handle);
		if( SQL_SUCCESS != SqlStmt_Prepare(stmt, LOG_QUERY " INTO `%s` (`npc_date`, `account_id`, `char_id`, `char_name`, `map`, `mes`) VALUES (NOW(), '%d', '%d', ?, '%s', ?)", log_config.log_npc, sd->status.account_id, sd->status.char_id, mapindex_id2name(sd->mapindex) )
		||  SQL_SUCCESS != SqlStmt_BindParam(stmt, 0, SQLDT_STRING, sd->status.name, strnlen(sd->status.name, NAME_LENGTH))
		||  SQL_SUCCESS != SqlStmt_BindParam(stmt, 1, SQLDT_STRING, (char*)message, safestrnlen(message, 255))
		||  SQL_SUCCESS != SqlStmt_Execute(stmt) )
		{
			SqlStmt_ShowDebug(stmt);
			SqlStmt_Free(stmt);
			return;
		}
		SqlStmt_Free(stmt);
#endif
	}
	else
	{
		char timestring[255];
		time_t curtime;
		FILE* logfp;

		if( ( logfp = fopen(log_config.log_npc, "a") ) == NULL )
			return;
		time(&curtime);
		strftime(timestring, sizeof(timestring), "%m/%d/%Y %H:%M:%S", localtime(&curtime));
		fprintf(logfp, "%s - %s[%d]: %s\n", timestring, sd->status.name, sd->status.account_id, message);
		fclose(logfp);
	}
}
Example #28
0
void log_npc_sub_sql(struct map_session_data *sd, const char *message) {
	SqlStmt* stmt;
	stmt = SqlStmt_Malloc(logs->mysql_handle);
	if (SQL_SUCCESS != SqlStmt_Prepare(stmt, LOG_QUERY " INTO `%s` (`npc_date`, `account_id`, `char_id`, `char_name`, `map`, `mes`) VALUES (NOW(), '%d', '%d', ?, '%s', ?)", logs->config.log_npc, sd->status.account_id, sd->status.char_id, mapindex_id2name(sd->mapindex))
		|| SQL_SUCCESS != SqlStmt_BindParam(stmt, 0, SQLDT_STRING, sd->status.name, strnlen(sd->status.name, NAME_LENGTH))
		|| SQL_SUCCESS != SqlStmt_BindParam(stmt, 1, SQLDT_STRING, (char*)message, safestrnlen(message, 255))
		|| SQL_SUCCESS != SqlStmt_Execute(stmt))
	{
		SqlStmt_ShowDebug(stmt);
		SqlStmt_Free(stmt);
		return;
	}
	SqlStmt_Free(stmt);
}
Example #29
0
// ギルド会話送信
int guild_send_message(struct map_session_data *sd,const char *mes,int len)
{
	nullpo_ret(sd);

	if(sd->status.guild_id==0)
		return 0;
	intif_guild_message(sd->status.guild_id,sd->status.account_id,mes,len);
	guild_recv_message(sd->status.guild_id,sd->status.account_id,mes,len);

	// Chat logging type 'G' / Guild Chat
	log_chat(LOG_CHAT_GUILD, sd->status.guild_id, sd->status.char_id, sd->status.account_id, mapindex_id2name(sd->mapindex), sd->bl.x, sd->bl.y, NULL, mes);

	return 0;
}
Example #30
0
void log_branch_sub_txt(struct map_session_data* sd) {
	char timestring[255];
	time_t curtime;
	FILE* logfp;
	
	if( ( logfp = fopen(logs->config.log_branch, "a") ) == NULL )
		return;
	time(&curtime);
	strftime(timestring, sizeof(timestring), "%m/%d/%Y %H:%M:%S", localtime(&curtime));
	fprintf(logfp,"%s - %s[%d:%d]\t%s\n", timestring, sd->status.name, sd->status.account_id, sd->status.char_id, mapindex_id2name(sd->mapindex));
	fclose(logfp);
}