📄 log.c
字号:
struct tm tm1; memcpy( &tm1, localtime( (time_t *)&NowTime.tv_sec), sizeof( tm1)); printl( LOG_TENSEI, "%s\t%s\t%s=(%d,%d,%d,%d,%d,%d),(vi=%d->%d,str=%d->%d,tgh=%d->%d,dex=%d->%d),(%d,%d)" ,CharName, CharID, Key, level, transNum, quest, home, item, pet, vital, b_vital, str, b_str, tgh, b_tgh, dex, b_dex, tm1.tm_hour, tm1.tm_min );}// LOG_TALKvoid LogTalk( char *CharName, /* 平乓仿弁正 */ char *CharID, int floor, /* 甄 */ int x, int y, char *message){ struct tm tm1; memcpy( &tm1, localtime( (time_t *)&NowTime.tv_sec), sizeof( tm1)); printl( LOG_TALK, "%2d:%2d\t%s\t%s\t%d_%d_%d\tT=%s" , tm1.tm_hour, tm1.tm_min, (CharID==NULL) ? "(null)" :CharID, (CharName==NULL) ? "(null)" :CharName, floor, x, y, message );}/*------------------------------------------------------------ * 涩烂卞仄凶互匀化允屯化及白央奶伙毛田永弁失永皿 * 白央奶伙反弁夫□术今木化中卅仃木壬弁夫□术允月 * 娄醒 struct tm * 卅仄 * 忒曰袄 * 左□皿件仄凶白央奶伙及醒 ------------------------------------------------------------*/void backupAllLogFile( struct tm *ptm ){ int i; char szBuffer[256]; for( i=0 ; i<arraysizeof(LogConf) ; i++ ){ /* append 匹卅中手及反仄卅中 */ if( ! LogConf[i].append )continue; sprintf( szBuffer, "%s.%4d%02d%02d", LogConf[i].filename, ptm->tm_year+1900, ptm->tm_mon+1, ptm->tm_mday ); if( LogConf[i].f != NULL ){ /* 左□皿件今木化中凶日弁夫□术 */ fclose( LogConf[i].f ); /* 伉生□丞 */ rename( LogConf[i].filename, szBuffer ); /* 疯太左□皿件 */ LogConf[i].f = fopen( LogConf[i].filename , "a" ); }else{ /* 伉生□丞 */ rename( LogConf[i].filename, szBuffer ); /* 疯太左□皿件 */ LogConf[i].f = fopen( LogConf[i].filename , "a" ); } }}/*------------------------------------------------------------** 云嗯毛胶丹*-------------------------------------------------------------*/// Syu ADD 新增家族个人银行存取Log (不含家族银行)void LogFamilyBankStone( char *CharName, char *CharId, int Gold, int MyGold, char *Key, int floor, int x, int y, int banksum){ struct tm tm1; memcpy( &tm1, localtime( (time_t *)&NowTime.tv_sec), sizeof( tm1)); printl( LOG_BANKSTONELOG, "%s:%s\t%d=%s [%d] CHAR_GOLD(%d),(%d,%d,%d)(%d:%d)" , CharId, CharName, Gold, Key,banksum, MyGold, floor, x, y, tm1.tm_hour, tm1.tm_min ); print("\n%s:%s\t%d=%s [%d] CHAR_GOLD(%d),(%d,%d,%d)(%d:%d)\n" , CharId, CharName, Gold, Key,banksum, MyGold, floor, x, y, tm1.tm_hour, tm1.tm_min );}void LogStone( int TotalGold, char *CharName, /* 平乓仿弁正 */ char *CharId, /* 交□扒□ID */ int Gold, /* 嗯喊 */ int MyGold, char *Key, /* 平□伐□玉 */ int floor, /* 甄 */ int x, int y){ struct tm tm1; memcpy( &tm1, localtime( (time_t *)&NowTime.tv_sec), sizeof( tm1)); if(TotalGold == -1){ printl( LOG_STONE, "%s:%s\t%d=%s TOTAL_GOLD(%d),CHAR_GOLD(%d),(%d,%d,%d)(%d:%d)" , CharId, CharName, Gold, Key,TotalGold, MyGold, floor, x, y, tm1.tm_hour, tm1.tm_min ); } else{ printl( LOG_STONE, "%s:%s\t%d=%s CHAR_GOLD(%d),(%d,%d,%d)(%d:%d)" , CharId, CharName, Gold, Key, MyGold, floor, x, y, tm1.tm_hour, tm1.tm_min ); }}//ttom 12/26/2000 print the kill logvoid LogKill( char *CharName, char *CharId, char *CharPet_Item){ struct tm tm1; memcpy( &tm1, localtime( (time_t *)&NowTime.tv_sec), sizeof( tm1)); printl( LOG_KILL, "Name=%s:ID=%s\t%s (%d:%d)" ,CharName,CharId, CharPet_Item, tm1.tm_hour, tm1.tm_min );}//ttom// CoolFish: Trade 2001/4/19void LogTrade(char *message){ struct tm tm1; memcpy( &tm1, localtime( (time_t *)&NowTime.tv_sec), sizeof( tm1)); printl( LOG_TRADE, "%s (%d:%d)" , message, tm1.tm_hour, tm1.tm_min );}// CoolFish: Family Popular 2001/9/12void LogFMPOP(char *message){ struct tm tm1; memcpy( &tm1, localtime( (time_t *)&NowTime.tv_sec), sizeof( tm1)); printl( LOG_FMPOP, "%s (%d:%d)" , message, tm1.tm_hour, tm1.tm_min );}// Arminius 2001/6/14char hackmsg[HACK_TYPE_NUM][4096]= { "??? 什麽事也没有发生", "无法取得通讯协定码", "收到无法辨识的通讯协定码", "检查码错误", "人物的HP为负", };void logHack(int fd, int errcode){ struct tm tm1; char cdkey[4096]; char charname[4096]; unsigned long ip; char ipstr[4096]; memcpy( &tm1, localtime( (time_t *)&NowTime.tv_sec), sizeof( tm1)); CONNECT_getCdkey( fd, cdkey, 4096); CONNECT_getCharname( fd, charname, 4096); ip=CONNECT_get_userip(fd); sprintf(ipstr,"%d.%d.%d.%d", ((unsigned char *)&ip)[0], ((unsigned char *)&ip)[1], ((unsigned char *)&ip)[2], ((unsigned char *)&ip)[3]); if ((errcode<0) || (errcode>=HACK_TYPE_NUM)) errcode=HACK_NOTHING; printl( LOG_HACK, "(%d:%d) %s ip=%s cdkey=%s charname=%s", tm1.tm_hour, tm1.tm_min, hackmsg[errcode], ipstr, cdkey, charname);}// Nuke 0626void logSpeed(int fd){ struct tm tm1; char cdkey[4096]; char charname[4096]; unsigned long ip; char ipstr[4096]; memcpy( &tm1, localtime( (time_t *)&NowTime.tv_sec), sizeof( tm1)); CONNECT_getCdkey( fd, cdkey, 4096); CONNECT_getCharname( fd, charname, 4096); ip=CONNECT_get_userip(fd); sprintf(ipstr,"%d.%d.%d.%d", ((unsigned char *)&ip)[0], ((unsigned char *)&ip)[1], ((unsigned char *)&ip)[2], ((unsigned char *)&ip)[3]); printl( LOG_SPEED, "(%d:%d) ip=%s cdkey=%s charname=%s", tm1.tm_hour, tm1.tm_min, ipstr, cdkey, charname);}// Shan void LogGM( char *CharName, //角色名称 char *CharID, //玩家ID char *Message, //指令内容 int floor, int x, int y){ struct tm tm1; memcpy(&tm1,localtime((time_t *)&NowTime.tv_sec),sizeof(tm1)); printl(LOG_GM,"%s\t%s\t%s\t(%d,%d,%d)\t(%d:%d)", CharName,CharID,Message,floor,x,y,tm1.tm_hour,tm1.tm_min); }// Robin 10/02void LogFamily( char *FMName, int fmindex, char *charName, char *charID, char *keyWord, char *data){ struct tm tm1; memcpy( &tm1, localtime( (time_t *)&NowTime.tv_sec), sizeof( tm1)); // CoolFish: 2001/10/11 log time printl( LOG_FAMILY, "%s\t%d\t%s\t%s\t= %s, %s (%d:%d)", FMName, fmindex, charName, charID, keyWord, data, tm1.tm_hour, tm1.tm_min );}#ifdef _GAMBLE_ROULETTEvoid LogGamble( char *CharName, //角色名称 char *CharID, //玩家ID char *Key, //说明 int floor, int x, int y, int player_stone, //所拥有金钱 int Gamble_stone, //下注本金 int get_stone, //获得 int Gamble_num, int flg //flg = 1 玩家 2 庄家){ struct tm tm1; memcpy(&tm1,localtime((time_t *)&NowTime.tv_sec),sizeof(tm1)); if( flg == 1 ) { printl(LOG_GAMBLE,"%s\t%s\t TYPE:%s <<P_STONE:%9d,G_STONE:%9d,GET:%9d >>\t(%d,%d,%d)-(%d:%d) GAMBLENUM=%d", CharName,CharID,Key, player_stone, Gamble_stone, get_stone, floor,x,y,tm1.tm_hour,tm1.tm_min, Gamble_num); }else if( flg == 2 ) { printl(LOG_GAMBLE,"%s\tROULETTE MASTER\t TYPE:%s <<MASTER_STONE:%24d >>\t(%d,%d,%d)-(%d:%d)", CharName,Key, player_stone, floor,x,y,tm1.tm_hour,tm1.tm_min); }}#endifvoid LogLogin( char *CharID, //玩家ID char *CharName, //角色名称 int saveIndex, char *ipadress){ struct tm tm1; memcpy(&tm1,localtime((time_t *)&NowTime.tv_sec),sizeof(tm1)); printl(LOG_LOGIN,"%s\t%s\ti=%d\t%s\t(%d:%d)", CharID,CharName,saveIndex,ipadress,tm1.tm_hour,tm1.tm_min);}void warplog_to_file(){ int i =0; char outbuf[128]; FILE *f; f = fopen("log/warp1.log" ,"w" ); if( !f ) return; for( i=0; i<MAXMAPNUM; i++) { if( warplog[i].floor <= 0 ) continue; sprintf( outbuf, "%6d,%10d,%10d\n", warplog[i].floor, warplog[i].incount, warplog[i].outcount ); fputs( outbuf, f); } fclose(f); f = fopen("log/warp2.log" ,"w" ); if( !f ) return; for( i=0; i<MAXMAPLINK; i++) { if( warpCount[i].floor1 <= 0 ) continue; sprintf( outbuf, "%6d,%6d,%10d\n", warpCount[i].floor1, warpCount[i].floor2, warpCount[i].count ); fputs( outbuf, f); } fclose(f); }void warplog_from_file(){ int i =0; char outbuf[128]; FILE *f; print("warplog_from_file "); f = fopen("log/warp1.log" ,"r" ); if( !f ) return; while( fgets( outbuf, sizeof(outbuf), f) && i < MAXMAPNUM ) { if( !sscanf( outbuf, "%d,%d,%d", &warplog[i].floor, &warplog[i].incount, &warplog[i].outcount ) ) { continue; } //print(" %d", warplog[i].floor); i++; } print(" read_count:%d\n", i); fclose( f ); f = fopen("log/warp2.log" ,"r" ); if( !f ) return; i = 0; while( fgets( outbuf, sizeof(outbuf), f) && i < MAXMAPLINK ) { if( !sscanf( outbuf, "%d,%d,%d", &warpCount[i].floor1, &warpCount[i].floor2, &warpCount[i].count ) ) { continue; } i++; } print(" read_count2:%d\n", i); fclose( f );}void LogPetFeed( char * CharName, char *CharID, char *PetName, int petindex, int PetLv, char *Key,int floor, int x, int y, char *ucode) { struct tm tm1; memcpy( &tm1, localtime( (time_t *)&NowTime.tv_sec), sizeof( tm1)); printl( LOG_PET, "%s\t%s\t%s:%d 喂蛋=%s (%d,%d,%d)(%d:%d) %s " , CharName, CharID, PetName, PetLv, Key, floor, x, y, tm1.tm_hour, tm1.tm_min, ucode);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -